Interface WorkerStatusRepository
-
public interface WorkerStatusRepositoryRepository for basic storage of the Task Reactor workers statuses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classWorkerStatusRepository.ColumnNamesColumn names of the worker_status table.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<WorkerId>getAvailableWorkers()Returns the ids of all available workers.static WorkerStatusRepositorygetInstance(Session session, Identifier schema)Returns a new instance of the default repository implementation.Optional<Instant>getLastAvailable(WorkerId workerId)Returns the last timestamp when given worker was in available statusWorkerStatusgetStatusFor(WorkerId workerId)Returns the status of a worker with the specified id.Map<String,Integer>getWorkersNumberForEachStatus()Returns a map containing the number of workers in each status.voidremoveStatusFor(WorkerId workerId)Removes the status for a worker with the specified id.voidupdateStatusesFor(WorkerStatus status, List<WorkerId> workerIds)Updates the status of workers with the specified ids.voidupdateStatusFor(WorkerId workerId, WorkerStatus status)Updates the status of a worker with the specified id.
-
-
-
Method Detail
-
getAvailableWorkers
Set<WorkerId> getAvailableWorkers()
Returns the ids of all available workers.- Returns:
- set of ids of all available workers
-
getStatusFor
WorkerStatus getStatusFor(WorkerId workerId)
Returns the status of a worker with the specified id.- Parameters:
workerId- worker id- Returns:
- status of a worker with the specified id
-
updateStatusFor
void updateStatusFor(WorkerId workerId, WorkerStatus status)
Updates the status of a worker with the specified id.- Parameters:
workerId- worker idstatus- new worker status
-
updateStatusesFor
void updateStatusesFor(WorkerStatus status, List<WorkerId> workerIds)
Updates the status of workers with the specified ids.- Parameters:
status- new workers statusworkerIds- identifiers of workers
-
removeStatusFor
void removeStatusFor(WorkerId workerId)
Removes the status for a worker with the specified id.- Parameters:
workerId- worker id
-
getLastAvailable
Optional<Instant> getLastAvailable(WorkerId workerId)
Returns the last timestamp when given worker was in available status- Parameters:
workerId- id of worker- Returns:
- timestamp column for the last record when a worker with given id was in AVAILABLE status
-
getWorkersNumberForEachStatus
Map<String,Integer> getWorkersNumberForEachStatus()
Returns a map containing the number of workers in each status. The key of the map is worker status, the value is the number of workers that currently are in this status.- Returns:
- a map containing the number of workers in each status
-
getInstance
static WorkerStatusRepository getInstance(Session session, Identifier schema)
Returns a new instance of the default repository implementation.Default implementation of the repository uses:
- a default implementation of
DefaultWorkerStatusRepository.
- Parameters:
session- Snowpark session objectschema- Schema of the Task Reactor- Returns:
- a new repository instance
- a default implementation of
-
-