[][src]Enum sn_data_types::Sequence

pub enum Sequence {
    Public(PublicSeqData),
    Private(PrivateSeqData),
}

Write operation to apply to Sequence. This is used for all kind of CRDT operations made on the Sequence, i.e. not only on the data but also on the permissions and owner info. Object storing a Sequence variant.

Variants

Public Sequence Data.

Private Sequence Data.

Implementations

impl Data[src]

pub fn new_public(actor: PublicKey, name: XorName, tag: u64) -> Self[src]

Constructs a new Public Sequence Data.

pub fn new_private(actor: PublicKey, name: XorName, tag: u64) -> Self[src]

Constructs a new Private Sequence Data.

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 check_permission(
    &self,
    action: Action,
    requester: PublicKey
) -> Result<()>
[src]

Checks permissions for given action for the provided user.

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 len(&self) -> u64[src]

Returns the length of the sequence.

pub fn is_empty(&self) -> bool[src]

Returns true if the sequence is empty.

pub fn policy_version(&self) -> u64[src]

Returns the version of last Policy.

pub fn in_range(&self, start: Index, end: Index) -> Option<Entries>[src]

Gets a list of items which are within the given indices.

pub fn get(&self, index: Index) -> Option<&Vec<u8>>[src]

Returns a value at 'index', if present.

pub fn last_entry(&self) -> Option<&Entry>[src]

Returns the last entry, if present.

pub fn append(&mut self, entry: Entry) -> Result<DataWriteOp<Entry>>[src]

Appends new entry.

pub fn apply_data_op(&mut self, op: DataWriteOp<Entry>) -> Result<()>[src]

Apply a data CRDT operation.

pub fn set_public_policy(
    &mut self,
    owner: PublicKey,
    permissions: BTreeMap<User, PublicPermissions>
) -> Result<PolicyWriteOp<PublicPolicy>>
[src]

Sets the new policy for Public Sequence.

pub fn set_private_policy(
    &mut self,
    owner: PublicKey,
    permissions: BTreeMap<PublicKey, PrivatePermissions>
) -> Result<PolicyWriteOp<PrivatePolicy>>
[src]

Sets the new policy for Private Sequence.

pub fn apply_public_policy_op(
    &mut self,
    op: PolicyWriteOp<PublicPolicy>
) -> Result<()>
[src]

Apply Public Policy CRDT operation.

pub fn apply_private_policy_op(
    &mut self,
    op: PolicyWriteOp<PrivatePolicy>
) -> Result<()>
[src]

Apply Private Policy CRDT operation.

pub fn permissions(
    &self,
    user: User,
    version: impl Into<Index>
) -> Result<Permissions>
[src]

Returns user permissions, if applicable.

pub fn public_policy(&self, version: impl Into<Index>) -> Result<&PublicPolicy>[src]

Returns public policy, if applicable.

pub fn private_policy(
    &self,
    version: impl Into<Index>
) -> Result<&PrivatePolicy>
[src]

Returns private policy, if applicable.

Trait Implementations

impl Clone for Data[src]

impl Debug for Data[src]

impl<'de> Deserialize<'de> for Data[src]

impl Eq for Data[src]

impl From<Data> for Data[src]

impl Hash for Data[src]

impl PartialEq<Data> for Data[src]

impl PartialOrd<Data> for Data[src]

impl Serialize for Data[src]

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.

Auto Trait Implementations

impl RefUnwindSafe for Data

impl Send for Data

impl Sync for Data

impl Unpin for Data

impl UnwindSafe for Data

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Member for T where
    T: Clone + Eq + Hash
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,