relocate

package
v2.17.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package relocate is the one-time backfill that moves referenced file records onto one provider's configured bucket

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingStorageKey is returned when a file record has no storage key to relocate
	ErrMissingStorageKey = errors.New("file has no storage key")
	// ErrUnknownProvider is returned when a record names no provider and its URI has no scheme
	ErrUnknownProvider = errors.New("file records no storage provider")
	// ErrTouchUnsupported is returned when the target provider cannot touch objects
	ErrTouchUnsupported = errors.New("storage provider does not support touching objects")
	// ErrCopyUnsupported is returned when the target provider cannot copy objects between buckets
	ErrCopyUnsupported = errors.New("storage provider does not support copying objects")
	// ErrOpenUnsupported is returned when the source provider cannot stream objects
	ErrOpenUnsupported = errors.New("storage provider does not support streaming objects")
	// ErrKeyChanged is returned when the target stored a transferred object under another key
	ErrKeyChanged = errors.New("storage provider changed the object key")
	// ErrPullFailed is returned when reading the object through the target did not succeed
	ErrPullFailed = errors.New("failed to read object through target bucket")
	// ErrCopyFailed is returned when the target could not copy the object from its current bucket
	ErrCopyFailed = errors.New("failed to copy object into target bucket")
	// ErrResolveSourceFailed is returned when the provider a record is stored on cannot be resolved
	ErrResolveSourceFailed = errors.New("failed to resolve source provider")
	// ErrOpenSourceFailed is returned when the object cannot be opened on its source provider
	ErrOpenSourceFailed = errors.New("failed to open object on source provider")
	// ErrUploadFailed is returned when the object cannot be uploaded to the target
	ErrUploadFailed = errors.New("failed to upload object to target bucket")
	// ErrConfirmFailed is returned when the target bucket cannot be listed to confirm the object landed
	ErrConfirmFailed = errors.New("failed to list target bucket for object")
	// ErrStatFailed is returned when the landed object's metadata cannot be read
	ErrStatFailed = errors.New("failed to read landed object metadata")
	// ErrRepointFailed is returned when the file record cannot be updated to the target
	ErrRepointFailed = errors.New("failed to update file record to target")
)

Functions

func Files

func Files(ctx context.Context, client *ent.Client, plan Plan) error

Files moves every referenced file record onto the plan's target bucket by copy, pull-through read or download and upload under the same key; orphans are left for the file orphan sweep

Types

type Plan

type Plan struct {
	// Target is the provider records are moved onto, in its configured bucket
	Target storage.ProviderType
	// PullFrom is a provider Target fetches from on first read, such as S3 behind R2 Sippy; empty when none
	PullFrom storage.ProviderType
}

Plan names the target provider and how objects reach it

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL