dscache

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 NewBuilder

func NewBuilder() *Builder

NewBuilder returns a new dscache builder

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) AddUser

func (b *Builder) AddUser(username, profileID string)

AddUser adds a user to the dscache

func (*Builder) Build

func (b *Builder) Build() *Dscache

Build returns the built Dscache

func (*Builder) SetFilename

func (b *Builder) SetFilename(filename string)

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) Assign

func (d *Dscache) Assign(other *Dscache) error

Assign assigns the data from one dscache to this one

func (*Dscache) IsEmpty

func (d *Dscache) IsEmpty() bool

IsEmpty returns whether the dscache has any constructed data in it

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

func (d *Dscache) LookupByName(ref dsref.Ref) (*dsref.VersionInfo, error)

LookupByName looks up a dataset by dsref and returns the latest VersionInfo if found

func (*Dscache) ResolveRef added in v0.9.9

func (d *Dscache) ResolveRef(ctx context.Context, ref *dsref.Ref) (string, error)

ResolveRef finds the identifier for a dataset reference implements dsref.Resolver interface

func (*Dscache) VerboseString

func (d *Dscache) VerboseString(showEmpty bool) string

VerboseString is a convenience function that returns a readable string, for testing and debugging

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL