pub struct ZoneState {
pub config: Option<ZoneConfig>,
pub coordinator_id: Option<String>,
pub cells: Vec<String>,
pub aggregated_capabilities: Vec<Capability>,
pub timestamp: Option<Timestamp>,
}Expand description
Zone runtime state (CRDT-based)
Fields§
§config: Option<ZoneConfig>Zone configuration
coordinator_id: Option<String>Zone coordinator node ID (LWW-Register)
cells: Vec<String>Cell membership (OR-Set)
aggregated_capabilities: Vec<Capability>Aggregated capabilities from all cells (G-Set)
timestamp: Option<Timestamp>Timestamp for LWW conflict resolution
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ZoneState
impl<'de> Deserialize<'de> for ZoneState
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ZoneState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ZoneState, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Message for ZoneState
impl Message for ZoneState
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl Serialize for ZoneState
impl Serialize for ZoneState
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl ZoneStateExt for ZoneState
impl ZoneStateExt for ZoneState
Source§fn new(config: ZoneConfig) -> Self
fn new(config: ZoneConfig) -> Self
Create a new zone state from configuration Read more
Source§fn add_cell(&mut self, cell_id: String) -> bool
fn add_cell(&mut self, cell_id: String) -> bool
Add a cell to the zone (OR-Set add operation) Read more
Source§fn remove_cell(&mut self, cell_id: &str) -> bool
fn remove_cell(&mut self, cell_id: &str) -> bool
Remove a cell from the zone (OR-Set remove operation) Read more
Source§fn set_coordinator(&mut self, coordinator_id: String, timestamp: u64) -> bool
fn set_coordinator(&mut self, coordinator_id: String, timestamp: u64) -> bool
Set the zone coordinator (LWW-Register operation) Read more
Source§fn remove_coordinator(&mut self, timestamp: u64) -> bool
fn remove_coordinator(&mut self, timestamp: u64) -> bool
Remove the zone coordinator (LWW-Register deletion)
Source§fn add_capability(&mut self, capability: Capability)
fn add_capability(&mut self, capability: Capability)
Add an aggregated capability (G-Set add operation) Read more
Source§fn cell_count(&self) -> usize
fn cell_count(&self) -> usize
Get the number of cells in this zone
Source§fn contains_cell(&self, cell_id: &str) -> bool
fn contains_cell(&self, cell_id: &str) -> bool
Check if a specific cell is a member of this zone
Source§fn merge(&mut self, other: &ZoneState)
fn merge(&mut self, other: &ZoneState)
Merge another zone state into this one (CRDT merge) Read more
Source§fn update_timestamp(&mut self)
fn update_timestamp(&mut self)
Update timestamp to current time
impl StructuralPartialEq for ZoneState
Auto Trait Implementations§
impl Freeze for ZoneState
impl RefUnwindSafe for ZoneState
impl Send for ZoneState
impl Sync for ZoneState
impl Unpin for ZoneState
impl UnsafeUnpin for ZoneState
impl UnwindSafe for ZoneState
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> 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>
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