pub struct DoubletsLinkStore { /* private fields */ }Expand description
File-mapped binary storage backed by doublets-rs.
Implementations§
Source§impl DoubletsLinkStore
impl DoubletsLinkStore
Sourcepub fn create_file(path: impl AsRef<Path>) -> Result<Self, StorageError>
pub fn create_file(path: impl AsRef<Path>) -> Result<Self, StorageError>
Creates a new empty file-mapped doublets store at path.
Any existing file at path is removed first.
§Errors
Returns StorageError when the file cannot be created or initialized.
Sourcepub fn open_file(path: impl AsRef<Path>) -> Result<Self, StorageError>
pub fn open_file(path: impl AsRef<Path>) -> Result<Self, StorageError>
Opens an existing file-mapped doublets store, creating the file when it does not yet exist.
§Errors
Returns StorageError when the file cannot be opened or the doublets
store cannot be initialized.
Sourcepub fn replace_with_network(
&mut self,
network: &LinkNetwork,
) -> Result<(), StorageError>
pub fn replace_with_network( &mut self, network: &LinkNetwork, ) -> Result<(), StorageError>
Replaces the logical binary contents with a lossless encoding of
network.
§Errors
Returns StorageError when the file-mapped doublets store cannot be
updated.
Sourcepub fn snapshot_path(path: impl AsRef<Path>) -> PathBuf
pub fn snapshot_path(path: impl AsRef<Path>) -> PathBuf
Returns the durable companion snapshot path for a doublets store path.
Sourcepub fn to_network(&self) -> Result<LinkNetwork, StorageError>
pub fn to_network(&self) -> Result<LinkNetwork, StorageError>
Reconstructs a LinkNetwork from this binary store.
§Errors
Returns StorageError when the binary data is malformed.
Sourcepub fn create_with_id(
&mut self,
id: LinkId,
references: &[LinkId],
metadata: &LinkMetadata,
registered_term: bool,
) -> Result<(), StorageError>
pub fn create_with_id( &mut self, id: LinkId, references: &[LinkId], metadata: &LinkMetadata, registered_term: bool, ) -> Result<(), StorageError>
Creates a logical link using an explicit id.
This is used by network import paths to preserve text and binary id
equivalence. Normal callers can use LinkStore::create.
§Errors
Returns StorageError when the id already exists or the backend
cannot write the physical records.
Trait Implementations§
Source§impl LinkStore for DoubletsLinkStore
Available on crate feature doublets only.
impl LinkStore for DoubletsLinkStore
doublets only.Source§fn create(
&mut self,
references: &[LinkId],
metadata: LinkMetadata,
) -> Result<LinkId, StorageError>
fn create( &mut self, references: &[LinkId], metadata: LinkMetadata, ) -> Result<LinkId, StorageError>
Source§fn read(&self, id: LinkId) -> Result<Option<Link>, StorageError>
fn read(&self, id: LinkId) -> Result<Option<Link>, StorageError>
Source§fn 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>
Source§fn delete(&mut self, id: LinkId) -> Result<bool, StorageError>
fn delete(&mut self, id: LinkId) -> Result<bool, StorageError>
Source§fn search(&self, query: &LinkStoreQuery) -> Result<Vec<Link>, StorageError>
fn search(&self, query: &LinkStoreQuery) -> Result<Vec<Link>, StorageError>
query. Read moreSource§fn count(&self, query: &LinkStoreQuery) -> Result<usize, StorageError>
fn count(&self, query: &LinkStoreQuery) -> Result<usize, StorageError>
query. Read moreAuto Trait Implementations§
impl Freeze for DoubletsLinkStore
impl RefUnwindSafe for DoubletsLinkStore
impl Send for DoubletsLinkStore
impl Sync for DoubletsLinkStore
impl Unpin for DoubletsLinkStore
impl UnsafeUnpin for DoubletsLinkStore
impl UnwindSafe for DoubletsLinkStore
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more