pub struct AlbumClient { /* private fields */ }Expand description
The album-provisioning client.
Implementations§
Source§impl AlbumClient
impl AlbumClient
Sourcepub fn new(transport: AlbumTransport) -> Self
pub fn new(transport: AlbumTransport) -> Self
Build a client over an authorized AlbumTransport.
Sourcepub async fn provision(
&self,
album_id: Uuid,
) -> Result<ProvisionedAlbum, AlbumError>
pub async fn provision( &self, album_id: Uuid, ) -> Result<ProvisionedAlbum, AlbumError>
Register album_id with the server, binding it to the authenticated caller.
Idempotent: calling it again with the same id succeeds and writes nothing. The id is sent in its canonical lowercase hyphenated form, which is the only spelling the server stores, so two devices can never produce two rows for one album.
Sourcepub async fn publish_roster(
&self,
signed: &SignedAlbumRoster,
) -> Result<PublishedRoster, AlbumError>
pub async fn publish_roster( &self, signed: &SignedAlbumRoster, ) -> Result<PublishedRoster, AlbumError>
Publish signed as the roster of the album it names.
Orchestration only, and deliberately thin: the roster is signed in
capsule_core::crypto::membership by one of the owner’s devices, base64-encoded, and
handed to the generated publish_album_roster operation, so every byte that is
parsed or serialized on this path comes from the committed OpenAPI document. Idempotent
under (album_id, roster_version): the same bytes again succeed with replayed.
Two refusals a caller acts on: a 409 (error.album.roster_stale) means the server holds
a roster this one does not supersede, and a 400 error.album.roster_version_leap means
the version is too far ahead of the held one. Both carry
current_version, and the repair for both is the same — re-sign the
roster one above it.
Under a session, a 401 is refreshed once and replayed, exactly as the sync feed does:
the credential provider’s pre-flight refresh cannot cover a token revoked mid-flight.
§Errors
AlbumError::Transport when the request did not complete, AlbumError::Status with
the server’s error.* code when it was refused, AlbumError::Malformed when the roster
could not be encoded or the response could not be read.
Source§impl AlbumClient
impl AlbumClient
Sourcepub async fn apply_op(
&self,
request: &OpRequest,
) -> Result<AppliedOp, LifecycleOpError>
pub async fn apply_op( &self, request: &OpRequest, ) -> Result<AppliedOp, LifecycleOpError>
Apply one signed lifecycle op to the album its envelope names, through the generated
album_lifecycle_op operation.
Orchestration only, as Self::publish_roster is: the manifest was signed by the
library and the request is the generated type, so nothing on this path hand-writes a
wire shape. Idempotent under the manifest: a replay answers the first application’s
response with replayed set.
Under a session, a 401 is refreshed once and replayed. Nothing else is retried here,
and a permanent refusal must not be retried by the
caller either.
§Errors
LifecycleOpError::Refused with the server’s error.* code when the server refused
the op, LifecycleOpError::Malformed when the envelope names no album or the response
could not be read, LifecycleOpError::Transport when the request did not complete, and
LifecycleOpError::UpgradeRequired when the server will not take this build’s writes.
Auto Trait Implementations§
impl !RefUnwindSafe for AlbumClient
impl !UnwindSafe for AlbumClient
impl Freeze for AlbumClient
impl Send for AlbumClient
impl Sync for AlbumClient
impl Unpin for AlbumClient
impl UnsafeUnpin for AlbumClient
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
§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