Documentation
¶
Index ¶
- Constants
- func Dump(ctx context.Context, ms stores.RO, root Root, w io.Writer) error
- func Equal(a, b Root) bool
- func SpanForPath(p string) gotkv.Span
- func SplitPath(p string) []string
- type Builder
- type DiffEntry
- type Differ
- type DirEnt
- type Entry
- type Extent
- type Info
- type InfoDiff
- type InfoDiffer
- type InfoEntry
- type InfoIterator
- type Iterator
- type Key
- type Machine
- func (mach *Machine) Check(ctx context.Context, ms stores.RO, root Root, ...) error
- func (mach *Machine) Concat(ctx context.Context, ss RW, segs iter.Seq[Segment]) (Segment, error)
- func (mach *Machine) CreateFile(ctx context.Context, ss RW, x Root, p string, r io.Reader) (*Root, error)
- func (mach *Machine) Exists(ctx context.Context, ms stores.RO, root Root, p string) (bool, error)
- func (mach *Machine) ExistsDir(ctx context.Context, ms stores.RO, root Root, p string) (bool, error)
- func (mach *Machine) FileFromReader(ctx context.Context, ss RW, mode posixfs.FileMode, r io.Reader) (*Root, error)
- func (mach *Machine) FileFromReaders(ctx context.Context, ss RW, mode posixfs.FileMode, rs []io.Reader) (*Root, error)
- func (mach *Machine) ForEach(ctx context.Context, s stores.RO, root Root, p string, ...) error
- func (mach *Machine) ForEachLeaf(ctx context.Context, s stores.RO, root Root, p string, ...) error
- func (mach *Machine) GetDirInfo(ctx context.Context, s stores.RO, x Root, p string) (*Info, error)
- func (mach *Machine) GetFileInfo(ctx context.Context, s stores.RO, x Root, p string) (*Info, error)
- func (mach *Machine) GetInfo(ctx context.Context, s stores.RO, x Root, p string) (*Info, error)
- func (mach *Machine) Graft(ctx context.Context, ss RW, root Root, p string, branch Root) (*Root, error)
- func (mach *Machine) MaxInfo(ctx context.Context, ms stores.RO, root Root, span Span) (string, *Info, error)
- func (mach *Machine) MeanBlobSizeData() int
- func (mach *Machine) MeanBlobSizeMetadata() int
- func (mach *Machine) MetadataKV() *gotkv.Machine
- func (mach *Machine) Mkdir(ctx context.Context, s stores.RW, x Root, p string) (*Root, error)
- func (mach *Machine) MkdirAll(ctx context.Context, s stores.RW, x Root, p string) (*Root, error)
- func (mach *Machine) NewBuilder(ctx context.Context, ss RW) *Builder
- func (mach *Machine) NewDiffer(ms stores.RO, left, right Root) *Differ
- func (mach *Machine) NewEmpty(ctx context.Context, ms stores.RW, mode fs.FileMode) (*Root, error)
- func (mach *Machine) NewInfoDiffer(s stores.RO, left, right Root) InfoDiffer
- func (mach *Machine) NewInfoIterator(s stores.RW, root Root) *InfoIterator
- func (m *Machine) NewIterator(s stores.RO, root Root, span Span) Iterator
- func (mach *Machine) NewReader(ctx context.Context, ss RO, x Root, p string) (*Reader, error)
- func (mach *Machine) Pick(ctx context.Context, s stores.RW, root Root, p string) (*Root, error)
- func (mach *Machine) Populate(ctx context.Context, s stores.RO, root Root, mdSet, dataSet stores.Set) error
- func (mach *Machine) PutFile(ctx context.Context, ss RW, x Root, p string, r io.Reader) (*Root, error)
- func (mach *Machine) PutInfo(ctx context.Context, s stores.RW, x Root, p string, info *Info) (*Root, error)
- func (mach *Machine) ReadDir(ctx context.Context, s stores.RO, x Root, p string, fn func(e DirEnt) error) error
- func (mach *Machine) ReadFile(ctx context.Context, ss RO, x Root, p string, max int) ([]byte, error)
- func (mach *Machine) ReadFileAt(ctx context.Context, ss RO, x Root, p string, start int64, buf []byte) (int, error)
- func (mach *Machine) RemoveAll(ctx context.Context, s stores.RW, x Root, p string) (*Root, error)
- func (mach *Machine) ShiftOut(x Segment, p string) Segment
- func (mach *Machine) SizeOfFile(ctx context.Context, s stores.RO, x Root, p string) (uint64, error)
- func (mach *Machine) Splice(ctx context.Context, ss RW, segs []Segment) (*Root, error)
- func (mach *Machine) Sync(ctx context.Context, src RO, dst WO, root Root) error
- type Params
- type RO
- type RW
- type Reader
- type Ref
- type Root
- type Segment
- type Span
- type Store
- type Value
- type WO
Constants ¶
const ( DefaultMaxBlobSize = 1 << 21 DefaultMinBlobSizeData = 1 << 12 DefaultMeanBlobSizeData = 1 << 20 DefaultMeanBlobSizeMetadata = 1 << 13 DefaultContentCacheSize = 16 DefaultMetadataCacheSize = 16 )
const MaxPathLen = gotkv.MaxKeySize - 9
const RootSize = gdat.RefSize + 1
const Sep = '/'
Variables ¶
This section is empty.
Functions ¶
func SpanForPath ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder manages building a filesystem.
func (*Builder) BeginFile ¶
BeginFile creates a metadata entry for a regular file at p and directs Write calls to the content of that file.
func (*Builder) Finish ¶
Finish closes the builder and returns the Root to the filesystem. Finish is idempotent, and is safe to call multiple times. Not calling finish is not an error, the builder does not allocate resources other than memory.
func (*Builder) IsFinished ¶
type DiffEntry ¶ added in v0.4.0
DiffEntry is a single element of the difference between 2 filesystems.
type Differ ¶
type Differ struct {
// contains filtered or unexported fields
}
Differ iterates over the difference between 2 filesystems.
type InfoDiffer ¶ added in v0.4.0
type InfoDiffer struct {
// contains filtered or unexported fields
}
type InfoIterator ¶ added in v0.3.0
type InfoIterator struct {
// contains filtered or unexported fields
}
type Iterator ¶ added in v0.4.0
type Iterator struct {
// contains filtered or unexported fields
}
Iterate iterates over the metadata in a gotfs filesystem.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is a key that GotFS stores in GotKV. It contains a path and either an Extent end offset or an Info sentinel value.
func NewInfoKey ¶ added in v0.4.0
func (Key) ChildrenSpan ¶
ChildrenSpan returns a span that contains all children or the path if it was a directory
type Machine ¶
type Machine struct {
// contains filtered or unexported fields
}
func NewMachine ¶
func (*Machine) CreateFile ¶
func (mach *Machine) CreateFile(ctx context.Context, ss RW, x Root, p string, r io.Reader) (*Root, error)
CreateFile creates a file at p with data from r If there is an entry at p CreateFile returns an error ms is the store used for metadata ds is the store used for data.
func (*Machine) ExistsDir ¶ added in v0.3.0
func (mach *Machine) ExistsDir(ctx context.Context, ms stores.RO, root Root, p string) (bool, error)
ExistsDir returns true if there is an INFO object at p which is a directory.
func (*Machine) FileFromReader ¶
func (*Machine) FileFromReaders ¶
func (mach *Machine) FileFromReaders(ctx context.Context, ss RW, mode posixfs.FileMode, rs []io.Reader) (*Root, error)
ImportReaders creates a single file at the root from concatenating the data in rs. Each reader will be imported from in parallel.
func (*Machine) ForEachLeaf ¶
func (mach *Machine) ForEachLeaf(ctx context.Context, s stores.RO, root Root, p string, fn func(p string, md *Info) error) error
ForEachLeaf calls fn with each regular file in root, beneath p.
func (*Machine) GetDirInfo ¶
GetDirInfo returns directory metadata at p if it exists, and errors otherwise
func (*Machine) GetFileInfo ¶
GetFileInfo returns the file metadata at p if it exists, and errors otherwise
func (*Machine) Graft ¶
func (mach *Machine) Graft(ctx context.Context, ss RW, root Root, p string, branch Root) (*Root, error)
Graft places branch at p in root. If p == "" then branch is returned unaltered.
func (*Machine) MaxInfo ¶
func (mach *Machine) MaxInfo(ctx context.Context, ms stores.RO, root Root, span Span) (string, *Info, error)
MaxInfo returns the maximum path and the corresponding Info for the path. If no Info entry can be found MaxInfo returns ("", nil, nil)
func (*Machine) MeanBlobSizeData ¶
func (*Machine) MeanBlobSizeMetadata ¶
func (*Machine) MetadataKV ¶ added in v0.4.0
MetadataKV returns the gotkv.Machine used for metadata
func (*Machine) NewInfoDiffer ¶ added in v0.4.0
func (mach *Machine) NewInfoDiffer(s stores.RO, left, right Root) InfoDiffer
func (*Machine) NewInfoIterator ¶ added in v0.3.0
func (mach *Machine) NewInfoIterator(s stores.RW, root Root) *InfoIterator
func (*Machine) NewIterator ¶ added in v0.4.0
func (*Machine) Pick ¶ added in v0.4.0
Pick returns a new root containing everything under p, shifted to the root.
func (*Machine) Populate ¶
func (mach *Machine) Populate(ctx context.Context, s stores.RO, root Root, mdSet, dataSet stores.Set) error
Populate adds the ID for all the metadata blobs to mdSet and all the data blobs to dataSet
func (*Machine) PutFile ¶
func (mach *Machine) PutFile(ctx context.Context, ss RW, x Root, p string, r io.Reader) (*Root, error)
PutFile creates or replaces the file at path using data from r
func (*Machine) PutInfo ¶
func (mach *Machine) PutInfo(ctx context.Context, s stores.RW, x Root, p string, info *Info) (*Root, error)
PutInfo assigns metadata to p
func (*Machine) ReadDir ¶
func (mach *Machine) ReadDir(ctx context.Context, s stores.RO, x Root, p string, fn func(e DirEnt) error) error
ReadDir calls fn for every child of the directory at p.
func (*Machine) ReadFileAt ¶
func (mach *Machine) ReadFileAt(ctx context.Context, ss RO, x Root, p string, start int64, buf []byte) (int, error)
ReadFileAt fills `buf` with data in the file at `p` starting at offset `start`
func (*Machine) ShiftOut ¶ added in v0.4.0
ShiftOut shifts all the entries in a segment out by path. A path at a/b/ in x will be at p + a/b/ in the returned segment.
func (*Machine) SizeOfFile ¶
SizeOfFile returns the size of the file at p in bytes.
type Params ¶ added in v0.4.0
type Params struct {
Salt [32]byte
// MaxBlobSize is the maximum size of any blob posted by GotFS
MaxBlobSize *int
// MinSizeData is the minimum size of any content blob.
MinBlobSizeData *int
// MeanSizeData is the target mean size of all the content blobs.
MeanBlobSizeData *int
// MeanSizeMeta is the target meansize of all metadata blobs.
MeanBlobSizeMetadata *int
// ContentCacheSize is the number of blobs to keep in the content cache.
ContentCacheSize *int
// MetaCacheSize is the number of blobs to keep in the metadata cache.
MetaCacheSize *int
}
func (Params) GetContentCacheSize ¶ added in v0.4.0
func (Params) GetMaxBlobSize ¶ added in v0.4.0
func (Params) GetMeanBlobSizeData ¶ added in v0.4.0
func (Params) GetMeanBlobSizeMetadata ¶ added in v0.4.0
func (Params) GetMetaCacheSize ¶ added in v0.4.0
func (Params) GetMinSizeData ¶ added in v0.4.0
type Root ¶
func Promote ¶ added in v0.4.0
Promote promotes a segment to a Root if the segment has the correct first key.
type Segment ¶
type Segment struct {
// Contents is the gotkv instance representing the segment.
// If it contains entries outside of Span, they will not be used.
// If Contents is the zero value, then it will be interpretted as empty
Contents gotkv.Root
// Span is the span in the final Splice operation
Span gotkv.Span
}
Segment is a contiguous subset of a GotFS instance. It may not be a valid Root.