actions

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: GPL-3.0 Imports: 29 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 DefaultTemplate = `` /* 1860-byte string literal not displayed */

DefaultTemplate is the template that render will fall back to should no template be available

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 ApplyPath

func ApplyPath(ds *dataset.DatasetPod, path string) (interface{}, error)

ApplyPath gets a dataset value by applying a case.Sensitve.dot.separated.path

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, limit int) ([]*config.ProfilePod, error)

ConnectedQriProfiles gives any currently connected qri profiles to this node

func CreateDataset

func CreateDataset(node *p2p.QriNode, name string, ds *dataset.Dataset, data cafs.File, secrets map[string]string, dryRun, pin bool) (ref repo.DatasetRef, body cafs.File, err error)

CreateDataset initializes a dataset from a dataset pointer and data file

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, infile cafs.File, secrets map[string]string) (file cafs.File, err error)

ExecTransform executes a designated transformation

func InitIPFS

func InitIPFS(path string, cfgData []byte) error

InitIPFS initializes an IPFS repo

func ListDatasets

func ListDatasets(node *p2p.QriNode, ds *repo.DatasetRef, limit, offset int, RPC 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 LookupBody

func LookupBody(node *p2p.QriNode, path string, format dataset.DataFormat, fcfg dataset.FormatConfig, limit, offset int, all bool) (bodyPath string, data []byte, err error)

LookupBody grabs a subset of a dataset's body

func NewDataset

func NewDataset(dsp *dataset.DatasetPod) (ds *dataset.Dataset, body cafs.File, secrets map[string]string, err error)

NewDataset processes dataset input into it's necessary components for creation

func PinDataset

func PinDataset(r repo.Repo, ref repo.DatasetRef) error

PinDataset marks a dataset for retention in a store

func PrepareViz

func PrepareViz(ds *dataset.Dataset) (err error)

PrepareViz loads vizualization bytes from a local filepath

func Publish

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

Publish a dataset to a repo's specified registry

func ReadDataset

func ReadDataset(r repo.Repo, ref *repo.DatasetRef) (err error)

ReadDataset grabs a dataset from the store

func RenameDataset

func RenameDataset(node *p2p.QriNode, current, new *repo.DatasetRef) (err error)

RenameDataset alters a dataset name

func Render

func Render(r repo.Repo, ref repo.DatasetRef, tmplData []byte, limit, offest int, all bool) ([]byte, error)

Render executes a template for a dataset, returning a slice of HTML

func ResolveDatasetRef

func ResolveDatasetRef(n *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 Select

func Select(r repo.Repo, ref repo.DatasetRef, path string) (interface{}, error)

Select loads a dataset value specified by case.Sensitve.dot.separated.paths

func Setup

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

Setup provisions a new qri instance

func Status

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

Status checks to see if a dataset is published to a repo's specific registry

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 UnpinDataset

func UnpinDataset(r repo.Repo, ref repo.DatasetRef) error

UnpinDataset unmarks a dataset for retention in a store

func Unpublish

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

Unpublish a dataset from a repo's specified registry

func UpdateDataset

func UpdateDataset(node *p2p.QriNode, dsp *dataset.DatasetPod) (ds *dataset.Dataset, body cafs.File, secrets map[string]string, err error)

UpdateDataset prepares a set of changes for submission to CreateDataset

func Validate

func Validate(node *p2p.QriNode, ref repo.DatasetRef, body, schema cafs.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