qri: github.com/qri-io/qri/actions Index | Files

package actions

import "github.com/qri-io/qri/actions"

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

Package Files

actions.go body.go dag.go dataset.go dataset_head.go dataset_ref.go diff.go list_datasets.go log.go merge_events.go peers.go recall.go setup.go transform.go validate.go

func AddDataset Uses

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 Uses

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

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

func ConnectedQriProfiles Uses

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 Uses

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 Uses

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 Uses

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

DeleteDataset removes a dataset from the store

func DiffDatasets Uses

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 Uses

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 Uses

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 Uses

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

InitIPFS initializes an IPFS repo

func ListDatasets Uses

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 Uses

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

ListPeers lists Peers on the qri network

func Missing Uses

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 Uses

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 Uses

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 Uses

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

NewManifest generates a manifest for a given node

func Recall Uses

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 Uses

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 Uses

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 Uses

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 Uses

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

SetPublishStatus configures the publish status of a stored reference

func Setup Uses

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

Setup provisions a new qri instance

func Teardown Uses

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

Teardown reverses the setup process

func UpdateRemoteDataset Uses

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 Uses

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

type MergeResultEntry Uses

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

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

func (MergeResultEntry) NumConflicts Uses

func (e MergeResultEntry) NumConflicts() int

NumConflicts gets the number of conflicts.

func (MergeResultEntry) NumUpdates Uses

func (e MergeResultEntry) NumUpdates() int

NumUpdates gets the number of updates.

type MergeResultSet Uses

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

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

func MergeRepoEvents Uses

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

MergeRepoEvents tries to merge multiple EventLogs.

func (MergeResultSet) Peer Uses

func (s MergeResultSet) Peer(i int) MergeResultEntry

Peer gets a MegeResultEntry for a single peer.

type SaveDatasetSwitches Uses

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

Package actions imports 31 packages (graph) and is imported by 2 packages. Updated 2019-09-17. Refresh now. Tools for package owners.