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§
sourcetype Parameters: Serialize + DeserializeOwned + Send + Sync + Clone + Debug + 'static
type Parameters: Serialize + DeserializeOwned + Send + Sync + Clone + Debug + 'static
Immutable parameters specific to this application.
Required Methods§
sourceasync fn new(runtime: ServiceRuntime<Self>) -> Self
async fn new(runtime: ServiceRuntime<Self>) -> Self
Creates an in-memory instance of the service handler.
sourceasync fn handle_query(&self, query: Self::Query) -> Self::QueryResponse
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.