Database

Struct Database 

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

The main database object.

Implementations§

Source§

impl Database

Source

pub fn open_with_config(config: EmbeddedConfig) -> Result<Self>

構成付きでデータベースを開く(カラムナー機能を初期化)。

Source

pub fn storage_mode(&self) -> StorageMode

現在のカラムナーストレージモードを返す。

Source

pub fn write_columnar_segment( &self, table: &str, batch: RecordBatch, ) -> Result<u64>

カラムナーセグメントを書き込む。

Source

pub fn read_columnar_segment( &self, table: &str, segment_id: u64, columns: Option<&[&str]>, ) -> Result<Vec<RecordBatch>>

カラムナーセグメントを読み取る(カラム名指定オプション付き)。

Source

pub fn in_memory_usage(&self) -> Option<u64>

InMemory モード時のメモリ使用量を返す。Disk モードでは None。

Source

pub fn open_in_memory_with_limit(limit: usize) -> Result<Self>

メモリ上限付きでインメモリ DB を開く。

Source

pub fn resolve_table_id(&self, table: &str) -> Result<u32>

テーブル名から内部 ID を解決する。

Source

pub fn flush_in_memory_segment_to_file( &self, table: &str, segment_id: u64, path: &Path, ) -> Result<()>

InMemory モードのセグメントをファイルへフラッシュする。

Source

pub fn flush_in_memory_segment_to_kvs( &self, table: &str, segment_id: u64, ) -> Result<u64>

InMemory モードのセグメントを KVS へフラッシュする。

Source

pub fn flush_in_memory_segment_to_alopex( &self, table: &str, segment_id: u64, writer: &mut AlopexFileWriter, ) -> Result<u32>

InMemory モードのセグメントを .alopex ファイルへフラッシュする。

Source§

impl Database

Source

pub fn open(path: &Path) -> Result<Self>

Opens a database at the specified path.

Source

pub fn new() -> Self

Creates a new, purely in-memory (transient) database.

Source

pub fn open_in_memory() -> Result<Self>

Opens a database in in-memory mode with default options.

Source

pub fn open_in_memory_with_options(opts: DatabaseOptions) -> Result<Self>

Opens a database in in-memory mode with the given options.

Source

pub fn flush(&self) -> Result<()>

Flushes the current in-memory data to an SSTable on disk (beta).

Source

pub fn memory_usage(&self) -> Option<MemoryStats>

Returns current memory usage statistics (in-memory KV only).

Source

pub fn persist_to_disk(&self, wal_path: &Path) -> Result<()>

Persists the current in-memory database to disk atomically.

wal_path は「データディレクトリ」として扱う(file-mode)。

Source

pub fn clone_to_memory(&self) -> Result<Self>

Creates a fully in-memory clone of the current database.

Source

pub fn clear(&self) -> Result<()>

Clears all data while keeping the database usable.

Source

pub fn set_memory_limit(&self, bytes: Option<usize>)

Updates the memory limit in bytes for the underlying in-memory store.

Source

pub fn snapshot(&self) -> Vec<(Key, Vec<u8>)>

Returns a read-only snapshot of all key-value pairs.

Source

pub fn create_hnsw_index(&self, name: &str, config: HnswConfig) -> Result<()>

HNSW インデックスを作成し、永続化する。

Source

pub fn drop_hnsw_index(&self, name: &str) -> Result<()>

HNSW インデックスを削除する。

Source

pub fn get_hnsw_stats(&self, name: &str) -> Result<HnswStats>

HNSW 統計情報を取得する。

Source

pub fn compact_hnsw_index(&self, name: &str) -> Result<CompactionResult>

HNSW インデックスをコンパクションし、結果を返す。

Source

pub fn search_hnsw( &self, name: &str, query: &[f32], k: usize, ef_search: Option<usize>, ) -> Result<(Vec<HnswSearchResult>, HnswSearchStats)>

HNSW インデックスに検索を行う。

Source

pub fn create_blob_writer( &self, path: &Path, total_len: u64, chunk_size: Option<u32>, ) -> Result<LargeValueWriter>

Creates a chunked large value writer for opaque blobs (beta).

Source

pub fn create_typed_writer( &self, path: &Path, type_id: u16, total_len: u64, chunk_size: Option<u32>, ) -> Result<LargeValueWriter>

Creates a chunked large value writer for typed payloads (beta).

Source

pub fn open_large_value(&self, path: &Path) -> Result<LargeValueReader>

Opens a chunked large value reader (beta). Kind/type is read from the file header.

Source

pub fn begin(&self, mode: TxnMode) -> Result<Transaction<'_>>

Begins a new transaction.

Trait Implementations§

Source§

impl Default for Database

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more