versioning

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0, MIT Imports: 2 Imported by: 43

Documentation

Overview

Package versioning defines top level types for go-ds-versioning

Index

Constants

View Source
const ErrContextCancelled = readyError("context cancelled")

ErrContextCancelled means the context the migrations were run in was cancelled

View Source
const ErrMigrationsNotRun = readyError("Database not migrations must be run or are still running")

ErrMigrationsNotRun is run when ReadyError is called prior to running migrations

Variables

This section is empty.

Functions

This section is empty.

Types

type DatastoreMigration

type DatastoreMigration interface {
	Up(ctx context.Context, oldDs datastore.Batching, newDS datastore.Batching) ([]datastore.Key, error)
}

DatastoreMigration can run a migration of a datastore that is a table of one kind of structured data and write it to a table that is another kind of structured data

type MigrationFunc

type MigrationFunc interface{}

MigrationFunc is a function to transform an single element of one type of data into a single element of another type of data. It has the following form: func<T extends cbg.CBORUnmarshaller, U extends cbg.CBORMarshaller>(old T) (new U, error)

type MigrationState

type MigrationState interface {
	ReadyError() error
}

MigrationState is an interface that returns the current state of migrations being run

type ReversableDatastoreMigration

type ReversableDatastoreMigration interface {
	DatastoreMigration
	Down(ctx context.Context, newDs datastore.Batching, oldDS datastore.Batching) ([]datastore.Key, error)
}

ReversableDatastoreMigration is

type ReversibleVersionedMigration

type ReversibleVersionedMigration interface {
	VersionedMigration
	Down(ctx context.Context, ds datastore.Batching) ([]datastore.Key, error)
}

ReversibleVersionedMigration is a migration that migrates data in a single database between versions, and can be reversed

type VersionKey

type VersionKey string

VersionKey is an identifier for a databased version

type VersionedMigration

type VersionedMigration interface {
	OldVersion() VersionKey
	NewVersion() VersionKey
	Up(ctx context.Context, ds datastore.Batching) ([]datastore.Key, error)
}

VersionedMigration is a migration that migrates data in a single database between versions

type VersionedMigrationList

type VersionedMigrationList []VersionedMigration

VersionedMigrationList is a sortable list of versioned migrations

func (VersionedMigrationList) Len

func (vml VersionedMigrationList) Len() int

Len is the number of elements in the collection.

func (VersionedMigrationList) Less

func (vml VersionedMigrationList) Less(i int, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (VersionedMigrationList) Swap

func (vml VersionedMigrationList) Swap(i int, j int)

Swap swaps the elements with indexes i and j.

Directories

Path Synopsis
Package builder provides a low level interface for defining un-versioned migrations based on a record transformation function
Package builder provides a low level interface for defining un-versioned migrations based on a record transformation function
Package datastore provides an abstraction on top of go-datastore that allows you to make a datastore that tracks its own version and knows how to migrate itself to the target version
Package datastore provides an abstraction on top of go-datastore that allows you to make a datastore that tracks its own version and knows how to migrate itself to the target version
Package fsm provides an abstraction on top of the fsm's defined by go-statemachine that allows you to make a group of finite state machines that tracks their own version and know how to migrate themselves to the target version
Package fsm provides an abstraction on top of the fsm's defined by go-statemachine that allows you to make a group of finite state machines that tracks their own version and know how to migrate themselves to the target version
Package statestore provides an abstraction on top of go-statestore that allows you to make a StateStore that tracks its own version and knows how to migrate itself to the target version
Package statestore provides an abstraction on top of go-statestore that allows you to make a StateStore that tracks its own version and knows how to migrate itself to the target version
Package versioned provides an interface for defining versioned migrations -- migrations that move records from one versioned namespace to another withing go datastore
Package versioned provides an interface for defining versioned migrations -- migrations that move records from one versioned namespace to another withing go datastore

Jump to

Keyboard shortcuts

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