Documentation
¶
Overview ¶
Package librarycache stores complete account library snapshots on disk.
Package librarycache defines the persistent library snapshot contract.
Index ¶
- Variables
- type Cache
- type Snapshot
- type Store
- func (s *Store) Generation(account string) uint64
- func (s *Store) Load(account string) (Snapshot, error)
- func (s *Store) PreparePurge(account string) func() error
- func (s *Store) Purge(account string) error
- func (s *Store) PurgeAll() error
- func (s *Store) Save(account string, generation, revision uint64, data Snapshot) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotExist = fs.ErrNotExist
ErrNotExist identifies an account without a stored snapshot.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Load(account string) (Snapshot, error)
Generation(account string) uint64
Save(account string, generation, revision uint64, data Snapshot) error
PreparePurge(account string) func() error
Purge(account string) error
PurgeAll() error
}
Cache is the account-scoped library cache used by the app.
type Snapshot ¶
type Snapshot struct {
Playlists []model.Playlist `json:"playlists"`
Listings map[string]model.Listing `json:"listings"`
}
Snapshot contains only complete remote listings.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store serializes writes and fences writes queued before Purge.
func (*Store) Generation ¶
Generation identifies the current account cache epoch. A caller captures it before starting background work and supplies it to Save.
func (*Store) PreparePurge ¶
PreparePurge fences old writes immediately without waiting for file I/O. The returned cleanup can run off the UI loop. A snapshot saved in the new generation before cleanup starts is retained.