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 saved_settings(&self) -> BTreeMap<String, String>
pub fn saved_settings(&self) -> BTreeMap<String, String>
The settings Ursa 0.8 or 0.9 saved in the catalog, by full name, as
SET takes them. They are not applied (#353).
Sourcepub fn remove_saved_settings(&self) -> Result<()>
pub fn remove_saved_settings(&self) -> Result<()>
Remove the settings 0.8 or 0.9 saved from the catalog, rewriting the file if it has any. Refused when read-only.
Sourcepub fn default_index_storage_limit(&self) -> DefaultLimit
pub fn default_index_storage_limit(&self) -> DefaultLimit
The default ursa.index_storage_limit of this database: 25% of the
free space on its disk plus the indexes it stores, within bounds
(crate::options::default_index_storage_limit). Worked out once,
when first needed, so it does not move while a session runs.
Sourcepub fn index_storage_limit(&self, config: &SessionConfig) -> u64
pub fn index_storage_limit(&self, config: &SessionConfig) -> u64
The ursa.index_storage_limit in effect for the session config
belongs to: what it SET, or the database’s default.
Sourcepub fn use_index_storage_limit(&self, config: &SessionConfig)
pub fn use_index_storage_limit(&self, config: &SessionConfig)
Keep the stored indexes within the limit in effect for the session
config belongs to from now on: the next index stored makes room
within it. Nothing is removed now.
Sourcepub fn save(&self, statements: Vec<String>) -> Result<()>
pub fn save(&self, statements: Vec<String>) -> Result<()>
Replace the catalog’s statements 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 Move 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