pub struct StoreBuilder { /* private fields */ }Expand description
An artifact under construction.
Rows are buffered in memory, sorted by key, and written in finish, each
table opened once. redb fills pages tightly when keys arrive in order, and
opening a table is not free; the first build wrote every row through its
own open_table in arrival order and took ten minutes for the NL edition.
Implementations§
Source§impl StoreBuilder
impl StoreBuilder
Sourcepub fn create(
path: &Path,
system: &str,
version: &str,
) -> Result<Self, BuildError>
pub fn create( path: &Path, system: &str, version: &str, ) -> Result<Self, BuildError>
Creates the artifact at path, replacing any file there, and records
the layout version, system, and version.
§Errors
Returns BuildError when the file cannot be created.
Sourcepub fn vocabulary(
&mut self,
kind: Vocabulary,
ordinal: u32,
name: &str,
) -> Result<(), BuildError>
pub fn vocabulary( &mut self, kind: Vocabulary, ordinal: u32, name: &str, ) -> Result<(), BuildError>
Names a vocabulary ordinal (a property key, designation use, language reference set, or acceptability).
§Errors
Returns BuildError::Vocabulary when name already has another ordinal.
Sourcepub fn concept(
&mut self,
ordinal: Ordinal,
concept: &Concept,
) -> Result<(), BuildError>
pub fn concept( &mut self, ordinal: Ordinal, concept: &Concept, ) -> Result<(), BuildError>
Adds a concept under ordinal.
§Errors
Cannot fail today; the signature keeps the door open for a full buffer.
Sourcepub fn designation(
&mut self,
ordinal: Ordinal,
index: u32,
designation: &Designation,
) -> Result<(), BuildError>
pub fn designation( &mut self, ordinal: Ordinal, index: u32, designation: &Designation, ) -> Result<(), BuildError>
Adds designation index of concept ordinal.
§Errors
Cannot fail today; the signature keeps the door open for a full buffer.
Sourcepub fn acceptability(
&mut self,
ordinal: Ordinal,
index: u32,
language_refset: u32,
acceptability: u32,
) -> Result<(), BuildError>
pub fn acceptability( &mut self, ordinal: Ordinal, index: u32, language_refset: u32, acceptability: u32, ) -> Result<(), BuildError>
Records the acceptability of a designation in a language reference set.
§Errors
Cannot fail today; the signature keeps the door open for a full buffer.
Sourcepub fn properties(
&mut self,
ordinal: Ordinal,
key: u32,
values: &[PropertyValue],
) -> Result<(), BuildError>
pub fn properties( &mut self, ordinal: Ordinal, key: u32, values: &[PropertyValue], ) -> Result<(), BuildError>
Sets the values of property key on concept ordinal.
§Errors
Cannot fail today; the signature keeps the door open for a full buffer.
Sourcepub fn finish(self, rule: &PreferredRule) -> Result<PathBuf, BuildError>
pub fn finish(self, rule: &PreferredRule) -> Result<PathBuf, BuildError>
Writes every buffered row in key order, computes the preferred designations per language reference set and use, records the concept count, and commits.
§Errors
Returns BuildError when a table cannot be written or the commit fails.