actions

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2019 License: GPL-3.0 Imports: 35 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

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

ErrHandleTaken is for when a peername is already taken

Functions

func AddDataset

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

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 ConvertBodyFile added in v0.5.4

func ConvertBodyFile(file qfs.File, in, out *dataset.Structure, limit, offset int, all bool) (data []byte, err error)

ConvertBodyFile takes an input file & structure, and converts a specified selection to the structure specified by out

func DatasetHead

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

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

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

DeleteDataset removes a dataset from the store

func DiffDatasets

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 ExecTransform

func ExecTransform(node *p2p.QriNode, ds *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(node *p2p.QriNode, ds *repo.DatasetRef, limit, offset int, RPC, publishedOnly 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 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 Pin added in v0.6.1

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

Pin asks a registry to host a copy of a dataset

func Publish

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

Publish a dataset to a repo's specified registry

func Recall added in v0.6.0

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

Recall loads revisions of a dataset from history

func RegistryDataset added in v0.6.1

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 added in v0.6.1

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 ResolveDatasetRef

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

func SaveDataset added in v0.6.0

func SaveDataset(node *p2p.QriNode, changes *dataset.Dataset, secrets map[string]string, scriptOut io.Writer, dryRun, pin, convertFormatToPrev bool) (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, destroying a user's privateKey and removing local qri data

func Unpin added in v0.6.1

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

Unpin reverses the pin process

func Unpublish

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

Unpublish a dataset from a repo's specified registry

func UpdateRemoteDataset added in v0.7.0

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

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

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.

Jump to

Keyboard shortcuts

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