Struct sn_data_types::register::Register [−][src]
pub struct Register { /* fields omitted */ }
Object storing the Register
Implementations
impl Register
[src]
impl Register
[src]pub fn new_public(
authority: PublicKey,
name: XorName,
tag: u64,
policy: Option<PublicPolicy>
) -> Self
[src]
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
[src]
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.
pub fn address(&self) -> &Address
[src]
Return the address.
pub fn kind(&self) -> Kind
[src]
Return the kind.
pub fn name(&self) -> &XorName
[src]
Return the name.
pub fn tag(&self) -> u64
[src]
Return the tag.
pub fn is_public(&self) -> bool
[src]
Return true
if public.
pub fn is_private(&self) -> bool
[src]
Return true
if private.
pub fn size(&self, requester: Option<PublicKey>) -> Result<u64>
[src]
Return the number of items held in the register, optionally verifying read permissions if a pk is provided
pub fn is_empty(&self, requester: Option<PublicKey>) -> Result<bool>
[src]
Return true if the register is empty.
pub fn get(
&self,
hash: EntryHash,
requester: Option<PublicKey>
) -> Result<Option<&Entry>>
[src]
&self,
hash: EntryHash,
requester: Option<PublicKey>
) -> Result<Option<&Entry>>
Return a value corresponding to the provided ‘hash’, if present.
pub fn read(
&self,
requester: Option<PublicKey>
) -> Result<BTreeSet<(EntryHash, Entry)>>
[src]
&self,
requester: Option<PublicKey>
) -> Result<BTreeSet<(EntryHash, Entry)>>
Read the last entry, or entries when there are branches, if the register is not empty.
pub fn write(
&mut self,
entry: Entry,
parents: BTreeSet<EntryHash>
) -> Result<(EntryHash, RegisterOp<Entry>)>
[src]
&mut self,
entry: Entry,
parents: BTreeSet<EntryHash>
) -> Result<(EntryHash, RegisterOp<Entry>)>
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.
pub fn apply_op(&mut self, op: RegisterOp<Entry>) -> Result<()>
[src]
Apply a signed data CRDT operation.
pub fn permissions(
&self,
user: User,
requester: Option<PublicKey>
) -> Result<Permissions>
[src]
&self,
user: User,
requester: Option<PublicKey>
) -> Result<Permissions>
Return user permissions, if applicable.
pub fn policy(&self, requester: Option<PublicKey>) -> Result<&Policy>
[src]
Return the policy.
pub fn check_permission(
&self,
action: Action,
requester: Option<PublicKey>
) -> Result<()>
[src]
&self,
action: Action,
requester: Option<PublicKey>
) -> Result<()>
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.
pub fn owner(&self) -> PublicKey
[src]
Return the owner of the data.
pub fn replica_authority(&self) -> PublicKey
[src]
Return the PK which the messages are expected to be signed with by this replica.
Trait Implementations
impl<'de> Deserialize<'de> for Register
[src]
impl<'de> Deserialize<'de> for Register
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialOrd<Register> for Register
[src]
impl PartialOrd<Register> for Register
[src]impl StructuralEq for Register
[src]
impl StructuralEq for Register
[src]impl StructuralPartialEq for Register
[src]
impl StructuralPartialEq for Register
[src]Auto Trait Implementations
impl RefUnwindSafe for Register
impl RefUnwindSafe for Register
impl UnwindSafe for Register
impl UnwindSafe for Register
Blanket Implementations
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,