dataset

package
v0.0.0-...-f2d0646 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2016 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatasetRe = regexp.MustCompile(`[a-zA-Z0-9\-_/]+`)

Functions

This section is empty.

Types

type CommitOptions

type CommitOptions struct {
	// Parents, if provided is the parent commits of the commit we are creating.
	Parents types.Set
	Meta    types.Struct
}

CommitOptions is used to pass options into Commit.

type Dataset

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

func NewDataset

func NewDataset(db datas.Database, datasetID string) Dataset

func (*Dataset) Commit

func (ds *Dataset) Commit(v types.Value, opts CommitOptions) (Dataset, error)

Commit updates the commit that a dataset points at. The new Commit struct is constructed using `v`, `opts.Parents`, and `opts.Meta`. If `opts.Parents` is the zero value (`types.Set{}`) then the current head is used. If `opts.Meta is the zero value (`types.Struct{}`) then a fully initialized empty Struct is passed to NewCommit. If the update cannot be performed, e.g., because of a conflict, CommitWith returns an 'ErrMergeNeeded' error and the current snapshot of the dataset so that the client can merge the changes and try again.

func (*Dataset) CommitValue

func (ds *Dataset) CommitValue(v types.Value) (Dataset, error)

CommitValue updates the commit that a dataset points at. The new Commit struct is constructed using v and the current Head. If the update cannot be performed, e.g., because of a conflict, Commit returns an 'ErrMergeNeeded' error and the current snapshot of the dataset so that the client can merge the changes and try again.

func (*Dataset) Database

func (ds *Dataset) Database() datas.Database

func (*Dataset) FastForward

func (ds *Dataset) FastForward(newHeadRef types.Ref) (sink Dataset, err error)

FastForward takes a types.Ref to a Commit object and makes it the new Head of ds iff it is a descendant of the current Head. Intended to be used e.g. after a call to Pull(). If the update cannot be performed, e.g., because another process moved the current Head out from under you, err will be non-nil. The newest snapshot of the Dataset is always returned, so the caller an easily retry using the latest.

func (*Dataset) Head

func (ds *Dataset) Head() types.Struct

Head returns the current head Commit, which contains the current root of the Dataset's value tree.

func (*Dataset) HeadRef

func (ds *Dataset) HeadRef() types.Ref

func (*Dataset) HeadValue

func (ds *Dataset) HeadValue() types.Value

HeadValue returns the Value field of the current head Commit.

func (*Dataset) ID

func (ds *Dataset) ID() string

func (*Dataset) MaybeHead

func (ds *Dataset) MaybeHead() (types.Struct, bool)

MaybeHead returns the current Head Commit of this Dataset, which contains the current root of the Dataset's value tree, if available. If not, it returns a new Commit and 'false'.

func (*Dataset) MaybeHeadRef

func (ds *Dataset) MaybeHeadRef() (types.Ref, bool)

func (*Dataset) MaybeHeadValue

func (ds *Dataset) MaybeHeadValue() (types.Value, bool)

MaybeHeadValue returns the Value field of the current head Commit, if avaliable. If not it returns nil and 'false'.

func (*Dataset) Pull

func (ds *Dataset) Pull(sourceDB datas.Database, sourceRef types.Ref, concurrency int, progressCh chan datas.PullProgress)

Pull objects that descend from sourceRef in srcDB into sinkDB, using at most the given degree of concurrency. Progress will be reported over progressCh as the algorithm works. Objects that are already present in ds will not be pulled over.

func (*Dataset) SetHead

func (ds *Dataset) SetHead(newHeadRef types.Ref) (sink Dataset, err error)

SetHead takes a types.Ref to a Commit object and makes it the new Head of ds. Intended to be used e.g. when rewinding in ds' Commit history. If the update cannot be performed, e.g., because the state of ds.Database() changed out from under you, err will be non-nil. The newest snapshot of the Dataset is always returned, so the caller an easily retry using the latest.

Jump to

Keyboard shortcuts

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