Class KeyValuesCollectionListenerAdapter

java.lang.Object
io.deephaven.kv.KeyValuesCollectionListenerAdapter
All Implemented Interfaces:
WatchClient.UnitListener

public class KeyValuesCollectionListenerAdapter extends Object implements WatchClient.UnitListener
Adapts an KeyValuesCollectionListener into a WatchClient.UnitListener.

Useful for watches that want to keep an in-memory structure of key values for easy streaming parsability via a KeyValuesCollectionParser.

This implementation is stateful, essentially turning delta-based watch responses into key value collections that represent the collective state. As such, the initialization of this listener needs to be handled carefully.

Callers must be sure to call publishInitial(HeaderResponse, KeyValuesCollection) after creation, but before actually installing the listener.

  • Constructor Details

    • KeyValuesCollectionListenerAdapter

      public KeyValuesCollectionListenerAdapter(KeyValuesCollectionListener listener)
      Creates the adapter.

      The idea is that collection represents the whole known state from some point in time (usually recent). The known time is represented by the header. This state is usually from a recent GetPrefixResponse, but it can come from other sources. Once the state is known, the watch can be created as appropriate to receive the relevant watch responses to update the state in an efficient (delta-based) manner.

      Parameters:
      listener - the listener
  • Method Details