gotvc

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEach

func ForEach(ctx context.Context, s cadata.Store, xs []Ref, fn func(Ref, Snapshot) error) error

ForEach calls fn once for each Ref in the snapshot graph.

func IsDescendentOf

func IsDescendentOf(ctx context.Context, s Store, x, a Snapshot) (bool, error)

IsDescendentOf returns true if any of x's parents are equal to a.

func Populate

func Populate(ctx context.Context, s cadata.Store, start Snapshot, set stores.Set, rootFn func(gotfs.Root) error) error

Populate adds all the cadata.IDs reachable from start to set. This will not include the CID for start itself, which has not yet been computed.

func Sync

func Sync(ctx context.Context, src cadata.Store, dst cadata.Store, snap Snapshot, syncRoot func(gotfs.Root) error) error

Sync ensures dst has all of the data reachable from snap.

Types

type Operator

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

func NewOperator

func NewOperator(opts ...Option) Operator

func (*Operator) Check

func (o *Operator) Check(ctx context.Context, s cadata.Store, snap Snapshot, checkRoot func(gotfs.Root) error) error

Check ensures that snapshot is valid.

func (*Operator) GetSnapshot

func (op *Operator) GetSnapshot(ctx context.Context, s Store, ref Ref) (*Snapshot, error)

GetSnapshot retrieves the snapshot referenced by ref from the store.

func (*Operator) NewSnapshot

func (o *Operator) NewSnapshot(ctx context.Context, s cadata.Store, parents []Snapshot, root Root, sinfo SnapInfo) (*Snapshot, error)

func (*Operator) NewZero

func (op *Operator) NewZero(ctx context.Context, s cadata.Store, root Root, sinfo SnapInfo) (*Snapshot, error)

NewZero creates a new snapshot with no parent

func (*Operator) PostSnapshot

func (op *Operator) PostSnapshot(ctx context.Context, s Store, x Snapshot) (*Ref, error)

PostSnapshot marshals the snapshot and posts it to the store

func (*Operator) RefFromSnapshot

func (op *Operator) RefFromSnapshot(snap Snapshot, s cadata.Store) Ref

RefFromSnapshot computes a ref for snap if it was posted to s. It only calls s.Hash and s.MaxSize; it does not mutate s.

func (*Operator) Squash

func (op *Operator) Squash(ctx context.Context, s Store, x Snapshot, n int) (*Snapshot, error)

Squash turns multiple snapshots into one. It preserves the latest version of the data, but destroys versioning granularity

type Option

type Option = func(o *Operator)

func WithSalt

func WithSalt(salt *[32]byte) Option

type Ref

type Ref = gdat.Ref

type Root

type Root = gotfs.Root

type Snap

type Snap = Snapshot

type SnapInfo

type SnapInfo struct {
	CreatedAt  tai64.TAI64
	Creator    string
	AuthoredAt tai64.TAI64
	Authors    []string

	Message string
}

type Snapshot

type Snapshot struct {
	N       uint64     `json:"n"`
	Root    gotfs.Root `json:"root"`
	Parents []gdat.Ref `json:"parents"`

	CreatedAt  tai64.TAI64 `json:"created_at"`
	Creator    string      `json:"creator,omitempty"`
	AuthoredAt tai64.TAI64 `json:"authored_at"`
	Authors    []string    `json:"authors,omitempty"`

	Message string `json:"message"`
}

func (Snapshot) Equals

func (a Snapshot) Equals(b Snapshot) bool

type Store

type Store = cadata.Store

Jump to

Keyboard shortcuts

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