Skip to main content

DeepStore

Struct DeepStore 

Source
pub struct DeepStore<'s> {
    pub admin: bool,
    pub generation: u64,
    pub derived: HashMap<&'static str, (u64, Vec<Json>)>,
    pub in_mutation: bool,
    /* private fields */
}

Fields§

§admin: bool

x-hasura-admin-secret: the request is not judged by the policy.

§generation: u64

Bumped by every committed write, for what is derived from the rows.

§derived: HashMap<&'static str, (u64, Vec<Json>)>

Derived tables by name, for the generation they were computed at.

§in_mutation: bool

Inside a mutation what is derived is not kept: it may yet change.

Implementations§

Source§

impl<'s> DeepStore<'s>

Source

pub fn open( links: &'s mut (dyn NamedTypeLinks + 's), policy: Option<PermissionPolicy>, ) -> Result<Self>

Source

pub fn view<R>( &mut self, subject: u32, read: impl FnOnce(&mut dyn Triplets) -> R, ) -> R

Runs read over the triplets as subject sees them.

Source

pub fn has_policy(&self) -> bool

Source

pub fn triplet_of(&self, id: i64) -> Option<u32>

Source

pub fn address(&self, position: Position, id: i64) -> Option<u32>

The address a Deep id stands for in position of a query.

Source

pub fn deep_of(&self, triplet: u32) -> Option<i64>

Source

pub fn row_of(&self, triplet: &Triplet) -> Option<LinkRow>

The row of a triplet, if it is a row of links.

Source

pub fn values(&self) -> impl Iterator<Item = (u32, &ValueRow)>

Source

pub fn value_of_owner( &self, kind: ValueKind, owner: i64, ) -> Option<(u32, &ValueRow)>

Source

pub fn value(&self, row: u32) -> Option<&ValueRow>

Source

pub fn reserve(&mut self, count: i64) -> Vec<i64>

Source

pub fn begin(&mut self)

Source

pub fn commit(&mut self) -> Result<()>

Source

pub fn rollback(&mut self) -> Result<()>

Inserts a row of links; a part may name the id being inserted.

Deletes a row of links and all that uses it; returns the ids deleted.

Source

pub fn create_value( &mut self, subject: u32, kind: ValueKind, owner: i64, value: Json, ) -> Result<u32>

Source

pub fn update_value( &mut self, subject: u32, row: u32, value: Json, ) -> Result<()>

Source

pub fn delete_value(&mut self, subject: u32, row: u32) -> Result<()>

Source

pub fn load_package(&mut self, rows: &Json) -> Result<usize>

Loads rows {id, type_id, from_id, to_id, string?, number?, object?}, such as a dump of @deep-foundation/core; rows already there are left alone, so loading twice changes nothing. Ids may refer forward, so all the points are made first.

Source

pub fn grants(&mut self) -> Vec<(bool, Option<i64>, Option<i64>)>

The grants of the policy as (marker name, subject, object), in Deep ids (None where the rule says Anything).

Auto Trait Implementations§

§

impl<'s> !RefUnwindSafe for DeepStore<'s>

§

impl<'s> !Send for DeepStore<'s>

§

impl<'s> !Sync for DeepStore<'s>

§

impl<'s> !UnwindSafe for DeepStore<'s>

§

impl<'s> Freeze for DeepStore<'s>

§

impl<'s> Unpin for DeepStore<'s>

§

impl<'s> UnsafeUnpin for DeepStore<'s>

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.