pub struct SyncConsumer { /* private fields */ }Expand description
The sync consumer, over the generated REST client.
It used to drive capsule.sync.v1.SyncService over tonic. The feed is GET /v1/sync now and
is a generated operation like every other, which removes the SDK’s second transport and, with
it, the second place a wire contract could be described. What did not change is
everything below the transport: SyncState, the anti-rewind high-water marks and the
forward-version rule are the same pure state machine, because none of them was ever about
gRPC.
Implementations§
Source§impl SyncConsumer
impl SyncConsumer
Sourcepub async fn reannounce(
&self,
manifests: &[&HeldManifest],
) -> Result<Vec<ReannounceResult>, SyncError>
pub async fn reannounce( &self, manifests: &[&HeldManifest], ) -> Result<Vec<ReannounceResult>, SyncError>
Re-announce one batch of manifests: POST /v1/sync/reannounce.
One answer per manifest, in order. Refreshes once on a 401, as a pull does.
§Errors
SyncError::Rejected with the server’s code when it refused the request as a whole
(an empty or oversized batch, a collaborator that could not answer, the protocol gate),
SyncError::Transport when the request did not complete, and
SyncError::MalformedManifest when the server answered a different number of results
than manifests sent.
Source§impl SyncConsumer
impl SyncConsumer
Sourcepub fn with_session(base_url: &str, session: Session) -> Result<Self, SyncError>
pub fn with_session(base_url: &str, session: Session) -> Result<Self, SyncError>
A consumer for the API at base_url, authorizing through an SDK Session — the
sanctioned production path.
§Errors
SyncError::Transport when base_url is not a URL the client can hang paths off.
Sourcepub fn with_static_token(
base_url: &str,
token: impl Into<String>,
) -> Result<Self, SyncError>
pub fn with_static_token( base_url: &str, token: impl Into<String>, ) -> Result<Self, SyncError>
A consumer over a fixed bearer token (tests; callers holding a live token).
§Errors
SyncError::Transport when base_url is not a URL the client can hang paths off.
Sourcepub fn with_signed_capability(
base_url: &str,
token: impl Into<String>,
signer: Arc<dyn RequestSigner>,
) -> Result<Self, SyncError>
pub fn with_signed_capability( base_url: &str, token: impl Into<String>, signer: Arc<dyn RequestSigner>, ) -> Result<Self, SyncError>
A consumer presenting a federation capability token, each request signed by signer —
the puller’s key, which the home server pinned for the peer the capability names.
§Errors
SyncError::Transport when base_url is not a URL the client can hang paths off.
Sourcepub async fn pull(
&self,
cursor: &SyncCursor,
page_size: u32,
) -> Result<SyncPage, SyncError>
pub async fn pull( &self, cursor: &SyncCursor, page_size: u32, ) -> Result<SyncPage, SyncError>
Pull one page after cursor.
On a 401 under a session, refreshes once and retries — the reactive half of the session
contract, which the pre-flight refresh cannot cover when a token is revoked mid-flight.
A 503 or a transport failure rides the shared retry engine’s interactive class: short
timeout, at most two retries, then a visible failure — no configuration hot-loops.
Sourcepub async fn pull_album(
&self,
cursor: &SyncCursor,
page_size: u32,
album_id: &str,
) -> Result<SyncPage, SyncError>
pub async fn pull_album( &self, cursor: &SyncCursor, page_size: u32, album_id: &str, ) -> Result<SyncPage, SyncError>
Pull one page of one album after cursor.
The album arm of the same operation: an account reads it as the album’s
owner or a member of its current roster, and a federated peer reads it under a capability
whose audience is that album. Same retry and same refresh-once behaviour as
Self::pull; the only difference is the parameter, because the server is where the
two arms differ and the client has one feed.
§Errors
As Self::pull, plus the album refusals the server renders — a peer’s revoked or
out-of-audience capability among them.
Trait Implementations§
Source§impl Clone for SyncConsumer
impl Clone for SyncConsumer
Source§fn clone(&self) -> SyncConsumer
fn clone(&self) -> SyncConsumer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for SyncConsumer
impl !UnwindSafe for SyncConsumer
impl Freeze for SyncConsumer
impl Send for SyncConsumer
impl Sync for SyncConsumer
impl Unpin for SyncConsumer
impl UnsafeUnpin for SyncConsumer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more