Documentation ¶
Overview ¶
Package lib implements core qri business logic. It exports canonical methods that a qri instance can perform regardless of client interface. API's of any sort must use lib methods
Index ¶
- Constants
- Variables
- func CheckVersion(ctx context.Context, res namesys.Resolver, lookupAddr, localHash string) (latest string, err error)
- func NewParseResolveLoadFunc(username string, resolver dsref.Resolver, loader dsref.Loader) dsref.ParseResolveLoad
- func QriRepoExists(path string) error
- func ReadDatasetFiles(pathList ...string) (*dataset.Dataset, error)
- func Setup(p SetupParams) error
- func Teardown(p TeardownParams) error
- type CheckoutParams
- type ConfigMethods
- type DAGInfoParams
- type DatasetLogItem
- type DatasetMethods
- func (DatasetMethods) CoreRequestsName() string
- func (m *DatasetMethods) DAGInfo(s *DAGInfoParams, i *dag.Info) error
- func (m *DatasetMethods) Diff(p *DiffParams, res *DiffResponse) (err error)
- func (m *DatasetMethods) Get(p *GetParams, res *GetResult) error
- func (m *DatasetMethods) List(p *ListParams, res *[]dsref.VersionInfo) error
- func (m *DatasetMethods) ListRawRefs(p *ListParams, text *string) error
- func (m *DatasetMethods) Manifest(refstr *string, mfst *dag.Manifest) error
- func (m *DatasetMethods) ManifestMissing(a, b *dag.Manifest) error
- func (m *DatasetMethods) Pull(p *PullParams, res *dataset.Dataset) error
- func (m *DatasetMethods) Remove(p *RemoveParams, res *RemoveResponse) error
- func (m *DatasetMethods) Rename(p *RenameParams, res *dsref.VersionInfo) error
- func (m *DatasetMethods) Save(p *SaveParams, res *dataset.Dataset) error
- func (m *DatasetMethods) Stats(p *StatsParams, res *StatsResponse) error
- func (m *DatasetMethods) Validate(p *ValidateDatasetParams, valerrs *[]jsonschema.KeyError) error
- type Delta
- type DiffMode
- type DiffParams
- type DiffResponse
- type DiffStat
- type EnsureParams
- type FSIMethods
- func (m *FSIMethods) CanInitDatasetWorkDir(p *InitFSIDatasetParams, ok *bool) error
- func (m *FSIMethods) Checkout(p *CheckoutParams, out *string) (err error)
- func (m FSIMethods) CoreRequestsName() string
- func (m *FSIMethods) CreateLink(p *LinkParams, res *dsref.VersionInfo) (err error)
- func (m *FSIMethods) EnsureRef(p *EnsureParams, out *dsref.VersionInfo) error
- func (m *FSIMethods) InitDataset(p *InitFSIDatasetParams, refstr *string) (err error)
- func (m *FSIMethods) Restore(p *RestoreParams, out *string) (err error)
- func (m *FSIMethods) Status(dir *string, res *[]StatusItem) (err error)
- func (m *FSIMethods) StatusForAlias(alias *string, res *[]StatusItem) (err error)
- func (m *FSIMethods) Unlink(p *LinkParams, res *string) (err error)
- func (m *FSIMethods) WhatChanged(refstr *string, res *[]StatusItem) (err error)
- func (m *FSIMethods) Write(p *FSIWriteParams, res *[]StatusItem) (err error)
- type FSIWriteParams
- type FileParams
- type GetConfigParams
- type GetParams
- type GetResult
- type InitFSIDatasetParams
- type Instance
- func NewInstance(ctx context.Context, repoPath string, opts ...Option) (qri *Instance, err error)
- func NewInstanceFromConfigAndNode(ctx context.Context, cfg *config.Config, node *p2p.QriNode) *Instance
- func NewInstanceFromConfigAndNodeAndBus(ctx context.Context, cfg *config.Config, node *p2p.QriNode, bus event.Bus) *Instance
- func (inst *Instance) ChangeConfig(cfg *config.Config) (err error)
- func (inst *Instance) Config() *config.Config
- func (inst *Instance) Connect(ctx context.Context) (err error)
- func (inst *Instance) Dscache() *dscache.Dscache
- func (inst *Instance) FSI() *fsi.FSI
- func (inst *Instance) LoadDataset(ctx context.Context, ref dsref.Ref, source string) (*dataset.Dataset, error)
- func (inst *Instance) NewParseResolveLoadFunc(remote string) (dsref.ParseResolveLoad, error)
- func (inst *Instance) Node() *p2p.QriNode
- func (inst *Instance) ParseAndResolveRef(ctx context.Context, refStr, source string) (dsref.Ref, string, error)
- func (inst *Instance) ParseAndResolveRefWithWorkingDir(ctx context.Context, refStr, source string) (dsref.Ref, string, error)
- func (inst *Instance) RPC() *rpc.Client
- func (inst *Instance) Remote() *remote.Remote
- func (inst *Instance) RemoteClient() remote.Client
- func (inst *Instance) Repo() repo.Repo
- func (inst *Instance) RepoPath() string
- func (inst *Instance) ResolveReference(ctx context.Context, ref *dsref.Ref, mode string) (string, error)
- func (inst *Instance) ServeRPC(ctx context.Context)
- func (inst *Instance) ServeWebsocket(ctx context.Context)
- func (inst *Instance) Shutdown() <-chan error
- type InstanceContextKey
- type InstanceOptions
- type LinkParams
- type ListParams
- type LogEntry
- type LogMethods
- func (m LogMethods) CoreRequestsName() string
- func (m *LogMethods) Log(params *LogParams, res *[]DatasetLogItem) error
- func (m *LogMethods) Logbook(p *RefListParams, res *[]LogEntry) error
- func (m *LogMethods) LogbookSummary(p *struct{}, res *string) (err error)
- func (m *LogMethods) PlainLogs(p *PlainLogsParams, res *PlainLogs) (err error)
- type LogParams
- type Methods
- type Option
- func OptCheckConfigMigrations(shouldRunFn func() bool, errOnSuccess bool) Option
- func OptConfig(cfg *config.Config) Option
- func OptEnableRemote() Option
- func OptEventHandler(handler event.Handler, events ...event.Type) Option
- func OptIOStreams(streams ioes.IOStreams) Option
- func OptLogbook(bk *logbook.Book) Option
- func OptNoBootstrap() Option
- func OptQriNode(node *p2p.QriNode) Option
- func OptRegistryClient(cli *regclient.Client) Option
- func OptRemoteOptions(fns []remote.OptionsFunc) Option
- func OptSetIPFSPath(path string) Option
- func OptSetLogAll(logAll bool) Option
- func OptSetOpenFileTimeout(d time.Duration) Option
- func OptStatsCache(statsCache *stats.Cache) Option
- func OptStdIOStreams() Option
- type PeerConnectionParamsPod
- type PeerInfoParams
- type PeerListParams
- type PeerMethods
- func (m *PeerMethods) ConnectToPeer(p *PeerConnectionParamsPod, res *config.ProfilePod) error
- func (m *PeerMethods) ConnectedIPFSPeers(limit *int, peers *[]string) error
- func (m *PeerMethods) ConnectedQriProfiles(limit *int, peers *[]*config.ProfilePod) (err error)
- func (m PeerMethods) CoreRequestsName() string
- func (m *PeerMethods) DisconnectFromPeer(p *PeerConnectionParamsPod, res *bool) error
- func (m *PeerMethods) GetReferences(p *PeerRefsParams, res *[]reporef.DatasetRef) error
- func (m *PeerMethods) Info(p *PeerInfoParams, res *config.ProfilePod) error
- func (m *PeerMethods) List(p *PeerListParams, res *[]*config.ProfilePod) (err error)
- type PeerRefsParams
- type PlainLogs
- type PlainLogsParams
- type PreviewParams
- type ProfileMethods
- func (ProfileMethods) CoreRequestsName() string
- func (m *ProfileMethods) GetProfile(in *bool, res *config.ProfilePod) (err error)
- func (m *ProfileMethods) PosterPhoto(req *config.ProfilePod, res *[]byte) (err error)
- func (m *ProfileMethods) ProfilePhoto(req *config.ProfilePod, res *[]byte) (err error)
- func (m *ProfileMethods) SaveProfile(p *config.ProfilePod, res *config.ProfilePod) error
- func (m *ProfileMethods) SetPosterPhoto(p *FileParams, res *config.ProfilePod) error
- func (m *ProfileMethods) SetProfilePhoto(p *FileParams, res *config.ProfilePod) error
- type PullParams
- type PushParams
- type RefListParams
- type RegistryClientMethods
- type RegistryProfile
- type RemoteMethods
- func (*RemoteMethods) CoreRequestsName() string
- func (r *RemoteMethods) Feeds(remoteName *string, res *map[string][]dsref.VersionInfo) error
- func (r *RemoteMethods) Preview(p *PreviewParams, res *dataset.Dataset) error
- func (r *RemoteMethods) Pull(p *PushParams, res *dataset.Dataset) error
- func (r *RemoteMethods) Push(p *PushParams, res *dsref.Ref) error
- func (r *RemoteMethods) Remove(p *PushParams, res *dsref.Ref) error
- type RemoveParams
- type RemoveResponse
- type RenameParams
- type RenderMethods
- type RenderParams
- type RestoreParams
- type SQLMethods
- type SQLQueryParams
- type SaveParams
- type SearchMethods
- type SearchParams
- type SearchResult
- type SetupParams
- type StatsParams
- type StatsResponse
- type StatusItem
- type TeardownParams
- type ValidateDatasetParams
Constants ¶
const DefaultPageSize = 100
DefaultPageSize is the max number of items in a page if no Limit param is provided to a paginated method
Variables ¶
var ( // LastPubVerHash is a hard-coded reference the gx "lastpubver" file of the previous release LastPubVerHash = "/ipfs/QmcXZCLAgUdvXpt1fszjNGVGn6WnhsrJahkQXY3JJqxUWJ" // PrevIPNSName is the dnslink address to check for version agreement PrevIPNSName = "/ipns/cli.previous.qri.io" // ErrUpdateRequired means this version of qri is out of date ErrUpdateRequired = fmt.Errorf("update required") )
var ( // ErrBadArgs is an error for when a user provides bad arguments ErrBadArgs = errors.New("bad arguments provided") )
var ErrCantRemoveDirectoryDirty = fmt.Errorf("cannot remove files while working directory is dirty")
ErrCantRemoveDirectoryDirty is returned when a directory is dirty so the files cant' be removed
Functions ¶
func CheckVersion ¶
func CheckVersion(ctx context.Context, res namesys.Resolver, lookupAddr, localHash string) (latest string, err error)
CheckVersion uses a name resolver to lookup prevIPNSName, checking if the hard-coded lastPubVerHash and the returned lookup match. If they don't, CheckVersion returns ErrUpdateRequired
func NewParseResolveLoadFunc ¶ added in v0.9.9
func NewParseResolveLoadFunc(username string, resolver dsref.Resolver, loader dsref.Loader) dsref.ParseResolveLoad
NewParseResolveLoadFunc composes a username, resolver, and loader into a higher-order function that converts strings to full datasets pass the empty string as a username to disable the "me" keyword in references
func QriRepoExists ¶ added in v0.9.10
QriRepoExists returns nil if a qri repo is defined at the given path does not attempt to open the repo
func ReadDatasetFiles ¶ added in v0.7.3
ReadDatasetFiles reads zero or more files, each representing a dataset or component of a dataset, and deserializes them, merging the results into a single dataset object. It is an error to provide any combination of files whose contents overlap (modify the same component).
func Setup ¶
func Setup(p SetupParams) error
Setup provisions a new qri instance, it intentionally doesn't conform to the RPC function signature because remotely invoking setup doesn't make sense
func Teardown ¶
func Teardown(p TeardownParams) error
Teardown reverses the setup process, destroying a user's privateKey and removing local qri data
Types ¶
type CheckoutParams ¶ added in v0.9.0
CheckoutParams provides parameters to the Checkout method.
type ConfigMethods ¶ added in v0.8.0
type ConfigMethods struct {
// contains filtered or unexported fields
}
ConfigMethods encapsulates changes to a qri configuration
func NewConfigMethods ¶ added in v0.8.0
func NewConfigMethods(inst *Instance) *ConfigMethods
NewConfigMethods creates a configuration handle from an instance
func (ConfigMethods) CoreRequestsName ¶ added in v0.8.0
func (m ConfigMethods) CoreRequestsName() string
CoreRequestsName specifies this is a configuration handle
func (*ConfigMethods) GetConfig ¶ added in v0.8.0
func (m *ConfigMethods) GetConfig(p *GetConfigParams, res *[]byte) (err error)
GetConfig returns the Config, or one of the specified fields of the Config, as a slice of bytes the bytes can be formatted as json, concise json, or yaml
func (*ConfigMethods) GetConfigKeys ¶ added in v0.9.8
func (m *ConfigMethods) GetConfigKeys(p *GetConfigParams, res *[]byte) (err error)
GetConfigKeys returns the Config key fields, or sub keys of the specified fields of the Config, as a slice of bytes to be used for auto completion
type DAGInfoParams ¶ added in v0.7.3
type DAGInfoParams struct {
RefStr, Label string
}
DAGInfoParams defines parameters for the DAGInfo method
type DatasetLogItem ¶ added in v0.9.1
type DatasetLogItem = logbook.DatasetLogItem
DatasetLogItem is a line item in a dataset logbook
type DatasetMethods ¶ added in v0.9.9
type DatasetMethods struct {
// contains filtered or unexported fields
}
DatasetMethods encapsulates business logic for working with Datasets on Qri
func NewDatasetMethods ¶ added in v0.9.9
func NewDatasetMethods(inst *Instance) *DatasetMethods
NewDatasetMethods creates a DatasetMethods pointer from a qri instance
func (DatasetMethods) CoreRequestsName ¶ added in v0.9.9
func (DatasetMethods) CoreRequestsName() string
CoreRequestsName implements the Requets interface
func (*DatasetMethods) DAGInfo ¶ added in v0.9.9
func (m *DatasetMethods) DAGInfo(s *DAGInfoParams, i *dag.Info) error
DAGInfo generates a dag.Info for a dataset path. If a label is given, DAGInfo will generate a sub-dag.Info at that label.
func (*DatasetMethods) Diff ¶ added in v0.9.9
func (m *DatasetMethods) Diff(p *DiffParams, res *DiffResponse) (err error)
Diff computes the diff of two sources
func (*DatasetMethods) Get ¶ added in v0.9.9
func (m *DatasetMethods) Get(p *GetParams, res *GetResult) error
Get retrieves datasets and components for a given reference. p.Refstr is parsed to create a reference, which is used to load the dataset. It will be loaded from the local repo or from the filesystem if it has a linked working direoctry. Using p.Selector will control what components are returned in res.Bytes. The default, a blank selector, will also fill the entire dataset at res.Data. If the selector is "body" then res.Bytes is loaded with the body. If the selector is "stats", then res.Bytes is loaded with the generated stats.
func (*DatasetMethods) List ¶ added in v0.9.9
func (m *DatasetMethods) List(p *ListParams, res *[]dsref.VersionInfo) error
List gets the reflist for either the local repo or a peer
func (*DatasetMethods) ListRawRefs ¶ added in v0.9.9
func (m *DatasetMethods) ListRawRefs(p *ListParams, text *string) error
ListRawRefs gets the list of raw references as string
func (*DatasetMethods) Manifest ¶ added in v0.9.9
func (m *DatasetMethods) Manifest(refstr *string, mfst *dag.Manifest) error
Manifest generates a manifest for a dataset path
func (*DatasetMethods) ManifestMissing ¶ added in v0.9.9
func (m *DatasetMethods) ManifestMissing(a, b *dag.Manifest) error
ManifestMissing generates a manifest of blocks that are not present on this repo for a given manifest
func (*DatasetMethods) Pull ¶ added in v0.9.10
func (m *DatasetMethods) Pull(p *PullParams, res *dataset.Dataset) error
Pull downloads and stores an existing dataset to a peer's repository via a network connection
func (*DatasetMethods) Remove ¶ added in v0.9.9
func (m *DatasetMethods) Remove(p *RemoveParams, res *RemoveResponse) error
Remove a dataset entirely or remove a certain number of revisions
func (*DatasetMethods) Rename ¶ added in v0.9.9
func (m *DatasetMethods) Rename(p *RenameParams, res *dsref.VersionInfo) error
Rename changes a user's given name for a dataset
func (*DatasetMethods) Save ¶ added in v0.9.9
func (m *DatasetMethods) Save(p *SaveParams, res *dataset.Dataset) error
Save adds a history entry, updating a dataset
func (*DatasetMethods) Stats ¶ added in v0.9.9
func (m *DatasetMethods) Stats(p *StatsParams, res *StatsResponse) error
Stats generates stats for a dataset
func (*DatasetMethods) Validate ¶ added in v0.9.9
func (m *DatasetMethods) Validate(p *ValidateDatasetParams, valerrs *[]jsonschema.KeyError) error
Validate gives a dataset of errors and issues for a given dataset
type Delta ¶ added in v0.7.1
Delta is an alias for deepdiff.Delta, abstracting the deepdiff implementation away from packages that depend on lib
type DiffMode ¶ added in v0.9.9
type DiffMode int
DiffMode is one of the methods that diff can perform
const ( // InvalidDiffMode is the default diff mode InvalidDiffMode DiffMode = iota // DatasetRefDiffMode will diff two dataset references DatasetRefDiffMode // FilepathDiffMode will diff two files FilepathDiffMode // WorkingDirectoryDiffMode will diff a working directory against its dataset head WorkingDirectoryDiffMode // PrevVersionDiffMode will diff a dataset head against its previous version PrevVersionDiffMode )
type DiffParams ¶
type DiffParams struct {
// File paths or reference to datasets
LeftSide, RightSide string
// If not null, the working directory that the diff is using
WorkingDir string
// Whether to get the previous version of the left parameter
UseLeftPrevVersion bool
// Which component or part of a dataset to compare
Selector string
Remote string
}
DiffParams defines parameters for diffing two sources. There are three valid ways to use these parameters: 1) both LeftSide and RightSide set, 2) only LeftSide set with a WorkingDir, 3) only LeftSide set with the UseLeftPrevVersion flag.
type DiffResponse ¶ added in v0.7.1
type DiffResponse struct { Stat *DiffStat `json:"stat,omitempty"` SchemaStat *DiffStat `json:"schemaStat,omitempty"` Schema []*Delta `json:"schema,omitempty"` Diff []*Delta `json:"diff,omitempty"` }
DiffResponse is the result of a call to diff
type DiffStat ¶ added in v0.7.1
DiffStat is an alias for deepdiff.Stat, abstracting the deepdiff implementation away from packages that depend on lib
type EnsureParams ¶ added in v0.9.3
EnsureParams holds values for EnsureRef call
type FSIMethods ¶ added in v0.9.0
type FSIMethods struct {
// contains filtered or unexported fields
}
FSIMethods encapsulates filesystem integrations methods
func NewFSIMethods ¶ added in v0.9.0
func NewFSIMethods(inst *Instance) *FSIMethods
NewFSIMethods creates a fsi handle from an instance
func (*FSIMethods) CanInitDatasetWorkDir ¶ added in v0.9.9
func (m *FSIMethods) CanInitDatasetWorkDir(p *InitFSIDatasetParams, ok *bool) error
CanInitDatasetWorkDir returns nil if the directory can init a dataset, or an error if not
func (*FSIMethods) Checkout ¶ added in v0.9.0
func (m *FSIMethods) Checkout(p *CheckoutParams, out *string) (err error)
Checkout method writes a dataset to a directory as individual files.
func (FSIMethods) CoreRequestsName ¶ added in v0.9.0
func (m FSIMethods) CoreRequestsName() string
CoreRequestsName specifies this is a fsi handle
func (*FSIMethods) CreateLink ¶ added in v0.9.0
func (m *FSIMethods) CreateLink(p *LinkParams, res *dsref.VersionInfo) (err error)
CreateLink creates a connection between a working drirectory and a dataset history
func (*FSIMethods) EnsureRef ¶ added in v0.9.3
func (m *FSIMethods) EnsureRef(p *EnsureParams, out *dsref.VersionInfo) error
EnsureRef will modify the directory path in the repo for the given reference
func (*FSIMethods) InitDataset ¶ added in v0.9.0
func (m *FSIMethods) InitDataset(p *InitFSIDatasetParams, refstr *string) (err error)
InitDataset creates a new dataset and FSI link
func (*FSIMethods) Restore ¶ added in v0.9.0
func (m *FSIMethods) Restore(p *RestoreParams, out *string) (err error)
Restore method restores a component or all of the component files of a dataset from the repo
func (*FSIMethods) Status ¶ added in v0.9.0
func (m *FSIMethods) Status(dir *string, res *[]StatusItem) (err error)
Status checks for any modifications or errors in a linked directory against its previous version in the repo. Must only be called if FSI is enabled for this dataset.
func (*FSIMethods) StatusForAlias ¶ added in v0.9.0
func (m *FSIMethods) StatusForAlias(alias *string, res *[]StatusItem) (err error)
StatusForAlias receives an alias for a dataset that must be linked to the filesystem, and checks the status of its current working directory. It is an error to call this for a reference that is not linked.
func (*FSIMethods) Unlink ¶ added in v0.9.0
func (m *FSIMethods) Unlink(p *LinkParams, res *string) (err error)
Unlink removes the connection between a working directory and a dataset. If given only a directory, will remove the link file from that directory. If given only a reference, will remove the fsi path from that reference, and remove the link file from that fsi path
func (*FSIMethods) WhatChanged ¶ added in v0.9.7
func (m *FSIMethods) WhatChanged(refstr *string, res *[]StatusItem) (err error)
WhatChanged gets changes that happened at a particular version in the history of the given dataset reference. Not used for FSI.
func (*FSIMethods) Write ¶ added in v0.9.0
func (m *FSIMethods) Write(p *FSIWriteParams, res *[]StatusItem) (err error)
Write mutates a linked dataset on the filesystem
type FSIWriteParams ¶ added in v0.9.0
FSIWriteParams encapsultes arguments for writing to an FSI-linked directory
type FileParams ¶
type FileParams struct { // Url string // url to download data from. either Url or Data is required Filename string // filename of data file. extension is used for filetype detection Data io.Reader // reader of structured data. either Url or Data is required }
FileParams defines parameters for Files as arguments to lib methods
type GetConfigParams ¶
GetConfigParams are the params needed to format/specify the fields in bytes returned from the GetConfig function
type GetParams ¶
type GetParams struct { // Refstr to get, representing a dataset ref to be parsed Refstr string Selector string // read from a filesystem link instead of stored version Format string FormatConfig dataset.FormatConfig Limit, Offset int All bool // outfile is a filename to save the dataset to Outfile string // whether to generate a filename from the dataset name instead GenFilename bool Remote string }
GetParams defines parameters for looking up the head or body of a dataset
type GetResult ¶ added in v0.7.0
type GetResult struct { Ref *dsref.Ref `json:"ref"` Dataset *dataset.Dataset `json:"data"` Bytes []byte `json:"bytes"` Message string `json:"message"` FSIPath string `json:"fsipath"` Published bool `json:"published"` }
GetResult combines data with it's hashed path
type InitFSIDatasetParams ¶ added in v0.9.0
type InitFSIDatasetParams = fsi.InitParams
InitFSIDatasetParams proxies parameters to initialization
type Instance ¶ added in v0.8.0
type Instance struct {
// contains filtered or unexported fields
}
Instance bundles the foundational values qri relies on, including a qri configuration, p2p node, and base context. An instance wraps required state for for "Method" constructors, which contain qri business logic. Think of instance as the "core" of the qri ecosystem. Create an Instance pointer with NewInstance
func NewInstance ¶ added in v0.8.0
NewInstance creates a new Qri Instance, if no Option funcs are provided, New uses a default set of Option funcs. Any Option functions passed to this function must check whether their fields are nil or not.
func NewInstanceFromConfigAndNode ¶ added in v0.8.0
func NewInstanceFromConfigAndNode(ctx context.Context, cfg *config.Config, node *p2p.QriNode) *Instance
NewInstanceFromConfigAndNode is a temporary solution to create an instance from an already-allocated QriNode & configuration don't write new code that relies on this, instead create a configuration and options that can be fed to NewInstance This function must only be used for testing purposes
func NewInstanceFromConfigAndNodeAndBus ¶ added in v0.9.10
func NewInstanceFromConfigAndNodeAndBus(ctx context.Context, cfg *config.Config, node *p2p.QriNode, bus event.Bus) *Instance
NewInstanceFromConfigAndNodeAndBus adds a bus argument to the horrible, hacky instance construtor
func (*Instance) ChangeConfig ¶ added in v0.8.0
ChangeConfig implements the ConfigSetter interface
func (*Instance) Config ¶ added in v0.8.0
Config provides methods for manipulating Qri configuration
func (*Instance) LoadDataset ¶ added in v0.9.9
func (inst *Instance) LoadDataset(ctx context.Context, ref dsref.Ref, source string) (*dataset.Dataset, error)
LoadDataset fetches, dereferences and opens a dataset from a reference implements the dsfs.Loader interface this function expects the passed in reference is fully resolved
func (*Instance) NewParseResolveLoadFunc ¶ added in v0.9.10
func (inst *Instance) NewParseResolveLoadFunc(remote string) (dsref.ParseResolveLoad, error)
NewParseResolveLoadFunc generates a dsref.ParseResolveLoad function from an instance
func (*Instance) ParseAndResolveRef ¶ added in v0.9.9
func (inst *Instance) ParseAndResolveRef(ctx context.Context, refStr, source string) (dsref.Ref, string, error)
ParseAndResolveRef combines reference parsing and resolution
func (*Instance) ParseAndResolveRefWithWorkingDir ¶ added in v0.9.9
func (inst *Instance) ParseAndResolveRefWithWorkingDir(ctx context.Context, refStr, source string) (dsref.Ref, string, error)
ParseAndResolveRefWithWorkingDir combines reference parsing and resolution, including setting default Path to a linked working directory if one exists
func (*Instance) RemoteClient ¶ added in v0.9.0
RemoteClient exposes the instance client for making requests to remotes
func (*Instance) RepoPath ¶ added in v0.8.0
RepoPath returns the path to the directory qri is operating from
func (*Instance) ResolveReference ¶ added in v0.9.9
func (inst *Instance) ResolveReference(ctx context.Context, ref *dsref.Ref, mode string) (string, error)
ResolveReference finds the identifier & HEAD path for a dataset reference. the mode parameter determines which subsystems of Qri to use when resolving
func (*Instance) ServeRPC ¶ added in v0.9.9
ServeRPC checks for a configured RPC port, and registers a listener if so
func (*Instance) ServeWebsocket ¶ added in v0.9.10
ServeWebsocket creates a websocket that clients can connect to in order to get realtime events
type InstanceContextKey ¶ added in v0.9.3
type InstanceContextKey string
InstanceContextKey is used by context to set keys for constucting a lib.Instance
type InstanceOptions ¶ added in v0.8.0
type InstanceOptions struct { Cfg *config.Config Streams ioes.IOStreams // contains filtered or unexported fields }
InstanceOptions provides details to NewInstance. New will alter InstanceOptions by applying any provided Option functions to distinguish "Options" from "Config": * Options contains state that can only be determined at runtime * Config consists only of static values stored in a configuration file Options may override config in specific cases to avoid undefined state
type LinkParams ¶ added in v0.9.0
LinkParams encapsulate parameters to the link method
type ListParams ¶
type ListParams struct { ProfileID profile.ID Term string Peername string OrderBy string Limit int Offset int // RPC is a horrible hack while we work to replace the net/rpc package // TODO - remove this RPC bool // Public only applies to listing datasets, shows only datasets that are // set to visible Public bool // ShowNumVersions only applies to listing datasets ShowNumVersions bool // EnsureFSIExists controls whether to ensure references in the repo have correct FSIPaths EnsureFSIExists bool // UseDscache controls whether to build a dscache to use to list the references UseDscache bool }
ListParams is the general input for any sort of Paginated Request ListParams define limits & offsets, not pages & page sizes. TODO - rename this to PageParams.
func ListParamsFromRequest ¶
func ListParamsFromRequest(r *http.Request) ListParams
ListParamsFromRequest extracts ListParams from an http.Request pointer
func NewListParams ¶
func NewListParams(orderBy string, page, pageSize int) ListParams
NewListParams creates a ListParams from page & pagesize, pages are 1-indexed (the first element is 1, not 0), NewListParams performs the conversion
func (ListParams) Page ¶
func (lp ListParams) Page() util.Page
Page converts a ListParams struct to a util.Page struct
type LogMethods ¶ added in v0.9.9
type LogMethods struct {
// contains filtered or unexported fields
}
LogMethods extends a lib.Instance with business logic for working with lists of dataset versions. think "git log".
func NewLogMethods ¶ added in v0.9.9
func NewLogMethods(inst *Instance) *LogMethods
NewLogMethods creates a LogMethods pointer from either a repo or an rpc.Client
func (LogMethods) CoreRequestsName ¶ added in v0.9.9
func (m LogMethods) CoreRequestsName() string
CoreRequestsName implements the Requets interface
func (*LogMethods) Log ¶ added in v0.9.9
func (m *LogMethods) Log(params *LogParams, res *[]DatasetLogItem) error
Log returns the history of changes for a given dataset
func (*LogMethods) Logbook ¶ added in v0.9.9
func (m *LogMethods) Logbook(p *RefListParams, res *[]LogEntry) error
Logbook lists log entries for actions taken on a given dataset
func (*LogMethods) LogbookSummary ¶ added in v0.9.9
func (m *LogMethods) LogbookSummary(p *struct{}, res *string) (err error)
LogbookSummary returns a string overview of the logbook
func (*LogMethods) PlainLogs ¶ added in v0.9.9
func (m *LogMethods) PlainLogs(p *PlainLogsParams, res *PlainLogs) (err error)
PlainLogs encodes the full logbook as human-oriented json
type LogParams ¶
type LogParams struct { ListParams // Reference to data to fetch history for Ref string Pull bool Source string }
LogParams defines parameters for the Log method
type Methods ¶ added in v0.8.0
type Methods interface { // CoreRequestsName confirms participation in the CoreRequests interface while // also giving a human readable string for logging purposes // TODO (b5): rename this interface to "MethodsName", or remove entirely CoreRequestsName() string }
Methods is a related set of library functions
type Option ¶ added in v0.8.0
type Option func(o *InstanceOptions) error
Option is a function that manipulates config details when fed to New(). Fields on the o parameter may be null, functions cannot assume the Config is non-null.
func OptCheckConfigMigrations ¶ added in v0.8.0
OptCheckConfigMigrations checks for any configuration migrations that may need to be run. running & updating config if so
func OptEnableRemote ¶ added in v0.9.10
func OptEnableRemote() Option
OptEnableRemote enables the remote functionality in the node
func OptEventHandler ¶ added in v0.9.10
OptEventHandler provides an event handler & list of event types to subscribe to. The canonical list of events a qri instance emits are defined in the github.com/qri-io/qri/event package plase note that event handlers in qri are synchronous. A handler function that takes a long time to return will slow down the performance of qri generally
func OptIOStreams ¶ added in v0.8.0
OptIOStreams sets the input IOStreams
func OptLogbook ¶ added in v0.9.3
OptLogbook overrides the configured logbook with a manually provided one
func OptNoBootstrap ¶ added in v0.9.10
func OptNoBootstrap() Option
OptNoBootstrap ensures the node will not attempt to bootstrap to any other nodes in the network
func OptQriNode ¶ added in v0.9.0
OptQriNode configures bring-your-own qri node
func OptRegistryClient ¶ added in v0.9.0
OptRegistryClient overrides any configured registry client
func OptRemoteOptions ¶ added in v0.9.0
func OptRemoteOptions(fns []remote.OptionsFunc) Option
OptRemoteOptions provides options to the instance remote the provided configuration function is called with the Qri configuration-derived remote settings applied, allowing partial-overrides.
func OptSetIPFSPath ¶ added in v0.8.0
OptSetIPFSPath sets the directory to read IPFS from. Passing the empty string adjusts qri to use the go-ipfs default: first checking the IPFS_PATH env variable, then falling back to $HOME/.ipfs if no ipfs filesystem is configured, this option creates one
func OptSetLogAll ¶ added in v0.9.4
OptSetLogAll sets the logAll value so that debug level logging is enabled for all qri packages
func OptSetOpenFileTimeout ¶ added in v0.9.10
OptSetOpenFileTimeout sets a timeout duration for opening files
func OptStatsCache ¶ added in v0.9.2
OptStatsCache overrides the configured stats cache
func OptStdIOStreams ¶ added in v0.8.0
func OptStdIOStreams() Option
OptStdIOStreams sets treams to std, stdout, & stderr
type PeerConnectionParamsPod ¶
type PeerConnectionParamsPod struct { Peername string ProfileID string NetworkID string Multiaddr string }
PeerConnectionParamsPod defines parameters for defining a connection to a peer as plain-old-data
func NewPeerConnectionParamsPod ¶
func NewPeerConnectionParamsPod(s string) *PeerConnectionParamsPod
NewPeerConnectionParamsPod attempts to turn a string into peer connection parameters
func (PeerConnectionParamsPod) Decode ¶
func (p PeerConnectionParamsPod) Decode() (cp p2p.PeerConnectionParams, err error)
Decode turns plain-old-data into it's rich types
type PeerInfoParams ¶
type PeerInfoParams struct { Peername string ProfileID profile.ID // Verbose adds network details from the p2p Peerstore Verbose bool }
PeerInfoParams defines parameters for the Info method
type PeerListParams ¶
type PeerListParams struct {
Limit, Offset int
// Cached == true will return offline peers from the repo
// as well as online peers, default is to list connected peers only
Cached bool
}
PeerListParams defines parameters for the List method
type PeerMethods ¶ added in v0.9.9
type PeerMethods struct {
// contains filtered or unexported fields
}
PeerMethods extends a lib.Instance with business logic for peer-to-peer interaction
func NewPeerMethods ¶ added in v0.9.9
func NewPeerMethods(inst *Instance) *PeerMethods
NewPeerMethods creates a p2p Methods pointer
func (*PeerMethods) ConnectToPeer ¶ added in v0.9.9
func (m *PeerMethods) ConnectToPeer(p *PeerConnectionParamsPod, res *config.ProfilePod) error
ConnectToPeer attempts to create a connection with a peer for a given peer.ID
func (*PeerMethods) ConnectedIPFSPeers ¶ added in v0.9.9
func (m *PeerMethods) ConnectedIPFSPeers(limit *int, peers *[]string) error
ConnectedIPFSPeers lists PeerID's we're currently connected to. If running IPFS this will also return connected IPFS nodes
func (*PeerMethods) ConnectedQriProfiles ¶ added in v0.9.9
func (m *PeerMethods) ConnectedQriProfiles(limit *int, peers *[]*config.ProfilePod) (err error)
ConnectedQriProfiles lists profiles we're currently connected to
func (PeerMethods) CoreRequestsName ¶ added in v0.9.9
func (m PeerMethods) CoreRequestsName() string
CoreRequestsName implements the Requets interface
func (*PeerMethods) DisconnectFromPeer ¶ added in v0.9.9
func (m *PeerMethods) DisconnectFromPeer(p *PeerConnectionParamsPod, res *bool) error
DisconnectFromPeer explicitly closes a peer connection
func (*PeerMethods) GetReferences ¶ added in v0.9.9
func (m *PeerMethods) GetReferences(p *PeerRefsParams, res *[]reporef.DatasetRef) error
GetReferences lists a peer's named datasets
func (*PeerMethods) Info ¶ added in v0.9.9
func (m *PeerMethods) Info(p *PeerInfoParams, res *config.ProfilePod) error
Info shows peer profile details
func (*PeerMethods) List ¶ added in v0.9.9
func (m *PeerMethods) List(p *PeerListParams, res *[]*config.ProfilePod) (err error)
List lists Peers on the qri network
type PeerRefsParams ¶
PeerRefsParams defines params for the GetReferences method
type PlainLogs ¶ added in v0.9.5
PlainLogs is an alias for a human representation of a plain-old-data logbook
type PlainLogsParams ¶ added in v0.9.5
type PlainLogsParams struct { }
PlainLogsParams enapsulates parameters for the PlainLogs methods
type PreviewParams ¶ added in v0.9.5
PreviewParams provides arguments to the preview method
type ProfileMethods ¶ added in v0.8.0
type ProfileMethods struct {
// contains filtered or unexported fields
}
ProfileMethods encapsulates business logic for this node's user profile TODO (b5) - alterations to user profile are a subset of configuration changes. all of this code should be refactored into subroutines of general configuration getters & setters
func NewProfileMethods ¶ added in v0.8.0
func NewProfileMethods(inst *Instance) *ProfileMethods
NewProfileMethods creates a ProfileMethods pointer from either a repo or an rpc.Client
func (ProfileMethods) CoreRequestsName ¶ added in v0.8.0
func (ProfileMethods) CoreRequestsName() string
CoreRequestsName implements the Request interface
func (*ProfileMethods) GetProfile ¶ added in v0.8.0
func (m *ProfileMethods) GetProfile(in *bool, res *config.ProfilePod) (err error)
GetProfile get's this node's peer profile
func (*ProfileMethods) PosterPhoto ¶ added in v0.8.0
func (m *ProfileMethods) PosterPhoto(req *config.ProfilePod, res *[]byte) (err error)
PosterPhoto fetches the byte slice of a given user's poster photo
func (*ProfileMethods) ProfilePhoto ¶ added in v0.8.0
func (m *ProfileMethods) ProfilePhoto(req *config.ProfilePod, res *[]byte) (err error)
ProfilePhoto fetches the byte slice of a given user's profile photo
func (*ProfileMethods) SaveProfile ¶ added in v0.8.0
func (m *ProfileMethods) SaveProfile(p *config.ProfilePod, res *config.ProfilePod) error
SaveProfile stores changes to this peer's editable profile
func (*ProfileMethods) SetPosterPhoto ¶ added in v0.8.0
func (m *ProfileMethods) SetPosterPhoto(p *FileParams, res *config.ProfilePod) error
SetPosterPhoto changes this peer's poster image
func (*ProfileMethods) SetProfilePhoto ¶ added in v0.8.0
func (m *ProfileMethods) SetProfilePhoto(p *FileParams, res *config.ProfilePod) error
SetProfilePhoto changes this peer's profile image
type PullParams ¶ added in v0.9.10
type PullParams struct { Ref string LinkDir string Remote string // remote to attempt to pull from LogsOnly bool // only fetch logbook data }
PullParams encapsulates parameters to the add command
type PushParams ¶ added in v0.7.3
type PushParams struct { Ref string RemoteName string // All indicates all versions of a dataset and the dataset namespace should // be either published or removed All bool }
PushParams encapsulates parmeters for dataset publication
type RefListParams ¶ added in v0.9.1
type RefListParams struct { // String value of a reference Ref string // Pagination Parameters Offset, Limit int }
RefListParams encapsulates parameters for requests to a single reference that will produce a paginated result
type RegistryClientMethods ¶ added in v0.9.0
type RegistryClientMethods struct {
// contains filtered or unexported fields
}
RegistryClientMethods defines business logic for working with registries
func NewRegistryClientMethods ¶ added in v0.9.0
func NewRegistryClientMethods(inst *Instance) *RegistryClientMethods
NewRegistryClientMethods creates client methods from an instance
func (RegistryClientMethods) CoreRequestsName ¶ added in v0.9.0
func (RegistryClientMethods) CoreRequestsName() string
CoreRequestsName implements the Requests interface
func (RegistryClientMethods) CreateProfile ¶ added in v0.9.0
func (m RegistryClientMethods) CreateProfile(p *RegistryProfile, ok *bool) (err error)
CreateProfile creates a profile
func (RegistryClientMethods) ProveProfileKey ¶ added in v0.9.0
func (m RegistryClientMethods) ProveProfileKey(p *RegistryProfile, ok *bool) error
ProveProfileKey asserts to a registry that this user has control of a specified private key
type RegistryProfile ¶ added in v0.9.0
RegistryProfile is a user profile as stored on a registry
type RemoteMethods ¶ added in v0.9.0
type RemoteMethods struct {
// contains filtered or unexported fields
}
RemoteMethods encapsulates business logic of remote operation TODO (b5): switch to using an Instance instead of separate fields
func NewRemoteMethods ¶ added in v0.9.0
func NewRemoteMethods(inst *Instance) *RemoteMethods
NewRemoteMethods creates a RemoteMethods pointer from either a node or an rpc.Client
func (*RemoteMethods) CoreRequestsName ¶ added in v0.9.0
func (*RemoteMethods) CoreRequestsName() string
CoreRequestsName implements the Requests interface
func (*RemoteMethods) Feeds ¶ added in v0.9.5
func (r *RemoteMethods) Feeds(remoteName *string, res *map[string][]dsref.VersionInfo) error
Feeds returns a listing of datasets from a number of feeds like featured and popular. Each feed is keyed by string in the response
func (*RemoteMethods) Preview ¶ added in v0.9.5
func (r *RemoteMethods) Preview(p *PreviewParams, res *dataset.Dataset) error
Preview requests a dataset preview from a remote
func (*RemoteMethods) Pull ¶ added in v0.9.10
func (r *RemoteMethods) Pull(p *PushParams, res *dataset.Dataset) error
Pull fetches a dataset version & logbook data from a remote
func (*RemoteMethods) Push ¶ added in v0.9.10
func (r *RemoteMethods) Push(p *PushParams, res *dsref.Ref) error
Push posts a dataset version to a remote
func (*RemoteMethods) Remove ¶ added in v0.9.10
func (r *RemoteMethods) Remove(p *PushParams, res *dsref.Ref) error
Remove asks a remote to remove a dataset
type RemoveParams ¶ added in v0.6.2
RemoveParams defines parameters for remove command
type RemoveResponse ¶ added in v0.7.0
RemoveResponse gives the results of a remove
type RenameParams ¶
type RenameParams struct {
Current, Next string
}
RenameParams defines parameters for Dataset renaming
type RenderMethods ¶ added in v0.9.9
type RenderMethods struct {
// contains filtered or unexported fields
}
RenderMethods encapsulates business logic for executing templates, using a dataset as a source
func NewRenderMethods ¶ added in v0.9.9
func NewRenderMethods(inst *Instance) *RenderMethods
NewRenderMethods creates a RenderMethods pointer from either a repo or an rpc.Client
func (RenderMethods) CoreRequestsName ¶ added in v0.9.9
func (RenderMethods) CoreRequestsName() string
CoreRequestsName implements the Requets interface
func (*RenderMethods) RenderReadme ¶ added in v0.9.9
func (m *RenderMethods) RenderReadme(p *RenderParams, res *string) (err error)
RenderReadme renders the readme into html for the given dataset
func (*RenderMethods) RenderViz ¶ added in v0.9.9
func (m *RenderMethods) RenderViz(p *RenderParams, res *[]byte) (err error)
RenderViz renders a viz component as html
type RenderParams ¶
type RenderParams struct { // Ref is a string reference to the dataset to render Ref string // Optionally pass an entire dataset in for rendering, if providing a dataset, // the Ref field must be empty Dataset *dataset.Dataset // Optional template override Template []byte // If true, UseFSI bool // Output format. defaults to "html" OutFormat string // remote resolver to use Remote string }
RenderParams defines parameters for the Render method
func (*RenderParams) Validate ¶ added in v0.9.5
func (p *RenderParams) Validate() error
Validate checks if render parameters are valid
type RestoreParams ¶ added in v0.9.0
RestoreParams provides parameters to the restore method.
type SQLMethods ¶ added in v0.9.7
type SQLMethods struct {
// contains filtered or unexported fields
}
SQLMethods encapsulates business logic for the qri search command TODO (b5): switch to using an Instance instead of separate fields
func NewSQLMethods ¶ added in v0.9.7
func NewSQLMethods(inst *Instance) *SQLMethods
NewSQLMethods creates SQLMethods from a qri Instance
func (SQLMethods) CoreRequestsName ¶ added in v0.9.7
func (m SQLMethods) CoreRequestsName() string
CoreRequestsName implements the requests interface
func (*SQLMethods) Exec ¶ added in v0.9.7
func (m *SQLMethods) Exec(p *SQLQueryParams, results *[]byte) error
Exec runs an SQL query
type SQLQueryParams ¶ added in v0.9.7
SQLQueryParams defines paremeters for the exec Method ExecParams provides parameters to the execute command
type SaveParams ¶
type SaveParams struct { // dataset supplies params directly, all other param fields override values // supplied by dataset Dataset *dataset.Dataset // dataset reference string, the name to save to Ref string // commit title, defaults to a generated string based on diff Title string // commit message, defaults to blank Message string // path to body data BodyPath string // absolute path or URL to the list of dataset files or components to load FilePaths []string // secrets for transform execution Secrets map[string]string // optional writer to have transform script record standard output to // note: this won't work over RPC, only on local calls ScriptOutput io.Writer // Replace writes the entire given dataset as a new snapshot instead of // applying save params as augmentations to the existing history Replace bool // option to make dataset private. private data is not currently implimented, // see https://github.com/qri-io/qri/issues/291 for updates Private bool // run without saving, returning results DryRun bool // if true, res.Dataset.Body will be a fs.file of the body ReturnBody bool // if true, convert body to the format of the previous version, if applicable ConvertFormatToPrev bool // string of references to recall before saving Recall string // comma separated list of component names to delete before saving Drop string // force a new commit, even if no changes are detected Force bool // save a rendered version of the template along with the dataset ShouldRender bool // new dataset only, don't create a commit on an existing dataset, name will be unused NewName bool // whether to create a new dscache if none exists UseDscache bool }
SaveParams encapsulates arguments to Save
func (*SaveParams) AbsolutizePaths ¶ added in v0.8.0
func (p *SaveParams) AbsolutizePaths() error
AbsolutizePaths converts any relative path references to their absolute variations, safe to call on a nil instance
type SearchMethods ¶ added in v0.9.0
type SearchMethods struct {
// contains filtered or unexported fields
}
SearchMethods encapsulates business logic for the qri search command TODO (b5): switch to using an Instance instead of separate fields
func NewSearchMethods ¶ added in v0.9.0
func NewSearchMethods(inst *Instance) *SearchMethods
NewSearchMethods creates SearchMethods from a qri Instance
func (SearchMethods) CoreRequestsName ¶ added in v0.9.0
func (m SearchMethods) CoreRequestsName() string
CoreRequestsName implements the requests
func (*SearchMethods) Search ¶ added in v0.9.0
func (m *SearchMethods) Search(p *SearchParams, results *[]SearchResult) error
Search queries for items on qri related to given parameters
type SearchParams ¶
type SearchParams struct { QueryString string `json:"q"` Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` }
SearchParams defines paremeters for the search Method
type SearchResult ¶
SearchResult struct
type SetupParams ¶
type SetupParams struct { // a configuration is required. defaults to config.DefaultConfig() Config *config.Config // where to initialize qri repository RepoPath string // submit new username to the configured registry Register bool // overwrite any existing repo, erasing all data and deleting private keys // this is almost always a bad idea Overwrite bool // attempt to setup an IFPS repo SetupIPFS bool SetupIPFSConfigData []byte // setup requires a crypto source Generator gen.CryptoGenerator }
SetupParams encapsulates arguments for Setup
type StatsParams ¶ added in v0.9.2
type StatsParams struct { // string representation of a dataset reference Ref string // if we get a Dataset from the params, then we do not have to // attempt to open a dataset from the reference Dataset *dataset.Dataset }
StatsParams defines the params for a Stats request
type StatsResponse ¶ added in v0.9.2
type StatsResponse struct {
StatsBytes []byte
}
StatsResponse defines the response for a Stats request
type StatusItem ¶ added in v0.9.0
type StatusItem = fsi.StatusItem
StatusItem is an alias for an fsi.StatusItem
type TeardownParams ¶
TeardownParams encapsulates arguments for Setup