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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.