Class DataRoutingStateAdapter

java.lang.Object
com.illumon.iris.db.v2.routing.impl.kv.DataRoutingStateAdapter
All Implemented Interfaces:
io.deephaven.kv.WatchClient.UnitListener

public class DataRoutingStateAdapter extends Object implements io.deephaven.kv.WatchClient.UnitListener
Adapts a WatchClient.UnitListener into a WatchClient.StateListener. Track all kv state and updates for the routing-file prefix, and provide synchronized access to current data and routing service.
  • Method Details

    • getDataRoutingYmlString

      @Nullable public String getDataRoutingYmlString()
      Get the data routing data as a yaml String. This is the routing file only and does not include additional DISes.
      Returns:
      the data routing configuration, or null if not present
    • getDataRoutingService

      @NotNull public DataRoutingService getDataRoutingService()
      Get the data routing service. This is the etcd implementation, parsed from the routing file and additional DISes. The service might be invalid/non-functional if the routing file is missing, or there are errors parsing the configuration.
      Returns:
      the data routing service
    • getRoutingFileRev

      public long getRoutingFileRev()
      Get the current wrt revision of the routing file.
      Returns:
      the current wrt of the routing file, or 0 if it does not exist.
    • getDisesRev

      public long getDisesRev()
      Get the current wrt revision of the additional DISes container.
      Returns:
      the current wrt of the DISes prefix, or 0 if it does not exist.
    • getDisRev

      public long getDisRev(String disName)
      Get the current wrt revision of the named additional DIS file.
      Parameters:
      disName - the name of the DIS
      Returns:
      the current wrt of the named DIS, or 0 if it does not exist.
    • getExtraDisMap

      @NotNull public Map<String,DataImportServiceConfig> getExtraDisMap()
      Get the configured additional DISes as a map.
      Returns:
      map of additional DISes
    • getExtraDisNames

      @NotNull public Set<String> getExtraDisNames()
      Get the configured additional DIS names as a set.
      Returns:
      set of additional DIS names
    • getExtraDisText

      @NotNull public Map<String,String> getExtraDisText()
      Get the configured additional DISes as a map of name to raw yml string. For error handling.
      Returns:
      map of additional DIS names to raw yml strings
    • publishInitial

      public void publishInitial(@NotNull io.deephaven.kv.HeaderResponse initialHeader, @NotNull io.deephaven.kv.KeyValuesCollection initialState)
      Initialize the state.
      Parameters:
      initialHeader - the initial header
      initialState - the initial state - all keys and values starting at the GetPrefix root
    • onNext

      public void onNext(@NotNull io.deephaven.kv.WatchResponseUnit unit)
      Specified by:
      onNext in interface io.deephaven.kv.WatchClient.UnitListener
    • onError

      public void onError(@NotNull Throwable t)
      Specified by:
      onError in interface io.deephaven.kv.WatchClient.UnitListener
    • onCompleted

      public void onCompleted()
      Specified by:
      onCompleted in interface io.deephaven.kv.WatchClient.UnitListener
    • createWatch

      public CompletableFuture<io.deephaven.kv.WatchClient.Watch> createWatch(@NotNull io.deephaven.kv.KVClient kvClient, @NotNull io.deephaven.kv.WatchClient watchClient, @NotNull io.deephaven.kv.GetPrefix request)
      Returns a future that will create, but not start, the watch.
      Parameters:
      kvClient - the kv client
      watchClient - the watch client
      request - the get prefix request
      Returns:
      a future for the watch