Skip to main content

CacheLinks

Struct CacheLinks 

Source
pub struct CacheLinks<L> { /* private fields */ }
Expand description

links kept as CacheOptions tell; see the top of this module. Every write has to go through it for it to know which links exist.

Implementations§

Source§

impl<L: NamedTypeLinks> CacheLinks<L>

Source

pub fn new(links: L, options: CacheOptions) -> Self

links on the system clock. A step back in that clock delays what comes due. wasm32-unknown-unknown has no system clock: there, use Self::with_clock.

Source

pub fn with_clock( links: L, options: CacheOptions, clock: impl FnMut() -> u64 + Send + 'static, ) -> Self

links on a clock of milliseconds. The links already there are the least recently used, in the order of their addresses, and have no deadline.

The store below, to read without using anything.

Source

pub fn into_inner(self) -> L

The store below, without the cache.

Source

pub fn purge_expired(&mut self) -> Result<usize>

Deletes what is due now, and how many links that deleted, cascades included.

Source

pub fn expire(&mut self, id: u32, milliseconds: u64) -> Result<bool>

Gives id a deadline in place of any it had; false when there is no such link. A time of zero deletes it now, as Redis EXPIRE does.

Source

pub fn persist(&mut self, id: u32) -> Result<bool>

Takes the deadline of id away; false when it had none.

Source

pub fn time_to_live(&mut self, id: u32) -> Result<Option<u64>>

The milliseconds id has left; None when it has no deadline or is gone.

Trait Implementations§

Source§

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

Panics when the cache is full; use try_create.

Source§

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

Panics when the cache is full; use try_ensure_created.

Source§

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

Asked of the store below: asking by creating here could evict.

Source§

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

Panics when the cache is full; use try_get_or_create.

Source§

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

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

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

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

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

Source§

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

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

fn claims(&mut self, id: u32) -> 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 exists(&mut self, id: u32) -> bool

Source§

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

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

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

Self::delete, reporting every change the deletion caused. Read more
The links that match a pattern, where None matches any value, in the order of their addresses. Read more
Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

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 update(&mut self, id: T, source: T, target: T) -> Result<GenericLink<T>>

Source§

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

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<L> !RefUnwindSafe for CacheLinks<L>

§

impl<L> !Sync for CacheLinks<L>

§

impl<L> !UnwindSafe for CacheLinks<L>

§

impl<L> Freeze for CacheLinks<L>
where L: Freeze,

§

impl<L> Send for CacheLinks<L>
where L: Send,

§

impl<L> Unpin for CacheLinks<L>
where L: Unpin,

§

impl<L> UnsafeUnpin for CacheLinks<L>
where L: UnsafeUnpin,

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.