Documentation
¶
Overview ¶
Package fsi defines qri file system integration: representing a dataset as files in a directory on a user's computer. Using fsi, users can edit files as an interface for working with qri datasets.
A dataset is "linked" to a directory through a `.qri_ref` dotfile that connects the folder to a version history stored in the local qri repository.
files in a linked directory follow naming conventions that map to components of a dataset. eg: a file named "meta.json" in a linked directory maps to the dataset meta component. This mapping can be used to construct a dataset for read and write actions
Index ¶
- Constants
- Variables
- func DeleteComponents(removeList []string, fileMap map[string]FileStat, dirPath string) error
- func GetBody(dirPath string, format dataset.DataFormat, fcfg dataset.FormatConfig, ...) ([]byte, error)
- func GetLinkedFilesysRef(dir string) (string, bool)
- func ReadDir(dir string) (ds *dataset.Dataset, fileMap, problems map[string]FileStat, err error)
- func RepoPath(repoPath string) string
- func WriteComponents(ds *dataset.Dataset, dirPath string) error
- type FSI
- func (fsi *FSI) AliasToLinkedDir(alias string) (string, error)
- func (fsi *FSI) CalculateStateTransition(prev, next *dataset.Dataset, fileMap, problems map[string]FileStat) (changes []StatusItem, err error)
- func (fsi *FSI) CreateLink(dirPath, refStr string) (string, error)
- func (fsi *FSI) InitDataset(p InitParams) (name string, err error)
- func (fsi *FSI) LinkedRefs(offset, limit int) ([]repo.DatasetRef, error)
- func (fsi *FSI) Status(dir string) (changes []StatusItem, err error)
- func (fsi *FSI) StatusAtVersion(refStr string) (changes []StatusItem, err error)
- func (fsi *FSI) Unlink(dirPath, refStr string) error
- func (fsi *FSI) UpdateLink(dirPath, refStr string) (string, error)
- type FileStat
- type InitParams
- type StatusItem
Constants ¶
const QriRefFilename = ".qri-ref"
QriRefFilename is the name of the file that links a folder to a dataset. The file contains a dataset reference that declares the link ref files are the authoritative definition of weather a folder is linked or not
Variables ¶
var ( // STUnmodified is "no status" STUnmodified = "unmodified" // STAdd is an added component STAdd = "add" // STChange is a modified component STChange = "modified" // STRemoved is a removed component STRemoved = "removed" // STParseError is a component that didn't parse STParseError = "parse error" )
var ( // ErrNoDatasetFiles indicates no data ErrNoDatasetFiles = fmt.Errorf("no dataset files provided") )
Functions ¶
func DeleteComponents ¶
DeleteComponents removes the list of named components from the given directory
func GetBody ¶
func GetBody(dirPath string, format dataset.DataFormat, fcfg dataset.FormatConfig, offset, limit int, all bool) ([]byte, error)
GetBody is an FSI version of actions.GetBody
func GetLinkedFilesysRef ¶
GetLinkedFilesysRef returns whether a directory is linked to a dataset in your repo, and the reference to that dataset.
func ReadDir ¶
ReadDir parses a directory into a dataset, returning both the dataset and a map of component names to the files they came from. Files can be specified in either JSON or YAML format. It is an error to specify any component more than once
Types ¶
type FSI ¶
type FSI struct {
// contains filtered or unexported fields
}
FSI is a repo-side struct for coordinating file system integration
func (*FSI) AliasToLinkedDir ¶
AliasToLinkedDir converts the given dataset alias to the FSI path it is linked to.
func (*FSI) CalculateStateTransition ¶
func (fsi *FSI) CalculateStateTransition(prev, next *dataset.Dataset, fileMap, problems map[string]FileStat) (changes []StatusItem, err error)
CalculateStateTransition calculates the differences between two versions of a dataset.
func (*FSI) CreateLink ¶
CreateLink connects a directory
func (*FSI) InitDataset ¶
func (fsi *FSI) InitDataset(p InitParams) (name string, err error)
InitDataset creates a new dataset
func (*FSI) LinkedRefs ¶
func (fsi *FSI) LinkedRefs(offset, limit int) ([]repo.DatasetRef, error)
LinkedRefs returns a list of linked datasets and their connected directories
func (*FSI) Status ¶
func (fsi *FSI) Status(dir string) (changes []StatusItem, err error)
Status compares status of the current working directory against the dataset's last version
func (*FSI) StatusAtVersion ¶
func (fsi *FSI) StatusAtVersion(refStr string) (changes []StatusItem, err error)
StatusAtVersion gets changes that happened at a particular version in a dataset's history.
type InitParams ¶
InitParams encapsulates parameters for fsi.InitDataset
type StatusItem ¶
type StatusItem struct { SourceFile string `json:"sourceFile"` Component string `json:"component"` Type string `json:"type"` Message string `json:"message"` Mtime time.Time `json:"mtime"` }
StatusItem is a component that has status representation on the filesystem
func (StatusItem) MarshalJSON ¶
func (si StatusItem) MarshalJSON() ([]byte, error)
MarshalJSON marshals a StatusItem, handling mtime specially