Trait mentat_db::db::MentatStoring
[−]
[src]
pub trait MentatStoring { fn resolve_avs<'a>(&self, avs: &'a [&'a AVPair]) -> Result<AVMap<'a>>; fn begin_tx_application(&self) -> Result<()>; fn insert_non_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity],
search_type: SearchType
) -> Result<()>; fn insert_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity],
search_type: SearchType
) -> Result<()>; fn commit_transaction(&self, tx_id: Entid) -> Result<()>; fn committed_metadata_assertions(
&self,
tx_id: Entid
) -> Result<Vec<(Entid, Entid, TypedValue, bool)>>; }
MentatStoring
will be the trait that encapsulates the storage layer. It is consumed by the
transaction processing layer.
Right now, the only implementation of MentatStoring
is the SQLite-specific SQL schema. In the
future, we might consider other SQL engines (perhaps with different fulltext indexing), or
entirely different data stores, say ones shaped like key-value stores.
Required Methods
fn resolve_avs<'a>(&self, avs: &'a [&'a AVPair]) -> Result<AVMap<'a>>
Given a slice of [a v] lookup-refs, look up the corresponding [e a v] triples.
It is assumed that the attribute a
in each lookup-ref is :db/unique
, so that at most one
matching [e a v] triple exists. (If this is not true, some matching entid e
will be
chosen non-deterministically, if one exists.)
Returns a map &(a, v) -> e, to avoid cloning potentially large values. The keys of the map are exactly those (a, v) pairs that have an assertion [e a v] in the store.
fn begin_tx_application(&self) -> Result<()>
Begin (or prepare) the underlying storage layer for a new Mentat transaction.
Use this to create temporary tables, prepare indices, set pragmas, etc, before the initial
insert_non_fts_searches
invocation.
fn insert_non_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity],
search_type: SearchType
) -> Result<()>
&self,
entities: &'a [ReducedEntity],
search_type: SearchType
) -> Result<()>
fn insert_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity],
search_type: SearchType
) -> Result<()>
&self,
entities: &'a [ReducedEntity],
search_type: SearchType
) -> Result<()>
fn commit_transaction(&self, tx_id: Entid) -> Result<()>
Finalize the underlying storage layer after a Mentat transaction.
Use this to finalize temporary tables, complete indices, revert pragmas, etc, after the
final insert_non_fts_searches
invocation.
fn committed_metadata_assertions(
&self,
tx_id: Entid
) -> Result<Vec<(Entid, Entid, TypedValue, bool)>>
&self,
tx_id: Entid
) -> Result<Vec<(Entid, Entid, TypedValue, bool)>>
Extract metadata-related [e a typed_value added] datoms committed in the given transaction.
Implementations on Foreign Types
impl MentatStoring for Connection
[src]
impl MentatStoring for Connection
fn resolve_avs<'a>(&self, avs: &'a [&'a AVPair]) -> Result<AVMap<'a>>
[src]
fn resolve_avs<'a>(&self, avs: &'a [&'a AVPair]) -> Result<AVMap<'a>>
fn begin_tx_application(&self) -> Result<()>
[src]
fn begin_tx_application(&self) -> Result<()>
Create empty temporary tables for search parameters and search results.
fn insert_non_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity<'a>],
search_type: SearchType
) -> Result<()>
[src]
fn insert_non_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity<'a>],
search_type: SearchType
) -> Result<()>
Insert search rows into temporary search tables.
Eventually, the details of this approach will be captured in https://github.com/mozilla/mentat/wiki/Transacting:-entity-to-SQL-translation.
fn insert_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity<'a>],
search_type: SearchType
) -> Result<()>
[src]
fn insert_fts_searches<'a>(
&self,
entities: &'a [ReducedEntity<'a>],
search_type: SearchType
) -> Result<()>
Insert search rows into temporary search tables.
Eventually, the details of this approach will be captured in https://github.com/mozilla/mentat/wiki/Transacting:-entity-to-SQL-translation.
fn commit_transaction(&self, tx_id: Entid) -> Result<()>
[src]
fn commit_transaction(&self, tx_id: Entid) -> Result<()>
fn committed_metadata_assertions(
&self,
tx_id: Entid
) -> Result<Vec<(Entid, Entid, TypedValue, bool)>>
[src]
fn committed_metadata_assertions(
&self,
tx_id: Entid
) -> Result<Vec<(Entid, Entid, TypedValue, bool)>>