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 ¶
- func AddDataset(ctx context.Context, node *p2p.QriNode, rc *remote.Client, remoteAddr string, ...) (err error)
- func CanResolveEvents(left repo.Event, right repo.Event) bool
- func ConnectedQriProfiles(node *p2p.QriNode) (map[profile.ID]*config.ProfilePod, error)
- func DatasetHead(ctx context.Context, node *p2p.QriNode, ds *repo.DatasetRef) error
- func DatasetLog(ctx context.Context, node *p2p.QriNode, ref repo.DatasetRef, limit, offset int) (rlog []repo.DatasetRef, err error)
- func DeleteDataset(ctx context.Context, node *p2p.QriNode, ref *repo.DatasetRef) (err error)
- func DiffDatasets(ctx context.Context, node *p2p.QriNode, leftRef, rightRef repo.DatasetRef, ...) (diffs map[string]*dsdiff.SubDiff, err error)
- func ExecTransform(ctx context.Context, node *p2p.QriNode, ds, prev *dataset.Dataset, ...) error
- func GetBody(node *p2p.QriNode, ds *dataset.Dataset, format dataset.DataFormat, ...) (data []byte, err error)
- func InitIPFS(path string, cfgData []byte, g gen.CryptoGenerator) error
- func ListDatasets(ctx context.Context, node *p2p.QriNode, ds *repo.DatasetRef, term string, ...) (res []repo.DatasetRef, err error)
- func ListPeers(node *p2p.QriNode, limit, offset int, onlineOnly bool) ([]*config.ProfilePod, error)
- func Missing(node *p2p.QriNode, m *dag.Manifest) (missing *dag.Manifest, err error)
- func ModifyDataset(node *p2p.QriNode, current, new *repo.DatasetRef, isRename bool) (err error)
- func NewDAGInfo(node *p2p.QriNode, path, label string) (*dag.Info, error)
- func NewManifest(node *p2p.QriNode, path string) (*dag.Manifest, error)
- func Recall(ctx context.Context, node *p2p.QriNode, str string, ref repo.DatasetRef) (*dataset.Dataset, error)
- func ReplaceRefIfMoreRecent(node *p2p.QriNode, prev, curr *repo.DatasetRef) error
- func ResolveDatasetRef(ctx context.Context, node *p2p.QriNode, rc *remote.Client, remoteAddr string, ...) (local bool, err error)
- func SaveDataset(ctx context.Context, node *p2p.QriNode, changes *dataset.Dataset, ...) (ref repo.DatasetRef, err error)
- func SetPublishStatus(node *p2p.QriNode, ref *repo.DatasetRef, published bool) (err error)
- func Setup(repoPath, cfgPath string, cfg *config.Config, register bool) error
- func Teardown(repoPath string, cfg *config.Config) error
- func UpdateRemoteDataset(ctx context.Context, node *p2p.QriNode, ref *repo.DatasetRef, pin bool) (res repo.DatasetRef, err error)
- func Validate(ctx context.Context, node *p2p.QriNode, ref repo.DatasetRef, ...) (errors []jsonschema.ValError, err error)
- type MergeResultEntry
- type MergeResultSet
- type SaveDatasetSwitches
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 ¶
CanResolveEvents determines whether two Events can be resolved, or if they conflict.
func ConnectedQriProfiles ¶
ConnectedQriProfiles returns a map from ProfileIDs to profiles for each connected node
func DatasetHead ¶
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 ¶
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 Missing ¶ added in v0.6.1
Missing returns a manifest describing blocks that are not in this node for a given manifest
func ModifyDataset ¶ added in v0.6.2
ModifyDataset alters a reference by changing what dataset it refers to
func NewDAGInfo ¶ added in v0.7.3
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
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
SetPublishStatus configures the publish status of a stored reference
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
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 ¶
MergeRepoEvents tries to merge multiple EventLogs.
func (MergeResultSet) Peer ¶
func (s MergeResultSet) Peer(i int) MergeResultEntry
Peer gets a MegeResultEntry for a single peer.