C# 클래스 BlueCollar.SQLiteRepository

상속: IRepository
파일 보기 프로젝트 열기: ChadBurggraf/blue-collar 1 사용 예제들

공개 메소드들

메소드 설명
BeginTransaction ( ) : IDbTransaction

Begins a transaction.

BeginTransaction ( IsolationLevel level ) : IDbTransaction

Begins a transaction.

ClearWorkingSignalPair ( long workerId, long workingId, IDbTransaction transaction ) : void

Clears signals for the given worker and working job if applicable.

CreateQueuedAndHistoryForSchedule ( long scheduleId, System.DateTime scheduleDate, IEnumerable queued, IEnumerable history, IDbTransaction transaction ) : int

Creates the queue and history records for the given schedule.

DeleteAll ( string applicationName, IDbTransaction transaction ) : void

Deletes all data in the repository.

DeleteHistory ( string applicationName, System.DateTime olderThan, IDbTransaction transaction ) : void

Deletes history older than the given date.

DeleteQueued ( long id, IDbTransaction transaction ) : void

Deletes the queued record with the given ID.

DeleteSchedule ( long id, IDbTransaction transaction ) : void

Deletes the schedule record with the given ID.

DeleteScheduledJob ( long id, IDbTransaction transaction ) : void

Deletes the scheduled job record with the given ID.

DeleteWorker ( long id, IDbTransaction transaction ) : void

Deletes the worker record with the given ID.

DeleteWorking ( long id, IDbTransaction transaction ) : void

Deletes the working record with the given ID.

Dispose ( ) : void

Disposes of resources used by this instance.

GetCounts ( string applicationName, IDbTransaction transaction ) : CountsRecord

Gets a set of counts for the given application.

GetHistoryDetails ( long id, IDbTransaction transaction ) : HistoryDetailsRecord

Gets a history details record.

GetHistoryList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of history records.

GetQueuedDetails ( long id, IDbTransaction transaction ) : QueueDetailsRecord

Gets a queued details record.

GetQueuedList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of queue records.

GetSchedule ( long id, IDbTransaction transaction ) : ScheduleRecord

Gets the schedule with the given ID, NOT including its related scheduled jobs.

GetScheduleDateExistsForSchedule ( long scheduleId, System.DateTime scheduleDate, IDbTransaction transaction ) : bool

Gets a value indicating whether data exists for the given schedule ID and calculated schedule date. If it does, this indicates that jobs have already been enqueued for the schedule and should not be enqueued again until the next calculated schedule date.

GetScheduleEnqueueingLock ( long scheduleId, System.DateTime forceIfOlderThan, IDbTransaction transaction ) : bool

Attempts to obtain the enqueueing lock for the given schedule ID.

GetScheduleList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of schedule records.

GetScheduledJobList ( string applicationName, long id, string search, int limit, int offset, IDbTransaction transaction ) : ScheduledJobRecordList

Gets a schedule and its related scheduled jobs, filtered by the given list parameters.

GetSchedules ( string applicationName, IDbTransaction transaction ) : IEnumerable

Gets a collection of schedules and their related scheduled jobs for the given application name.

GetStatistics ( string applicationName, System.DateTime recentBeginDate, System.DateTime distantBeginDate, System.DateTime endDate, IDbTransaction transaction ) : StatisticsRecord

Gets a set of system statistics for the given application name and date ranges.

GetWorker ( long id, IDbTransaction transaction ) : WorkerRecord

Gets the worker record with the given ID.

GetWorkerList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of worker records.

GetWorkers ( string applicationName, string machineAddress, string machineName, IDbTransaction transaction ) : IEnumerable

Gets the worker collection for the given machine.

GetWorking ( long id, IDbTransaction transaction ) : WorkingRecord

Gets the working record with the given ID.

GetWorkingDetails ( long id, IDbTransaction transaction ) : WorkingDetailsRecord

Gets a working details record.

GetWorkingForWorker ( long workerId, long excludingId, IDbTransaction transaction ) : IEnumerable

Gets a collection of working records that belong to the given worker ID.

GetWorkingList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList

Gets a list of working records.

GetWorkingSignals ( long workerId, long workingId, IDbTransaction transaction ) : SignalsRecord

Gets the current signals set for a worker and a working job, if applicable.

ReleaseScheduleEnqueueingLock ( long scheduleId, IDbTransaction transaction ) : void

Releases the enqueueing lock for the schedule with the given ID.

SQLiteRepository ( string connectionString ) : System

Initializes a new instance of the SQLiteRepository class.

SignalWorkers ( string applicationName, WorkerSignal signal, IDbTransaction transaction ) : void

Signals all workers for the given application name.

UpdateSchedule ( ScheduleRecord record, IDbTransaction transaction ) : ScheduleRecord

Updates the given schedule.

