Interface DatasetReader<K extends Comparable<K>>

Type Parameters:
K - the key type for the record
All Known Subinterfaces:
DatasetWriterReader<K>

public interface DatasetReader<K extends Comparable<K>>
Accessor that provides read only access on to a dataset.
  • Method Details

    • getKeyType

      Type<K> getKeyType()
      Return the key type of underlying Dataset.
      Returns:
      the key type
    • get

      Optional<Record<K>> get(K key)
      Retrieves the record for the specified key. If this dataset contains a record for the supplied key, then an Optional containing that record is returned. If there is no record for this key, then an empty Optional is returned.
      Parameters:
      key - key for the record
      Returns:
      an Optional containing the record for the given key, or an empty Optional if there is no record held against the key.
    • on

      Returns a ReadRecordAccessor which can be used to for fine-control of read operations on the record held against the specified key.
      Parameters:
      key - key for the record
      Returns:
      a ReadRecordAccessor tied to the supplied key.
    • records

      RecordStream<K> records()
      Returns a Stream of the records in this dataset.
      Returns:
      a stream of records
    • async

      default AsyncDatasetReader<K> async()
      Returns an asynchronous version of this reader using the ForkJoinPool.commonPool() as an executor.
      Returns:
      an asynchronous dataset reader
    • async

      AsyncDatasetReader<K> async(Executor executor)
      Returns an asynchronous version of this reader.

      Any asynchronous tasks associated with operations run through the returned reader will be submitted to the given executor.

      Parameters:
      executor - executor for asynchronous tasks
      Returns:
      an asynchronous dataset reader
    • registerChangeListener

      void registerChangeListener(ChangeListener<K> listener)
      Registers a listener that will receive an event for changes to a key. Changes that trigger events are: the addition of a key, and associated record; the mutation of a record; the deletion of a key, and associated record.

      The order of events that would be received for changes to a particular key will be same as the order in which the server has made those changes on that key. Note: This ordering of events is guaranteed only for changes to a key and not across the keys.

      Parameters:
      listener - the user provided object to which events will be sent
    • deregisterChangeListener

      void deregisterChangeListener(ChangeListener<K> listener)
      Deregisters a listener so that it no longer receives events
      Parameters:
      listener - the listener to be deregistered