Trait linera_sdk::Service

source ·
pub trait Service: WithServiceAbi + ServiceAbi + Sized {
    type Parameters: Serialize + DeserializeOwned + Send + Sync + Clone + Debug + 'static;

    // Required methods
    async fn new(runtime: ServiceRuntime<Self>) -> Self;
    async fn handle_query(&self, query: Self::Query) -> Self::QueryResponse;
}
Expand description

The service interface of a Linera application.

As opposed to the Contract interface of an application, service entry points are triggered by JSON queries (typically GraphQL). Their execution cannot modify storage and is not gas-metered.

Required Associated Types§

source

type Parameters: Serialize + DeserializeOwned + Send + Sync + Clone + Debug + 'static

Immutable parameters specific to this application.

Required Methods§

source

async fn new(runtime: ServiceRuntime<Self>) -> Self

Creates an in-memory instance of the service handler.

source

async fn handle_query(&self, query: Self::Query) -> Self::QueryResponse

Executes a read-only query on the state of this application.

Object Safety§

This trait is not object safe.

Implementors§