Skip to main content

MemoryStore

Struct MemoryStore 

Source
pub struct MemoryStore { /* private fields */ }
Expand description

The in-memory reference implementation of JournalStore and GraphStore on one dataset, used by the test kit’s self-test and by tests of code above the storage layer.

Like the tiramemsu backend, it holds the journal and the graphs in one store: an append writes the entry graphs and the state delta into the dataset under one lock. By default it enforces fencing, accepts state deltas and declares RDF 1.2; each can be switched off to exercise the other side of a capability.

Implementations§

Source§

impl MemoryStore

Source

pub fn new() -> Self

An empty store with fencing, state deltas and RDF 1.2.

Source

pub fn with_fencing(self, on: bool) -> Self

This store with fencing enforced or not.

Source

pub fn with_state_in_append(self, on: bool) -> Self

This store with state deltas accepted or not.

Source

pub fn with_rdf(self, rdf: RdfCapability) -> Self

This store declaring rdf. With RdfCapability::Rdf11 it refuses triple terms.

Source

pub fn dataset(&self) -> Dataset

A copy of every quad in the store.

Trait Implementations§

Source§

impl Debug for MemoryStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MemoryStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl GraphStore for MemoryStore

Source§

fn capabilities(&self) -> GraphCapabilities

What the store declares about itself.
Source§

fn insert_quads(&self, quads: &[Quad]) -> Result<(), StoreError>

Adds quads. Read more
Source§

fn remove_quads(&self, quads: &[Quad]) -> Result<(), StoreError>

Removes quads (absent ones are ignored). Blank nodes cannot be named for removal. Read more
Source§

fn clear_graph(&self, graph: &NamedNode) -> Result<(), StoreError>

Removes every statement of the named graph graph. Read more
Source§

fn query(&self, sparql: &str) -> Result<QueryResults, StoreError>

Runs a SPARQL 1.1 query (SELECT, ASK, CONSTRUCT, DESCRIBE). Read more
Source§

fn rdf_capability(&self) -> RdfCapability

Whether the store supports RDF 1.2 triple terms.
Source§

impl JournalStore for MemoryStore

Source§

fn capabilities(&self) -> JournalCapabilities

What the store supports beyond compare-and-set.
Source§

fn append( &self, actor: &NamedNode, expected: Position, entries: &[Entry], meta: &AppendMeta, ) -> Result<Position, AppendError>

Appends entries to actor’s journal if, and only if, its last entry is at expected. Read more
Source§

fn read( &self, actor: &NamedNode, from: Position, ) -> Result<Vec<JournalRecord>, StoreError>

The entries of actor’s journal from position from (inclusive; 0 reads from the start) to the head, in order. Read more
Source§

fn head(&self, actor: &NamedNode) -> Result<Position, StoreError>

The position of actor’s last entry, 0 for an empty journal. Read more
Source§

fn actors(&self) -> Result<Vec<NamedNode>, StoreError>

Every actor with at least one entry. Read more
Source§

fn supports_fencing(&self) -> bool

True when the store enforces fencing tokens.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

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

Source§

fn vzip(self) -> V