Skip to content

Add multi storage driver#751

Draft
SuperSandro2000 wants to merge 1 commit into
masterfrom
multi-storage-driver
Draft

Add multi storage driver#751
SuperSandro2000 wants to merge 1 commit into
masterfrom
multi-storage-driver

Conversation

@SuperSandro2000

Copy link
Copy Markdown
Member

No description provided.

@SuperSandro2000
SuperSandro2000 force-pushed the multi-storage-driver branch 3 times, most recently from 5a4ed86 to 7038a58 Compare July 20, 2026 11:02
Comment thread internal/drivers/multi/storage.go
Comment thread internal/drivers/multi/storage.go Outdated
Comment thread internal/drivers/multi/storage.go Outdated
Comment thread internal/drivers/multi/storage.go Outdated
@SuperSandro2000 SuperSandro2000 changed the title TMP multi storage driver Add multi storage driver Jul 20, 2026
@sapcc sapcc deleted a comment from github-actions Bot Jul 20, 2026
@SuperSandro2000
SuperSandro2000 requested a review from majewsky July 20, 2026 14:36
Comment thread internal/drivers/multi/storage.go
Comment thread internal/drivers/multi/storage.go Outdated
Comment thread internal/drivers/multi/storage.go Outdated
Comment thread internal/drivers/multi/storage.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new “multi” storage driver intended to support migration between two storage backends, and extends the storage driver interface to provide validation-time reads that can trigger on-demand migration.

Changes:

  • Added ReadBlobForValidation / ReadManifestForValidation to keppel.StorageDriver and updated validation paths to use them.
  • Introduced a new internal/drivers/multi storage driver that can read from the “new” backend first and fall back to “old”, copying on first validation.
  • Centralized the blob chunk size constant as keppel.ChunkSizeBytes.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
internal/processor/manifests.go Uses ReadManifestForValidation() during manifest validation to enable migration-on-validation.
internal/processor/blobs.go Uses ReadBlobForValidation() during blob validation; switches chunking to keppel.ChunkSizeBytes.
internal/keppel/utils.go Defines ChunkSizeBytes as a shared chunking constant.
internal/keppel/storage_driver.go Extends the StorageDriver interface with validation-specific read methods.
internal/drivers/trivial/storage.go Implements the new validation read methods by delegating to existing reads.
internal/drivers/openstack/swift.go Implements the new validation read methods by delegating to existing reads.
internal/drivers/filesystem/storage.go Implements the new validation read methods by delegating to existing reads.
internal/drivers/multi/storage.go Adds the new multi storage driver with migration-on-validation logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/drivers/multi/storage.go
Comment thread internal/drivers/multi/storage.go Outdated
Comment thread internal/drivers/multi/storage.go
Comment thread internal/drivers/multi/storage.go
Comment on lines +183 to +186
reader, sizeBytes, err := d.newDriver.ReadBlob(ctx, account, storageID)
if errors.Is(err, os.ErrNotExist) {
reader, sizeBytes, err = d.oldDriver.ReadBlob(ctx, account, storageID)
if err != nil {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@majewsky that should not be a problem for us, right? Or do we want to write tests e2e tests for this?

Comment thread internal/drivers/multi/storage.go Outdated
Comment thread internal/drivers/multi/storage.go Outdated
Comment thread internal/keppel/storage_driver.go
@github-actions

Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/sapcc/keppel/internal/drivers/filesystem 0.00% (ø)
github.com/sapcc/keppel/internal/drivers/multi 0.00% (ø)
github.com/sapcc/keppel/internal/drivers/openstack 0.00% (ø)
github.com/sapcc/keppel/internal/drivers/trivial 0.00% (ø)
github.com/sapcc/keppel/internal/keppel 83.55% (ø)
github.com/sapcc/keppel/internal/processor 83.64% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/sapcc/keppel/internal/drivers/filesystem/storage.go 0.00% (ø) 0 0 0
github.com/sapcc/keppel/internal/drivers/multi/storage.go 0.00% (ø) 0 0 0
github.com/sapcc/keppel/internal/drivers/openstack/swift.go 0.00% (ø) 0 0 0
github.com/sapcc/keppel/internal/drivers/trivial/storage.go 0.00% (ø) 0 0 0
github.com/sapcc/keppel/internal/keppel/storage_driver.go 87.50% (ø) 88 77 11
github.com/sapcc/keppel/internal/keppel/utils.go 89.19% (ø) 407 363 44
github.com/sapcc/keppel/internal/processor/blobs.go 70.45% (ø) 792 558 234
github.com/sapcc/keppel/internal/processor/manifests.go 83.87% (ø) 2418 2028 390

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants