You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds transfers between stores to external attachments (#1358)
This PR follows on from #1320, and adds support for:
- Moving attachments between stores
- Basic configuration of external attachments using environment variables
This allows a user to change the document's store, then transfer all of the attachments from their current store(s) to the new default.
This includes transfers from internal (SQLite) storage to external storage, external to internal, and external to external (e.g MinIO to filesystem).
This PR also introduces the concept of "labels", which are an admin-friendly way to refer to a store, and map 1-to-1 with store IDs. Labels don't need to be unique between instances, only within an instance.
### User-facing changes:
- Adds API endpoints to:
- Migrate all attachments from their current store to the store set for that document
- Check on the status of transfers
- Get and set the store for a document
- Adds an environment variable for setting external attachments behaviour `GRIST_EXTERNAL_ATTACHMENTS_MODE`
- `test` mode sets Grist to use a temporary folder in the filesystem.
- `snapshots` mode sets Grist to use the external storage currently used for snapshots, to also be used for attachments.
### Internal changes:
- Adds methods to AttachmentFileManager to facilitate transfers from one storage to another.
- Exposes new methods on ActiveDoc for triggering transfers, retrieving transfer status and setting the store.
- Refactors how DocStorage provides access to attachment details
- Adds a way to retrieve attachment config from env vars, and use them to decide which stores will be available.
- Adds a `snapshot` external storage provider, that uses an attachment-compatible external storage for attachments.
All of the logic behind these changes should be documented in the source code with comments.
0 commit comments