java.lang.Object
io.hotmoka.local.AbstractStore<C>
- All Implemented Interfaces:
Store,AutoCloseable
Shared implementation of the store of a node. It keeps information about the state of the objects created
by the requests executed by the node. This store is external to the node and, typically, only
its hash is stored in the node, if consensus is needed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CThe configuration ofnode.protected final ObjectThe lock for modifications of the store.protected static final Loggerprotected final AbstractLocalNode<? extends C,? extends AbstractStore<? extends C>> The node having this store. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStore(AbstractLocalNode<? extends C, ? extends AbstractStore<? extends C>> node) Builds the store for a node.protectedAbstractStore(AbstractStore<? extends C> parent) Builds a clone of the given store. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()final voidpush(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response) Pushes into the store the result of executing a successful Hotmoka request.final voidreplace(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response) Pushes into the store the result of executing a successful Hotmoka request.protected abstract voidsetHistory(StorageReference object, Stream<TransactionReference> history) Sets the history of the given object, that is, the references to the transactions that provide information about its current state, in reverse chronological order (from newest to oldest).protected abstract voidsetManifest(StorageReference manifest) Mark the node as initialized.protected abstract voidsetResponse(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response) Writes in store the given request and response for the given transaction reference.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.hotmoka.local.Store
getError, getHistory, getHistoryUncommitted, getManifest, getManifestUncommitted, getNow, getRequest, getResponse, getResponseUncommitted, push
-
Field Details
-
logger
-
lock
The lock for modifications of the store. -
node
protected final AbstractLocalNode<? extends C extends Config,? extends AbstractStore<? extends C extends Config>> nodeThe node having this store. -
config
The configuration ofnode.
-
-
Constructor Details
-
AbstractStore
Builds the store for a node.- Parameters:
node- the node having this store
-
AbstractStore
Builds a clone of the given store.- Parameters:
parent- the store to clone
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
push
public final void push(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response) throws IOException Description copied from interface:StorePushes into the store the result of executing a successful Hotmoka request. This method assumes that the given request was not already present in the store.- Specified by:
pushin interfaceStore- Parameters:
reference- the reference of the requestrequest- the request of the transactionresponse- the response of the transaction- Throws:
IOException- if an I/O occurred
-
replace
public final void replace(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response) Description copied from interface:StorePushes into the store the result of executing a successful Hotmoka request. This method assumes that the given request was already present in the store. -
setResponse
protected abstract void setResponse(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response) Writes in store the given request and response for the given transaction reference.- Parameters:
reference- the reference of the transactionrequest- the requestresponse- the response
-
setHistory
Sets the history of the given object, that is, the references to the transactions that provide information about its current state, in reverse chronological order (from newest to oldest).- Parameters:
object- the object whose history is sethistory- the stream that will become the history of the object, replacing its previous history; this is in chronological order, from newest transactions to oldest; hence the last transaction is that when the object has been created- Throws:
IOException- if there was an I/O error
-
setManifest
Mark the node as initialized. This happens for initialization requests.- Parameters:
manifest- the manifest to put in the node
-