pub struct BatchWriter { /* private fields */ }Expand description
Convenience writer using the canonical configured mutation executor.
ParallelConfig changes scheduling only. Chunk boundaries, serialized
nodes, and roots are invariant across worker widths.
use prolly::{BatchWriter, ParallelConfig};
let writer = BatchWriter::with_config(ParallelConfig::new(4, 256));
assert_eq!(writer.config().max_threads, 4);Implementations§
Source§impl BatchWriter
impl BatchWriter
Sourcepub fn with_config(config: ParallelConfig) -> Self
pub fn with_config(config: ParallelConfig) -> Self
Create a writer with explicit canonical scheduling preferences.
use prolly::{BatchWriter, ParallelConfig};
let writer = BatchWriter::with_config(ParallelConfig::new(8, 512));
assert_eq!(writer.config().parallelism_threshold, 512);Sourcepub fn config(&self) -> &ParallelConfig
pub fn config(&self) -> &ParallelConfig
Return the writer’s scheduling policy.
use prolly::BatchWriter;
let writer = BatchWriter::new();
assert_eq!(writer.config().parallelism_threshold, 100);Sourcepub fn apply_batch<S: Store>(
&self,
prolly: &Prolly<S>,
tree: &Tree,
mutations: Vec<Mutation>,
) -> Result<Tree, Error>
pub fn apply_batch<S: Store>( &self, prolly: &Prolly<S>, tree: &Tree, mutations: Vec<Mutation>, ) -> Result<Tree, Error>
Apply mutations through the canonical writer using this scheduling policy.
§Arguments
prolly- Reference to the Prolly tree managertree- The tree to modifymutations- Vector of mutations to apply
§Returns
Ok(Tree)- New tree with all mutations appliedErr(Error)- On storage or processing errors
§Example
use prolly::{BatchWriter, Prolly, MemStore, Config, Mutation};
let store = MemStore::new();
let prolly = Prolly::new(store, Config::default());
let tree = prolly.create();
let writer = BatchWriter::new();
let mutations = vec![
Mutation::Upsert { key: b"key".to_vec(), val: b"value".to_vec() },
];
let new_tree = writer.apply_batch(&prolly, &tree, mutations).unwrap();Sourcepub fn apply_batch_with_stats<S: Store>(
&self,
prolly: &Prolly<S>,
tree: &Tree,
mutations: Vec<Mutation>,
) -> Result<BatchApplyResult, Error>
pub fn apply_batch_with_stats<S: Store>( &self, prolly: &Prolly<S>, tree: &Tree, mutations: Vec<Mutation>, ) -> Result<BatchApplyResult, Error>
Apply batch mutations and return store-neutral execution stats.
This is useful for tuning workload shape across storage backends. The returned stats report tree-level work such as affected leaves and unique prolly nodes/bytes written, independent of backend compaction or object layout.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BatchWriter
impl RefUnwindSafe for BatchWriter
impl Send for BatchWriter
impl Sync for BatchWriter
impl Unpin for BatchWriter
impl UnsafeUnpin for BatchWriter
impl UnwindSafe for BatchWriter
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
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>
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 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>
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