Struct routing::MutableData
[−]
[src]
pub struct MutableData { /* fields omitted */ }
Mutable data.
Methods
impl MutableData
[src]
fn new(
name: XorName,
tag: u64,
permissions: BTreeMap<User, PermissionSet>,
data: BTreeMap<Vec<u8>, Value>,
owners: BTreeSet<PublicKey>
) -> Result<MutableData, ClientError>
name: XorName,
tag: u64,
permissions: BTreeMap<User, PermissionSet>,
data: BTreeMap<Vec<u8>, Value>,
owners: BTreeSet<PublicKey>
) -> Result<MutableData, ClientError>
Creates a new MutableData
fn validate(&self) -> Result<(), ClientError>
Validate this data.
fn shell(&self) -> MutableData
Returns the shell of this data. Shell contains the same fields as the data itself, except the entries.
fn name(&self) -> &XorName
Returns the name.
fn tag(&self) -> u64
Returns the type tag of this MutableData
fn version(&self) -> u64
Returns the current version of this MutableData
fn owners(&self) -> &BTreeSet<PublicKey>
Returns the owner keys
fn get(&self, key: &[u8]) -> Option<&Value>
Returns a value by the given key
fn keys(&self) -> BTreeSet<&Vec<u8>>
Returns keys of all entries
fn values(&self) -> Vec<&Value>
Returns values of all entries
fn entries(&self) -> &BTreeMap<Vec<u8>, Value>
Returns all entries
fn take_entries(&mut self) -> BTreeMap<Vec<u8>, Value>
Removes and returns all entries
fn mutate_entries(
&mut self,
actions: BTreeMap<Vec<u8>, EntryAction>,
requester: PublicKey
) -> Result<(), ClientError>
&mut self,
actions: BTreeMap<Vec<u8>, EntryAction>,
requester: PublicKey
) -> Result<(), ClientError>
Mutates entries (key + value pairs) in bulk
fn mutate_entries_without_validation(
&mut self,
actions: BTreeMap<Vec<u8>, EntryAction>
)
&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.
fn mutate_entry_without_validation(
&mut self,
key: Vec<u8>,
value: Value
) -> bool
&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.
fn permissions(&self) -> &BTreeMap<User, PermissionSet>
Gets a complete list of permissions
fn user_permissions(&self, user: &User) -> Result<&PermissionSet, ClientError>
Gets a list of permissions for the provided user.
fn set_user_permissions(
&mut self,
user: User,
permissions: PermissionSet,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
&mut self,
user: User,
permissions: PermissionSet,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
Insert or update permissions for the provided user.
fn set_user_permissions_without_validation(
&mut self,
user: User,
permissions: PermissionSet,
version: u64
) -> bool
&mut self,
user: User,
permissions: PermissionSet,
version: u64
) -> bool
Set user permission without performing any validation.
fn del_user_permissions(
&mut self,
user: &User,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
&mut self,
user: &User,
version: u64,
requester: PublicKey
) -> Result<(), ClientError>
Delete permissions for the provided user.
fn del_user_permissions_without_validation(
&mut self,
user: &User,
version: u64
) -> bool
&mut self,
user: &User,
version: u64
) -> bool
Delete user permissions without performing any validation.
fn change_owner(
&mut self,
new_owner: PublicKey,
version: u64
) -> Result<(), ClientError>
&mut self,
new_owner: PublicKey,
version: u64
) -> Result<(), ClientError>
Change owner of the mutable data.
fn change_owner_without_validation(
&mut self,
new_owner: PublicKey,
version: u64
) -> bool
&mut self,
new_owner: PublicKey,
version: u64
) -> bool
Change the owner without performing any validation.
fn serialised_size(&self) -> u64
Return the size of this data after serialisation.
fn validate_size(&self) -> bool
Return true if the size is valid
Trait Implementations
impl Hash for MutableData
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
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
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &MutableData) -> bool
This method tests for !=
.
impl PartialOrd for MutableData
[src]
fn partial_cmp(&self, __arg_0: &MutableData) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &MutableData) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &MutableData) -> bool
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
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &MutableData) -> bool
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
This method returns an Ordering
between self
and other
. Read more
impl Clone for MutableData
[src]
fn clone(&self) -> MutableData
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more