Documentation ¶
Index ¶
- Variables
- type CommitOptions
- type Dataset
- func (ds *Dataset) Commit(v types.Value, opts CommitOptions) (Dataset, error)
- func (ds *Dataset) CommitValue(v types.Value) (Dataset, error)
- func (ds *Dataset) Database() datas.Database
- func (ds *Dataset) FastForward(newHeadRef types.Ref) (sink Dataset, err error)
- func (ds *Dataset) Head() types.Struct
- func (ds *Dataset) HeadRef() types.Ref
- func (ds *Dataset) HeadValue() types.Value
- func (ds *Dataset) ID() string
- func (ds *Dataset) MaybeHead() (types.Struct, bool)
- func (ds *Dataset) MaybeHeadRef() (types.Ref, bool)
- func (ds *Dataset) MaybeHeadValue() (types.Value, bool)
- func (ds *Dataset) Pull(sourceDB datas.Database, sourceRef types.Ref, concurrency int, ...)
- func (ds *Dataset) SetHead(newHeadRef types.Ref) (sink Dataset, err error)
Constants ¶
This section is empty.
Variables ¶
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 (*Dataset) Commit ¶
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 ¶
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) FastForward ¶
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 ¶
Head returns the current head Commit, which contains the current root of the Dataset's value tree.
func (*Dataset) MaybeHead ¶
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) MaybeHeadValue ¶
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 ¶
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.