Type Parameters:
T - the type of PersistentData to read
All Superinterfaces:
AutoCloseable

public interface Reader<T extends PersistentData> extends AutoCloseable

Reader interface for reading from a data store.

Implementations of this interface should be thread-safe and should properly handle multiple concurrent readers.

  • Method Summary

    Modifier and Type
    Method
    Description
    takeData(Long maximumTimestamp, int batchSize)
    Fetches a set of transactions from the data store.
    Reads the next transaction set from the data store.

    Methods inherited from interface java.lang.AutoCloseable

    close
  • Method Details

    • takeNext

      TransactionSet<T> takeNext() throws Exception
      Reads the next transaction set from the data store.
      Returns:
      a TransactionSet containing the transactions that were read, or an empty set if there isn't more data available.
      Throws:
      Exception - if an error occurs while reading the data.
    • takeData

      TransactionSet<T> takeData(@Nullable Long maximumTimestamp, int batchSize) throws Exception
      Fetches a set of transactions from the data store.

      This method retrieves transactions of data limited by the batch size. The transactions retrieved will have a timestamp less than or equal to the maximum timestamp provided. If the maximum timestamp is null, the method will retrieve the oldest limited by the batch size.
      Parameters:
      maximumTimestamp - The maximum timestamp for the data in the returned transaction sets. Can be null.
      batchSize - The maximum number of data contained within the transaction set to return.
      Returns:
      a TransactionSet containing the transactions that were read, or an empty set if there isn't more data available.
      Throws:
      Exception - if an error occurs while reading the data.