public interface StateLog<T> extends Resource<StateLog<T>>
| Modifier and Type | Method and Description |
|---|---|
static <T> StateLog<T> |
create(String name)
Creates a new state log with the default cluster and state log configurations.
|
static <T> StateLog<T> |
create(String name,
ClusterConfig cluster)
Creates a new state log with the default state log configuration.
|
static <T> StateLog<T> |
create(String name,
ClusterConfig cluster,
StateLogConfig config)
Creates a new state log.
|
<V> StateLog<T> |
installWith(java.util.function.Consumer<V> installer)
Registers a state log snapshot installer.
|
<U extends T,V> |
registerCommand(String name,
java.util.function.Function<U,V> command)
Registers a state command.
|
<U extends T,V> |
registerQuery(String name,
java.util.function.Function<U,V> query)
Registers a state query.
|
<U extends T,V> |
registerQuery(String name,
java.util.function.Function<U,V> query,
Consistency consistency)
Registers a state query.
|
<V> StateLog<T> |
snapshotWith(java.util.function.Supplier<V> snapshotter)
Registers a state log snapshot function.
|
<U> CompletableFuture<U> |
submit(String command,
T entry)
Submits a state command or query to the log.
|
StateLog<T> |
unregister(String name)
Unregisters a state command or query.
|
StateLog<T> |
unregisterCommand(String name)
Unregisters a state command.
|
StateLog<T> |
unregisterQuery(String name)
Unregisters a state query.
|
addShutdownTask, addStartupTask, cluster, namestatic <T> StateLog<T> create(String name)
The state log will be constructed with the default cluster configuration. The default cluster configuration
searches for two resources on the classpath - cluster and {cluster-defaults} - in that order. Configuration
options specified in cluster.conf will override those in {cluster-defaults.conf}.
Additionally, the state log will be constructed with an state log configuration that searches the classpath for
three configuration files - {name}, state-log, state-log-defaults, resource, and
resource-defaults - in that order. The first resource is a configuration resource with the same name
as the state log resource. If the resource is namespaced - e.g. `state-logs.my-log.conf` - then resource
configurations will be loaded according to namespaces as well; for example, `state-logs.conf`.
T - The state log entry type.name - The state log resource name.static <T> StateLog<T> create(String name, ClusterConfig cluster)
The state log will be constructed with an state log configuration that searches the classpath for three
configuration files - {name}, state-log, state-log-defaults, resource, and
resource-defaults - in that order. The first resource is a configuration resource with the same name
as the state log resource. If the resource is namespaced - e.g. `state-logs.my-log.conf` - then resource
configurations will be loaded according to namespaces as well; for example, `state-logs.conf`.
T - The state log entry type.name - The state log resource name.cluster - The state log cluster configuration.static <T> StateLog<T> create(String name, ClusterConfig cluster, StateLogConfig config)
T - The state log entry type.name - The state log resource name.cluster - The state log cluster configuration.config - The state log configuration.<U extends T,V> StateLog<T> registerCommand(String name, java.util.function.Function<U,V> command)
U - The command input type.V - The command output type.name - The command name.command - The command function.StateLog<T> unregisterCommand(String name)
name - The command name.<U extends T,V> StateLog<T> registerQuery(String name, java.util.function.Function<U,V> query)
U - The query input type.V - The query output type.name - The query name.query - The query function.<U extends T,V> StateLog<T> registerQuery(String name, java.util.function.Function<U,V> query, Consistency consistency)
U - The query input type.V - The query output type.name - The query name.query - The query function.consistency - The default query consistency.StateLog<T> unregisterQuery(String name)
name - The query name.StateLog<T> unregister(String name)
name - The command or query name.<V> StateLog<T> snapshotWith(java.util.function.Supplier<V> snapshotter)
snapshotter - The snapshot function.<V> StateLog<T> installWith(java.util.function.Consumer<V> installer)
installer - The snapshot installer.<U> CompletableFuture<U> submit(String command, T entry)
U - The command return type.command - The command name.entry - The command entry.Copyright © 2013-2015. All Rights Reserved.