Struct ObjectWriterBuilder

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

A builder for an AsyncWrite that writes to an object store location.

This can be used to specify file compression on the writer. The writer will have a default buffer size unless altered. The specific default size is chosen by BufWriter::new.

We drop the AbortableWrite struct and the writer will not try to cleanup on failure. Users can configure automatic cleanup with their cloud provider.

Implementations§

Source§

impl ObjectWriterBuilder

Source

pub fn new( file_compression_type: FileCompressionType, location: &Path, object_store: Arc<dyn ObjectStore>, ) -> Self

Create a new ObjectWriterBuilder for the specified path and compression type.

Source

pub fn set_buffer_size(&mut self, buffer_size: Option<usize>)

Set buffer size in bytes for object writer.

§Example
let mut builder = ObjectWriterBuilder::new(compression_type, &location, object_store);
builder.set_buffer_size(Some(20 * 1024 * 1024)); //20 MiB
assert_eq!(builder.get_buffer_size(), Some(20 * 1024 * 1024), "Internal error: Builder buffer size doesn't match");
Source

pub fn with_buffer_size(self, buffer_size: Option<usize>) -> Self

Set buffer size in bytes for object writer, returning the builder.

§Example
let builder = ObjectWriterBuilder::new(compression_type, &location, object_store)
    .with_buffer_size(Some(20 * 1024 * 1024)); //20 MiB
assert_eq!(builder.get_buffer_size(), Some(20 * 1024 * 1024), "Internal error: Builder buffer size doesn't match");
Source

pub fn get_buffer_size(&self) -> Option<usize>

Currently specified buffer size in bytes.

Source

pub fn build(self) -> Result<Box<dyn AsyncWrite + Send + Unpin>>

Return a writer object that writes to the object store location.

If a buffer size has not been set, the default buffer buffer size will be used.

§Errors

If there is an error applying the compression type.

Trait Implementations§

Source§

impl Debug for ObjectWriterBuilder

Source§

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

Formats the value using the given formatter. Read more

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, 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<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> ErasedDestructor for T
where T: 'static,