pub struct FoldDB { /* private fields */ }Expand description
The main database coordinator that manages schemas, permissions, and data storage.
Implementations§
Source§impl FoldDB
impl FoldDB
Sourcepub async fn get_node_id(&self) -> Result<String, StorageError>
pub async fn get_node_id(&self) -> Result<String, StorageError>
Retrieves or generates and persists the node identifier.
Sourcepub fn get_schema_permissions(&self, node_id: &str) -> Vec<String>
pub fn get_schema_permissions(&self, node_id: &str) -> Vec<String>
Retrieves the list of permitted schemas for the given node.
Sourcepub fn set_schema_permissions(
&self,
node_id: &str,
schemas: &[String],
) -> Result<()>
pub fn set_schema_permissions( &self, node_id: &str, schemas: &[String], ) -> Result<()>
Sets the permitted schemas for the given node.
Sourcepub fn close(&self) -> Result<(), Error>
pub fn close(&self) -> Result<(), Error>
Properly close and flush the database to release all file locks
Sourcepub async fn new(path: &str) -> Result<Self, StorageError>
pub async fn new(path: &str) -> Result<Self, StorageError>
Creates a new FoldDB instance with the specified storage path. All initializations happen here. This is the main entry point for the FoldDB system. Do not initialize anywhere else.
Now fully async to support DbOperationsV2 with storage abstraction!
Sourcepub async fn new_with_s3(config: S3Config) -> Result<Self, StorageError>
pub async fn new_with_s3(config: S3Config) -> Result<Self, StorageError>
Creates a new FoldDB instance with S3-backed storage. The database is downloaded from S3 on initialization and can be synced back with flush_to_s3().
Sourcepub async fn new_with_db_ops(
db_ops: Arc<DbOperationsV2>,
db_path: &str,
) -> Result<Self, StorageError>
pub async fn new_with_db_ops( db_ops: Arc<DbOperationsV2>, db_path: &str, ) -> Result<Self, StorageError>
Creates a new FoldDB instance with a pre-created DbOperationsV2.
This allows you to use any storage backend implementation (DynamoDB, custom, etc.) by creating DbOperationsV2 yourself and passing it in.
§Arguments
db_ops- Pre-created DbOperationsV2 instance with your chosen storage backenddb_path- Path identifier for logging/debugging (can be any string)
Sourcepub async fn flush_to_s3(&self) -> Result<(), StorageError>
pub async fn flush_to_s3(&self) -> Result<(), StorageError>
Flushes local Sled database and syncs to S3 (if S3 storage is configured)
Sourcepub fn has_s3_storage(&self) -> bool
pub fn has_s3_storage(&self) -> bool
Returns true if this FoldDB instance is configured with S3 storage
Sourcepub async fn get_indexing_status(&self) -> IndexingStatus
pub async fn get_indexing_status(&self) -> IndexingStatus
Get the current indexing status
Sourcepub async fn is_indexing(&self) -> bool
pub async fn is_indexing(&self) -> bool
Check if indexing is currently in progress
Sourcepub async fn load_schema_from_json(
&mut self,
json_str: &str,
) -> Result<(), SchemaError>
pub async fn load_schema_from_json( &mut self, json_str: &str, ) -> Result<(), SchemaError>
Load schema from JSON string (creates Available schema)
Sourcepub async fn load_schema_from_file<P: AsRef<Path>>(
&mut self,
path: P,
) -> Result<(), SchemaError>
pub async fn load_schema_from_file<P: AsRef<Path>>( &mut self, path: P, ) -> Result<(), SchemaError>
Load schema from file (creates Available schema)
Sourcepub fn get_db_ops(&self) -> Arc<DbOperationsV2>
pub fn get_db_ops(&self) -> Arc<DbOperationsV2>
Provides access to the underlying database operations
Sourcepub fn get_event_statistics(&self) -> EventStatistics
pub fn get_event_statistics(&self) -> EventStatistics
Get current event statistics from the event monitor
Sourcepub fn get_backfill_tracker(&self) -> Arc<BackfillTracker>
pub fn get_backfill_tracker(&self) -> Arc<BackfillTracker>
Get the backfill tracker
Sourcepub fn get_all_backfills(&self) -> Vec<BackfillInfo>
pub fn get_all_backfills(&self) -> Vec<BackfillInfo>
Get all backfill information
Sourcepub fn get_active_backfills(&self) -> Vec<BackfillInfo>
pub fn get_active_backfills(&self) -> Vec<BackfillInfo>
Get active (in-progress) backfills
Sourcepub fn get_backfill(&self, transform_id: &str) -> Option<BackfillInfo>
pub fn get_backfill(&self, transform_id: &str) -> Option<BackfillInfo>
Get specific backfill info
Sourcepub fn message_bus(&self) -> Arc<MessageBus>
pub fn message_bus(&self) -> Arc<MessageBus>
Get the message bus for publishing events (for testing)
Sourcepub fn transform_manager(&self) -> Arc<TransformManager>
pub fn transform_manager(&self) -> Arc<TransformManager>
Get the transform manager for testing transform functionality
Sourcepub fn schema_manager(&self) -> Arc<SchemaCore>
pub fn schema_manager(&self) -> Arc<SchemaCore>
Get the schema manager for testing schema functionality
Sourcepub fn native_word_search(
&self,
term: &str,
) -> Result<Vec<IndexResult>, SchemaError>
pub fn native_word_search( &self, term: &str, ) -> Result<Vec<IndexResult>, SchemaError>
Search the native word index for a specific term
Sourcepub async fn native_search_all_classifications(
&self,
term: &str,
) -> Result<Vec<IndexResult>, SchemaError>
pub async fn native_search_all_classifications( &self, term: &str, ) -> Result<Vec<IndexResult>, SchemaError>
Search native index across all classification types and aggregate results This now includes field name matches via search_word
Sourcepub fn transform_orchestrator(&self) -> Option<Arc<TransformOrchestrator>>
pub fn transform_orchestrator(&self) -> Option<Arc<TransformOrchestrator>>
Get the transform orchestrator for managing transform execution Returns None if orchestrator is not available (e.g., with DynamoDB backend)
Auto Trait Implementations§
impl Freeze for FoldDB
impl !RefUnwindSafe for FoldDB
impl Send for FoldDB
impl Sync for FoldDB
impl Unpin for FoldDB
impl !UnwindSafe for FoldDB
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 more