Class AbstractStore<C extends Config>

java.lang.Object
io.hotmoka.local.AbstractStore<C>
All Implemented Interfaces:
Store, AutoCloseable

public abstract class AbstractStore<C extends Config> extends Object implements Store
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 Details

    • logger

      protected static final Logger logger
    • lock

      protected final Object lock
      The lock for modifications of the store.
    • node

      protected final AbstractLocalNode<? extends C extends Config,? extends AbstractStore<? extends C extends Config>> node
      The node having this store.
    • config

      protected final C extends Config config
      The configuration of node.
  • Constructor Details

    • AbstractStore

      protected AbstractStore(AbstractLocalNode<? extends C,? extends AbstractStore<? extends C>> node)
      Builds the store for a node.
      Parameters:
      node - the node having this store
    • AbstractStore

      protected AbstractStore(AbstractStore<? extends C> parent)
      Builds a clone of the given store.
      Parameters:
      parent - the store to clone
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • push

      public final void push(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response) throws IOException
      Description copied from interface: Store
      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.
      Specified by:
      push in interface 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

      public final void replace(TransactionReference reference, TransactionRequest<?> request, TransactionResponse response)
      Description copied from interface: Store
      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.
      Specified by:
      replace in interface Store
      Parameters:
      reference - the reference of the request
      request - the request of the transaction
      response - the response of the transaction
    • 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 transaction
      request - the request
      response - the response
    • setHistory

      protected abstract void setHistory(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).
      Parameters:
      object - the object whose history is set
      history - 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

      protected abstract void setManifest(StorageReference manifest)
      Mark the node as initialized. This happens for initialization requests.
      Parameters:
      manifest - the manifest to put in the node