Type Alias BlockchainReadHandle

Source
pub type BlockchainReadHandle = DatabaseReadService<BlockchainReadRequest, BlockchainResponse>;
Expand description

The blockchain database read service.

Aliased Type§

struct BlockchainReadHandle { /* private fields */ }

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 24 bytes

Implementations

Source§

impl<Req, Res> DatabaseReadService<Req, Res>
where Req: Send + 'static, Res: Send + 'static,

Source

pub fn new( env: Arc<ConcreteEnv>, pool: Arc<ThreadPool>, req_handler: impl Fn(&ConcreteEnv, Req) -> Result<Res, RuntimeError> + Send + Sync + 'static, ) -> DatabaseReadService<Req, Res>

Creates the DatabaseReadService with the provided backing thread-pool.

Should be called once per actual database, although nothing bad will happen, cloning the DatabaseReadService is the correct way to get multiple handles to the database.

Trait Implementations

Source§

impl<Req, Res> Clone for DatabaseReadService<Req, Res>

Source§

fn clone(&self) -> DatabaseReadService<Req, Res>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Req, Res> Service<Req> for DatabaseReadService<Req, Res>
where Req: Send + 'static, Res: Send + 'static,

Source§

type Response = Res

Responses given by the service.
Source§

type Error = RuntimeError

Errors produced by the service.
Source§

type Future = InfallibleOneshotReceiver<Result<<DatabaseReadService<Req, Res> as Service<Req>>::Response, RuntimeError>>

The future response value.
Source§

fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), RuntimeError>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
Source§

fn call( &mut self, req: Req, ) -> <DatabaseReadService<Req, Res> as Service<Req>>::Future

Process the request and return the response asynchronously. Read more