Struct warg_protocol::operator::LogState
source · pub struct LogState { /* private fields */ }
Expand description
Calculated state for an operator log.
Implementations§
source§impl LogState
impl LogState
sourcepub fn head(&self) -> &Option<Head>
pub fn head(&self) -> &Option<Head>
Gets the current head of the log.
Returns None
if no records have been validated yet.
sourcepub fn validate(
&mut self,
record: &ProtoEnvelope<OperatorRecord>
) -> Result<(), ValidationError>
pub fn validate( &mut self, record: &ProtoEnvelope<OperatorRecord> ) -> Result<(), ValidationError>
Validates an individual operator record.
It is expected that validate
is called in order of the
records in the log.
This operation is transactional: if any entry in the record fails to validate, the validator state will remain unchanged.
sourcepub fn public_key(&self, key_id: &KeyID) -> Option<&PublicKey>
pub fn public_key(&self, key_id: &KeyID) -> Option<&PublicKey>
Gets the public key of the given key id.
Returns None
if the key id is not recognized.
Trait Implementations§
source§impl<'de> Deserialize<'de> for LogState
impl<'de> Deserialize<'de> for LogState
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for LogState
impl PartialEq for LogState
source§impl Validator for LogState
impl Validator for LogState
§type Record = OperatorRecord
type Record = OperatorRecord
The type of record being validated.
§type Error = ValidationError
type Error = ValidationError
The type of error returned when validation fails.
impl Eq for LogState
impl StructuralEq for LogState
impl StructuralPartialEq for LogState
Auto Trait Implementations§
impl RefUnwindSafe for LogState
impl Send for LogState
impl Sync for LogState
impl Unpin for LogState
impl UnwindSafe for LogState
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.