referrerpolicy=no-referrer-when-downgrade

BitswapApiServer

Trait BitswapApiServer 

Source
pub trait BitswapApiServer:
    Sized
    + Send
    + Sync
    + 'static {
    // Required methods
    fn bitswap_unstable_get(&self, cid: String) -> RpcResult<String>;
    fn bitswap_unstable_stream(
        &self,
        subscription_sink: PendingSubscriptionSink,
        cids: Vec<String>,
    );

    // Provided method
    fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description

Server trait implementation for the BitswapApi RPC API.

Required Methods§

Source

fn bitswap_unstable_get(&self, cid: String) -> RpcResult<String>

Retrieve indexed transaction data by CID.

Accepts a CIDv1 (base32 multibase-encoded string), extracts the 32-byte hash digest, looks up the indexed transaction, and returns hex-encoded data.

bitswap_v1_get is kept as an alias during the transition to the unstable_ naming and will be removed once clients migrate.

Source

fn bitswap_unstable_stream( &self, subscription_sink: PendingSubscriptionSink, cids: Vec<String>, )

Stream chunks as they become available.

Emits one StreamEvent::StreamItem / StreamEvent::StreamItemError event per input CID, in arrival order (the order in which each CID resolves) — not input order. Clients correlate each event with its request via the embedded cid. After the last per-CID event, a single StreamEvent::StreamDone marks end-of-stream. No streamDone is emitted if the client cancels via the unsubscribe method or disconnects.

Top-level rejections (no events emitted, no subscription opened): -32801 TooManyCids, -32802 EmptyCids, -32803 DuplicateCids.

Provided Methods§

Source

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.

Implementors§

Source§

impl<Block, Client> BitswapApiServer for Bitswap<Block, Client>
where Block: BlockT, Client: BlockBackend<Block> + Send + Sync + 'static,