Documentation
¶
Index ¶
- Constants
- func Dump(ctx context.Context, s stores.Reading, 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 Delta
- type DeltaBuilder
- type DeltaEntry
- type DeltaIterator
- type Differ
- type DirEnt
- type Expr
- type Extent
- type GetPostExister
- type Info
- type Key
- type Machine
- func (mach *Machine) Check(ctx context.Context, s stores.Reading, root Root, ...) error
- func (mach *Machine) CreateFile(ctx context.Context, ss [2]stores.RW, x Root, p string, r io.Reader) (*Root, error)
- func (mach *Machine) Exists(ctx context.Context, ms stores.Reading, root Root, p string) (bool, error)
- func (mach *Machine) FileFromReader(ctx context.Context, ss [2]stores.RW, mode posixfs.FileMode, r io.Reader) (*Root, error)
- func (mach *Machine) FileFromReaders(ctx context.Context, ss [2]stores.RW, mode posixfs.FileMode, rs []io.Reader) (*Root, error)
- func (mach *Machine) ForEach(ctx context.Context, s stores.Reading, root Root, p string, ...) error
- func (mach *Machine) ForEachLeaf(ctx context.Context, s stores.Reading, root Root, p string, ...) error
- func (mach *Machine) GetDirInfo(ctx context.Context, s stores.Reading, x Root, p string) (*Info, error)
- func (mach *Machine) GetFileInfo(ctx context.Context, s stores.Reading, x Root, p string) (*Info, error)
- func (mach *Machine) GetInfo(ctx context.Context, s stores.Reading, x Root, p string) (*Info, error)
- func (mach *Machine) Graft(ctx context.Context, ss [2]stores.RW, root Root, p string, branch Root) (*Root, error)
- func (mach *Machine) MaxInfo(ctx context.Context, ms stores.Reading, root Root, span Span) (string, *Info, error)
- func (mach *Machine) MeanBlobSizeData() int
- func (mach *Machine) MeanBlobSizeMetadata() int
- 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, ms, ds stores.RW) *Builder
- func (mach *Machine) NewDeltaBuilder(ms, ds stores.RW) *DeltaBuilder
- func (mach *Machine) NewDeltaIterator(ms, ds stores.Reading, delta Delta) *DeltaIterator
- func (mach *Machine) NewDiffer(ms stores.Reading, left, right Root) *Differ
- func (mach *Machine) NewEmpty(ctx context.Context, s stores.RW) (*Root, error)
- func (mach *Machine) NewReader(ctx context.Context, ss [2]stores.Reading, x Root, p string) (*Reader, error)
- func (mach *Machine) Populate(ctx context.Context, s stores.Reading, root Root, mdSet, dataSet cadata.Set) error
- func (mach *Machine) PutFile(ctx context.Context, ss [2]stores.RW, x Root, p string, r io.Reader) (*Root, error)
- func (mach *Machine) PutInfo(ctx context.Context, s stores.RW, x Root, p string, md *Info) (*Root, error)
- func (mach *Machine) ReadDir(ctx context.Context, s stores.Reading, x Root, p string, ...) error
- func (mach *Machine) ReadFile(ctx context.Context, ss [2]stores.Reading, x Root, p string, max int) ([]byte, error)
- func (mach *Machine) ReadFileAt(ctx context.Context, ss [2]stores.Reading, x Root, p string, start int64, ...) (int, error)
- func (mach *Machine) RemoveAll(ctx context.Context, s Store, x Root, p string) (*Root, error)
- func (mach *Machine) Select(ctx context.Context, s stores.RW, root Root, p string) (*Root, error)
- func (mach *Machine) SizeOfFile(ctx context.Context, s stores.Reading, x Root, p string) (uint64, error)
- func (mach *Machine) Splice(ctx context.Context, ss [2]stores.RW, segs []Segment) (*Root, error)
- func (mach *Machine) Sync(ctx context.Context, src [2]stores.Reading, dst [2]stores.Writing, root Root) error
- type Option
- type PutContent
- type Reader
- type Ref
- type Root
- type Segment
- type Span
- type Store
Constants ¶
const ( DefaultMaxBlobSize = 1 << 21 DefaultMinBlobSizeData = 1 << 12 DefaultMeanBlobSizeData = 1 << 20 DefaultMeanBlobSizeMetadata = 1 << 13 )
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 DeltaBuilder ¶
type DeltaBuilder struct {
// contains filtered or unexported fields
}
type DeltaEntry ¶
type DeltaEntry struct {
Path string
PutInfo *Info
Delete *struct{}
PutContent *PutContent
}
type DeltaIterator ¶
type DeltaIterator struct {
// contains filtered or unexported fields
}
func (*DeltaIterator) Next ¶
func (di *DeltaIterator) Next(ctx context.Context, dsts []DeltaEntry) (int, error)
type GetPostExister ¶
type GetPostExister interface {
cadata.Getter
cadata.PostExister
}
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 (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 [2]stores.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) FileFromReader ¶
func (*Machine) FileFromReaders ¶
func (mach *Machine) FileFromReaders(ctx context.Context, ss [2]stores.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.Reading, 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 ¶
func (mach *Machine) GetDirInfo(ctx context.Context, s stores.Reading, x Root, p string) (*Info, error)
GetDirInfo returns directory metadata at p if it exists, and errors otherwise
func (*Machine) GetFileInfo ¶
func (mach *Machine) GetFileInfo(ctx context.Context, s stores.Reading, x Root, p string) (*Info, error)
GetFileInfo returns the file metadata at p if it exists, and errors otherwise
func (*Machine) GetInfo ¶
func (mach *Machine) GetInfo(ctx context.Context, s stores.Reading, x Root, p string) (*Info, error)
GetInfo retrieves the metadata at p if it exists and errors otherwise
func (*Machine) Graft ¶
func (mach *Machine) Graft(ctx context.Context, ss [2]stores.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.Reading, 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) NewBuilder ¶
func (*Machine) NewDeltaBuilder ¶
func (mach *Machine) NewDeltaBuilder(ms, ds stores.RW) *DeltaBuilder
func (*Machine) NewDeltaIterator ¶
func (mach *Machine) NewDeltaIterator(ms, ds stores.Reading, delta Delta) *DeltaIterator
func (*Machine) NewReader ¶
func (mach *Machine) NewReader(ctx context.Context, ss [2]stores.Reading, x Root, p string) (*Reader, error)
NewReader returns an io.Reader | io.Seeker | io.ReaderAt
func (*Machine) Populate ¶
func (mach *Machine) Populate(ctx context.Context, s stores.Reading, root Root, mdSet, dataSet cadata.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 [2]stores.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, md *Info) (*Root, error)
PutInfo assigns metadata to p
func (*Machine) ReadDir ¶
func (mach *Machine) ReadDir(ctx context.Context, s stores.Reading, 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 [2]stores.Reading, 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) Select ¶
Select returns a new root containing everything under p, shifted to the root.
func (*Machine) SizeOfFile ¶
func (mach *Machine) SizeOfFile(ctx context.Context, s stores.Reading, x Root, p string) (uint64, error)
SizeOfFile returns the size of the file at p in bytes.
type Option ¶
type Option func(a *Machine)
func WithContentCacheSize ¶
WithContentCacheSize sets the size of the cache for raw data
func WithMetaCacheSize ¶
WithMetaCacheSize sets the size of the cache for metadata