Trait exonum::blockchain::Service [] [src]

pub trait Service: Send + Sync + 'static {
    fn service_id(&self) -> u16;
fn service_name(&self) -> &'static str;
fn tx_from_raw(
        &self,
        raw: RawTransaction
    ) -> Result<Box<Transaction>, MessageError>; fn state_hash(&self, _: &Snapshot) -> Vec<Hash> { ... }
fn initialize(&self, fork: &mut Fork) -> Value { ... }
fn handle_commit(&self, context: &ServiceContext) { ... }
fn public_api_handler(&self, context: &ApiContext) -> Option<Box<Handler>> { ... }
fn private_api_handler(&self, context: &ApiContext) -> Option<Box<Handler>> { ... } }

A trait that describes a business-logic of the concrete service.

Required Methods

Unique service identification for database schema and service messages.

Unique human readable service name.

Tries to create Transaction object from the given raw message.

Provided Methods

Returns a list of root hashes of tables that determine the current state of the service database. These hashes are collected from all services in a common MerklePatriciaTable that named state_hash_aggregator.

See also service_table_unique_key.

By this method you can initialize information schema of service and generates initial service configuration. This method is called on genesis block creation event.

Handles commit event. This handler is invoked for each service after commit of the block. For example service can create some transaction if the specific condition occurred.

Try not to perform long operations here.

Returns api handler for public users.

Returns api handler for maintainers.

Implementors