Documentation ¶
Index ¶
- Variables
- type Builder
- type Dscache
- func (d *Dscache) Assign(other *Dscache) error
- func (d *Dscache) IsEmpty() bool
- func (d *Dscache) ListRefs() ([]reporef.DatasetRef, error)
- func (d *Dscache) LookupByName(ref dsref.Ref) (*dsref.VersionInfo, error)
- func (d *Dscache) ResolveRef(ctx context.Context, ref *dsref.Ref) (string, error)
- func (d *Dscache) VerboseString(showEmpty bool) string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoDscache is returned when methods are called on a non-existant Dscache ErrNoDscache = fmt.Errorf("dscache: does not exist") // ErrInvalidProfileID is returned when an invalid profileID is given to dscache ErrInvalidProfileID = fmt.Errorf("invalid profileID") )
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder can be used to construct a dscache directly
func (*Builder) AddDsVersionInfo ¶
func (b *Builder) AddDsVersionInfo(ver dsref.VersionInfo)
AddDsVersionInfo adds a versionInfo to the dscache
func (*Builder) AddDsVersionInfoWithIndexes ¶ added in v0.9.6
func (b *Builder) AddDsVersionInfoWithIndexes(ver dsref.VersionInfo, topIndex, cursorIndex int)
AddDsVersionInfoWithIndexes adds a versionInfo with indexes to the dscache
func (*Builder) SetFilename ¶
SetFilename sets the filename for the dscache
type Dscache ¶
type Dscache struct { Filename string Root *dscachefb.Dscache Buffer []byte CreateNewEnabled bool ProfileIDToUsername map[string]string DefaultUsername string }
Dscache represents an in-memory serialized dscache flatbuffer
func BuildDscacheFromLogbookAndProfilesAndDsref ¶
func BuildDscacheFromLogbookAndProfilesAndDsref(ctx context.Context, refs []reporef.DatasetRef, profiles profile.Store, book *logbook.Book, filesys qfs.Filesystem) (*Dscache, error)
BuildDscacheFromLogbookAndProfilesAndDsref creates a dscache, building it from logbook and profiles and dsrefs. Deprecated: Dsref is going away once dscache is in use. For now, only FSIPath is retrieved from dsref, but in the future it will be added directly to dscache, with the file systems's linkfiles (.qri-ref) acting as the authoritative source.
func NewDscache ¶
func NewDscache(ctx context.Context, fsys qfs.Filesystem, bus event.Bus, username, filename string) *Dscache
NewDscache will construct a dscache from the given filename, or will construct an empty dscache that will save to the given filename. Using an empty filename will disable loading and saving
func (*Dscache) ListRefs ¶
func (d *Dscache) ListRefs() ([]reporef.DatasetRef, error)
ListRefs returns references to each dataset in the cache
func (*Dscache) LookupByName ¶ added in v0.9.7
LookupByName looks up a dataset by dsref and returns the latest VersionInfo if found
func (*Dscache) ResolveRef ¶ added in v0.9.9
ResolveRef finds the identifier for a dataset reference implements dsref.Resolver interface
func (*Dscache) VerboseString ¶
VerboseString is a convenience function that returns a readable string, for testing and debugging