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 registry.go remote.go setup.go transform.go validate.go

Variables

var ErrHandleTaken = fmt.Errorf("handle is taken")

ErrHandleTaken is for when a peername is already taken

func AddDataset Uses

func AddDataset(node *p2p.QriNode, 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(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(node *p2p.QriNode, ref repo.DatasetRef, limit, offset int) (rlog []repo.DatasetRef, err error)

DatasetLog fetches the history of changes to a dataset

func DeleteDataset Uses

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

DeleteDataset removes a dataset from the store

func DiffDatasets Uses

func DiffDatasets(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 DsyncCompletePush Uses

func DsyncCompletePush(node *p2p.QriNode, location, sessionID string) error

DsyncCompletePush completes the send by creating a datasetRef and pinning the dataset

func DsyncSendBlocks Uses

func DsyncSendBlocks(node *p2p.QriNode, location, sessionID string, manifest, diff *dag.Manifest) error

DsyncSendBlocks sends the IPFS blocks to the remote

func DsyncStartPush Uses

func DsyncStartPush(node *p2p.QriNode, dagInfo *dag.Info, location string, ref *repo.DatasetRef) (string, *dag.Manifest, error)

DsyncStartPush posts the dataset's dag.Info to the remote to get a sessionID and diff

func ExecTransform Uses

func ExecTransform(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(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 Pin Uses

func Pin(node *p2p.QriNode, ref repo.DatasetRef) (err error)

Pin asks a registry to host a copy of a dataset

func Publish Uses

func Publish(node *p2p.QriNode, ref repo.DatasetRef) (err error)

Publish a dataset to a repo's specified registry

func Recall Uses

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

Recall loads revisions of a dataset from history

func RegistryDataset Uses

func RegistryDataset(node *p2p.QriNode, ds *repo.DatasetRef) error

RegistryDataset gets dataset info published to the registry, which is usually subset of the full dataset, and not suitable for hash-referencing.

func RegistryList Uses

func RegistryList(node *p2p.QriNode, limit, offset int) (datasets []*repo.DatasetRef, err error)

RegistryList gets a list of the published datasets of a repo's specific registry

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(node *p2p.QriNode, 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 - this looks small now, but in the future we may consider reinforcing p2p network with registry lookups 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(node *p2p.QriNode, changes *dataset.Dataset, secrets map[string]string, scriptOut io.Writer, dryRun, pin, convertFormatToPrev, force, shouldRender bool) (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, destroying a user's privateKey and removing local qri data

func Unpin Uses

func Unpin(node *p2p.QriNode, ref repo.DatasetRef) (err error)

Unpin reverses the pin process

func Unpublish Uses

func Unpublish(node *p2p.QriNode, ref repo.DatasetRef) (err error)

Unpublish a dataset from a repo's specified registry

func UpdateRemoteDataset Uses

func UpdateRemoteDataset(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(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 CompleteParams Uses

type CompleteParams struct {
    SessionID string
}

CompleteParams holds parameters to send when completing a dsync sent to a remote

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 ReceiveParams Uses

type ReceiveParams struct {
    Peername  string
    Name      string
    ProfileID profile.ID
    DagInfo   *dag.Info
}

ReceiveParams hold parameters for receiving daginfo's when running as a remote

type ReceiveResult Uses

type ReceiveResult struct {
    Success      bool
    RejectReason string
    SessionID    string
    Diff         *dag.Manifest
}

ReceiveResult is the result of receiving a posted dataset when running as a remote

Package actions imports 36 packages (graph) and is imported by 2 packages. Updated 2019-07-04. Refresh now. Tools for package owners.