Skip to main content

Store

Struct Store 

Source
pub struct Store<'a, T, Repo, Access> { /* private fields */ }
Expand description

Storage for collaborative objects of a specific type T in a single repository.

Implementations§

Source§

impl<'a, T, Repo, Access> Store<'a, T, Repo, Access>
where Repo: ReadRepository + Store<Namespace = PublicKey>, Access: Access,

Source

pub fn open_for( type_name: &'a TypeName, repo: &'a Repo, access: Access, ) -> Result<Store<'a, T, Repo, Access>, Error>

Source§

impl<'a, T, Repo, Access> Store<'a, T, Repo, Access>
where Repo: ReadRepository + Store<Namespace = PublicKey>, Access: Access,

Source

pub fn identity(self, identity: Oid) -> Store<'a, T, Repo, Access>

Return a new store with the attached identity.

Source§

impl<'a, T, Repo, Access> Store<'a, T, Repo, Access>
where T: CobWithType, Repo: ReadRepository + Store<Namespace = PublicKey>, Access: Access,

Source

pub fn open( repo: &'a Repo, access: Access, ) -> Result<Store<'a, T, Repo, Access>, Error>

Open a new generic store.

Source§

impl<'a, 'b, T, Repo, Signer> Store<'a, T, Repo, WriteAs<'b, Signer>>
where T: Cob + Evaluate<Repo>, Repo: ReadRepository + Store<Namespace = PublicKey>,

Source

pub fn transaction( &self, actions: Vec<<T as Cob>::Action>, embeds: Vec<Embed<Uri>>, ) -> Transaction<T, Repo>

Source§

impl<'a, 'b, T, Repo, Signer> Store<'a, T, Repo, WriteAs<'b, Signer>>
where T: Cob + Evaluate<Repo>, <T as Cob>::Action: Serialize, Repo: ReadRepository + SignRepository + Store<Namespace = PublicKey>, Signer: Keypair<VerifyingKey = PublicKey> + Signer<Signature> + Signer<ExtendedSignature> + Verifier<Signature>,

Source

pub fn update( &mut self, type_name: &TypeName, object_id: ObjectId, message: &str, actions: impl Into<NonEmpty<<T as Cob>::Action>>, embeds: Vec<Embed<Uri>>, ) -> Result<Updated<T>, Error>

Update an object.

Source

pub fn create( &mut self, message: &str, actions: impl Into<NonEmpty<<T as Cob>::Action>>, embeds: Vec<Embed<Uri>>, ) -> Result<(ObjectId, T), Error>

Create an object.

Source

pub fn remove(&mut self, id: &ObjectId) -> Result<(), Error>

Remove an object.

Source§

impl<'a, T, Repo, Access> Store<'a, T, Repo, Access>
where T: Cob + Evaluate<Repo> + 'a, <T as Cob>::Action: Serialize, Repo: ReadRepository + Store<Namespace = PublicKey>, Access: Access,

Source

pub fn get(&self, id: &ObjectId) -> Result<Option<T>, Error>

Get an object.

Source

pub fn all( &self, ) -> Result<impl ExactSizeIterator + use<'a, T, Repo, Access>, Error>

Return all objects.

Source

pub fn is_empty(&self) -> Result<bool, Error>

Return true if the list of issues is empty.

Source

pub fn count(&self) -> Result<usize, Error>

Return objects count.

Trait Implementations§

Source§

impl<T, Repo, Access> AsRef<Repo> for Store<'_, T, Repo, Access>

Source§

fn as_ref(&self) -> &Repo

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T, Repo, Access> HasRepoId for Store<'_, T, Repo, Access>
where Repo: HasRepoId,

Source§

fn rid(&self) -> RepoId

Auto Trait Implementations§

§

impl<'a, T, Repo, Access> Freeze for Store<'a, T, Repo, Access>
where Access: Freeze,

§

impl<'a, T, Repo, Access> RefUnwindSafe for Store<'a, T, Repo, Access>
where Access: RefUnwindSafe, Repo: RefUnwindSafe, T: RefUnwindSafe,

§

impl<'a, T, Repo, Access> Send for Store<'a, T, Repo, Access>
where Access: Send, Repo: Sync, T: Send,

§

impl<'a, T, Repo, Access> Sync for Store<'a, T, Repo, Access>
where Access: Sync, Repo: Sync, T: Sync,

§

impl<'a, T, Repo, Access> Unpin for Store<'a, T, Repo, Access>
where Access: Unpin, T: Unpin,

§

impl<'a, T, Repo, Access> UnsafeUnpin for Store<'a, T, Repo, Access>
where Access: UnsafeUnpin,

§

impl<'a, T, Repo, Access> UnwindSafe for Store<'a, T, Repo, Access>
where Access: UnwindSafe, Repo: RefUnwindSafe, T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V