pub struct Session { /* private fields */ }Expand description
Represents a session with Objectstore, tied to a specific Usecase and Scope within it.
Create a Session using Client::session or Scope::session.
Implementations§
Source§impl Session
impl Session
Sourcepub fn object_url(&self, object_key: &str) -> Url
pub fn object_url(&self, object_key: &str) -> Url
Generates a GET url to the object with the given key.
This can then be used by downstream services to fetch the given object.
NOTE however that the service does not strictly follow HTTP semantics,
in particular in relation to Accept-Encoding.
Sourcepub fn mint_token(&self) -> Result<Option<String>>
pub fn mint_token(&self) -> Result<Option<String>>
Returns a signed token if a token or generator was provided or None otherwise
Source§impl Session
impl Session
Sourcepub fn delete(&self, key: &str) -> DeleteBuilder
pub fn delete(&self, key: &str) -> DeleteBuilder
Deletes the object with the given key.
Source§impl Session
impl Session
Sourcepub fn get(&self, key: &str) -> GetBuilder
pub fn get(&self, key: &str) -> GetBuilder
Retrieves the object with the given key.
Source§impl Session
impl Session
Sourcepub fn many(&self) -> ManyBuilder
pub fn many(&self) -> ManyBuilder
Creates a ManyBuilder associated with this session.
A ManyBuilder can be used to enqueue multiple operations, which the client can choose to
send as batch requests via a dedicated endpoint, minimizing network overhead.
Source§impl Session
impl Session
Sourcepub fn put(&self, body: impl Into<Bytes>) -> PutBuilder
pub fn put(&self, body: impl Into<Bytes>) -> PutBuilder
Creates or replaces an object using a Bytes-like payload.
Sourcepub fn put_stream(&self, body: ClientStream) -> PutBuilder
pub fn put_stream(&self, body: ClientStream) -> PutBuilder
Creates or replaces an object using a streaming payload.
Sourcepub fn put_read<R>(&self, body: R) -> PutBuilder
pub fn put_read<R>(&self, body: R) -> PutBuilder
Creates or replaces an object using an AsyncRead payload.
Sourcepub fn put_file(&self, file: File) -> PutBuilder
pub fn put_file(&self, file: File) -> PutBuilder
Creates or replaces an object using the contents of an opened file.
The file descriptor is held open from the moment this method is called until the
upload completes. When enqueueing many files via Session::many, prefer
put_path instead: it defers opening the file until just before
upload, keeping file descriptor usage within the active concurrency window and avoiding
OS file descriptor limit (e.g., macOS’s default ulimit -n) exhaustion.
Sourcepub fn put_path(&self, path: impl Into<PathBuf>) -> PutBuilder
pub fn put_path(&self, path: impl Into<PathBuf>) -> PutBuilder
Creates or replaces an object using the contents of the file at path.
Unlike put_file, this method defers opening the file until the
request is actually sent. When enqueueing many file uploads via Session::many, this
ensures that file descriptors are opened only within the active concurrency window,
preventing the process from exhausting the OS file descriptor limit (e.g., macOS’s
default ulimit -n).
Prefer put_path over put_file whenever you are lining up a
large number of files for upload.