Documentation
¶
Overview ¶
Package storagemigration implements the engine that copies an instance's object-storage content (files, versions, avatar) from one VFS backend to another, without touching the shared CouchDB index. It is used to move an instance's files between Swift and S3 — either direction, S3 to Swift as well as Swift to S3 — while all other instances sharing the same CouchDB cluster keep working against the same io.cozy.files / io.cozy.files.versions documents.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// To is the target storage scheme: config.SchemeS3 or config.SchemeSwift.
To string
// DryRun reports source content without blocking the instance, copying,
// verifying the target, or switching backends, including with FlagOnly.
DryRun bool
// FlagOnly switches to an already-populated target without copying.
FlagOnly bool
// Force acknowledges that FlagOnly may discard writes made since cutover.
Force bool
// PurgeSource deletes the source backend's objects after a successful
// flip. It is a best-effort cleanup performed once the instance is
// already fully served from the target: a failure here does not revert
// the flip.
//
// If To already equals the instance's current storage scheme,
// PurgeSource switches Migrate into purge-only mode: nothing is copied,
// verified, or flipped, and only the OTHER backend's leftover data for
// this instance is deleted. This is what makes a deferred reclaim
// (running --purge-source well after the flip, or retrying an inline
// purge that failed) possible.
PurgeSource bool
}
Options configures a call to Migrate.
type Report ¶
Report summarizes copied content, or source content for a dry-run or flag-only migration.
func Migrate ¶
Migrate moves an instance's object-storage content (files, versions, avatar) from its current backend to opts.To, verifies the copy, and only then flips the instance's FsScheme to the target. The instance is blocked (instance.BlockedMoving) for the duration of the copy/verify, then its previous block state is restored on every return path.
FsScheme is updated ONLY after verification succeeds. A DryRun only reports source content and leaves the instance unchanged.
If opts.To already equals the instance's current storage scheme AND opts.PurgeSource is set, Migrate runs in purge-only mode instead: see purgeOnly. Without PurgeSource, opts.To == the current scheme is still an error.