pub struct Database { /* private fields */ }Expand description
The main database object.
Implementations§
Source§impl Database
impl Database
Sourcepub fn open_with_config(config: EmbeddedConfig) -> Result<Self>
pub fn open_with_config(config: EmbeddedConfig) -> Result<Self>
構成付きでデータベースを開く(カラムナー機能を初期化)。
Sourcepub fn storage_mode(&self) -> StorageMode
pub fn storage_mode(&self) -> StorageMode
現在のカラムナーストレージモードを返す。
Sourcepub fn write_columnar_segment(
&self,
table: &str,
batch: RecordBatch,
) -> Result<u64>
pub fn write_columnar_segment( &self, table: &str, batch: RecordBatch, ) -> Result<u64>
カラムナーセグメントを書き込む。
Sourcepub fn read_columnar_segment(
&self,
table: &str,
segment_id: u64,
columns: Option<&[&str]>,
) -> Result<Vec<RecordBatch>>
pub fn read_columnar_segment( &self, table: &str, segment_id: u64, columns: Option<&[&str]>, ) -> Result<Vec<RecordBatch>>
カラムナーセグメントを読み取る(カラム名指定オプション付き)。
Sourcepub fn in_memory_usage(&self) -> Option<u64>
pub fn in_memory_usage(&self) -> Option<u64>
InMemory モード時のメモリ使用量を返す。Disk モードでは None。
Sourcepub fn open_in_memory_with_limit(limit: usize) -> Result<Self>
pub fn open_in_memory_with_limit(limit: usize) -> Result<Self>
メモリ上限付きでインメモリ DB を開く。
Sourcepub fn resolve_table_id(&self, table: &str) -> Result<u32>
pub fn resolve_table_id(&self, table: &str) -> Result<u32>
テーブル名から内部 ID を解決する。
Sourcepub fn flush_in_memory_segment_to_file(
&self,
table: &str,
segment_id: u64,
path: &Path,
) -> Result<()>
pub fn flush_in_memory_segment_to_file( &self, table: &str, segment_id: u64, path: &Path, ) -> Result<()>
InMemory モードのセグメントをファイルへフラッシュする。
Sourcepub fn flush_in_memory_segment_to_kvs(
&self,
table: &str,
segment_id: u64,
) -> Result<u64>
pub fn flush_in_memory_segment_to_kvs( &self, table: &str, segment_id: u64, ) -> Result<u64>
InMemory モードのセグメントを KVS へフラッシュする。
Sourcepub fn flush_in_memory_segment_to_alopex(
&self,
table: &str,
segment_id: u64,
writer: &mut AlopexFileWriter,
) -> Result<u32>
pub fn flush_in_memory_segment_to_alopex( &self, table: &str, segment_id: u64, writer: &mut AlopexFileWriter, ) -> Result<u32>
InMemory モードのセグメントを .alopex ファイルへフラッシュする。
Source§impl Database
impl Database
Sourcepub fn open_in_memory() -> Result<Self>
pub fn open_in_memory() -> Result<Self>
Opens a database in in-memory mode with default options.
Sourcepub fn open_in_memory_with_options(opts: DatabaseOptions) -> Result<Self>
pub fn open_in_memory_with_options(opts: DatabaseOptions) -> Result<Self>
Opens a database in in-memory mode with the given options.
Sourcepub fn flush(&self) -> Result<()>
pub fn flush(&self) -> Result<()>
Flushes the current in-memory data to an SSTable on disk (beta).
Sourcepub fn memory_usage(&self) -> Option<MemoryStats>
pub fn memory_usage(&self) -> Option<MemoryStats>
Returns current memory usage statistics (in-memory KV only).
Sourcepub fn persist_to_disk(&self, wal_path: &Path) -> Result<()>
pub fn persist_to_disk(&self, wal_path: &Path) -> Result<()>
Persists the current in-memory database to disk atomically.
wal_path は「データディレクトリ」として扱う(file-mode)。
Sourcepub fn clone_to_memory(&self) -> Result<Self>
pub fn clone_to_memory(&self) -> Result<Self>
Creates a fully in-memory clone of the current database.
Sourcepub fn set_memory_limit(&self, bytes: Option<usize>)
pub fn set_memory_limit(&self, bytes: Option<usize>)
Updates the memory limit in bytes for the underlying in-memory store.
Sourcepub fn snapshot(&self) -> Vec<(Key, Vec<u8>)>
pub fn snapshot(&self) -> Vec<(Key, Vec<u8>)>
Returns a read-only snapshot of all key-value pairs.
Sourcepub fn create_hnsw_index(&self, name: &str, config: HnswConfig) -> Result<()>
pub fn create_hnsw_index(&self, name: &str, config: HnswConfig) -> Result<()>
HNSW インデックスを作成し、永続化する。
Sourcepub fn drop_hnsw_index(&self, name: &str) -> Result<()>
pub fn drop_hnsw_index(&self, name: &str) -> Result<()>
HNSW インデックスを削除する。
Sourcepub fn get_hnsw_stats(&self, name: &str) -> Result<HnswStats>
pub fn get_hnsw_stats(&self, name: &str) -> Result<HnswStats>
HNSW 統計情報を取得する。
Sourcepub fn compact_hnsw_index(&self, name: &str) -> Result<CompactionResult>
pub fn compact_hnsw_index(&self, name: &str) -> Result<CompactionResult>
HNSW インデックスをコンパクションし、結果を返す。
Sourcepub fn search_hnsw(
&self,
name: &str,
query: &[f32],
k: usize,
ef_search: Option<usize>,
) -> Result<(Vec<HnswSearchResult>, HnswSearchStats)>
pub fn search_hnsw( &self, name: &str, query: &[f32], k: usize, ef_search: Option<usize>, ) -> Result<(Vec<HnswSearchResult>, HnswSearchStats)>
HNSW インデックスに検索を行う。
Sourcepub fn create_blob_writer(
&self,
path: &Path,
total_len: u64,
chunk_size: Option<u32>,
) -> Result<LargeValueWriter>
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).
Sourcepub fn create_typed_writer(
&self,
path: &Path,
type_id: u16,
total_len: u64,
chunk_size: Option<u32>,
) -> Result<LargeValueWriter>
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).
Sourcepub fn open_large_value(&self, path: &Path) -> Result<LargeValueReader>
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.
Sourcepub fn begin(&self, mode: TxnMode) -> Result<Transaction<'_>>
pub fn begin(&self, mode: TxnMode) -> Result<Transaction<'_>>
Begins a new transaction.