Documentation ¶
Index ¶
- Constants
- Variables
- func Dump(ctx context.Context, s Store, root Root, w io.Writer) error
- func Equal(a, b Root) bool
- func IsEmpty(root Root) bool
- func SpanForPath(p string) gotkv.Span
- func SplitPath(p string) []string
- type Builder
- func (b *Builder) BeginFile(p string, mode os.FileMode) error
- func (b *Builder) Finish() (*Root, error)
- func (b *Builder) IsFinished() bool
- func (b *Builder) Mkdir(p string, mode os.FileMode) error
- func (b *Builder) Write(data []byte) (int, error)
- func (b *Builder) WriteExtents(ctx context.Context, exts []*Extent) error
- type DirEnt
- type Extent
- type Info
- type Operator
- func (o *Operator) AddPrefix(root Root, p string) Root
- func (o *Operator) Check(ctx context.Context, s Store, root Root, checkData func(ref gdat.Ref) error) error
- func (o *Operator) CreateExtents(ctx context.Context, ds Store, r io.Reader) ([]*Extent, error)
- func (o *Operator) CreateFile(ctx context.Context, ms, ds Store, x Root, p string, r io.Reader) (*Root, error)
- func (o *Operator) CreateFileRoot(ctx context.Context, ms, ds Store, r io.Reader) (*Root, error)
- func (o *Operator) ForEach(ctx context.Context, s cadata.Store, root Root, p string, ...) error
- func (o *Operator) ForEachLeaf(ctx context.Context, s cadata.Store, root Root, p string, ...) error
- func (o *Operator) GetDirInfo(ctx context.Context, s Store, x Root, p string) (*Info, error)
- func (o *Operator) GetFileInfo(ctx context.Context, s Store, x Root, p string) (*Info, error)
- func (o *Operator) GetInfo(ctx context.Context, s Store, x Root, p string) (*Info, error)
- func (o *Operator) Graft(ctx context.Context, ms, ds cadata.Store, root Root, p string, branch Root) (*Root, error)
- func (o *Operator) MaxInfo(ctx context.Context, ms cadata.Store, root Root, span Span) (string, *Info, error)
- func (o *Operator) MeanBlobSizeData() int
- func (o *Operator) MeanBlobSizeMetadata() int
- func (o *Operator) Mkdir(ctx context.Context, s Store, x Root, p string) (*Root, error)
- func (o *Operator) MkdirAll(ctx context.Context, s Store, x Root, p string) (*Root, error)
- func (o *Operator) NewBuilder(ctx context.Context, ms, ds Store) *Builder
- func (o *Operator) NewEmpty(ctx context.Context, s Store) (*Root, error)
- func (o *Operator) NewReader(ctx context.Context, ms, ds Store, x Root, p string) (*Reader, error)
- func (o *Operator) Populate(ctx context.Context, s Store, root Root, mdSet, dataSet cadata.Set) error
- func (o *Operator) PutInfo(ctx context.Context, s Store, x Root, p string, md *Info) (*Root, error)
- func (o *Operator) ReadDir(ctx context.Context, s Store, x Root, p string, fn func(e DirEnt) error) error
- func (o *Operator) ReadFileAt(ctx context.Context, ms, ds Store, x Root, p string, start int64, buf []byte) (int, error)
- func (o *Operator) RemoveAll(ctx context.Context, s Store, x Root, p string) (*Root, error)
- func (o *Operator) Select(ctx context.Context, s cadata.Store, root Root, p string) (*Root, error)
- func (o *Operator) SizeOfFile(ctx context.Context, s Store, x Root, p string) (uint64, error)
- func (o *Operator) Splice(ctx context.Context, ms, ds Store, segs []Segment) (*Root, error)
- func (o *Operator) Sync(ctx context.Context, srcMeta, srcData, dstMeta, dstData Store, root Root) error
- type Option
- 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 - 2 - 8
const Sep = '/'
Variables ¶
var File_models_proto protoreflect.FileDescriptor
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 ¶
func (*Builder) WriteExtents ¶
WriteExtents adds extents to the current file. Rechunking is avoided, but the last Extent could be short, so it must be rechunked regardless. WriteExtents is useful for efficiently joining Extents from disjoint regions of a file. See also: Operator.CreateExtents
type Info ¶ added in v0.0.3
type Info struct { Mode uint32 `protobuf:"varint,1,opt,name=mode,proto3" json:"mode,omitempty"` Labels map[string]string `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
func (*Info) Descriptor
deprecated
added in
v0.0.3
func (*Info) ProtoMessage ¶ added in v0.0.3
func (*Info) ProtoMessage()
func (*Info) ProtoReflect ¶ added in v0.0.3
func (x *Info) ProtoReflect() protoreflect.Message
type Operator ¶
type Operator struct {
// contains filtered or unexported fields
}
func NewOperator ¶
func (*Operator) CreateExtents ¶
CreateExtents returns a list of extents created from r
func (*Operator) CreateFile ¶
func (o *Operator) CreateFile(ctx context.Context, ms, ds Store, 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 (*Operator) CreateFileRoot ¶
CreateFileRoot creates a new filesystem with the contents read from r at the root
func (*Operator) ForEachLeaf ¶ added in v0.0.4
func (o *Operator) ForEachLeaf(ctx context.Context, s cadata.Store, root Root, p string, fn func(p string, md *Info) error) error
ForEachLeaf calls fn with each regular file in root, beneath p.
func (*Operator) GetDirInfo ¶ added in v0.0.3
GetDirInfo returns directory metadata at p if it exists, and errors otherwise
func (*Operator) GetFileInfo ¶ added in v0.0.3
GetFileInfo returns the file metadata at p if it exists, and errors otherwise
func (*Operator) GetInfo ¶ added in v0.0.3
GetInfo retrieves the metadata at p if it exists and errors otherwise
func (*Operator) Graft ¶
func (o *Operator) Graft(ctx context.Context, ms, ds cadata.Store, root Root, p string, branch Root) (*Root, error)
Graft places branch at p in root. If p == "" then branch is returned unaltered.
func (*Operator) MaxInfo ¶ added in v0.0.4
func (o *Operator) MaxInfo(ctx context.Context, ms cadata.Store, 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 (*Operator) MeanBlobSizeData ¶ added in v0.0.4
func (*Operator) MeanBlobSizeMetadata ¶ added in v0.0.4
func (*Operator) NewBuilder ¶
func (*Operator) Populate ¶ added in v0.0.4
func (o *Operator) Populate(ctx context.Context, s Store, 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 (*Operator) ReadDir ¶
func (o *Operator) ReadDir(ctx context.Context, s Store, x Root, p string, fn func(e DirEnt) error) error
ReadDir calls fn for every child of the directory at p.
func (*Operator) ReadFileAt ¶
func (o *Operator) ReadFileAt(ctx context.Context, ms, ds Store, 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 (*Operator) Select ¶
Select returns a new root containing everything under p, shifted to the root.
func (*Operator) SizeOfFile ¶
SizeOfFile returns the size of the file at p in bytes.
type Option ¶
type Option func(o *Operator)
func WithContentCacheSize ¶
WithContentCacheSize sets the size of the cache for raw data
func WithMetaCacheSize ¶
WithMetaCacheSize sets the size of the cache for metadata
type Segment ¶
Segment is a span of a GotFS instance.
func ChangesOnBase ¶
ChangesOnBase inserts segments from base between each Segment in changes.