pub struct DataFoldNode {
pub config: NodeConfig,
/* 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
Fields§
§config: NodeConfigConfiguration settings for this node
Implementations§
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 async fn get_fold_db(&self) -> FoldDbResult<OwnedMutexGuard<FoldDB>>
pub async fn get_fold_db(&self) -> FoldDbResult<OwnedMutexGuard<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.
Sourcepub async fn mutate_batch(
&self,
mutations: Vec<Mutation>,
) -> FoldDbResult<Vec<String>>
pub async fn mutate_batch( &self, mutations: Vec<Mutation>, ) -> FoldDbResult<Vec<String>>
Execute a batch of mutations.
This is a convenience method that delegates to the underlying FoldDB. It is primarily used by tests and internal components that need direct access without going through the OperationProcessor.
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 async fn add_transform_to_queue(
&self,
transform_id: &str,
) -> FoldDbResult<()>
pub async fn add_transform_to_queue( &self, transform_id: &str, ) -> FoldDbResult<()>
Add a transform to the queue
Sourcepub async fn get_transform_queue_info(&self) -> FoldDbResult<TransformQueueInfo>
pub async fn get_transform_queue_info(&self) -> FoldDbResult<TransformQueueInfo>
Get information about the transform queue
Sourcepub async fn get_all_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
pub async fn get_all_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
Get all backfill information
Sourcepub async fn get_active_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
pub async fn get_active_backfills(&self) -> FoldDbResult<Vec<BackfillInfo>>
Get active backfills
Sourcepub async fn get_backfill(
&self,
transform_id: &str,
) -> FoldDbResult<Option<BackfillInfo>>
pub async fn get_backfill( &self, transform_id: &str, ) -> FoldDbResult<Option<BackfillInfo>>
Get specific backfill info by transform ID
Sourcepub async fn get_backfill_by_hash(
&self,
hash: &str,
) -> FoldDbResult<Option<BackfillInfo>>
pub async fn get_backfill_by_hash( &self, hash: &str, ) -> FoldDbResult<Option<BackfillInfo>>
Get specific backfill info by backfill hash
Sourcepub async fn get_event_statistics(&self) -> FoldDbResult<EventStatistics>
pub async 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