Skip to main content

ShardSession

Struct ShardSession 

Source
pub struct ShardSession<T: LinkReference> { /* private fields */ }
Expand description

Standard raw links operations in a selected shard. Commit the containing group explicitly; individual shard flushes cannot publish a partial group.

Implementations§

Source§

impl<T: LinkReference> ShardSession<T>

Source

pub fn get_name(&self, id: T) -> Option<String>

Source

pub fn get_by_name(&self, name: &str) -> Option<T>

Source

pub fn set_name(&mut self, id: T, name: Option<String>) -> Result<(), LinkError>

Source

pub fn savepoint(&mut self) -> Result<Savepoint, LinkError>

A savepoint covers this shard only, not the containing group.

Source

pub fn rollback_to_savepoint( &mut self, savepoint: Savepoint, ) -> Result<(), LinkError>

Source

pub fn release_savepoint( &mut self, savepoint: Savepoint, ) -> Result<(), LinkError>

Trait Implementations§

Source§

impl<T: LinkReference> LinksStorage<T> for ShardSession<T>

Creates a link and returns its address. A uniqueness resolver may return an existing link after removing the temporary allocation.
Ensures a link exists at index, creating placeholders as needed.
Returns the link stored at index, if any.
Repoints index at source/target, returning the previous state.
Deletes index, returning the link that was removed.
Returns every link in the store.
Source§

fn flush(&mut self) -> Result<(), LinkError>

Makes every write durable on disk. Read more
Self::create_link, reporting every change, including partial changes before an error. Transactions need these callbacks to distinguish a new allocation from a duplicate resolved into an existing link. Read more
Self::ensure_link_created, reporting every placeholder it creates. Read more
Returns true when a link exists at index.
Writes exactly this row for undo and replay, returning the previous state. Read more
Self::update_link, reporting every (before, after) change it made. Read more
Self::delete_link, reporting every (before, after) change it made. Read more
Returns every link matching the (optional) index/source/target pattern.
Finds the address of a link with the given source and target.
Returns the address of an existing (source, target) link, creating it when it does not exist yet.
Number of links currently stored.
Source§

fn capture_names(&mut self) -> Result<Option<BTreeMap<T, String>>, LinkError>

Optional logical name snapshot for transactional undo. Unnamed stores return None without allocation. Include names of absent/external rows.
Changes one logical name without recording. A named adapter must restore external-reference names even when their row currently does not exist.
Source§

fn has_external_changes(&self) -> Result<bool, LinkError>

Cheap check for “did another process write to this database since we last read or wrote it?”. Read more
Source§

fn reload(&mut self) -> Result<(), LinkError>

Re-reads the database from disk, discarding cached state. Read more
Source§

impl<T: QueryAddress> NamedTypeLinks<T> for ShardSession<T>

Source§

fn reserve_query_allocations( &mut self, processor: &GenericQueryProcessor<T>, restriction: &LinoLink, substitution: &LinoLink, ) -> Result<Option<HashSet<T>>>

Reserve the actual allocation sequence without staging observable rows. Backends with a recycling allocator may retain the legacy probe path.
Source§

fn create(&mut self, source: T, target: T) -> T

Source§

fn try_create(&mut self, source: T, target: T) -> Result<T>

Fallible allocation for backends that can report transaction/address errors.
Source§

fn ensure_created(&mut self, id: T) -> T

Source§

fn try_ensure_created(&mut self, id: T) -> Result<T>

Source§

fn exists(&mut self, id: T) -> bool

Source§

fn update_observed( &mut self, id: T, source: T, target: T, observer: ChangeObserver<'_, T>, ) -> Result<Link<T>>

Self::update, reporting every change the update caused. Read more
Source§

fn delete_observed( &mut self, id: T, observer: ChangeObserver<'_, T>, ) -> Result<Link<T>>

Self::delete, reporting every change the deletion caused. Read more
Source§

fn search(&mut self, source: T, target: T) -> Option<T>

Source§

fn get_or_create(&mut self, source: T, target: T) -> T

Source§

fn get_name(&mut self, id: T) -> Result<Option<String>>

Source§

fn set_name(&mut self, id: T, name: &str) -> Result<T>

Source§

fn get_by_name(&mut self, name: &str) -> Result<Option<T>>

Source§

fn remove_name(&mut self, id: T) -> Result<()>

Source§

fn save(&mut self) -> Result<()>

Source§

fn query_limits(&self) -> Option<QueryLimits>

A checked transport may restrict numeric input and query expansion.
Source§

fn reference_exists(&mut self, id: T) -> bool

Whether a reference of a query to id names a link that exists. Read more
Source§

fn claims(&mut self, id: T) -> Option<bool>

Whether id is an address of this store, so a link created there (Self::ensure_created, the undo of a delete) belongs in it; None for a plain store, which has no addresses of its own. Read more
Source§

fn next_created_addresses(&mut self, count: usize) -> Result<Vec<T>>

The addresses the next count links created in the store get. Read more
Source§

fn update(&mut self, id: T, source: T, target: T) -> Result<GenericLink<T>>

Source§

fn delete(&mut self, id: T) -> Result<GenericLink<T>>

The links that match a pattern, where None matches any value, in the order of their addresses. Read more
Source§

fn try_get_or_create(&mut self, source: T, target: T) -> Result<T>

Fallible pair lookup/allocation for composable query and decorator writes.
Source§

fn get_or_create_named(&mut self, name: &str) -> Result<T>

Source§

fn format_reference(&mut self, id: T) -> Result<String>

Source§

fn format_lino(&mut self, link: &GenericLink<T>) -> Result<String>

Source§

fn lino_lines(&mut self) -> Result<Vec<String>>

Source§

fn write_lino_output<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
where Self: Sized,

Source§

fn print_all_lino(&mut self) -> Result<()>

Source§

fn print_change_lino( &mut self, before: &Option<GenericLink<T>>, after: &Option<GenericLink<T>>, ) -> Result<()>

Source§

fn format_structure(&mut self, id: T) -> Result<String>

Source§

fn format_structure_recursive( &mut self, id: T, visited: &mut HashSet<T>, ) -> Result<String>

Auto Trait Implementations§

§

impl<T> !Freeze for ShardSession<T>

§

impl<T> RefUnwindSafe for ShardSession<T>
where T: RefUnwindSafe,

§

impl<T> Send for ShardSession<T>

§

impl<T> Sync for ShardSession<T>

§

impl<T> Unpin for ShardSession<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for ShardSession<T>

§

impl<T> UnwindSafe for ShardSession<T>

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.