relocate

package
v2.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 14 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")
)

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