pub struct HttpRemoteClient { /* private fields */ }Expand description
Reference HTTP RemoteClient implementation. A single instance
is tied to exactly one RemoteConfig and one base URL.
Implementations§
Source§impl HttpRemoteClient
impl HttpRemoteClient
Sourcepub fn new(cfg: RemoteConfig) -> Self
pub fn new(cfg: RemoteConfig) -> Self
Build a client from a parsed RemoteConfig. A fresh
reqwest::Client is created per call; callers who want to
pool connections across remotes should build one client
explicitly and share it via the future with_client
constructor (deferred, tracked in B3.3).
Sourcepub async fn negotiate_capabilities(&mut self) -> Result<(), ClientError>
pub async fn negotiate_capabilities(&mut self) -> Result<(), ClientError>
Negotiate capabilities with the remote by calling list_refs
and intersecting the server’s advertised set with the local
one. After this call, Self::capabilities returns the
agreed set that all subsequent verbs must operate under.
Sourcepub const fn capabilities(&self) -> &CapabilitySet
pub const fn capabilities(&self) -> &CapabilitySet
The agreed-upon capability set. Before
Self::negotiate_capabilities has been called this is the
local advertisement; after, it’s the intersection with the
server.
Trait Implementations§
Source§impl Debug for HttpRemoteClient
impl Debug for HttpRemoteClient
Source§impl RemoteClient for HttpRemoteClient
impl RemoteClient for HttpRemoteClient
Source§fn list_refs(
&self,
) -> Pin<Box<dyn Future<Output = Result<RefsResponse, ClientError>> + Send + '_>>
fn list_refs( &self, ) -> Pin<Box<dyn Future<Output = Result<RefsResponse, ClientError>> + Send + '_>>
GET /remote/v1/refs - enumerate the server’s current refs
and the capability set it will negotiate against.Source§fn fetch_blocks(
&self,
wants: Vec<Cid>,
have_set: BloomHaveSet,
) -> Pin<Box<dyn Future<Output = Result<Bytes, ClientError>> + Send + '_>>
fn fetch_blocks( &self, wants: Vec<Cid>, have_set: BloomHaveSet, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ClientError>> + Send + '_>>
POST /remote/v1/fetch-blocks - request a CAR body containing
every block in wants and its transitive graph, minus
anything in have_set.Source§fn push_blocks(
&self,
car_body: Bytes,
) -> Pin<Box<dyn Future<Output = Result<PushResponse, ClientError>> + Send + '_>>
fn push_blocks( &self, car_body: Bytes, ) -> Pin<Box<dyn Future<Output = Result<PushResponse, ClientError>> + Send + '_>>
POST /remote/v1/push-blocks - upload a CAR body. Requires
the bearer token.Source§fn advance_head(
&self,
old: Cid,
new: Cid,
ref_name: String,
) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + '_>>
fn advance_head( &self, old: Cid, new: Cid, ref_name: String, ) -> Pin<Box<dyn Future<Output = Result<(), ClientError>> + Send + '_>>
POST /remote/v1/advance-head - atomic compare-and-swap on a
named ref. Requires the bearer token. Returns
ClientError::CasMismatch on 409.