mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[PR #582] [MERGED] Refactor Cache and remove Volume struct #981
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#981
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/librespot-org/librespot/pull/582
Author: @Johannesd3
Created: 1/26/2021
Status: ✅ Merged
Merged: 2/2/2021
Merged by: @sashahilton00
Base:
dev← Head:refactor_cache_remove_volume📝 Commits (4)
14a004fRefactored Cachefa5c9f7Made locations in cache optionalfd1f049Removed volume structefedc67Handle cache full situation📊 Changes
7 files changed (+159 additions, -155 deletions)
View changed files
📝
audio/src/fetch.rs(+1 -1)📝
connect/src/spirc.rs(+1 -2)📝
core/src/authentication.rs(+1 -28)📝
core/src/cache.rs(+128 -78)📝
core/src/lib.rs(+0 -1)➖
core/src/volume.rs(+0 -33)📝
src/main.rs(+28 -12)📄 Description
This PR suggest a refactor of Cache.
The
Volumestruct was removed, since its only purpose was to read and write a single integer in a file. Its logic was moved toCache, as well as the functions to storeCredentials to disk. It recently became possible to split audio and system cache (#506), so this PR makes the paths instruct Cacheoptional. Also, error handling and logging was improved. It contains some breaking changes.Here are some random thoughts and questions about the cache I had while writing this PR. Some of this is stuff for future PRs.
Cachefeels now very "threefold". The struct could neatly be divided into three independent structs. It's basically twice the same code for volume and credentials, and even the code for audio files is similar. Is there any abstraction possible to avoid repetition?(This functioniality is currently not present in this branch but could be added again.)In #34 and #558 was suggested to limit the cache size. Any smart solutions for these problems?🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.