Documentation ¶
Overview ¶
Package base defines functions that operate on local data
Index ¶
- Constants
- Variables
- func CloseDataset(ds *dataset.Dataset) (err error)
- func ConvertBodyFormat(bodyFile qfs.File, fromSt, toSt *dataset.Structure) (qfs.File, error)
- func DatasetLog(ctx context.Context, r repo.Repo, ref dsref.Ref, limit, offset int, ...) ([]dsref.VersionInfo, error)
- func GetBody(ds *dataset.Dataset, limit, offset int, all bool) (interface{}, error)
- func InAuthorNamespace(ctx context.Context, author *profile.Profile, ref dsref.Ref) bool
- func InlineJSONBody(ds *dataset.Dataset) error
- func ListDatasets(ctx context.Context, r repo.Repo, term, profileID string, offset, limit int, ...) ([]dsref.VersionInfo, error)
- func ModifyRepoUsername(ctx context.Context, r repo.Repo, book *logbook.Book, from, to string) error
- func OpenDataset(ctx context.Context, fsys qfs.Filesystem, ds *dataset.Dataset) (err error)
- func RawDatasetRefs(ctx context.Context, pid profile.ID, s collection.Set) (string, error)
- func ReadBodyBytes(ds *dataset.Dataset, format dataset.DataFormat, fcfg dataset.FormatConfig, ...) (data []byte, err error)
- func ReadDataset(ctx context.Context, r repo.Repo, path string) (ds *dataset.Dataset, err error)
- func ReadEntries(reader dsio.EntryReader) (interface{}, error)
- func RenameDatasetRef(ctx context.Context, r repo.Repo, author *profile.Profile, ref dsref.Ref, ...) (*dsref.VersionInfo, error)
- func ReplaceRefIfMoreRecent(r repo.Repo, prev, curr *reporef.DatasetRef) error
- func SetPublishStatus(ctx context.Context, r repo.Repo, author *profile.Profile, ref dsref.Ref, ...) error
- func StoredHistoricalDatasets(ctx context.Context, r repo.Repo, headPath string, offset, limit int, ...) (log []*dataset.Dataset, err error)
- type ComponentStatus
- type StatusItem
Constants ¶
const TimeoutDuration = 100 * time.Millisecond
TimeoutDuration is the duration allowed for a datasetLog lookup before it times out
Variables ¶
var ( // ErrUnlistableReferences is an error for when listing references encounters // some problem, but these problems are non-fatal ErrUnlistableReferences = fmt.Errorf("Warning: Some datasets could not be listed, because of invalid state. These datasets still exist in your repository, but have references that cannot be resolved. This will be fixed in a future version. You can see all datasets by using `affix list --raw`") // ErrNameTaken is an error for when a name for a new dataset is already being used ErrNameTaken = fmt.Errorf("name already in use") // ErrDatasetLogTimeout is an error for when getting the datasetLog times out ErrDatasetLogTimeout = fmt.Errorf("datasetLog: timeout") )
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" // STMissing is a component that is missing STMissing = "missing" // STConflictError is a component with a conflict STConflictError = "conflict error" // ErrWorkingDirectoryDirty is the error for when the working directory is not clean ErrWorkingDirectoryDirty = fmt.Errorf("working directory is dirty") )
var ErrNoBodyToInline = fmt.Errorf("no body to inline")
ErrNoBodyToInline is an error returned when a dataset has no body for inlining
var ( // OpenFileTimeoutDuration determines the maximium amount of time to wait for // a Filestore to open a file. Some filestores (like IPFS) fallback to a // network request when it can't find a file locally. Setting a short timeout // prevents waiting for a slow network response, at the expense of leaving // files unresolved. // TODO (b5) - allow -1 duration as a sentinel value for no timeout OpenFileTimeoutDuration = time.Millisecond * 250 )
Functions ¶
func CloseDataset ¶
CloseDataset ensures all open dataset files are closed
func ConvertBodyFormat ¶
ConvertBodyFormat rewrites a body from a source format to a destination format. TODO (b5): Combine this with ConvertBodyFile, update callers.
func DatasetLog ¶
func DatasetLog(ctx context.Context, r repo.Repo, ref dsref.Ref, limit, offset int, term string, loadDatasets bool) ([]dsref.VersionInfo, error)
DatasetLog fetches the change version history of a dataset
func GetBody ¶
GetBody takes returns the Body as a go-native structure, using limit, offset, and all parameters to determine what part of the Body to return
func InAuthorNamespace ¶
InAuthorNamespace checks if a dataset ref is owned by the author, assumes the reference is already resolved
func InlineJSONBody ¶
InlineJSONBody reads the contents dataset.BodyFile() into a json.RawMessage, assigning the result to dataset.Body
func ListDatasets ¶
func ListDatasets(ctx context.Context, r repo.Repo, term, profileID string, offset, limit int, publishedOnly, showVersions bool) ([]dsref.VersionInfo, error)
ListDatasets lists datasets from a repo
func ModifyRepoUsername ¶
func ModifyRepoUsername(ctx context.Context, r repo.Repo, book *logbook.Book, from, to string) error
ModifyRepoUsername performs all tasks necessary to switch a username (formerly: peername) for a local repo, and must be called when a username is changed TODO (b5) - make this transactional
func OpenDataset ¶
OpenDataset prepares a dataset for use, checking each component for populated Path or Byte suffixed fields, consuming those fields to set File handlers that are ready for reading
func RawDatasetRefs ¶
RawDatasetRefs converts the dataset refs to a string
func ReadBodyBytes ¶
func ReadBodyBytes(ds *dataset.Dataset, format dataset.DataFormat, fcfg dataset.FormatConfig, limit, offset int, all bool) (data []byte, err error)
ReadBodyBytes grabs some or all of a dataset's body, writing an output in the desired format
func ReadEntries ¶
func ReadEntries(reader dsio.EntryReader) (interface{}, error)
ReadEntries reads entries and returns them as a native go array or map
func RenameDatasetRef ¶
func RenameDatasetRef(ctx context.Context, r repo.Repo, author *profile.Profile, ref dsref.Ref, newName string) (*dsref.VersionInfo, error)
RenameDatasetRef changes a dataset's pretty name by modifying the ref in the repository refstore, and returns a versionInfo describing the resulting dataset reference.
func ReplaceRefIfMoreRecent ¶
func ReplaceRefIfMoreRecent(r repo.Repo, prev, curr *reporef.DatasetRef) error
ReplaceRefIfMoreRecent replaces the given ref in the ref store, if it is more recent then the ref currently in the refstore
func SetPublishStatus ¶
func SetPublishStatus(ctx context.Context, r repo.Repo, author *profile.Profile, ref dsref.Ref, published bool) error
SetPublishStatus updates the Published field of a dataset ref
func StoredHistoricalDatasets ¶
func StoredHistoricalDatasets(ctx context.Context, r repo.Repo, headPath string, offset, limit int, loadDatasets bool) (log []*dataset.Dataset, err error)
StoredHistoricalDatasets fetches the history of changes to a dataset by walking backwards through dataset commits. if loadDatasets is true, dataset information will be populated
Types ¶
type ComponentStatus ¶
type ComponentStatus struct {
// contains filtered or unexported fields
}
ComponentStatus owns functionality to get change status about components
func NewComponentStatus ¶
func NewComponentStatus(ctx context.Context, fs *muxfs.Mux) *ComponentStatus
NewComponentStatus returns a new ComponentStatus
func (*ComponentStatus) WhatChanged ¶
func (cs *ComponentStatus) WhatChanged(ctx context.Context, ref dsref.Ref) (changes []StatusItem, err error)
WhatChanged gets changes that happened at a particular version in a dataset's history.
type StatusItem ¶
StatusItem is the status of a component of a dataset, and whether it was changed at a specific version in history
func (StatusItem) MarshalJSON ¶
func (si StatusItem) MarshalJSON() ([]byte, error)
MarshalJSON marshals a StatusItem
Directories ¶
Path | Synopsis |
---|---|
Package archive creates and consumes high-fidelity conversions of dataset documents for export & import
|
Package archive creates and consumes high-fidelity conversions of dataset documents for export & import |
Package dsfs glues datsets to cafs (content-addressed-file-system)
|
Package dsfs glues datsets to cafs (content-addressed-file-system) |
dstest
Package dstest defines an interface for reading test cases from static files leveraging directories of test dataset input files & expected output files
|
Package dstest defines an interface for reading test cases from static files leveraging directories of test dataset input files & expected output files |
Package fill assigns arbitrary values to struct fields using reflection.
|
Package fill assigns arbitrary values to struct fields using reflection. |