pub struct ObjectWriterBuilder {
file_compression_type: FileCompressionType,
location: Path,
object_store: Arc<dyn ObjectStore>,
buffer_size: Option<usize>,
}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.
Fields§
§file_compression_type: FileCompressionTypeCompression type for object writer.
location: PathOutput path
object_store: Arc<dyn ObjectStore>The related store that handles the given path
buffer_size: Option<usize>The size of the buffer for the object writer.
Implementations§
Source§impl ObjectWriterBuilder
impl ObjectWriterBuilder
Sourcepub fn new(
file_compression_type: FileCompressionType,
location: &Path,
object_store: Arc<dyn ObjectStore>,
) -> Self
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.
Sourcepub fn set_buffer_size(&mut self, buffer_size: Option<usize>)
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"
);Sourcepub fn with_buffer_size(self, buffer_size: Option<usize>) -> Self
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"
);Sourcepub fn get_buffer_size(&self) -> Option<usize>
pub fn get_buffer_size(&self) -> Option<usize>
Currently specified buffer size in bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObjectWriterBuilder
impl !RefUnwindSafe for ObjectWriterBuilder
impl Send for ObjectWriterBuilder
impl Sync for ObjectWriterBuilder
impl Unpin for ObjectWriterBuilder
impl !UnwindSafe for ObjectWriterBuilder
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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