Interface Scheduler.Module

All Superinterfaces:
Lifecycle
Enclosing interface:
Scheduler

public static interface Scheduler.Module
extends Lifecycle
A scheduler module.
  • Method Details

    • claim

      void claim​(@Nonnull Scheduler.Client client, @Nonnull java.util.List<java.util.Set<TCSResource<?>>> claim)
      Sets a client's total claim. With vehicles, this is equivalent to the route a vehicle plans to take.
      Parameters:
      client - The client the resource sequence is claimed by.
      claim - The resource sequence, i.e. total claim.
    • unclaim

      void unclaim​(@Nonnull Scheduler.Client client)
      Resets a client's total claim.
      Parameters:
      client - The client for which to reset the claim.
    • setAllocationState

      void setAllocationState​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> alloc, @Nonnull java.util.List<java.util.Set<TCSResource<?>>> remainingClaim)
      Informs this module about a client's current allocation state.
      Parameters:
      client - The client.
      alloc - The client's currently allocated resources.
      remainingClaim - The client's remaining claim.
    • mayAllocate

      boolean mayAllocate​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
      Checks if the resulting system state is safe if the given set of resources would be allocated by the given resource user.
      Parameters:
      client - The ResourceUser requesting resources set.
      resources - The requested resources.
      Returns:
      true if this module thinks the given resources may be allocated for the given client.
    • prepareAllocation

      void prepareAllocation​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
      Lets this module prepare the given resources so they can be allocated to a client.
      Parameters:
      client - The client the resources are being prepared for.
      resources - The resources to be prepared.
    • hasPreparedAllocation

      boolean hasPreparedAllocation​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
      Checks if this module is done preparing the given resources for a client.
      Parameters:
      client - The client the resources are being prepared for.
      resources - The resources to be checked.
      Returns:
      true if the resoruces are prepared for a client.
    • allocationReleased

      void allocationReleased​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
      Informs this module about resources being fully released by a client.
      Parameters:
      client - The client releasing the resources.
      resources - The resources being released.