Interface Store

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 Details

    • 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

      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

      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

      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) throws IOException
      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 request
      request - the request of the transaction
      response - the response of the transaction
      Throws:
      IOException - if an I/O occurred
    • 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 request
      request - the request of the transaction
      response - 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 request
      request - the request of the transaction
      errorMessage - the error message