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: boolx-hasura-admin-secret: the request is not judged by the policy.
generation: u64Bumped 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: boolInside a mutation what is derived is not kept: it may yet change.
Implementations§
Source§impl<'s> DeepStore<'s>
impl<'s> DeepStore<'s>
pub fn open( links: &'s mut (dyn NamedTypeLinks + 's), policy: Option<PermissionPolicy>, ) -> Result<Self>
Sourcepub fn view<R>(
&mut self,
subject: u32,
read: impl FnOnce(&mut dyn Triplets) -> R,
) -> R
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.
pub fn has_policy(&self) -> bool
pub fn triplet_of(&self, id: i64) -> Option<u32>
Sourcepub fn address(&self, position: Position, id: i64) -> Option<u32>
pub fn address(&self, position: Position, id: i64) -> Option<u32>
The address a Deep id stands for in position of a query.
pub fn deep_of(&self, triplet: u32) -> Option<i64>
Sourcepub fn row_of(&self, triplet: &Triplet) -> Option<LinkRow>
pub fn row_of(&self, triplet: &Triplet) -> Option<LinkRow>
The row of a triplet, if it is a row of links.
pub fn values(&self) -> impl Iterator<Item = (u32, &ValueRow)>
pub fn value_of_owner( &self, kind: ValueKind, owner: i64, ) -> Option<(u32, &ValueRow)>
pub fn value(&self, row: u32) -> Option<&ValueRow>
pub fn reserve(&mut self, count: i64) -> Vec<i64>
pub fn begin(&mut self)
pub fn commit(&mut self) -> Result<()>
pub fn rollback(&mut self) -> Result<()>
Sourcepub fn create_link(
&mut self,
subject: u32,
id: Option<i64>,
type_id: i64,
from_id: i64,
to_id: i64,
) -> Result<i64>
pub fn create_link( &mut self, subject: u32, id: Option<i64>, type_id: i64, from_id: i64, to_id: i64, ) -> Result<i64>
Inserts a row of links; a part may name the id being inserted.
pub fn update_link( &mut self, subject: u32, id: i64, type_id: i64, from_id: i64, to_id: i64, ) -> Result<()>
Sourcepub fn delete_link(&mut self, subject: u32, id: i64) -> Result<Vec<i64>>
pub fn delete_link(&mut self, subject: u32, id: i64) -> Result<Vec<i64>>
Deletes a row of links and all that uses it; returns the ids deleted.
pub fn create_value( &mut self, subject: u32, kind: ValueKind, owner: i64, value: Json, ) -> Result<u32>
pub fn update_value( &mut self, subject: u32, row: u32, value: Json, ) -> Result<()>
pub fn delete_value(&mut self, subject: u32, row: u32) -> Result<()>
Sourcepub fn load_package(&mut self, rows: &Json) -> Result<usize>
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.