Interface WorkerStatusRepository


  • public interface WorkerStatusRepository
    Repository for basic storage of the Task Reactor workers statuses.
    • 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 id
        status - new worker status
      • updateStatusesFor

        void updateStatusesFor​(WorkerStatus status,
                               List<WorkerId> workerIds)
        Updates the status of workers with the specified ids.
        Parameters:
        status - new workers status
        workerIds - 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 object
        schema - Schema of the Task Reactor
        Returns:
        a new repository instance