-
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
CheckableStore
- All Known Implementing Classes:
AbstractStore
public interface Store extends AutoCloseable
The shared 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 held in the node, if consensus is needed. Stores must be thread-safe, since they can be used concurrently for executing more requests.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<String>getError(TransactionReference reference)Yields the error generated by the transaction having the given reference.Stream<TransactionReference>getHistory(StorageReference object)Yields the history of the given object, that is, the references of the transactions that provide information about the current values of its fields.Stream<TransactionReference>getHistoryUncommitted(StorageReference object)Yields the history of the given object, that is, the references of the transactions that provide information about the current values of its fields.Optional<StorageReference>getManifest()Yields the manifest installed when the node is initialized.Optional<StorageReference>getManifestUncommitted()Yields the manifest installed when the node is initialized, also when the transaction that installed it is not yet committed.longgetNow()Yields the UTC time that must be used for a transaction, if it is executed with this state in this moment.Optional<TransactionRequest<?>>getRequest(TransactionReference reference)Yields the request that generated the transaction with the given reference.Optional<TransactionResponse>getResponse(TransactionReference reference)Yields the response of the transaction having the given reference.Optional<TransactionResponse>getResponseUncommitted(TransactionReference reference)Yields the response of the transaction having the given reference.voidpush(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response)Pushes into the store the result of executing a successful Hotmoka request.voidpush(TransactionReference reference, TransactionRequest<?> request, String errorMessage)Pushes into state the error message resulting from the unsuccessful execution of a Hotmoka request.voidreplace(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response)Pushes into the store the result of executing a successful Hotmoka request.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
getNow
long getNow()
Yields the UTC time that must be used for a transaction, if it is executed with this state in this moment.- Returns:
- the UTC time, in the same format as returned by
System.currentTimeMillis()
-
getResponse
Optional<TransactionResponse> getResponse(TransactionReference reference)
Yields the response of the transaction having the given reference.- Parameters:
reference- the reference of the transaction- Returns:
- the response, if any
-
getResponseUncommitted
Optional<TransactionResponse> getResponseUncommitted(TransactionReference reference)
Yields the response of the transaction having the given reference. The response if returned also when it is not yet committed.- Parameters:
reference- the reference of the transaction- Returns:
- the response, if any
-
getError
Optional<String> getError(TransactionReference reference)
Yields the error generated by the transaction having the given reference.- Parameters:
reference- the reference of the transaction- Returns:
- the error, if any
-
getHistory
Stream<TransactionReference> getHistory(StorageReference object)
Yields the history of the given object, that is, the references of the transactions that provide information about the current values of its fields.- Parameters:
object- the reference of the object- Returns:
- the history. Yields an empty stream if there is no history for
object
-
getHistoryUncommitted
Stream<TransactionReference> getHistoryUncommitted(StorageReference object)
Yields the history of the given object, that is, the references of the transactions that provide information about the current values of its fields.- Parameters:
object- the reference of the object- Returns:
- the history. Yields an empty stream if there is no history for
object
-
getManifest
Optional<StorageReference> getManifest()
Yields the manifest installed when the node is initialized.- Returns:
- the manifest
-
getManifestUncommitted
Optional<StorageReference> getManifestUncommitted()
Yields the manifest installed when the node is initialized, also when the transaction that installed it is not yet committed.- Returns:
- the manifest
-
getRequest
Optional<TransactionRequest<?>> getRequest(TransactionReference reference)
Yields the request that generated the transaction with the given reference. If this node has some form of commit, then this method is called only when the transaction has been already committed.- Parameters:
reference- the reference of the transaction- Returns:
- the request, if any
-
push
void push(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response)
Pushes 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.- Parameters:
reference- the reference of the requestrequest- the request of the transactionresponse- the response of the transaction
-
replace
void replace(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response)
Pushes into the store the result of executing a successful Hotmoka request. This method assumes that the given request was already present in the store.- Parameters:
reference- the reference of the requestrequest- the request of the transactionresponse- the response of the transaction
-
push
void push(TransactionReference reference, TransactionRequest<?> request, String errorMessage)
Pushes into state the error message resulting from the unsuccessful execution of a Hotmoka request.- Parameters:
reference- the reference of the requestrequest- the request of the transactionerrorMessage- the error message
-
-