Struct routing::MutableData
[−]
[src]
pub struct MutableData { /* fields omitted */ }
Mutable data.
Methods
impl MutableData
[src]
pub fn new(
name: XorName,
tag: u64,
permissions: BTreeMap<User, PermissionSet>,
data: BTreeMap<Vec<u8>, Value>,
owners: BTreeSet<PublicKey>
) -> Result<MutableData, ClientError>
[src]
name: XorName,
tag: u64,
permissions: BTreeMap<User, PermissionSet>,
data: BTreeMap<Vec<u8>, Value>,
owners: BTreeSet<PublicKey>
) -> Result<MutableData, ClientError>
Creates a new MutableData
pub fn validate(&self) -> Result<(), ClientError>
[src]
Validate this data.
pub fn shell(&self) -> MutableData
[src]
Returns the shell of this data. Shell contains the same fields as the data itself, except the entries.
pub fn name(&self) -> &XorName
[src]
Returns the name.
pub fn tag(&self) -> u64
[src]
Returns the type tag of this MutableData
pub fn version(&self) -> u64
[src]
Returns the current version of this MutableData
pub fn owners(&self) -> &BTreeSet<PublicKey>
[src]
Returns the owner keys
pub fn get(&self, key: &[u8]) -> Option<&Value>
[src]
Returns a value by the given key
pub fn keys(&self) -> BTreeSet<&Vec<u8>>
[src]
Returns keys of all entries
pub fn values(&self) -> Vec<&Value>
[src]
Returns values of all entries
pub fn entries(&self) -> &BTreeMap<Vec<u8>, Value>
[src]
Returns all entries
pub fn take_entries(&mut self) -> BTreeMap<Vec<u8>, Value>
[src]
Removes and returns all entries
pub fn mutate_entries(
&mut self,
actions: BTreeMap<Vec<u8>, EntryAction>,
requester: PublicKey
) -> Result<(), ClientError>
[src]
&mut self,
actions: BTreeMap<Vec<u8>, EntryAction>,
requester: PublicKey
) -> Result<(), ClientError>
Mutates entries (key + value pairs) in bulk
pub fn mutate_entries_without_validation(
&mut self,
actions: BTreeMap<Vec<u8>, EntryAction>
)
[src]
&mut self,
actions: BTreeMap<Vec<u8>, EntryAction>
)
Mutates entries without performing any validation.
For updates and deletes, the mutation is performed only if he entry version of the action is higher than the current version of the entry.
pub fn mutate_entry_without_validation(
&mut self,
key: Vec<u8>,
value: Value
) -> bool
[src]
&mut self,
key: Vec<u8>,
value: Value
) -> bool
Mutates single entry without performing any validations, except the version check (new version must be higher than the existing one). If the entry doesn't exist yet, inserts it, otherwise, updates it. Returns true if the version check passed and the entry was mutated, false otherwise.
pub fn permissions(&self) -> &BTreeMap<User, PermissionSet>
[src]
Gets a complete list of permissions
pub fn user_permissions(
&self,
user: &User
) -> Result<&PermissionSet, ClientError>
[src]
&self,
user: &User
) -> Result<&PermissionSet, ClientError>
Gets a list of permissions for the provided user.
pub fn set_user_permissions(
&mut self,
user: User,
permissions: PermissionSet,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
[src]
&mut self,
user: User,
permissions: PermissionSet,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
Insert or update permissions for the provided user.
pub fn set_user_permissions_without_validation(
&mut self,
user: User,
permissions: PermissionSet,
version: u64
) -> bool
[src]
&mut self,
user: User,
permissions: PermissionSet,
version: u64
) -> bool
Set user permission without performing any validation.
pub fn del_user_permissions(
&mut self,
user: &User,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
[src]
&mut self,
user: &User,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
Delete permissions for the provided user.
pub fn del_user_permissions_without_validation(
&mut self,
user: &User,
version: u64
) -> bool
[src]
&mut self,
user: &User,
version: u64
) -> bool
Delete user permissions without performing any validation.
pub fn change_owner(
&mut self,
new_owner: PublicKey,
version: u64
) -> Result<(), ClientError>
[src]
&mut self,
new_owner: PublicKey,
version: u64
) -> Result<(), ClientError>
Change owner of the mutable data.
pub fn change_owner_without_validation(
&mut self,
new_owner: PublicKey,
version: u64
) -> bool
[src]
&mut self,
new_owner: PublicKey,
version: u64
) -> bool
Change the owner without performing any validation.
pub fn serialised_size(&self) -> u64
[src]
Return the size of this data after serialisation.
pub fn validate_size(&self) -> bool
[src]
Return true if the size is valid
Trait Implementations
impl Hash for MutableData
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Eq for MutableData
[src]
impl PartialEq for MutableData
[src]
fn eq(&self, __arg_0: &MutableData) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MutableData) -> bool
[src]
This method tests for !=
.
impl PartialOrd for MutableData
[src]
fn partial_cmp(&self, __arg_0: &MutableData) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &MutableData) -> bool
[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &MutableData) -> bool
[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &MutableData) -> bool
[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &MutableData) -> bool
[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for MutableData
[src]
fn cmp(&self, __arg_0: &MutableData) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Clone for MutableData
[src]
fn clone(&self) -> MutableData
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more