actions

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: GPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package actions provides canonical business logic that operates on Repos to get higher-order functionality. Actions use only Repo methods to do their work, allowing them to be used across any repo.Repo implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDataset

func AddDataset(ctx context.Context, node *p2p.QriNode, rc *remote.Client, remoteAddr string, ref *repo.DatasetRef) (err error)

AddDataset fetches & pins a dataset to the store, adding it to the list of stored refs

func CanResolveEvents

func CanResolveEvents(left repo.Event, right repo.Event) bool

CanResolveEvents determines whether two Events can be resolved, or if they conflict.

func ConnectedQriProfiles

func ConnectedQriProfiles(node *p2p.QriNode) (map[profile.ID]*config.ProfilePod, error)

ConnectedQriProfiles returns a map from ProfileIDs to profiles for each connected node

func DatasetHead

func DatasetHead(ctx context.Context, node *p2p.QriNode, ds *repo.DatasetRef) error

DatasetHead gets commit, structure, meta, viz & transform for a given reference, either from the local repo or by asking peers for it, modifying the input ref on success

func DatasetLog

func DatasetLog(ctx context.Context, node *p2p.QriNode, ref repo.DatasetRef, limit, offset int) (rlog []repo.DatasetRef, err error)

DatasetLog fetches the history of changes to a dataset TODO (b5) - implement remote log fetching

func DeleteDataset

func DeleteDataset(ctx context.Context, node *p2p.QriNode, ref *repo.DatasetRef) (err error)

DeleteDataset removes a dataset from the store

func DiffDatasets

func DiffDatasets(ctx context.Context, node *p2p.QriNode, leftRef, rightRef repo.DatasetRef, all bool, components map[string]bool) (diffs map[string]*dsdiff.SubDiff, err error)

DiffDatasets calculates the difference between two dataset references

func ExecTransform

func ExecTransform(ctx context.Context, node *p2p.QriNode, ds, prev *dataset.Dataset, scriptOut io.Writer, mutateCheck func(...string) error) error

ExecTransform executes a designated transformation

func GetBody added in v0.7.0

func GetBody(node *p2p.QriNode, ds *dataset.Dataset, format dataset.DataFormat, fcfg dataset.FormatConfig, limit, offset int, all bool) (data []byte, err error)

GetBody grabs some or all of a dataset's body, writing an output in the desired format

func InitIPFS

func InitIPFS(path string, cfgData []byte, g gen.CryptoGenerator) error

InitIPFS initializes an IPFS repo

func ListDatasets

func ListDatasets(ctx context.Context, node *p2p.QriNode, ds *repo.DatasetRef, term string, limit, offset int, RPC, publishedOnly, showVersions bool) (res []repo.DatasetRef, err error)

ListDatasets lists a peer's datasets

func ListPeers

func ListPeers(node *p2p.QriNode, limit, offset int, onlineOnly bool) ([]*config.ProfilePod, error)

ListPeers lists Peers on the qri network

func Missing added in v0.6.1

func Missing(node *p2p.QriNode, m *dag.Manifest) (missing *dag.Manifest, err error)

Missing returns a manifest describing blocks that are not in this node for a given manifest

func ModifyDataset added in v0.6.2

func ModifyDataset(node *p2p.QriNode, current, new *repo.DatasetRef, isRename bool) (err error)

ModifyDataset alters a reference by changing what dataset it refers to

func NewDAGInfo added in v0.7.3

func NewDAGInfo(node *p2p.QriNode, path, label string) (*dag.Info, error)

NewDAGInfo generates a DAGInfo for a given node. If a label is given, it will generate a sub-DAGInfo at thea label.

func NewManifest added in v0.6.1

func NewManifest(node *p2p.QriNode, path string) (*dag.Manifest, error)

NewManifest generates a manifest for a given node

func Recall added in v0.6.0

func Recall(ctx context.Context, node *p2p.QriNode, str string, ref repo.DatasetRef) (*dataset.Dataset, error)

Recall loads revisions of a dataset from history

func ReplaceRefIfMoreRecent added in v0.8.2

func ReplaceRefIfMoreRecent(node *p2p.QriNode, prev, curr *repo.DatasetRef) error

ReplaceRefIfMoreRecent replaces the given ref in the ref store, if it is more recent then the ref currently in the refstore

func ResolveDatasetRef

func ResolveDatasetRef(ctx context.Context, node *p2p.QriNode, rc *remote.Client, remoteAddr string, ref *repo.DatasetRef) (local bool, err error)

ResolveDatasetRef uses a node to complete the missing pieces of a dataset reference. The most typical example is completing a human ref like peername/dataset_name with content-addressed identifiers It will first attempt to use the local repo to Canonicalize the reference, falling back to a network call if one isn't found TODO (ramfox) - Canonicalizing a Dataset with no errors is not a good enough tell to see if a dataset is local or not, we have to actually attempt to load it. however, if we are connected to a network, we cannot fully reason if a file is local or from the network. We need to build tools that allow us better control over local only and network actions. Once we have those, we can attempt to load the dataset locally, if it error with DatasetNotFound, or something similar we will know that the dataset does not exist locally

func SaveDataset added in v0.6.0

func SaveDataset(ctx context.Context, node *p2p.QriNode, changes *dataset.Dataset, secrets map[string]string, scriptOut io.Writer, sw SaveDatasetSwitches) (ref repo.DatasetRef, err error)

SaveDataset initializes a dataset from a dataset pointer and data file

func SetPublishStatus added in v0.6.0

func SetPublishStatus(node *p2p.QriNode, ref *repo.DatasetRef, published bool) (err error)

SetPublishStatus configures the publish status of a stored reference

func Setup

func Setup(repoPath, cfgPath string, cfg *config.Config, register bool) error

Setup provisions a new qri instance

func Teardown

func Teardown(repoPath string, cfg *config.Config) error

Teardown reverses the setup process

func UpdateRemoteDataset added in v0.7.0

func UpdateRemoteDataset(ctx context.Context, node *p2p.QriNode, ref *repo.DatasetRef, pin bool) (res repo.DatasetRef, err error)

UpdateRemoteDataset brings a reference to the latest version, syncing to the latest history it can find over p2p & via any configured registry

func Validate

func Validate(ctx context.Context, node *p2p.QriNode, ref repo.DatasetRef, body, schema qfs.File) (errors []jsonschema.ValError, err error)

Validate checks a dataset body for errors based on a schema

Types

type MergeResultEntry

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

MergeResultEntry contains information about how a single peer should update its EventLog.

func (MergeResultEntry) NumConflicts

func (e MergeResultEntry) NumConflicts() int

NumConflicts gets the number of conflicts.

func (MergeResultEntry) NumUpdates

func (e MergeResultEntry) NumUpdates() int

NumUpdates gets the number of updates.

type MergeResultSet

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

MergeResultSet contains information about how to merge a collection of EventLogs.

func MergeRepoEvents

func MergeRepoEvents(one repo.Repo, two repo.Repo) (MergeResultSet, error)

MergeRepoEvents tries to merge multiple EventLogs.

func (MergeResultSet) Peer

Peer gets a MegeResultEntry for a single peer.

type SaveDatasetSwitches added in v0.9.0

type SaveDatasetSwitches struct {
	Replace             bool
	DryRun              bool
	Pin                 bool
	ConvertFormatToPrev bool
	Force               bool
	ShouldRender        bool
}

SaveDatasetSwitches provides toggleable flags to SaveDataset that control save behaviour

Jump to

Keyboard shortcuts

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