pub struct Gcs<T: TokenProvider> { /* private fields */ }Expand description
A bucket as an ObjectStore.
Implementations§
Source§impl<T: TokenProvider> Gcs<T>
impl<T: TokenProvider> Gcs<T>
Sourcepub fn new(bucket: &str, tokens: T, cfg: GcsConfig) -> Result<Self>
pub fn new(bucket: &str, tokens: T, cfg: GcsConfig) -> Result<Self>
A store for bucket, authenticated by tokens.
Sourcepub fn with_max_inflated(self, limit: u64) -> Self
pub fn with_max_inflated(self, limit: u64) -> Self
Refuse to decode an encoded object past limit bytes
(Error::TooLarge); the default is MAX_INFLATED_BYTES. The
stored bytes stay bounded by GcsConfig::max_object_bytes.
Trait Implementations§
Source§impl<T: TokenProvider> ObjectStore for Gcs<T>
impl<T: TokenProvider> ObjectStore for Gcs<T>
Source§type Get<'a> = impl Future<Output = Result<Option<Object>, Error>> + 'a
where
Self: 'a
type Get<'a> = impl Future<Output = Result<Option<Object>, Error>> + 'a where Self: 'a
Future of
get.Source§type GetRange<'a> = impl Future<Output = Result<Bytes, Error>> + 'a
where
Self: 'a
type GetRange<'a> = impl Future<Output = Result<Bytes, Error>> + 'a where Self: 'a
Future of
get_range.Source§type Head<'a> = impl Future<Output = Result<Option<Meta>, Error>> + 'a
where
Self: 'a
type Head<'a> = impl Future<Output = Result<Option<Meta>, Error>> + 'a where Self: 'a
Future of
head.Source§type List<'a> = impl Future<Output = Result<Vec<Meta>, Error>> + 'a
where
Self: 'a
type List<'a> = impl Future<Output = Result<Vec<Meta>, Error>> + 'a where Self: 'a
Future of
list.Source§type Delete<'a> = impl Future<Output = Result<(), Error>> + 'a
where
Self: 'a
type Delete<'a> = impl Future<Output = Result<(), Error>> + 'a where Self: 'a
Future of
delete.Source§fn get<'a>(&'a self, key: &'a str) -> Self::Get<'a>
fn get<'a>(&'a self, key: &'a str) -> Self::Get<'a>
The whole object, or
None if it does not exist.Source§fn get_range<'a>(
&'a self,
key: &'a str,
range: Range<u64>,
) -> Self::GetRange<'a>
fn get_range<'a>( &'a self, key: &'a str, range: Range<u64>, ) -> Self::GetRange<'a>
Bytes
range of the object. A range running past the end is clipped;
a range starting at or past the end is an empty body. A missing object
is Error::NotFound.Source§fn put<'a>(&'a self, key: &'a str, body: Bytes, cond: Cond) -> Self::Put<'a>
fn put<'a>(&'a self, key: &'a str, body: Bytes, cond: Cond) -> Self::Put<'a>
Write
body under key if cond holds; returns the new generation.Source§fn list<'a>(&'a self, prefix: &'a str) -> Self::List<'a>
fn list<'a>(&'a self, prefix: &'a str) -> Self::List<'a>
Every object whose key starts with
prefix, sorted by key. An empty
prefix lists everything; a non-empty prefix is validated like a key
(a trailing / is allowed).Source§fn delete<'a>(&'a self, key: &'a str) -> Self::Delete<'a>
fn delete<'a>(&'a self, key: &'a str) -> Self::Delete<'a>
Remove the object. Deleting a missing key succeeds.
Source§async fn put_encoded<'a>(
&'a self,
key: &'a str,
body: Bytes,
cond: Cond,
encoding: ContentEncoding,
) -> Result<u64>
async fn put_encoded<'a>( &'a self, key: &'a str, body: Bytes, cond: Cond, encoding: ContentEncoding, ) -> Result<u64>
Like
put, storing body compressed with
encoding and recording the encoding, so get
returns body again and get_range refuses
with Error::EncodedRange. Conditions behave exactly as for put. Read moreAuto Trait Implementations§
impl<T> !RefUnwindSafe for Gcs<T>
impl<T> !UnwindSafe for Gcs<T>
impl<T> Freeze for Gcs<T>where
T: Freeze,
impl<T> Send for Gcs<T>where
T: Send,
impl<T> Sync for Gcs<T>where
T: Sync,
impl<T> Unpin for Gcs<T>where
T: Unpin,
impl<T> UnsafeUnpin for Gcs<T>where
T: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more