This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
backend: Pluggable blob storage interface supporting attachment documents #738
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
Currently, Homebox attachment storage works by reading and writing files on the local filesystem, rooted with the "storage data" directory. The business logic for the mechanics of this attachment file R/W is intertwined inside the attachment and document services, and the attachment API handlers.
This PR proposes decoupling attachment storage from the core business logic behind a generic "blob storage" interface. The underlying motivation of this work is to enable future support for other attachment storage backends--for example, S3, or private object storage, etc. This patch is structured such that someone could easily add a new blobstore implementation based on any storage backend of their choosing.
To accomplish this, this change introduces a new
blobstore
package with only one implementation, backed by the local filesystem, which is behaviorally equivalent to the current attachment storage behavior. Attachment storage works identically both with and without this PR, and this PR is also fully backwards compatible.While I was here, I also used this as an opportunity to fix data directory relocation resiliency. See the inline commentary for details. This required a change to the metadata (DB) storage convention.
Which issue(s) this PR fixes:
(REQUIRED)
Special notes for your reviewer:
(fill-in or delete this section)
Testing
(fill-in or delete this section)
Release Notes
(REQUIRED)