Class AbstractJdbcServiceInstanceRepository

java.lang.Object
io.kestra.jdbc.repository.AbstractJdbcRepository
io.kestra.jdbc.repository.AbstractJdbcServiceInstanceRepository
All Implemented Interfaces:
io.kestra.core.repositories.ServiceInstanceRepositoryInterface

@Singleton public abstract class AbstractJdbcServiceInstanceRepository extends AbstractJdbcRepository implements io.kestra.core.repositories.ServiceInstanceRepositoryInterface
  • Field Details

  • Constructor Details

    • AbstractJdbcServiceInstanceRepository

      public AbstractJdbcServiceInstanceRepository(AbstractJdbcRepository<io.kestra.core.server.ServiceInstance> jdbcRepository)
  • Method Details

    • findById

      public Optional<io.kestra.core.server.ServiceInstance> findById(String id)
      Specified by:
      findById in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • findById

      public Optional<io.kestra.core.server.ServiceInstance> findById(String id, org.jooq.Configuration configuration, boolean isForUpdate)
    • findAllInstancesInState

      public List<io.kestra.core.server.ServiceInstance> findAllInstancesInState(io.kestra.core.server.Service.ServiceState state)
      Specified by:
      findAllInstancesInState in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • findAllInstancesInStates

      public List<io.kestra.core.server.ServiceInstance> findAllInstancesInStates(Set<io.kestra.core.server.Service.ServiceState> states)
      Specified by:
      findAllInstancesInStates in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • findAllInstancesBetween

      public List<io.kestra.core.server.ServiceInstance> findAllInstancesBetween(io.kestra.core.server.Service.ServiceType type, Instant from, Instant to)
      Specified by:
      findAllInstancesBetween in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • findAllInstancesInStates

      public List<io.kestra.core.server.ServiceInstance> findAllInstancesInStates(org.jooq.Configuration configuration, Set<io.kestra.core.server.Service.ServiceState> states, boolean isForUpdate)
    • findAllNonRunningInstances

      public List<io.kestra.core.server.ServiceInstance> findAllNonRunningInstances()
      Finds all service instances which are NOT Service.ServiceState.RUNNING.
      Returns:
      the list of ServiceInstance.
    • findAllNonRunningInstances

      public List<io.kestra.core.server.ServiceInstance> findAllNonRunningInstances(org.jooq.Configuration configuration, boolean isForUpdate)
      Finds all service instances which are NOT Service.ServiceState.RUNNING.
      Returns:
      the list of ServiceInstance.
    • findAllInstancesInNotRunningState

      public List<io.kestra.core.server.ServiceInstance> findAllInstancesInNotRunningState()
      Finds all service instances which are Service.ServiceState.NOT_RUNNING.
      Returns:
      the list of ServiceInstance.
    • findAllInstancesInNotRunningState

      public List<io.kestra.core.server.ServiceInstance> findAllInstancesInNotRunningState(org.jooq.Configuration configuration, boolean isForUpdate)
      Finds all service instances which are Service.ServiceState.NOT_RUNNING.
      Returns:
      the list of ServiceInstance.
    • transaction

      public void transaction(org.jooq.TransactionalRunnable runnable)
    • transactionResult

      public <T> T transactionResult(org.jooq.TransactionalCallable<T> runnable)
    • delete

      public void delete(org.jooq.DSLContext context, io.kestra.core.server.ServiceInstance instance)
    • delete

      public void delete(io.kestra.core.server.ServiceInstance instance)
      Specified by:
      delete in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • save

      public io.kestra.core.server.ServiceInstance save(io.kestra.core.server.ServiceInstance instance)
      Specified by:
      save in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • findAll

      public List<io.kestra.core.server.ServiceInstance> findAll()
      Specified by:
      findAll in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • find

      public io.kestra.core.repositories.ArrayListTotal<io.kestra.core.server.ServiceInstance> find(io.micronaut.data.model.Pageable pageable, Set<io.kestra.core.server.Service.ServiceState> states, Set<io.kestra.core.server.Service.ServiceType> types)
      Specified by:
      find in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • mayTransitionServiceTo

      public io.kestra.core.server.ServiceStateTransition.Response mayTransitionServiceTo(io.kestra.core.server.ServiceInstance instance, io.kestra.core.server.Service.ServiceState newState, String reason)
      Specified by:
      mayTransitionServiceTo in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface
    • mayTransitServiceTo

      public io.kestra.core.server.ServiceStateTransition.Response mayTransitServiceTo(org.jooq.Configuration configuration, io.kestra.core.server.ServiceInstance instance, io.kestra.core.server.Service.ServiceState newState, String reason)
      Attempt to transition the state of a given service to given new state. This method may not update the service if the transition is not valid.
      Parameters:
      instance - the service instance.
      newState - the new state of the service.
      Returns:
      an optional of the ServiceInstance or Optional.empty() if the service is not running.
    • sortMapping

      public Function<String,String> sortMapping()
      Specified by:
      sortMapping in interface io.kestra.core.repositories.ServiceInstanceRepositoryInterface