public interface State
Note that the semantics of 'fetch' and 'store' provide atomicity. That is, you can not store a variable that has changed since you did the last fetch. That is, if a store succeeds then no other writes have been performed on the variable since your fetch. Example:
State state = new ZooKeeperState();
Future<Variable> variable = state.fetch("machines");
Variable machines = variable.get();
machines = machines.mutate(...);
variable = state.store(machines);
machines = variable.get();
| Modifier and Type | Method and Description |
|---|---|
Future<Boolean> |
expunge(Variable variable)
Returns true if successfully expunged the variable from the state
or false if the variable did not exist or was no longer valid.
|
Future<Variable> |
fetch(String name)
Returns an immutable "variable" representing the current value
from the state associated with the specified name.
|
Future<Iterator<String>> |
names()
Returns an iterator of variable names in the state.
|
Future<Variable> |
store(Variable variable)
Returns an immutable "variable" representing the current value in
the state if updating the specified variable in the state was
successful, otherwise returns null.
|
Future<Variable> fetch(String name)
name - The name of the variable.VariableFuture<Variable> store(Variable variable)
variable - The variable to be stored.VariableFuture<Boolean> expunge(Variable variable)
variable - The variable to be expunged.VariableCopyright © 2014 The Apache Software Foundation. All Rights Reserved.