pub struct CellStore<B: DataSyncBackend> { /* private fields */ }Expand description
Cell storage manager
Implementations§
Source§impl<B: DataSyncBackend> CellStore<B>
impl<B: DataSyncBackend> CellStore<B>
Sourcepub async fn new(backend: Arc<B>) -> Result<Self>
pub async fn new(backend: Arc<B>) -> Result<Self>
Create a new cell store with sync subscription for P2P replication
Sourcepub async fn store_cell(&self, cell: &CellState) -> Result<String>
pub async fn store_cell(&self, cell: &CellState) -> Result<String>
Store a cell state (OR-Set + LWW-Register operations)
Sourcepub async fn get_valid_cells(&self) -> Result<Vec<CellState>>
pub async fn get_valid_cells(&self) -> Result<Vec<CellState>>
Get all valid cells (meeting minimum size requirements)
Sourcepub async fn get_cells_by_zone(
&self,
platoon_id: &str,
) -> Result<Vec<CellState>>
pub async fn get_cells_by_zone( &self, platoon_id: &str, ) -> Result<Vec<CellState>>
Get all cells in a platoon
Sourcepub async fn get_cells_with_capability(
&self,
capability_type: CapabilityType,
) -> Result<Vec<CellState>>
pub async fn get_cells_with_capability( &self, capability_type: CapabilityType, ) -> Result<Vec<CellState>>
Get cells that have a specific capability type
Sourcepub async fn get_available_cells(&self) -> Result<Vec<CellState>>
pub async fn get_available_cells(&self) -> Result<Vec<CellState>>
Get cells that are not full (can accept more members)
Sourcepub async fn add_member(&self, cell_id: &str, node_id: String) -> Result<()>
pub async fn add_member(&self, cell_id: &str, node_id: String) -> Result<()>
Add a member to a cell (OR-Set add operation)
Sourcepub async fn remove_member(&self, cell_id: &str, node_id: &str) -> Result<()>
pub async fn remove_member(&self, cell_id: &str, node_id: &str) -> Result<()>
Remove a member from a cell (OR-Set remove operation)
Sourcepub async fn set_leader(&self, cell_id: &str, node_id: String) -> Result<()>
pub async fn set_leader(&self, cell_id: &str, node_id: String) -> Result<()>
Set squad leader (LWW-Register operation)
Sourcepub async fn add_capability(
&self,
cell_id: &str,
capability: Capability,
) -> Result<()>
pub async fn add_capability( &self, cell_id: &str, capability: Capability, ) -> Result<()>
Add a capability to a cell (G-Set operation)
Sourcepub async fn delete_cell(&self, cell_id: &str) -> Result<()>
pub async fn delete_cell(&self, cell_id: &str) -> Result<()>
Delete a cell
Auto Trait Implementations§
impl<B> Freeze for CellStore<B>
impl<B> !RefUnwindSafe for CellStore<B>
impl<B> Send for CellStore<B>
impl<B> Sync for CellStore<B>
impl<B> Unpin for CellStore<B>
impl<B> UnsafeUnpin for CellStore<B>
impl<B> !UnwindSafe for CellStore<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