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§
type Scope
type PublishedHandle
Required Methods§
Sourcefn resolve<'a>(
&'a self,
scope: &'a Self::Scope,
reference: &'a ResourceReference,
) -> CapabilityFuture<'a, Result<ResourceMetadata, CapabilityError>>
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.
Sourcefn read<'a>(
&'a self,
scope: &'a Self::Scope,
reference: &'a ResourceReference,
) -> CapabilityFuture<'a, Result<ResourceRead, CapabilityError>>
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.
Sourcefn 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 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.
Sourcefn publication_status<'a>(
&'a self,
scope: &'a Self::Scope,
operation_id: &'a str,
) -> CapabilityFuture<'a, Result<PublicationStatus<Self::PublishedHandle>, CapabilityError>>
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.
Sourcefn release<'a>(
&'a self,
scope: &'a Self::Scope,
handle: &'a Self::PublishedHandle,
) -> CapabilityFuture<'a, Result<(), CapabilityError>>
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.
fn limits(&self) -> CapabilityLimits
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".