UpdateScheduledJob ( ScheduledJobRecord record, IDbTransaction transaction ) : ScheduledJobRecord

Updates the given scheduled job.

UpdateScheduledJobOrder ( ScheduledJobOrderRecord record, IDbTransaction transaction ) : void

Updates the scheduled job's order number.

UpdateWorker ( WorkerRecord record, IDbTransaction transaction ) : WorkerRecord

Updates the given worker.

UpdateWorkerStatus ( long id, WorkerStatus status, IDbTransaction transaction ) : void

Updates the status of the worker with the given ID.

UpdateWorking ( WorkingRecord record, IDbTransaction transaction ) : WorkingRecord

Updates the given working record.

보호된 메소드들

메소드 설명
Dispose ( bool disposing ) : void

Disposes of resources used by this instance.

EnsureDatabase ( string path ) : void

Ensures that the SQLite database at the given path exists, creating it if it doesn't.

비공개 메소드들

메소드 설명
CreateCounts ( Dapper.SqlMapper multi ) : CountsRecord

Creates a new CountsRecord by reading from the given multi-mapped reader.

CreateHistory ( HistoryRecord record, IDbTransaction transaction ) : HistoryRecord
CreateHistoryStatusCounts ( Dapper.SqlMapper multi ) : HistoryStatusCountsRecord

Creates a new HistoryStatusCountsRecord by reading from the given multi-mapped reader.

CreateQueued ( QueueRecord record, IDbTransaction transaction ) : QueueRecord
CreateSchedule ( ScheduleRecord record, IDbTransaction transaction ) : ScheduleRecord
CreateScheduledJob ( ScheduledJobRecord record, IDbTransaction transaction ) : ScheduledJobRecord
CreateWorker ( WorkerRecord record, IDbTransaction transaction ) : WorkerRecord
CreateWorking ( WorkingRecord record, IDbTransaction transaction ) : WorkingRecord
GetQueued ( string applicationName, QueueNameFilters queueFilters, System.DateTime queuedBefore, IDbTransaction transaction ) : QueueRecord

메소드 상세

BeginTransaction() 공개 메소드

Begins a transaction.
public BeginTransaction ( ) : IDbTransaction
리턴 IDbTransaction

BeginTransaction() 공개 메소드

Begins a transaction.
public BeginTransaction ( IsolationLevel level ) : IDbTransaction
level IsolationLevel The isolation level to use for the transaction.
리턴 IDbTransaction

ClearWorkingSignalPair() 공개 메소드

Clears signals for the given worker and working job if applicable.
public ClearWorkingSignalPair ( long workerId, long workingId, IDbTransaction transaction ) : void
workerId long The ID of the worker to clear the signal of.
workingId long The ID of the working job to clear the signal of, if applicable.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

CreateQueuedAndHistoryForSchedule() 공개 메소드

Creates the queue and history records for the given schedule.
public CreateQueuedAndHistoryForSchedule ( long scheduleId, System.DateTime scheduleDate, IEnumerable queued, IEnumerable history, IDbTransaction transaction ) : int
scheduleId long The ID of the schedule records are being created for.
scheduleDate System.DateTime The schedule date records are being created for.
queued IEnumerable The queued records to create.
history IEnumerable The history records to create.
transaction IDbTransaction The transaction to use, if applicable.
리턴 int

DeleteAll() 공개 메소드

Deletes all data in the repository.
public DeleteAll ( string applicationName, IDbTransaction transaction ) : void
applicationName string The name of the application to delete data for.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

DeleteHistory() 공개 메소드

Deletes history older than the given date.
public DeleteHistory ( string applicationName, System.DateTime olderThan, IDbTransaction transaction ) : void
applicationName string The name of the application to delete data for.
olderThan System.DateTime The date to delete history older than.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

DeleteQueued() 공개 메소드

Deletes the queued record with the given ID.
public DeleteQueued ( long id, IDbTransaction transaction ) : void
id long The ID of the queued record to delete.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

DeleteSchedule() 공개 메소드

Deletes the schedule record with the given ID.
public DeleteSchedule ( long id, IDbTransaction transaction ) : void
id long The ID of the schedule to delete.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

DeleteScheduledJob() 공개 메소드

Deletes the scheduled job record with the given ID.
public DeleteScheduledJob ( long id, IDbTransaction transaction ) : void
id long The ID of the scheduled job to delete.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

DeleteWorker() 공개 메소드

Deletes the worker record with the given ID.
public DeleteWorker ( long id, IDbTransaction transaction ) : void
id long The ID of the worker to delete.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

DeleteWorking() 공개 메소드

Deletes the working record with the given ID.
public DeleteWorking ( long id, IDbTransaction transaction ) : void
id long The ID of the working record to delete.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

Dispose() 공개 메소드

