branches

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExist = errors.New("branch does not exist")
	ErrExists   = errors.New("a branch already exists by that name")
)

Functions

func Apply

func Apply(ctx context.Context, b Branch, src StoreTriple, fn func(*Snap) (*Snap, error)) error

Apply applies fn to branch, any missing data will be pulled from scratch

func CheckName

func CheckName(name string) error

func CleanupVolume

func CleanupVolume(ctx context.Context, vol Volume) error

func History

func History(ctx context.Context, b Branch, vcop *gotvc.Operator, fn func(ref gdat.Ref, snap Snap) error) error

func IsExists

func IsExists(err error) bool

func IsNotExist

func IsNotExist(err error) bool

func IsValidName

func IsValidName(name string) bool

func SetHead

func SetHead(ctx context.Context, b Branch, src StoreTriple, snap Snap) error

SetHead forcibly sets the head of the branch.

func SyncVolumes

func SyncVolumes(ctx context.Context, dst, src Volume, force bool) error

func TestSpace

func TestSpace(t *testing.T, newSpace func(t testing.TB) Space)

Types

type Annotations

type Annotations = map[string]string

type Branch

type Branch struct {
	Volume      Volume
	Annotations Annotations
	CreatedAt   tai64.TAI64
	Salt        []byte
}

Branch is a Volume plus additional metadata

func CreateIfNotExists

func CreateIfNotExists(ctx context.Context, r Space, k string, params Params) (*Branch, error)

type CryptoSpace

type CryptoSpace struct {
	// contains filtered or unexported fields
}

func (*CryptoSpace) Create

func (r *CryptoSpace) Create(ctx context.Context, name string, params Params) (*Branch, error)

func (*CryptoSpace) Delete

func (r *CryptoSpace) Delete(ctx context.Context, name string) error

func (*CryptoSpace) ForEach

func (r *CryptoSpace) ForEach(ctx context.Context, fn func(string) error) error

func (*CryptoSpace) Get

func (r *CryptoSpace) Get(ctx context.Context, name string) (*Branch, error)

type Layer

type Layer struct {
	Prefix string
	Target Space
}

type MemSpace

type MemSpace struct {
	// contains filtered or unexported fields
}

func (*MemSpace) Create

func (r *MemSpace) Create(ctx context.Context, name string, params Params) (*Branch, error)

func (*MemSpace) Delete

func (r *MemSpace) Delete(ctx context.Context, name string) error

func (*MemSpace) ForEach

func (r *MemSpace) ForEach(ctx context.Context, fn func(string) error) error

func (*MemSpace) Get

func (r *MemSpace) Get(ctx context.Context, name string) (*Branch, error)

type Params

type Params struct {
	Salt []byte
}

func NewParams

func NewParams(public bool) Params

type Snap

type Snap = gotvc.Snap

func GetHead

func GetHead(ctx context.Context, b Branch) (*Snap, error)

GetHead returns the branch head

type Space

type Space interface {
	Get(ctx context.Context, name string) (*Branch, error)
	Create(ctx context.Context, name string, params Params) (*Branch, error)
	Delete(ctx context.Context, name string) error
	ForEach(ctx context.Context, fn func(string) error) error
}

A Space holds named branches.

func NewCryptoSpace

func NewCryptoSpace(inner Space, secret *[32]byte) Space

func NewMem

func NewMem(newStore func() cadata.Store, newCell func() cells.Cell) Space

func NewMultiSpace

func NewMultiSpace(layers []Layer) (Space, error)

type StoreTriple

type StoreTriple struct {
	VC, FS, Raw cadata.Store
}

StoreTriple is an instance of the 3 stores needed to store a Got Snapshot

type Volume

type Volume struct {
	cells.Cell
	VCStore, FSStore, RawStore cadata.Store
}

Volume is a Cell and a set of stores

func (Volume) StoreTriple

func (v Volume) StoreTriple() StoreTriple

Jump to

Keyboard shortcuts

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