Package com.exonum.binding.service
Class AbstractService
- java.lang.Object
-
- com.exonum.binding.service.AbstractService
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractService(short id, java.lang.String name, TransactionConverter transactionConverter)
Creates an AbstractService.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Transaction
convertToTransaction(RawTransaction rawTransaction)
Converts an Exonum raw transaction to an executable transaction of this service.protected abstract Schema
createDataSchema(View view)
Creates a data schema of this service.short
getId()
Returns the id of the service.java.lang.String
getName()
Returns the name of the service.java.util.List<com.exonum.binding.common.hash.HashCode>
getStateHashes(Snapshot snapshot)
Returns a list of root hashes of all Merklized tables defined by this service, as of the given snapshot of the blockchain state.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.exonum.binding.service.Service
afterCommit, createPublicApiHandlers, initialize
-
-
-
-
Constructor Detail
-
AbstractService
protected AbstractService(short id, java.lang.String name, TransactionConverter transactionConverter)
Creates an AbstractService.- Parameters:
id
- an id of the servicename
- a name of the servicetransactionConverter
- a transaction converter that is aware of all transactions of this service
-
-
Method Detail
-
getId
public short getId()
Description copied from interface:Service
Returns the id of the service.
-
getName
public java.lang.String getName()
Description copied from interface:Service
Returns the name of the service.
-
convertToTransaction
public Transaction convertToTransaction(RawTransaction rawTransaction)
Description copied from interface:Service
Converts an Exonum raw transaction to an executable transaction of this service.- Specified by:
convertToTransaction
in interfaceService
- Parameters:
rawTransaction
- a raw transaction to be converted- Returns:
- an executable transaction
-
getStateHashes
public java.util.List<com.exonum.binding.common.hash.HashCode> getStateHashes(Snapshot snapshot)
Description copied from interface:Service
Returns a list of root hashes of all Merklized tables defined by this service, as of the given snapshot of the blockchain state. If the service doesn't have any Merklized tables, returns an empty list.The core uses this list to aggregate hashes of tables defined by all services into a single Merklized meta-map. The hash of this meta-map is considered the hash of the entire blockchain state and is recorded as such in blocks and Precommit messages.
- Specified by:
getStateHashes
in interfaceService
- Parameters:
snapshot
- a snapshot of the blockchain state. Not valid after this method returns- See Also:
ProofListIndexProxy.getRootHash()
,ProofMapIndexProxy.getRootHash()
-
-