pub trait LinkStore {
// Required methods
fn create(
&mut self,
references: &[LinkId],
metadata: LinkMetadata,
) -> Result<LinkId, StorageError>;
fn read(&self, id: LinkId) -> Result<Option<Link>, StorageError>;
fn update(
&mut self,
id: LinkId,
references: &[LinkId],
metadata: LinkMetadata,
) -> Result<bool, StorageError>;
fn delete(&mut self, id: LinkId) -> Result<bool, StorageError>;
fn search(&self, query: &LinkStoreQuery) -> Result<Vec<Link>, StorageError>;
// Provided method
fn count(&self, query: &LinkStoreQuery) -> Result<usize, StorageError> { ... }
}Expand description
Storage trait for create/read/update/delete/search over meta-language links.
Required Methods§
Sourcefn create(
&mut self,
references: &[LinkId],
metadata: LinkMetadata,
) -> Result<LinkId, StorageError>
fn create( &mut self, references: &[LinkId], metadata: LinkMetadata, ) -> Result<LinkId, StorageError>
Creates a link and returns its stable id.
§Errors
Returns StorageError when the backend cannot write the link.
Sourcefn update(
&mut self,
id: LinkId,
references: &[LinkId],
metadata: LinkMetadata,
) -> Result<bool, StorageError>
fn update( &mut self, id: LinkId, references: &[LinkId], metadata: LinkMetadata, ) -> Result<bool, StorageError>
Replaces an existing link’s references and metadata.
§Errors
Returns StorageError when the backend cannot write the update.
Sourcefn search(&self, query: &LinkStoreQuery) -> Result<Vec<Link>, StorageError>
fn search(&self, query: &LinkStoreQuery) -> Result<Vec<Link>, StorageError>
Returns links matching query.
§Errors
Returns StorageError when the backend cannot search its storage.
Provided Methods§
Sourcefn count(&self, query: &LinkStoreQuery) -> Result<usize, StorageError>
fn count(&self, query: &LinkStoreQuery) -> Result<usize, StorageError>
Counts links matching query.
§Errors
Returns StorageError when the backend cannot search its storage.
Implementors§
impl LinkStore for EngineNetwork
impl LinkStore for ReadOnlyNetwork
impl LinkStore for LinkNetwork
impl LinkStore for DoubletsLinkStore
Available on crate feature
doublets only.