Struct safe_network::types::register::Register [−][src]
pub struct Register { /* fields omitted */ }
Expand description
Object storing the Register
Implementations
pub fn new_public(
authority: PublicKey,
name: XorName,
tag: u64,
policy: Option<PublicPolicy>
) -> Self
pub fn new_public(
authority: PublicKey,
name: XorName,
tag: u64,
policy: Option<PublicPolicy>
) -> Self
Construct a new Public Register. The ‘authority’ is assumed to be the PK which the messages were and will be signed with. If a policy is not provided, a default policy will be set where the ‘authority’ is the owner along with an empty users permissions set.
pub fn new_private(
authority: PublicKey,
name: XorName,
tag: u64,
policy: Option<PrivatePolicy>
) -> Self
pub fn new_private(
authority: PublicKey,
name: XorName,
tag: u64,
policy: Option<PrivatePolicy>
) -> Self
Construct a new Private Register. The ‘authority’ is assumed to be the PK which the messages were and will be signed with. If a policy is not provided, a default policy will be set where the ‘authority’ is the owner along with an empty users permissions set.
Return true
if private.
Return the number of items held in the register, optionally verifying read permissions if a pk is provided
Return true if the register is empty.
Return a value corresponding to the provided ‘hash’, if present.
Read the last entry, or entries when there are branches, if the register is not empty.
Write an entry to the Register, returning the generated unsigned CRDT operation so the caller can sign and broadcast it to other replicas, along with the hash of the entry just written.
Apply a signed data CRDT operation.
Return user permissions, if applicable.
Helper to check permissions for given action
for the given requester’s public key.
Returns:
Ok(())
if the permissions are valid,
Err::AccessDenied
if the action is not allowed.
Return the PK which the messages are expected to be signed with by this replica.
Trait Implementations
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
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
type Error = TryFromError
type Error = TryFromError
The type returned in the event of a conversion error.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Register
impl UnwindSafe for Register
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self
pub fn vzip(self) -> V