Package org.apache.storm.state
Interface State
- All Known Subinterfaces:
KeyValueState<K,
V>
- All Known Implementing Classes:
InMemoryKeyValueState
,RedisKeyValueState
public interface State
The state of the component that is either managed by the framework (e.g in case of
IStatefulBolt
) or managed by the the
individual components themselves.-
Method Summary
Modifier and TypeMethodDescriptionvoid
commit()
Persist the current state.void
commit
(long txid) Commit a previously prepared transaction.void
prepareCommit
(long txid) Invoked by the framework to prepare a transaction for commit.void
rollback()
Rollback a prepared transaction to the previously committed state.
-
Method Details
-
prepareCommit
void prepareCommit(long txid) Invoked by the framework to prepare a transaction for commit. It should be possible to commit the prepared state later.The same txid can be prepared again, but the next txid cannot be prepared when previous one is not yet committed.
- Parameters:
txid
- the transaction id
-
commit
void commit(long txid) Commit a previously prepared transaction. It should be possible to retrieve a committed state later.- Parameters:
txid
- the transaction id
-
commit
void commit()Persist the current state. This is used when the component manages the state. -
rollback
void rollback()Rollback a prepared transaction to the previously committed state.
-