Trait mentat::vocabulary::VersionedStore
[−]
[src]
pub trait VersionedStore: HasVocabularies + HasSchema { fn ensure_vocabulary(
&mut self,
definition: &Definition
) -> Result<VocabularyOutcome>; fn ensure_vocabularies(
&mut self,
vocabularies: &mut VocabularySource
) -> Result<BTreeMap<Keyword, VocabularyOutcome>>; fn check_vocabulary<'definition>(
&self,
definition: &'definition Definition
) -> Result<VocabularyCheck<'definition>> { ... } fn verify_core_schema(&self) -> Result<()> { ... } }
This trait captures the ability of a store to check and install/upgrade vocabularies.
Required Methods
fn ensure_vocabulary(
&mut self,
definition: &Definition
) -> Result<VocabularyOutcome>
&mut self,
definition: &Definition
) -> Result<VocabularyOutcome>
Check whether the provided vocabulary is present in the store. If it isn't, make it so.
fn ensure_vocabularies(
&mut self,
vocabularies: &mut VocabularySource
) -> Result<BTreeMap<Keyword, VocabularyOutcome>>
&mut self,
vocabularies: &mut VocabularySource
) -> Result<BTreeMap<Keyword, VocabularyOutcome>>
Check whether the provided vocabularies are present in the store at the correct
version and with all defined attributes. If any are not, invoke the pre
function on the provided VocabularySource
, install or upgrade the necessary vocabularies,
then invoke post
. Returns Ok
if all of these steps succeed.
Use this function instead of calling ensure_vocabulary
if you need to have pre/post
functions invoked when vocabulary changes are necessary.
Provided Methods
fn check_vocabulary<'definition>(
&self,
definition: &'definition Definition
) -> Result<VocabularyCheck<'definition>>
&self,
definition: &'definition Definition
) -> Result<VocabularyCheck<'definition>>
Check whether the vocabulary described by the provided metadata is present in the store.
fn verify_core_schema(&self) -> Result<()>
Make sure that our expectations of the core vocabulary — basic types and attributes — are met.
Implementors
impl<'a, 'c> VersionedStore for InProgress<'a, 'c>