Struct sn_data_types::Sequence[][src]

pub struct Sequence { /* fields omitted */ }

Object storing the Sequence

Implementations

impl Data[src]

pub fn new_public(
    authority: PublicKey,
    actor: String,
    name: XorName,
    tag: u64,
    policy: Option<PublicPolicy>
) -> Self
[src]

Constructs a new Public Sequence Data. The ‘authority’ 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. 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,
    actor: String,
    name: XorName,
    tag: u64,
    policy: Option<PrivatePolicy>
) -> Self
[src]

Constructs a new Private Sequence Data. The ‘authority’ 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. 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]

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_public(&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 in_range(
    &self,
    start: Index,
    end: Index,
    requester: Option<PublicKey>
) -> Result<Option<Entries>>
[src]

Gets a list of items which are within the given indices. Note the range of items is [start, end), i.e. the end index is not inclusive.

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

Returns a value at ‘index’, if present.

pub fn last_entry(&self, requester: Option<PublicKey>) -> Result<Option<&Entry>>[src]

Returns the last entry, if it’s not empty.

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

Generate unsigned crdt op, adding the new entry.

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

Apply a signed data CRDT operation.

pub fn permissions(
    &self,
    user: User,
    requester: Option<PublicKey>
) -> Result<Permissions>
[src]

Returns user permissions, if applicable.

pub fn public_policy(&self) -> Result<&PublicPolicy>[src]

Returns the public policy, if applicable.

pub fn private_policy(
    &self,
    requester: Option<PublicKey>
) -> Result<&PrivatePolicy>
[src]

Returns the private policy, if applicable.

pub fn check_permission(
    &self,
    action: Action,
    requester: Option<PublicKey>
) -> Result<()>
[src]

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]

Returns the owner of the data.

pub fn replica_authority(&self) -> PublicKey[src]

Returns the PK which the messages are expected to be signed with by this replica.

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]

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 + Hash + Eq
[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>,