[−][src]Struct sn_data_types::Sequence
Object storing the Sequence
Implementations
impl Data
[src]
pub fn new_public(
operations_pk: PublicKey,
actor: String,
name: XorName,
tag: u64
) -> Self
[src]
operations_pk: PublicKey,
actor: String,
name: XorName,
tag: u64
) -> Self
Constructs a new Public Sequence Data. The 'operations_pk' is assumed to be the PK which the messages were and will be signed with, whilst the 'actor' is a unique identifier to be used as the clock's Dot in all operations generated by this instance.
pub fn new_private(
operations_pk: PublicKey,
actor: String,
name: XorName,
tag: u64
) -> Self
[src]
operations_pk: PublicKey,
actor: String,
name: XorName,
tag: u64
) -> Self
Constructs a new Private Sequence Data. The 'operations_pk' is assumed to be the PK which the messages were and will be signed with, whilst the 'actor' is a unique identifier to be used as the clock's Dot in all operations generated by this instance.
pub fn address(&self) -> &Address
[src]
Returns the address.
pub fn kind(&self) -> Kind
[src]
Returns the kind.
pub fn name(&self) -> &XorName
[src]
Returns the name.
pub fn tag(&self) -> u64
[src]
Returns the tag.
pub fn is_pub(&self) -> bool
[src]
Returns true
if public.
pub fn is_private(&self) -> bool
[src]
Returns true
if private.
pub fn len(&self, requester: Option<PublicKey>) -> Result<u64>
[src]
Returns the length of the sequence, optionally verifying read permissions if a pk is provided
pub fn is_empty(&self, requester: Option<PublicKey>) -> Result<bool>
[src]
Returns true if the sequence is empty.
pub fn policy_version(
&self,
requester: Option<PublicKey>
) -> Result<Option<u64>>
[src]
&self,
requester: Option<PublicKey>
) -> Result<Option<u64>>
Returns the version of last Policy.
pub fn in_range(
&self,
start: Index,
end: Index,
requester: Option<PublicKey>
) -> Result<Option<Entries>>
[src]
&self,
start: Index,
end: Index,
requester: Option<PublicKey>
) -> Result<Option<Entries>>
Gets a list of items which are within the given indices.
pub fn get(
&self,
index: Index,
requester: Option<PublicKey>
) -> Result<Option<&Vec<u8>>>
[src]
&self,
index: Index,
requester: Option<PublicKey>
) -> Result<Option<&Vec<u8>>>
Returns a value at 'index', if present.
pub fn last_entry(&self, requester: Option<PublicKey>) -> Result<Option<&Entry>>
[src]
Returns the last entry, if present.
pub fn create_unsigned_append_op(
&mut self,
entry: Entry
) -> Result<DataWriteOp<Entry>>
[src]
&mut self,
entry: Entry
) -> Result<DataWriteOp<Entry>>
Generate unsigned crdt op, adding the new entry.
pub fn apply_data_op(&mut self, op: DataWriteOp<Entry>) -> Result<()>
[src]
Apply a signed data CRDT operation.
pub fn create_unsigned_public_policy_op(
&mut self,
owner: PublicKey,
permissions: BTreeMap<User, PublicPermissions>
) -> Result<PolicyWriteOp<PublicPolicy>>
[src]
&mut self,
owner: PublicKey,
permissions: BTreeMap<User, PublicPermissions>
) -> Result<PolicyWriteOp<PublicPolicy>>
Sets the new policy for Public Sequence.
pub fn create_unsigned_private_policy_op(
&mut self,
owner: PublicKey,
permissions: BTreeMap<PublicKey, PrivatePermissions>
) -> Result<PolicyWriteOp<PrivatePolicy>>
[src]
&mut self,
owner: PublicKey,
permissions: BTreeMap<PublicKey, PrivatePermissions>
) -> Result<PolicyWriteOp<PrivatePolicy>>
Sets the new policy for Private Sequence.
pub fn apply_public_policy_op(
&mut self,
op: PolicyWriteOp<PublicPolicy>
) -> Result<()>
[src]
&mut self,
op: PolicyWriteOp<PublicPolicy>
) -> Result<()>
Apply Public Policy CRDT operation.
pub fn apply_private_policy_op(
&mut self,
op: PolicyWriteOp<PrivatePolicy>
) -> Result<()>
[src]
&mut self,
op: PolicyWriteOp<PrivatePolicy>
) -> Result<()>
Apply Private Policy CRDT operation.
pub fn permissions(
&self,
user: User,
requester: Option<PublicKey>
) -> Result<Permissions>
[src]
&self,
user: User,
requester: Option<PublicKey>
) -> Result<Permissions>
Returns user permissions, if applicable.
pub fn permissions_at(
&self,
user: User,
version: impl Into<Index>,
requester: Option<PublicKey>
) -> Result<Permissions>
[src]
&self,
user: User,
version: impl Into<Index>,
requester: Option<PublicKey>
) -> Result<Permissions>
Returns user permissions at provided index in the history, if applicable.
pub fn public_policy(&self) -> Result<&PublicPolicy>
[src]
Returns the current public policy, if applicable.
pub fn public_policy_at(
&self,
version: impl Into<Index>
) -> Result<&PublicPolicy>
[src]
&self,
version: impl Into<Index>
) -> Result<&PublicPolicy>
Returns the public policy at provided index in the history, if applicable.
pub fn private_policy(
&self,
requester: Option<PublicKey>
) -> Result<&PrivatePolicy>
[src]
&self,
requester: Option<PublicKey>
) -> Result<&PrivatePolicy>
Returns the current private policy, if applicable.
pub fn private_policy_at(
&self,
version: impl Into<Index>,
requester: Option<PublicKey>
) -> Result<&PrivatePolicy>
[src]
&self,
version: impl Into<Index>,
requester: Option<PublicKey>
) -> Result<&PrivatePolicy>
Returns the private policy at provided index in the history, if applicable.
pub fn check_permission(
&self,
action: Action,
requester: Option<PublicKey>,
policy_id: Option<&Identifier<String>>
) -> Result<()>
[src]
&self,
action: Action,
requester: Option<PublicKey>,
policy_id: Option<&Identifier<String>>
) -> Result<()>
Helper to check permissions for given action
for the given requester's public key.
Returns:
Ok(())
if the permissions are valid,
Err::InvalidOwners
if the last owner is invalid,
Err::AccessDenied
if the action is not allowed.
pub fn owner(&self) -> PublicKey
[src]
Returns the owner of the data.
Trait Implementations
impl Clone for Data
[src]
impl Debug for Data
[src]
impl<'de> Deserialize<'de> for Data
[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for Data
[src]
impl From<Data> for Data
[src]
impl Hash for Data
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Data> for Data
[src]
impl PartialOrd<Data> for Data
[src]
pub fn partial_cmp(&self, other: &Data) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Data) -> bool
[src]
pub fn le(&self, other: &Data) -> bool
[src]
pub fn gt(&self, other: &Data) -> bool
[src]
pub fn ge(&self, other: &Data) -> bool
[src]
impl Serialize for Data
[src]
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Data
[src]
impl StructuralPartialEq for Data
[src]
impl TryFrom<QueryResponse> for Sequence
[src]
type Error = TryFromError
The type returned in the event of a conversion error.
pub fn try_from(response: QueryResponse) -> Result<Self, Self::Error>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Data
[src]
impl Send for Data
[src]
impl Sync for Data
[src]
impl Unpin for Data
[src]
impl UnwindSafe for Data
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Member for T where
T: Clone + Eq + Hash,
[src]
T: Clone + Eq + Hash,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,