Documentation
¶
Index ¶
- type Cache
- func (c *Cache) Invalidate(libraryID string)
- func (c *Cache) PrebuildCmd(libraryID, libraryMediaType string) tea.Cmd
- func (c *Cache) Prepare(ctx context.Context, libraryID, libraryMediaType string) error
- func (c *Cache) Search(_ context.Context, libraryID, libraryMediaType, query string) ([]abs.LibraryItem, error)
- func (c *Cache) TryGetAll(libraryID, libraryMediaType string) ([]abs.LibraryItem, bool)
- type CacheReadyMsg
- type PersistedEntry
- type PersistedSnapshot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache keeps lightweight per-library search snapshots in memory.
func (*Cache) Invalidate ¶ added in v0.3.0
Invalidate removes the cached search snapshot for a library.
func (*Cache) PrebuildCmd ¶ added in v0.4.0
PrebuildCmd returns a tea.Cmd that builds the search cache in the background.
func (*Cache) Prepare ¶
Prepare ensures the library snapshot exists before the user starts searching.
func (*Cache) Search ¶
func (c *Cache) Search(_ context.Context, libraryID, libraryMediaType, query string) ([]abs.LibraryItem, error)
Search returns search results from the cached snapshot of a library. The command palette calls it in the Update loop, so it does not wait for the network: if no snapshot is ready, it returns no results and builds the snapshot in the background.
type CacheReadyMsg ¶ added in v0.4.0
type CacheReadyMsg struct {
LibraryID string
}
CacheReadyMsg signals that the cache for a library is built.
type PersistedEntry ¶ added in v0.3.0
type PersistedEntry struct {
ItemID string
LibraryID string
MediaType string
Title string
Author string
Duration float64
SeriesID string
SeriesName string
EpisodeID string
EpisodeTitle string
PrimarySearchText string
SecondarySearchText string
CombinedSearchText string
FuzzySearchText string
PrimaryTokens []string
CombinedTokens []string
}
PersistedEntry is a gob-serializable representation of snapshotEntry.
type PersistedSnapshot ¶ added in v0.3.0
type PersistedSnapshot struct {
LibraryID string
MediaType string
BuiltAt time.Time
LastAccessedAt time.Time
Entries []PersistedEntry
Items []abs.LibraryItem
}
PersistedSnapshot is a gob-serializable representation of a librarySnapshot for disk cache persistence.