pub struct NodeStore<B: DataSyncBackend> { /* private fields */ }Expand description
Node storage manager
Implementations§
Source§impl<B: DataSyncBackend> NodeStore<B>
impl<B: DataSyncBackend> NodeStore<B>
Sourcepub async fn new(backend: Arc<B>) -> Result<Self>
pub async fn new(backend: Arc<B>) -> Result<Self>
Create a new node store with sync subscriptions for P2P replication
Sourcepub async fn store_config(&self, config: &NodeConfig) -> Result<String>
pub async fn store_config(&self, config: &NodeConfig) -> Result<String>
Store a node configuration (G-Set operation)
Sourcepub async fn get_config(&self, node_id: &str) -> Result<Option<NodeConfig>>
pub async fn get_config(&self, node_id: &str) -> Result<Option<NodeConfig>>
Retrieve a node configuration by ID
Sourcepub async fn store_state(
&self,
node_id: &str,
state: &NodeState,
) -> Result<String>
pub async fn store_state( &self, node_id: &str, state: &NodeState, ) -> Result<String>
Store node state (LWW-Register operation)
Sourcepub async fn get_state(&self, node_id: &str) -> Result<Option<NodeState>>
pub async fn get_state(&self, node_id: &str) -> Result<Option<NodeState>>
Retrieve node state by ID
Sourcepub async fn get_nodes_by_phase(&self, phase: Phase) -> Result<Vec<NodeState>>
pub async fn get_nodes_by_phase(&self, phase: Phase) -> Result<Vec<NodeState>>
Get all nodes in a specific phase
Sourcepub async fn get_nodes_by_cell(&self, squad_id: &str) -> Result<Vec<NodeState>>
pub async fn get_nodes_by_cell(&self, squad_id: &str) -> Result<Vec<NodeState>>
Get all nodes in a specific squad
Sourcepub async fn get_operational_nodes(&self) -> Result<Vec<NodeState>>
pub async fn get_operational_nodes(&self) -> Result<Vec<NodeState>>
Get all operational nodes (health != Failed && fuel > 0)
Sourcepub async fn delete_config(&self, node_id: &str) -> Result<()>
pub async fn delete_config(&self, node_id: &str) -> Result<()>
Delete a node configuration
Sourcepub async fn delete_state(&self, node_id: &str) -> Result<()>
pub async fn delete_state(&self, node_id: &str) -> Result<()>
Delete a node state
Auto Trait Implementations§
impl<B> Freeze for NodeStore<B>
impl<B> !RefUnwindSafe for NodeStore<B>
impl<B> Send for NodeStore<B>
impl<B> Sync for NodeStore<B>
impl<B> Unpin for NodeStore<B>
impl<B> UnsafeUnpin for NodeStore<B>
impl<B> !UnwindSafe for NodeStore<B>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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