org.apache.mesos.state
Interface State

All Known Implementing Classes:
AbstractState, InMemoryState, LevelDBState, ZooKeeperState

public interface State

An abstraction of "state" (possibly between multiple distributed components) represented by "variables" (effectively key/value pairs). Variables are versioned such that setting a variable in the state will only succeed if the variable has not changed since last fetched. Varying implementations of state provide varying replicated guarantees. 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 = state.fetch("machines"); Variable machines = variable.get(); machines = machines.mutate(...); variable = state.store(machines); machines = variable.get();


Method Summary
 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.
 

Method Detail

fetch

Future<Variable> fetch(String name)
Returns an immutable "variable" representing the current value from the state associated with the specified name.


store

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.


expunge

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.


names

Future<Iterator<String>> names()
Returns an iterator of variable names in the state.



Copyright © 2014 The Apache Software Foundation. All Rights Reserved.