pub struct DataFoldNode { /* private fields */ }Expand description
A node in the DataFold distributed database system.
DataFoldNode combines database storage, schema management, and networking capabilities into a complete node implementation. It can operate independently or as part of a network of nodes, with trust relationships defining data access.
§Features
- Schema loading and management
- Query and mutation execution
- Network communication with other nodes
- Permission management for schemas
- Request forwarding to trusted nodes
Implementations§
Source§impl DataFoldNode
impl DataFoldNode
Sourcepub async fn query(
&self,
query: Query,
) -> FoldDbResult<HashMap<String, HashMap<KeyValue, FieldValue>>>
pub async fn query( &self, query: Query, ) -> FoldDbResult<HashMap<String, HashMap<KeyValue, FieldValue>>>
Executes a query against the database.
Sourcepub fn mutate(&self, mutation: Mutation) -> FoldDbResult<String>
👎Deprecated since 0.1.0: Use mutate_batch() instead for better performance
pub fn mutate(&self, mutation: Mutation) -> FoldDbResult<String>
Executes a mutation on the database.
§Deprecated
Use mutate_batch() instead for better performance, even for single mutations.
Sourcepub fn mutate_batch(
&self,
mutations: Vec<Mutation>,
) -> FoldDbResult<Vec<String>>
pub fn mutate_batch( &self, mutations: Vec<Mutation>, ) -> FoldDbResult<Vec<String>>
Executes multiple mutations in a batch for improved performance.
Sourcepub async fn mutate_batch_async(
&self,
mutations: Vec<Mutation>,
) -> FoldDbResult<Vec<String>>
pub async fn mutate_batch_async( &self, mutations: Vec<Mutation>, ) -> FoldDbResult<Vec<String>>
Executes multiple mutations in a batch (async version - preferred for DynamoDB)
Sourcepub fn list_transforms(&self) -> FoldDbResult<HashMap<String, Transform>>
pub fn list_transforms(&self) -> FoldDbResult<HashMap<String, Transform>>
List all registered transforms.
Source§impl DataFoldNode
impl DataFoldNode
Sourcepub async fn new(config: NodeConfig) -> FoldDbResult<Self>
pub async fn new(config: NodeConfig) -> FoldDbResult<Self>
Creates a new DataFoldNode with the specified configuration.
Now fully async to support storage abstraction!
Sourcepub async fn new_with_db(
config: NodeConfig,
db: Arc<Mutex<FoldDB>>,
) -> FoldDbResult<Self>
pub async fn new_with_db( config: NodeConfig, db: Arc<Mutex<FoldDB>>, ) -> FoldDbResult<Self>
Creates a new DataFoldNode with a pre-created FoldDB instance.
This is useful when you need to control the storage backend (e.g., S3) before creating the node.
§Arguments
config- Node configurationdb- Pre-created FoldDB instance
Sourcepub fn get_fold_db(&self) -> FoldDbResult<MutexGuard<'_, FoldDB>>
pub fn get_fold_db(&self) -> FoldDbResult<MutexGuard<'_, FoldDB>>
Get a reference to the underlying FoldDB instance
Sourcepub fn get_node_id(&self) -> &str
pub fn get_node_id(&self) -> &str
Gets the unique identifier for this node.
Sourcepub fn schema_service_url(&self) -> Option<String>
pub fn schema_service_url(&self) -> Option<String>
Gets the configured schema service URL, if present.
Sourcepub async fn fetch_available_schemas(&self) -> FoldDbResult<Vec<Schema>>
pub async fn fetch_available_schemas(&self) -> FoldDbResult<Vec<Schema>>
Fetch available schemas from the schema service. Returns an error if the schema service URL is not configured or if the fetch fails.
Sourcepub async fn add_schema_to_service(
&self,
schema: &Schema,
) -> FoldDbResult<Schema>
pub async fn add_schema_to_service( &self, schema: &Schema, ) -> FoldDbResult<Schema>
Add a new schema to the schema service. Returns an error if the schema service URL is not configured or if the operation fails.
Source§impl DataFoldNode
impl DataFoldNode
Sourcepub fn get_node_private_key(&self) -> &str
pub fn get_node_private_key(&self) -> &str
Gets the node’s private key.
Sourcepub fn get_node_public_key(&self) -> &str
pub fn get_node_public_key(&self) -> &str
Gets the node’s public key.
Sourcepub fn get_security_manager(&self) -> &Arc<SecurityManager>
pub fn get_security_manager(&self) -> &Arc<SecurityManager>
Gets a reference to the security manager.
Sourcepub fn get_schema_client(&self) -> SchemaServiceClient
pub fn get_schema_client(&self) -> SchemaServiceClient
Get a schema service client for communicating with the schema service
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
Source§impl DataFoldNode
impl DataFoldNode
Sourcepub fn add_transform_to_queue(&self, transform_id: &str) -> FoldDbResult<()>
pub fn add_transform_to_queue(&self, transform_id: &str) -> FoldDbResult<()>
Add a transform to the queue
Sourcepub fn get_transform_queue_info(&self) -> FoldDbResult<TransformQueueInfo>
pub fn get_transform_queue_info(&self) -> FoldDbResult<TransformQueueInfo>
Get information about the transform queue
Sourcepub fn get_all_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
pub fn get_all_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
Get all backfill information
Sourcepub fn get_active_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
pub fn get_active_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
Get active backfills
Sourcepub fn get_backfill(
&self,
transform_id: &str,
) -> FoldDbResult<Option<BackfillInfo>>
pub fn get_backfill( &self, transform_id: &str, ) -> FoldDbResult<Option<BackfillInfo>>
Get specific backfill info by transform ID
Sourcepub fn get_backfill_by_hash(
&self,
hash: &str,
) -> FoldDbResult<Option<BackfillInfo>>
pub fn get_backfill_by_hash( &self, hash: &str, ) -> FoldDbResult<Option<BackfillInfo>>
Get specific backfill info by backfill hash
Sourcepub fn get_event_statistics(&self) -> FoldDbResult<EventStatistics>
pub fn get_event_statistics(&self) -> FoldDbResult<EventStatistics>
Get event statistics
Trait Implementations§
Source§impl Clone for DataFoldNode
impl Clone for DataFoldNode
Source§fn clone(&self) -> DataFoldNode
fn clone(&self) -> DataFoldNode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DataFoldNode
impl !RefUnwindSafe for DataFoldNode
impl Send for DataFoldNode
impl Sync for DataFoldNode
impl Unpin for DataFoldNode
impl !UnwindSafe for DataFoldNode
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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