golazy.dev
–
golazy.dev
/
lazyassets
/
assetmigrate
Index
|
Files
package assetmigrate ¶
import "golazy.dev/lazyassets/assetmigrate"
Variables ¶
var ErrSchemaUnsupported ¶
ErrSchemaUnsupported is returned by schema load/dump methods because asset uploads do not have schema snapshots.
var ErrSchemaUnsupported = errors.New("assetmigrate: schema load and dump are not supported")
Functions ¶
func DB ¶
DB returns a lazymigrate DB containing one source migration and one backend.
func DB(ctx context.Context, config Config) (lazymigrate.DB, error)
Types ¶
type Backend ¶
Backend stores asset migration state in object storage and uploads the registry when its source migration is pending.
type Backend struct {
// contains filtered or unexported fields
}
func (b *Backend) DumpSchema ¶
func (b *Backend) DumpSchema(context.Context) ([]byte, error)
func (b *Backend) List ¶
List reports the configured migration as applied when its done marker exists and matches the current asset manifest and upload config.
func (b *Backend) List(ctx context.Context) ([]lazymigrate.BackendMigration, error)
func (b *Backend) LoadSchema ¶
func (b *Backend) LoadSchema(context.Context, []byte) error
func (b *Backend) Run ¶
Run applies the asset upload migration.
func (b *Backend) Run(ctx context.Context, step lazymigrate.Step) error
func (b *Backend) Setup ¶
Setup validates the backend. Object storage metadata is represented by marker objects, so no backend table or bucket is created here.
func (b *Backend) Setup(context.Context) error
type Config ¶
Config describes one asset upload migration.
type Config struct {
Registry *lazyassets.Registry
Storage Storage
ID string
MarkerPrefix string
Mode lazyassets.UnpackMode
UploadPrefix string
WriteManifest bool
StaleAfter time.Duration
HeartbeatEvery time.Duration
WaitMin time.Duration
WaitMax time.Duration
PostDoneRefresh time.Duration
}
type Storage ¶
Storage is the object storage capability required by asset migrations.
type Storage interface {
lazystorage.Storage
lazystorage.Writer
}
Package assetmigrate adapts lazyassets uploads to lazymigrate.