Skip to main content

ResourceAccess

Trait ResourceAccess 

Source
pub trait ResourceAccess {
    type Scope;
    type PublishedHandle;

    // Required methods
    fn resolve<'a>(
        &'a self,
        scope: &'a Self::Scope,
        reference: &'a ResourceReference,
    ) -> CapabilityFuture<'a, Result<ResourceMetadata, CapabilityError>>;
    fn read<'a>(
        &'a self,
        scope: &'a Self::Scope,
        reference: &'a ResourceReference,
    ) -> CapabilityFuture<'a, Result<ResourceRead, CapabilityError>>;
    fn publish<'a>(
        &'a self,
        scope: &'a Self::Scope,
        operation_id: &'a str,
        kind: PublicationKind,
        metadata: ResourceMetadata,
        body: HttpBody,
    ) -> CapabilityFuture<'a, Result<PublishedResource<Self::PublishedHandle>, CapabilityError>>;
    fn publication_status<'a>(
        &'a self,
        scope: &'a Self::Scope,
        operation_id: &'a str,
    ) -> CapabilityFuture<'a, Result<PublicationStatus<Self::PublishedHandle>, CapabilityError>>;
    fn release<'a>(
        &'a self,
        scope: &'a Self::Scope,
        handle: &'a Self::PublishedHandle,
    ) -> CapabilityFuture<'a, Result<(), CapabilityError>>;
    fn limits(&self) -> CapabilityLimits;
}
Expand description

Scoped resource publication and access.

Required Associated Types§

Required Methods§

Source

fn resolve<'a>( &'a self, scope: &'a Self::Scope, reference: &'a ResourceReference, ) -> CapabilityFuture<'a, Result<ResourceMetadata, CapabilityError>>

Returns file metadata or NotFound/Expired as appropriate.

Source

fn read<'a>( &'a self, scope: &'a Self::Scope, reference: &'a ResourceReference, ) -> CapabilityFuture<'a, Result<ResourceRead, CapabilityError>>

Reads a resource as a streamable body with file-only metadata.

Source

fn publish<'a>( &'a self, scope: &'a Self::Scope, operation_id: &'a str, kind: PublicationKind, metadata: ResourceMetadata, body: HttpBody, ) -> CapabilityFuture<'a, Result<PublishedResource<Self::PublishedHandle>, CapabilityError>>

Publishes one body under a host-assigned reference and handle.

operation_id is idempotency-scoped by scope. Hosts check and update its stored state atomically, including stored expiry, before validating new metadata. No preceding status query is required.

A duplicate completed operation with the same kind returns the original publication and metadata without consuming the new body. A different kind or a pending operation returns Conflict; a released or expired operation returns Expired, irrespective of newly supplied metadata. An existing publication’s metadata is never overwritten by a retry. Callers can inspect the durable state with Self::publication_status. If the caller is dropped after remote publication but before receiving the handle, it can recover the result with Self::publication_status without replaying the body. The metadata expiry for a new operation must be present and in the future; otherwise the host returns Invalid before consuming the body. If kind is unsupported, the host returns Unsupported before any side effect. Rejection and duplicate paths do not consume the supplied body.

Source

fn publication_status<'a>( &'a self, scope: &'a Self::Scope, operation_id: &'a str, ) -> CapabilityFuture<'a, Result<PublicationStatus<Self::PublishedHandle>, CapabilityError>>

Recovers publication state after cancellation or a lost result.

Source

fn release<'a>( &'a self, scope: &'a Self::Scope, handle: &'a Self::PublishedHandle, ) -> CapabilityFuture<'a, Result<(), CapabilityError>>

Releases a published handle after the host verifies signed ownership and scope. This is intentionally separate from publication and does not add a delete-existing-resource operation for arbitrary references. On success the operation becomes Expired, retaining its idempotency record: status queries and duplicate publishes must not return a stale publication or recreate the resource. Expiry has the same terminal effect.

Source

fn limits(&self) -> CapabilityLimits

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§