#[non_exhaustive]pub struct UploadOptions {
pub stream_above: u64,
pub part_size: usize,
pub concurrency: usize,
pub fallback_max: u64,
pub spill_dir: Option<PathBuf>,
}Expand description
How a handle writes segments and their sidecars, set with
Namespace::with_upload_options.
An object over stream_above goes up in parts of part_size,
concurrency at a time, to a staging key, then is copied to its key with
put-if-absent. That copy needs a store that supports
CopyMode::Create: InMemory, LocalFileSystem, itzma’s GCS, Azure
and AWS adapters, and object_store’s S3 client only when built with
S3CopyIfNotExists::Multipart. On a store that answers NotSupported
an object up to fallback_max is written with one PUT instead, and a
larger one fails with the store’s error. The handle remembers a
NotSupported and stages nothing after it. itzma’s Azure adapter copies
by reading the staging object back and writing it in one request, so on
Azure a streamed segment is held whole while it is copied.
A merge whose output is expected over stream_above writes its sections
to files under spill_dir (default: itzma-<pid> in the system temp
directory) as they fill, so it holds about a part per section in memory;
the files are deleted when the merge is done or fails.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.stream_above: u64Objects larger than this many bytes are streamed. Default 64 MiB.
part_size: usizeBytes per uploaded part. Default 8 MiB; S3 needs at least 5 MiB.
concurrency: usizeParts in flight at once. Default 4.
fallback_max: u64The largest object written with one PUT when the store cannot copy with put-if-absent. Default 256 MiB.
spill_dir: Option<PathBuf>Where a merge’s spill files go. Default None: a itzma-<pid>
directory under the system temp directory.
Implementations§
Source§impl UploadOptions
impl UploadOptions
Sourcepub fn stream_above(self, bytes: u64) -> Self
pub fn stream_above(self, bytes: u64) -> Self
Set stream_above.
Sourcepub fn concurrency(self, parts: usize) -> Self
pub fn concurrency(self, parts: usize) -> Self
Set concurrency.
Sourcepub fn fallback_max(self, bytes: u64) -> Self
pub fn fallback_max(self, bytes: u64) -> Self
Set fallback_max.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Check the settings.
§Errors
ItzmaError::InvalidConfig for a part_size under
MIN_PART_SIZE (S3 refuses a multipart upload with a smaller part
but the last, and only at completion, after every part was sent) or
a concurrency of zero.
Trait Implementations§
Source§impl Clone for UploadOptions
impl Clone for UploadOptions
Source§impl Debug for UploadOptions
impl Debug for UploadOptions
Source§impl Default for UploadOptions
impl Default for UploadOptions
Source§impl<'de> Deserialize<'de> for UploadOptionswhere
UploadOptions: Default,
impl<'de> Deserialize<'de> for UploadOptionswhere
UploadOptions: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for UploadOptions
Source§impl PartialEq for UploadOptions
impl PartialEq for UploadOptions
Source§impl Serialize for UploadOptions
impl Serialize for UploadOptions
impl StructuralPartialEq for UploadOptions
Auto Trait Implementations§
impl Forget for UploadOptions
impl Freeze for UploadOptions
impl Move for UploadOptions
impl RefUnwindSafe for UploadOptions
impl Send for UploadOptionswhere
RawVecInner: Send,
impl Sync for UploadOptionswhere
RawVecInner: Sync,
impl Unpin for UploadOptions
impl UnsafeUnpin for UploadOptions
impl UnwindSafe for UploadOptionswhere
RawVecInner: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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