pub struct Database { /* private fields */ }Expand description
An open .ursa database.
Implementations§
Source§impl Database
impl Database
Sourcepub fn open(path: impl AsRef<Path>, options: &OpenOptions) -> Result<Self>
pub fn open(path: impl AsRef<Path>, options: &OpenOptions) -> Result<Self>
Open the database at path, creating it (and its sidecar directory)
unless read-only. A writer takes the lock first, waiting up to
options.lock_timeout, then reads the catalog.
Sourcepub fn dir(&self) -> &Path
pub fn dir(&self) -> &Path
The directory holding the catalog file: stored relative paths are relative to it.
Sourcepub fn sidecar_dir(&self) -> &Path
pub fn sidecar_dir(&self) -> &Path
The sidecar directory, club.ursa.d. It exists unless read-only.
Sourcepub fn index_dir(&self) -> PathBuf
pub fn index_dir(&self) -> PathBuf
Where stored graph indexes go (club.ursa.d/indexes), created on
the first write.
Sourcepub fn index_store(&self) -> Arc<IndexStore> ⓘ
pub fn index_store(&self) -> Arc<IndexStore> ⓘ
The database’s stored graph indexes. A read-only database reads them and never writes.
pub fn is_read_only(&self) -> bool
Sourcepub fn statements(&self) -> Vec<String>
pub fn statements(&self) -> Vec<String>
The catalog’s statements, in replay order.
Sourcepub fn save(&self, statements: Vec<String>) -> Result<()>
pub fn save(&self, statements: Vec<String>) -> Result<()>
Replace the catalog with statements, rewriting the file atomically
(temporary file, fsync, rename). Refused when read-only.
Sourcepub fn stored_location(&self, location: &str, cwd: &Path) -> Option<String>
pub fn stored_location(&self, location: &str, cwd: &Path) -> Option<String>
How the catalog stores location, written in a statement run from
cwd: a local path inside the database’s directory becomes relative to
it, any other local path becomes absolute. None when the location is
stored as written: a URL, a ~/… path, or a path already in its
stored form.
Sourcepub fn replayed_location(&self, location: &str) -> Option<String>
pub fn replayed_location(&self, location: &str) -> Option<String>
location from a stored statement as replay runs it: a relative local
path resolved against the database’s directory; None for anything
else (a URL, an absolute path, ~/…), which runs as stored.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Database
impl Forget for Database
impl RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
impl UnwindSafe for Database
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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