Skip to main content

S3Store

Struct S3Store 

Source
pub struct S3Store { /* private fields */ }
Expand description

Production ObjectStore backed by aws-sdk-s3.

Implementations§

Source§

impl S3Store

Source

pub async fn from_remote_url(url: &RemoteUrl) -> Result<Self, ObjectStoreError>

Build an S3Store from a parsed RemoteUrl.

The RemoteUrl::S3::prefix field is intentionally not consumed here; callers compose it into keys themselves per the module-level docs.

§Errors

Returns ObjectStoreError::Other if url is not the S3 variant or if the endpoint URL cannot be normalised for virtual-hosted addressing.

Trait Implementations§

Source§

impl Debug for S3Store

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ObjectStore for S3Store

Source§

fn get_bytes_range<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, range: Range<u64>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Issue a GetObject with a Range: bytes=<start>-<end-1> header. HTTP 416 maps to ObjectStoreError::RangeNotSatisfiable with the original requested range (so the wire-line names what the caller asked for, not the server’s translation). All other failures route through [classify].

S3 silently truncates a ranged GET to EOF when the requested range overruns the object — start < body.len() <= end returns start..body.len() bytes with HTTP 206 and no error. The post-flight length check via [super::verify_range_response_length] elevates that mismatch to ObjectStoreError::RangeNotSatisfiable so callers (notably the packchain reader) cannot mistake a truncated slice for the full requested range.

Source§

fn presigned_get_url<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ttl: Duration, ) -> Pin<Box<dyn Future<Output = Result<String, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Presign a GetObject request for key valid for ttl. Used by the bundle-uri capability (issue #76) to advertise time-limited download URLs against private buckets. The returned URL carries an X-Amz-Signature query parameter derived from the SDK’s resolved SigV4 credentials and an X-Amz-Expires=<ttl-seconds> parameter that the operator can use to verify the requested TTL was honoured.

§Errors

Returns ObjectStoreError::Other when the SDK rejects the TTL (AWS caps presigned URLs at 7 days) or when the presigning step fails (e.g. credential provider returned no credentials).

Source§

fn list<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObjectMeta>, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enumerate every object whose key has prefix as a byte prefix.
Source§

fn get_to_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, dest: &'life2 Path, opts: GetOpts, ) -> Pin<Box<dyn Future<Output = Result<(), ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stream the object body to dest. The destination’s parent directory must already exist. opts.progress, when set, fires at chunk boundaries with the count of bytes just received.
Source§

fn get_bytes<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the entire object body into memory.
Source§

fn put_bytes<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, body: Bytes, opts: PutOpts, ) -> Pin<Box<dyn Future<Output = Result<(), ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write body to key, overwriting any existing object.
Source§

fn put_path<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 str, src: &'life2 Path, opts: PutOpts, ) -> Pin<Box<dyn Future<Output = Result<(), ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Stream a local file to key, overwriting any existing object. Read more
Source§

fn put_if_absent<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, body: Bytes, ) -> Pin<Box<dyn Future<Output = Result<bool, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create key if and only if it does not exist. Returns Ok(true) when the object was created, Ok(false) when the key was already present.
Source§

fn head<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ObjectMeta, ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch metadata for an exact key.
Source§

fn copy<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, src: &'life1 str, dst: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Copy src to dst. The body is preserved on every backend; user metadata is not guaranteed to survive — callers must not rely on metadata round-tripping through copy. Read more
Source§

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ObjectStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete key. Returns Err(ObjectStoreError::NotFound) if the key was not present.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more