pub struct Database { /* private fields */ }Expand description
The SQLite Database interface.
This can be shared between threads via clone, but only one operation may occur at a time.
Implementations§
Source§impl Database
impl Database
Sourcepub fn new(path: &Path) -> Result<Self>
pub fn new(path: &Path) -> Result<Self>
Create a new database at the given path, with all migrations applied
§Panics
- if database creation fails
- if database migration fails
Sourcepub fn new_default_path() -> Result<Self>
pub fn new_default_path() -> Result<Self>
Sourcepub fn get_connection(&self) -> MutexGuard<'_, Connection>
pub fn get_connection(&self) -> MutexGuard<'_, Connection>
Get a lock to the underlying connection to start operations.
Sourcepub fn scan_path(
&self,
path: &Path,
config: &ServerOverlay,
replace_metadata: bool,
) -> Result<()>
pub fn scan_path( &self, path: &Path, config: &ServerOverlay, replace_metadata: bool, ) -> Result<()>
Scan the given path recursively, limited to [ServerOverlay::get_library_scan_depth].
If replace_metadata is false then paths that already exist in the database will not be updated.
Waits for a permit before starting another worker.
Sourcepub fn run_cleanup(&self)
pub fn run_cleanup(&self)
Spawn a worker to cleanup the database.
This includes removing unreferenced albums and artists.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Database
impl !RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl !UnwindSafe for Database
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request