Disposes of resources used by this instance.
public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

Disposes of resources used by this instance.
protected Dispose ( bool disposing ) : void
disposing bool A value indicating whether to dispose of managed resources.
리턴 void

EnsureDatabase() 보호된 정적인 메소드

Ensures that the SQLite database at the given path exists, creating it if it doesn't.
protected static EnsureDatabase ( string path ) : void
path string The path of the SQLite database to ensure.
리턴 void

GetCounts() 공개 메소드

Gets a set of counts for the given application.
public GetCounts ( string applicationName, IDbTransaction transaction ) : CountsRecord
applicationName string The name of the application to get counts for.
transaction IDbTransaction The transaction to use, if applicable.
리턴 CountsRecord

GetHistoryDetails() 공개 메소드

Gets a history details record.
public GetHistoryDetails ( long id, IDbTransaction transaction ) : HistoryDetailsRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
리턴 HistoryDetailsRecord

GetHistoryList() 공개 메소드

Gets a list of history records.
public GetHistoryList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The name of the application to get the history list for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
리턴 RecordList

GetQueuedDetails() 공개 메소드

Gets a queued details record.
public GetQueuedDetails ( long id, IDbTransaction transaction ) : QueueDetailsRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
리턴 QueueDetailsRecord

GetQueuedList() 공개 메소드

Gets a list of queue records.
public GetQueuedList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The name of the application to get the queue list for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
리턴 RecordList

GetSchedule() 공개 메소드

Gets the schedule with the given ID, NOT including its related scheduled jobs.
public GetSchedule ( long id, IDbTransaction transaction ) : ScheduleRecord
id long The ID of the schedule to get.
transaction IDbTransaction The transaction to use, if applicable.
리턴 ScheduleRecord

GetScheduleDateExistsForSchedule() 공개 메소드

Gets a value indicating whether data exists for the given schedule ID and calculated schedule date. If it does, this indicates that jobs have already been enqueued for the schedule and should not be enqueued again until the next calculated schedule date.
public GetScheduleDateExistsForSchedule ( long scheduleId, System.DateTime scheduleDate, IDbTransaction transaction ) : bool
scheduleId long The ID of the schedule to check data for.
scheduleDate System.DateTime The calculated schedule date to check data for.
transaction IDbTransaction The transaction to use, if applicable.
리턴 bool

GetScheduleEnqueueingLock() 공개 메소드

Attempts to obtain the enqueueing lock for the given schedule ID.
public GetScheduleEnqueueingLock ( long scheduleId, System.DateTime forceIfOlderThan, IDbTransaction transaction ) : bool
scheduleId long The ID of the schedule to obtain the schedule enqueueing lock for.
forceIfOlderThan System.DateTime A date to compare the enqueue lock's last updated date with. If /// the lock is older than the given date, then it will be forced and acquired by the caller.
transaction IDbTransaction The transaction to use, if applicable.
리턴 bool

GetScheduleList() 공개 메소드

Gets a list of schedule records.
public GetScheduleList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The name of the application to get the schedule list for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
리턴 RecordList

GetScheduledJobList() 공개 메소드

Gets a schedule and its related scheduled jobs, filtered by the given list parameters.
public GetScheduledJobList ( string applicationName, long id, string search, int limit, int offset, IDbTransaction transaction ) : ScheduledJobRecordList
applicationName string The name of the application to get the scheduled job list for.
id long The ID of the schedule to get.
search string The search query to filter the related job collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
리턴 ScheduledJobRecordList

GetSchedules() 공개 메소드

Gets a collection of schedules and their related scheduled jobs for the given application name.
public GetSchedules ( string applicationName, IDbTransaction transaction ) : IEnumerable
applicationName string The name of the application to get schedules for.
transaction IDbTransaction The transaction to use, if applicable.
리턴 IEnumerable

GetStatistics() 공개 메소드

Gets a set of system statistics for the given application name and date ranges.
public GetStatistics ( string applicationName, System.DateTime recentBeginDate, System.DateTime distantBeginDate, System.DateTime endDate, IDbTransaction transaction ) : StatisticsRecord
applicationName string The name of the application to get system statistics for.
recentBeginDate System.DateTime The begin date of the recent period to get statistics for.
distantBeginDate System.DateTime The begin date of the distant period to get statistics for.
endDate System.DateTime The end date of the distant period to get statistics for.
transaction IDbTransaction The transaction to use, if applicable.
리턴 StatisticsRecord

GetWorker() 공개 메소드

Gets the worker record with the given ID.
public GetWorker ( long id, IDbTransaction transaction ) : WorkerRecord
id long The ID of the worker record to get.
transaction IDbTransaction The transaction to use.
리턴 WorkerRecord

GetWorkerList() 공개 메소드

