Trait StatementApiServer
pub trait StatementApiServer:
Sized
+ Send
+ Sync
+ 'static {
// Required methods
fn submit(
&self,
encoded: Bytes,
) -> Result<SubmitResult, ErrorObject<'static>>;
fn subscribe_statement(
&self,
subscription_sink: PendingSubscriptionSink,
ext: &Extensions,
topic_filter: TopicFilter,
);
// Provided method
fn into_rpc(self) -> RpcModule<Self> { ... }
}Expand description
Re-export the API for backward compatibility.
Server trait implementation for the StatementApi RPC API.
Required Methods§
fn submit(&self, encoded: Bytes) -> Result<SubmitResult, ErrorObject<'static>>
fn submit(&self, encoded: Bytes) -> Result<SubmitResult, ErrorObject<'static>>
Submit a SCALE-encoded statement.
See Statement definition for more details.
Returns SubmitResult indicating success or failure reason.
fn subscribe_statement(
&self,
subscription_sink: PendingSubscriptionSink,
ext: &Extensions,
topic_filter: TopicFilter,
)
fn subscribe_statement( &self, subscription_sink: PendingSubscriptionSink, ext: &Extensions, topic_filter: TopicFilter, )
Subscribe to new statements that match the provided filters.
§Parameters
topic_filter— Which topics to match. UseTopicFilter::Anyto match all topics,TopicFilter::MatchAll(vec)to match statements that include all provided topics, orTopicFilter::MatchAny(vec)to match statements that include any of the provided topics.
§Returns
Returns a stream of StatementEvent values.
When a subscription is initiated the endpoint will first return all matching statements
already in the store in batches as StatementEvent::NewStatements.
NewStatements includes an Optional field remaining which indicates how many more
statements are left to be sent in the initial batch of existing statements. The field
guarantees to the client that it will receive at least this many more statements in the
subscription stream, but it may receive more if new statements are added to the store that
match the filter.
If there are no statements in the store matching the filter, an empty batch of statements is sent.
Provided Methods§
fn into_rpc(self) -> RpcModule<Self>
fn into_rpc(self) -> RpcModule<Self>
Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.
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.