Skip to main content

ReadStore

Trait ReadStore 

Source
pub trait ReadStore: Send + Sync {
Show 25 methods // Required methods fn load_config<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<AppConfig>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn tracks_page<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 TrackFilter, page: Page, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn tracks_count<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 TrackFilter, ) -> Pin<Box<dyn Future<Output = Result<u32, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn album_tracks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, album_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn artist_tracks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, artist: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn genre_tracks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, genre: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn folder_tracks<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn recently_played<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn artist_sample_tracks<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn top_genre<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn search_corpus<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn tracks_by_keys<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, keys: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn artists<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, u32)>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn genres<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn album<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, album_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Album>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn artist_images<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ArtistImages, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn albums<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<Album>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_queue<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<QueueSnapshot, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn load_playlists<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<PlaylistStore, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn load_server<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<MusicServer>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn meta_get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, cache_key: &'life1 str, kind: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn favorites<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn is_favorite<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, server_id: &'life1 str, ref_: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn dirty_favorites<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn dirty_unlikes<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait;
}
Expand description

The read side of the persistence API — every query, no mutation. Carried as a supertrait of Storage, so any dyn Storage is also a dyn ReadStore.

Required Methods§

Source

fn load_config<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<AppConfig>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load the persisted AppConfig (the single-row JSON blob), or None if the app has never been configured.

Source

fn tracks_page<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 TrackFilter, page: Page, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

One window of a track listing (sorted + filtered in SQL — only this slice is materialized).

Source

fn tracks_count<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 TrackFilter, ) -> Pin<Box<dyn Future<Output = Result<u32, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Total rows a tracks_page filter matches (for the scroll spacer).

Source

fn album_tracks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, album_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One album’s tracks, disc/track-ordered.

Source

fn artist_tracks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, artist: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One artist’s tracks, album/disc/track-ordered.

Source

fn genre_tracks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, genre: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Tracks whose album has this genre, artist/album-ordered.

Source

fn folder_tracks<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Local tracks under a directory (path-prefix match), path-ordered.

Source

fn recently_played<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

This source’s recently-played track keys, newest first (capped).

Source

fn artist_sample_tracks<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, limit: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

One representative (first-inserted) track per artist, artist A→Z — for artist tiles that need a cover without pulling the whole source.

Source

fn top_genre<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The genre with the highest summed play count for a source, if any.

Source

fn search_corpus<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Every track of a source — ONLY for full-text search, which needs the corpus because its Unicode-aware matching can’t be expressed as SQLite LIKE (ASCII-only case folding). Runs on demand when a query is typed, never on page mount. Nothing else may pull a whole source.

Source

fn tracks_by_keys<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, keys: &'life2 [String], ) -> Pin<Box<dyn Future<Output = Result<Vec<Track>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve tracks by track_key, preserving the input order (recents, playlist membership). Missing keys are skipped.

Source

fn artists<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, u32)>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Distinct artists for a source with their track counts, A→Z.

Source

fn genres<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Distinct non-empty album genres for a source, A→Z.

Source

fn album<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source: &'life1 Source, album_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Album>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One album by id.

Source

fn artist_images<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ArtistImages, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Per-artist images: (overrides, photos) — see ArtistImages.

Source

fn albums<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<Vec<Album>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

All albums for a source, ordered by artist then title.

Source

fn load_queue<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<QueueSnapshot, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Reconstruct the queue/progress snapshot from the queue_state row.

Source

fn load_playlists<'life0, 'life1, 'async_trait>( &'life0 self, source: &'life1 Source, ) -> Pin<Box<dyn Future<Output = Result<PlaylistStore, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The PlaylistStore (the active source’s playlists + folders) — the read side of the playlists UI (use_playlists). Writes go through the playlist-scoped ops, never a whole-store save. Scoped to source, the caller’s in-memory active source.

Source

fn load_server<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<MusicServer>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hydrate one server row (creds included) into the in-memory shape — used by server switching so stored creds are reused instead of re-prompting.

Source

fn meta_get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, cache_key: &'life1 str, kind: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Generic metadata-cache read (metadata_cache table): the payload for (cache_key, kind), if cached.

Source

fn favorites<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The favorite refs (track_keys) for a server ("local" for filesystem).

Source

fn is_favorite<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, server_id: &'life1 str, ref_: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Whether ref_ is favorited under server_id.

Source

fn dirty_favorites<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pending-like refs (dirty=1) not yet pushed to the server.

Source

fn dirty_unlikes<'life0, 'life1, 'async_trait>( &'life0 self, server_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, DbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pending-unlike tombstones (dirty=2) not yet pushed to the server.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§