pub struct DbBuilder<P>{ /* private fields */ }Expand description
A builder for creating a new Db instance.
This builder provides a fluent API for configuring and opening a SlateDB database. It separates the concerns of configuration options (settings) and components.
Implementations§
Source§impl<P> DbBuilder<P>
impl<P> DbBuilder<P>
Sourcepub fn new(path: P, main_object_store: Arc<dyn ObjectStore>) -> DbBuilder<P>
pub fn new(path: P, main_object_store: Arc<dyn ObjectStore>) -> DbBuilder<P>
Creates a new builder for a database at the given path.
Sourcepub fn with_settings(self, settings: Settings) -> DbBuilder<P>
pub fn with_settings(self, settings: Settings) -> DbBuilder<P>
Sets the database settings.
Sourcepub fn with_wal_object_store(
self,
wal_object_store: Arc<dyn ObjectStore>,
) -> DbBuilder<P>
pub fn with_wal_object_store( self, wal_object_store: Arc<dyn ObjectStore>, ) -> DbBuilder<P>
Sets the separate object store dedicated specifically for WAL.
NOTE: WAL durability and availability properties depend on the properties of the underlying object store. Make sure the configured object store is durable and available enough for your use case.
Sourcepub fn with_db_cache(self, db_cache: Arc<dyn DbCache>) -> DbBuilder<P>
pub fn with_db_cache(self, db_cache: Arc<dyn DbCache>) -> DbBuilder<P>
Sets the cache to use for the database for caching sst blocks
SlateDB uses a cache to efficiently store and retrieve blocks and SST metadata locally.
[slatedb::db_cache::SplitCache] is used by default.
Sourcepub fn with_db_cache_disabled(self) -> DbBuilder<P>
pub fn with_db_cache_disabled(self) -> DbBuilder<P>
Disables the sst block/metadata cache
Sourcepub fn with_system_clock(self, clock: Arc<dyn SystemClock>) -> DbBuilder<P>
pub fn with_system_clock(self, clock: Arc<dyn SystemClock>) -> DbBuilder<P>
Sets the system clock to use for the database. System timestamps are used for scheduling operations such as compaction and garbage collection.
Sourcepub fn with_gc_runtime(self, gc_runtime: Handle) -> DbBuilder<P>
pub fn with_gc_runtime(self, gc_runtime: Handle) -> DbBuilder<P>
Sets the garbage collection runtime to use for the database.
Sourcepub fn with_compactor_builder(
self,
compactor_builder: CompactorBuilder<P>,
) -> DbBuilder<P>
pub fn with_compactor_builder( self, compactor_builder: CompactorBuilder<P>, ) -> DbBuilder<P>
Sets a custom CompactorBuilder for compaction orchestration.
Setting a CompactorBuilder will ignore any previous
Settings::compactor_options configuration passed in through
DbBuilder::with_settings since the CompactorBuilder provides its own
configuration.
Sourcepub fn with_gc_builder(
self,
gc_builder: GarbageCollectorBuilder<P>,
) -> DbBuilder<P>
pub fn with_gc_builder( self, gc_builder: GarbageCollectorBuilder<P>, ) -> DbBuilder<P>
Sets a custom GarbageCollectorBuilder for garbage collection.
Setting a GarbageCollectorBuilder will ignore any previous
Settings::garbage_collector_options configuration passed in through
DbBuilder::with_settings since the GarbageCollectorBuilder provides
its own configuration.
Sourcepub fn with_metrics_recorder(
self,
recorder: Arc<dyn MetricsRecorder>,
) -> DbBuilder<P>
pub fn with_metrics_recorder( self, recorder: Arc<dyn MetricsRecorder>, ) -> DbBuilder<P>
Sets the metrics recorder to use for the database.
Sourcepub fn with_fp_registry(
self,
fp_registry: Arc<FailPointRegistry>,
) -> DbBuilder<P>
pub fn with_fp_registry( self, fp_registry: Arc<FailPointRegistry>, ) -> DbBuilder<P>
Sets the fail point registry to use for the database.
Sourcepub fn with_seed(self, seed: u64) -> DbBuilder<P>
pub fn with_seed(self, seed: u64) -> DbBuilder<P>
Sets the seed to use for the database’s random number generator. All random behavior in SlateDB will use randomm number generators based off of this seed. This includes random bytes for UUIDs and ULIDS, as well as random pickers in cache eviction policies.
If not set, SlateDB uses the OS’s random number generator to generate a seed.
Sourcepub fn with_sst_block_size(self, block_size: SstBlockSize) -> DbBuilder<P>
pub fn with_sst_block_size(self, block_size: SstBlockSize) -> DbBuilder<P>
Sets the block size for SSTable blocks. Blocks are the unit of reading and caching in SlateDB. Smaller blocks can reduce read amplification but may increase metadata overhead. Larger blocks are more efficient for sequential scans but may waste bandwidth for point lookups.
Note: When compression is enabled, blocks are compressed individually. Larger blocks typically achieve better compression ratios.
§Arguments
block_size- The block size variant to use (1KB, 2KB, 4KB, 8KB, 16KB, 32KB, or 64KB).
§Returns
The builder instance for chaining.
Sourcepub fn with_merge_operator(
self,
merge_operator: Arc<dyn MergeOperator + Send + Sync>,
) -> DbBuilder<P>
pub fn with_merge_operator( self, merge_operator: Arc<dyn MergeOperator + Send + Sync>, ) -> DbBuilder<P>
Sets the merge operator to use for the database. The merge operator allows applications to bypass the traditional read/modify/write cycle by expressing partial updates using an associative operator.
§Arguments
merge_operator- An Arc-wrapped merge operator implementation.
§Returns
The builder instance for chaining.
Sourcepub fn with_block_transformer(
self,
block_transformer: Arc<dyn BlockTransformer>,
) -> DbBuilder<P>
pub fn with_block_transformer( self, block_transformer: Arc<dyn BlockTransformer>, ) -> DbBuilder<P>
Sets the block transformer to use for the database. The block transformer allows custom encoding/decoding of block data before storage and after retrieval. This can be used for encryption or other transformations.
The transformer is applied after compression on write and before decompression on read. The checksum is calculated on the transformed data.
§Arguments
block_transformer- An Arc-wrapped block transformer implementation.
§Returns
The builder instance for chaining.
Auto Trait Implementations§
impl<P> Freeze for DbBuilder<P>where
P: Freeze,
impl<P> !RefUnwindSafe for DbBuilder<P>
impl<P> Send for DbBuilder<P>where
P: Send,
impl<P> Sync for DbBuilder<P>where
P: Sync,
impl<P> Unpin for DbBuilder<P>where
P: Unpin,
impl<P> UnsafeUnpin for DbBuilder<P>where
P: UnsafeUnpin,
impl<P> !UnwindSafe for DbBuilder<P>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);