Class TestServerScheduleStore

java.lang.Object
io.fluxzero.testserver.scheduling.TestServerScheduleStore
All Implemented Interfaces:
Monitored<List<SerializedMessage>>, HasMessageStore, MessageStore, SchedulingClient, AutoCloseable

public class TestServerScheduleStore extends Object implements MessageStore, SchedulingClient
  • Constructor Details

  • Method Details

    • schedule

      public CompletableFuture<Void> schedule(Guarantee guarantee, SerializedSchedule... schedules)
      Description copied from interface: SchedulingClient
      Schedule one or more serialized schedules with a specified Guarantee.
      Specified by:
      schedule in interface SchedulingClient
      Parameters:
      guarantee - Delivery guarantee to apply (e.g., none, sent, stored).
      schedules - One or more schedules to register.
      Returns:
      A future that completes when the scheduling is acknowledged.
    • getBatch

      public List<SerializedMessage> getBatch(Long minIndex, int maxSize)
      Description copied from interface: MessageStore
      Retrieves a batch of messages starting from the given lastIndex (exclusive).
      Specified by:
      getBatch in interface MessageStore
      Parameters:
      minIndex - minimum message index to start from (exclusive)
      maxSize - maximum number of messages to retrieve
      Returns:
      a list of SerializedMessage instances
    • getBatch

      public List<SerializedMessage> getBatch(Long minIndex, int maxSize, boolean inclusive)
      Description copied from interface: MessageStore
      Retrieves a batch of messages starting from the given minIndex.
      Specified by:
      getBatch in interface MessageStore
      Parameters:
      minIndex - minimum message index to start from
      maxSize - maximum number of messages to retrieve
      inclusive - whether to include the message at minIndex
      Returns:
      a list of SerializedMessage instances
    • scanBatch

      public MessageStoreBatch scanBatch(Long minIndex, int maxSize, boolean inclusive, long maxBytes, Predicate<? super SerializedMessage> filter)
      Description copied from interface: MessageStore
      Scans messages starting from the given minIndex, returning messages accepted by filter and metadata about the unfiltered source scan.

      maxSize limits the number of source messages scanned. maxBytes limits the cumulative serialized payload bytes of accepted messages. If the first accepted message is larger than maxBytes, it is still returned so consumers can make progress.

      Specified by:
      scanBatch in interface MessageStore
      Parameters:
      minIndex - minimum message index to start from
      maxSize - maximum number of source messages to scan
      inclusive - whether to include the message at minIndex
      maxBytes - maximum number of accepted serialized payload bytes, or 0 for no byte limit
      filter - predicate deciding which messages enter the returned batch
      Returns:
      accepted messages and source scan metadata
    • rescheduleNextDeadline

      protected void rescheduleNextDeadline(long nextIndex)
    • truncate

      public void truncate()
      Description copied from interface: MessageStore
      Removes all messages from this store while keeping the logical log available for future appends.
      Specified by:
      truncate in interface MessageStore