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(
self,
record: &ProtoEnvelope<OperatorRecord>,
) -> Result<Self, ValidationError>
pub fn validate( self, record: &ProtoEnvelope<OperatorRecord>, ) -> Result<Self, ValidationError>
Validates an individual operator record.
It is expected that validate
is called in order of the
records in the log.
Note that on failure, the log state is consumed to prevent invalid state from being used in future validations.
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.
Sourcepub fn namespace_state(&self, namespace: &str) -> Option<&NamespaceState>
pub fn namespace_state(&self, namespace: &str) -> Option<&NamespaceState>
Gets the namespace state.
Sourcepub fn key_has_permission_to_sign_checkpoints(&self, key_id: &KeyID) -> bool
pub fn key_has_permission_to_sign_checkpoints(&self, key_id: &KeyID) -> bool
Checks the key has permission to sign checkpoints.
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 Validator for LogState
impl Validator for LogState
Source§type Record = OperatorRecord
type Record = OperatorRecord
The type of record being validated.
Source§type Error = ValidationError
type Error = ValidationError
The type of error returned when validation fails.
impl Eq for LogState
impl StructuralPartialEq for LogState
Auto Trait Implementations§
impl Freeze for LogState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.