Gets a list of worker records.
public GetWorkerList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The application name to get records for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
리턴 RecordList

GetWorkers() 공개 메소드

Gets the worker collection for the given machine.
public GetWorkers ( string applicationName, string machineAddress, string machineName, IDbTransaction transaction ) : IEnumerable
applicationName string The application name to get workers for.
machineAddress string The address of the machine to get workers for.
machineName string The name of the machine to get workers for.
transaction IDbTransaction The transaction to use, if applicable.
리턴 IEnumerable

GetWorking() 공개 메소드

Gets the working record with the given ID.
public GetWorking ( long id, IDbTransaction transaction ) : WorkingRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
리턴 WorkingRecord

GetWorkingDetails() 공개 메소드

Gets a working details record.
public GetWorkingDetails ( long id, IDbTransaction transaction ) : WorkingDetailsRecord
id long The ID of the record to get.
transaction IDbTransaction The transaction to use, if applicable.
리턴 WorkingDetailsRecord

GetWorkingForWorker() 공개 메소드

Gets a collection of working records that belong to the given worker ID.
public GetWorkingForWorker ( long workerId, long excludingId, IDbTransaction transaction ) : IEnumerable
workerId long The ID of the worker to get working records for.
excludingId long The ID of the working record to exclude, if applicable.
transaction IDbTransaction The transaction to use, if applicable.
리턴 IEnumerable

GetWorkingList() 공개 메소드

Gets a list of working records.
public GetWorkingList ( string applicationName, string search, int limit, int offset, IDbTransaction transaction ) : RecordList
applicationName string The application name to get records for.
search string The search query to filter the collection with.
limit int The paging limit to use.
offset int The paging offset to use.
transaction IDbTransaction The transaction to use, if applicable.
리턴 RecordList

GetWorkingSignals() 공개 메소드

Gets the current signals set for a worker and a working job, if applicable.
public GetWorkingSignals ( long workerId, long workingId, IDbTransaction transaction ) : SignalsRecord
workerId long The ID of the worker to get a signal for.
workingId long The ID of the working job to get a signal for, if applicable.
transaction IDbTransaction The transaction to use, if applicable.
리턴 SignalsRecord

ReleaseScheduleEnqueueingLock() 공개 메소드

Releases the enqueueing lock for the schedule with the given ID.
public ReleaseScheduleEnqueueingLock ( long scheduleId, IDbTransaction transaction ) : void
scheduleId long The ID of the schedule to release the enqueueing lock for.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

SQLiteRepository() 공개 메소드

Initializes a new instance of the SQLiteRepository class.
public SQLiteRepository ( string connectionString ) : System
connectionString string The connection string to use when connecting to the database.
리턴 System

SignalWorkers() 공개 메소드

Signals all workers for the given application name.
public SignalWorkers ( string applicationName, WorkerSignal signal, IDbTransaction transaction ) : void
applicationName string The application name to signal workers for.
signal WorkerSignal The signal to set.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

UpdateSchedule() 공개 메소드

Updates the given schedule.
public UpdateSchedule ( ScheduleRecord record, IDbTransaction transaction ) : ScheduleRecord
record ScheduleRecord The schedule record to update.
transaction IDbTransaction The transaction to use, if applicable.
리턴 ScheduleRecord

UpdateScheduledJob() 공개 메소드

Updates the given scheduled job.
public UpdateScheduledJob ( ScheduledJobRecord record, IDbTransaction transaction ) : ScheduledJobRecord
record ScheduledJobRecord The scheduled job record to update.
transaction IDbTransaction The transaction to use, if applicable.
리턴 ScheduledJobRecord

UpdateScheduledJobOrder() 공개 메소드

Updates the scheduled job's order number.
public UpdateScheduledJobOrder ( ScheduledJobOrderRecord record, IDbTransaction transaction ) : void
record ScheduledJobOrderRecord The scheduled job order record identifying the scheduled job to update.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

UpdateWorker() 공개 메소드

Updates the given worker.
public UpdateWorker ( WorkerRecord record, IDbTransaction transaction ) : WorkerRecord
record WorkerRecord The worker record to update.
transaction IDbTransaction The transaction to use, if applicable.
리턴 WorkerRecord

UpdateWorkerStatus() 공개 메소드

Updates the status of the worker with the given ID.
public UpdateWorkerStatus ( long id, WorkerStatus status, IDbTransaction transaction ) : void
id long The ID of the worker to update status for.
status WorkerStatus The status to update.
transaction IDbTransaction The transaction to use, if applicable.
리턴 void

UpdateWorking() 공개 메소드

Updates the given working record.
public UpdateWorking ( WorkingRecord record, IDbTransaction transaction ) : WorkingRecord
record WorkingRecord The working record to update.
transaction IDbTransaction The transaction to use, if applicable.
리턴 WorkingRecord