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 Summary
Modifier and TypeMethodDescriptionCompletableFuture<io.deephaven.kv.WatchClient.Watch>
createWatch
(io.deephaven.kv.KVClient kvClient, io.deephaven.kv.WatchClient watchClient, io.deephaven.kv.GetPrefix request) Returns a future that will create, but not start, the watch.Get the data routing service.Get the data routing data as a yaml String.long
Get the current wrt revision of the additional DISes container.long
Get the current wrt revision of the named additional DIS file.Get the configured additional DISes as a map.Get the configured additional DIS names as a set.Get the configured additional DISes as a map of name to raw yml string.long
Get the current wrt revision of the routing file.void
void
void
onNext
(io.deephaven.kv.WatchResponseUnit unit) void
publishInitial
(io.deephaven.kv.HeaderResponse initialHeader, io.deephaven.kv.KeyValuesCollection initialState) Initialize the state.
-
Method Details
-
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
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
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
Get the configured additional DISes as a map.- Returns:
- map of additional DISes
-
getExtraDisNames
Get the configured additional DIS names as a set.- Returns:
- set of additional DIS names
-
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 headerinitialState
- 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 interfaceio.deephaven.kv.WatchClient.UnitListener
-
onError
- Specified by:
onError
in interfaceio.deephaven.kv.WatchClient.UnitListener
-
onCompleted
public void onCompleted()- Specified by:
onCompleted
in interfaceio.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 clientwatchClient
- the watch clientrequest
- the get prefix request- Returns:
- a future for the watch
-