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(config: &ServerOverlay) -> Result<Self>
pub fn new(config: &ServerOverlay) -> Result<Self>
§Panics
- if app config path creation fails
- if any required database operation fails
Sourcepub fn sync_database(&mut self, path: &Path)
pub fn sync_database(&mut self, path: &Path)
Synchronize the database with the on-disk paths (insert, update, remove), limited to path
root
Sourcepub fn get_all_records(&mut self) -> Result<Vec<TrackDB>>
pub fn get_all_records(&mut self) -> Result<Vec<TrackDB>>
Get all Tracks in the database at once
Sourcepub fn get_record_by_criteria(
&mut self,
criteria_val: &str,
criteria: &SearchCriteria,
) -> Result<Vec<TrackDB>>
pub fn get_record_by_criteria( &mut self, criteria_val: &str, criteria: &SearchCriteria, ) -> Result<Vec<TrackDB>>
Get Tracks by SearchCriteria
Sourcepub fn get_criterias(
&mut self,
criteria: &SearchCriteria,
) -> Result<Vec<String>>
pub fn get_criterias( &mut self, criteria: &SearchCriteria, ) -> Result<Vec<String>>
Get a list of available distinct SearchCriteria
(ie get Artist names deduplicated)
Sourcepub fn get_last_position(&mut self, track: &Track) -> Result<Duration>
pub fn get_last_position(&mut self, track: &Track) -> Result<Duration>
Get the stored last_position
of a given track
Sourcepub fn set_last_position(
&mut self,
track: &Track,
last_position: Duration,
) -> Result<()>
pub fn set_last_position( &mut self, track: &Track, last_position: Duration, ) -> Result<()>
Set the stored last_position
of a given track
Sourcepub fn get_record_by_path(&mut self, file_path: &str) -> Result<TrackDB>
pub fn get_record_by_path(&mut self, file_path: &str) -> Result<TrackDB>
Get a Track by the given full file path
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