Closed bajtos closed 1 year ago
Why is this a problem: we don't want to back up the content cached by the Saturn L2 Node to the user's iCloud account, do we?
Hmm, I don't know. We're promising that the folder passed to modules will be persisted, as the module is also expected to store the metrics count in there. A cache folder makes sense for the Saturn L2 module's file storage, but not for the metrics file, and not for arbitrary files that any module can store.
Use this directory to write any app-specific support files that your app can re-create easily.
This is true for the L2 cache, but not the metrics and also not other files necessarily.
What do you think?
Neither is optimal, agreed, but I think the more persisted a location is, the more correct it is.
You quoted above:
In iOS, the contents of this directory are backed up by iTunes and iCloud.
This isn't running in iOS, only macOS.
We're promising that the folder passed to modules will be persisted, as the module is also expected to store the metrics count in there. A cache folder makes sense for the Saturn L2 module's file storage, but not for the metrics file, and not for arbitrary files that any module can store.
It makes me wonder when are the files in the cache folder deleted. I remember that Windows offer an action to get more free space by removing temporary files. If that deletes app caches but leaves other app data in place, then we definitely want to store our counters in the app data, not the app cache folder.
IMO, this tells us that we need more than one directory.
In iOS, the contents of this directory are backed up by iTunes and iCloud.
This isn't running in iOS, only macOS.
Yeah, the docs are not the best.
In my macOS Time Machine settings, I see that ~/Library/Caches
is excluded from backups, but ~/Library/Application Support
is not.
At the same time, many directories inside Application Support
are excluded from backups via filesystem metadata (see this AskDifferent response for more details: https://apple.stackexchange.com/a/25833/51077).
It could be a viable option to exclude cache files from backups using filesystem metadata. I don't think that's something for modules to implement though, IMO it should be handled by Station and/or Zinnia.
Sgtm, exposing multiple directories is reasonable for module builders and maps to concepts existing in all major operating systems 👍
Sgtm, exposing multiple directories is reasonable for module builders and maps to concepts existing in all major operating systems 👍
In that case, I propose to rework ROOT_DIR to STATE_DIR and CACHE_DIR - both in Desktop Core and Zinniad. WDYT?
Sounds good to me!
In that case, I propose to rework ROOT_DIR to STATE_DIR and CACHE_DIR - both in Desktop Core and Zinniad. WDYT?
Opened an ADR here: https://github.com/filecoin-station/zinnia/pull/152
Closing in favour of follow-up issues:
Station Core tells modules to store state files in
~/Library/Application Support
:https://github.com/filecoin-station/core/blob/ac03923e1dc0494fa82e7a50760f16dd430fbc2b/lib/paths.js#L31-L37
According to Apple File System Conventions, these files are backed up by iTunes and iCloud.
I am proposing to change Station Core to use the cache path instead, the same way as Station Desktop does.
https://github.com/filecoin-station/desktop/blob/7ab56a4479ec1fe96bceed1c3c787cc365d9ca6f/main/consts.js#L30-L31
Quoting from File System Conventions:
See also macOS Library Directory Details: