pub struct ColumnarEngine<S: StorageEngine> { /* private fields */ }Expand description
Manages all columnar collections for a NodeDbLite instance.
Implementations§
Source§impl<S: StorageEngine> ColumnarEngine<S>
impl<S: StorageEngine> ColumnarEngine<S>
Sourcepub async fn restore(storage: Arc<S>) -> Result<Self, LiteError>
pub async fn restore(storage: Arc<S>) -> Result<Self, LiteError>
Restore columnar collections from storage on startup.
Sourcepub async fn create_collection(
&mut self,
name: &str,
schema: ColumnarSchema,
profile: ColumnarProfile,
) -> Result<(), LiteError>
pub async fn create_collection( &mut self, name: &str, schema: ColumnarSchema, profile: ColumnarProfile, ) -> Result<(), LiteError>
Create a new columnar collection.
Sourcepub async fn drop_collection(&mut self, name: &str) -> Result<(), LiteError>
pub async fn drop_collection(&mut self, name: &str) -> Result<(), LiteError>
Drop a columnar collection and all its data.
Sourcepub async fn alter_add_column(
&mut self,
name: &str,
column: ColumnDef,
) -> Result<(), LiteError>
pub async fn alter_add_column( &mut self, name: &str, column: ColumnDef, ) -> Result<(), LiteError>
Add a column to an existing columnar collection.
Bumps the schema version. Existing segments are NOT rewritten — the reader null-fills columns that were added after the segment was written.
Sourcepub fn schema(&self, name: &str) -> Option<&ColumnarSchema>
pub fn schema(&self, name: &str) -> Option<&ColumnarSchema>
Get the schema for a collection.
Sourcepub fn profile(&self, name: &str) -> Option<&ColumnarProfile>
pub fn profile(&self, name: &str) -> Option<&ColumnarProfile>
Get the profile for a collection.
Sourcepub fn collection_names(&self) -> Vec<&str>
pub fn collection_names(&self) -> Vec<&str>
List all columnar collection names.
Sourcepub fn insert(
&mut self,
collection: &str,
values: &[Value],
) -> Result<(), LiteError>
pub fn insert( &mut self, collection: &str, values: &[Value], ) -> Result<(), LiteError>
Insert a row into a columnar collection’s memtable.
Sourcepub fn delete(
&mut self,
collection: &str,
pk: &Value,
) -> Result<bool, LiteError>
pub fn delete( &mut self, collection: &str, pk: &Value, ) -> Result<bool, LiteError>
Delete a row by PK.
Rejects deletion on timeseries collections (append-only constraint).
Marks the row in the segment’s delete bitmap. Compaction is triggered
separately via try_compact_collection when the delete ratio exceeds 20%.
Sourcepub fn update(
&mut self,
collection: &str,
old_pk: &Value,
new_values: &[Value],
) -> Result<bool, LiteError>
pub fn update( &mut self, collection: &str, old_pk: &Value, new_values: &[Value], ) -> Result<bool, LiteError>
Update a row: DELETE old + INSERT new.
Rejects update on timeseries collections (append-only constraint).
Sourcepub async fn flush_collection(
&mut self,
collection: &str,
) -> Result<(), LiteError>
pub async fn flush_collection( &mut self, collection: &str, ) -> Result<(), LiteError>
Flush the memtable for a collection to a new segment.
Called when the memtable reaches its threshold or on shutdown.
Sourcepub async fn try_compact_collection(
&mut self,
collection: &str,
) -> Result<bool, LiteError>
pub async fn try_compact_collection( &mut self, collection: &str, ) -> Result<bool, LiteError>
Check if any segments need compaction and run it.
Compaction is triggered when a segment’s delete ratio exceeds 20%. The old segment is replaced with a compacted one (deleted rows removed).
Sourcepub async fn read_segments(
&self,
collection: &str,
) -> Result<Vec<(u32, Vec<u8>)>, LiteError>
pub async fn read_segments( &self, collection: &str, ) -> Result<Vec<(u32, Vec<u8>)>, LiteError>
Read all segment bytes for a collection (for the table provider).
Sourcepub fn delete_bitmap(
&self,
collection: &str,
segment_id: u32,
) -> Option<&DeleteBitmap>
pub fn delete_bitmap( &self, collection: &str, segment_id: u32, ) -> Option<&DeleteBitmap>
Get the delete bitmap for a segment.
Auto Trait Implementations§
impl<S> Freeze for ColumnarEngine<S>
impl<S> RefUnwindSafe for ColumnarEngine<S>where
Arc<S>: RefUnwindSafe,
impl<S> Send for ColumnarEngine<S>
impl<S> Sync for ColumnarEngine<S>
impl<S> Unpin for ColumnarEngine<S>
impl<S> UnsafeUnpin for ColumnarEngine<S>where
Arc<S>: UnsafeUnpin,
impl<S> UnwindSafe for ColumnarEngine<S>where
Arc<S>: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§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);