fstree

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DirNameLen is how many bytes is used to group keys into directories.
	DirNameLen = 1 // in bytes
	// MaxDepth is maximum depth of nested directories.
	MaxDepth = (sha256.Size - 1) / DirNameLen
)
View Source
const Type = "fstree"

Type is fstree storage type used in logs and configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSTree

type FSTree struct {
	Info

	*compression.Config
	Depth      uint64
	DirNameLen int
	// contains filtered or unexported fields
}

FSTree represents an object storage as a filesystem tree.

func New added in v0.32.0

func New(opts ...Option) *FSTree

func (*FSTree) Close added in v0.32.0

func (*FSTree) Close() error

Close implements common.Storage.

func (*FSTree) Delete

func (t *FSTree) Delete(prm common.DeletePrm) (common.DeleteRes, error)

Delete removes the object with the specified address from the storage.

func (*FSTree) Exists

func (t *FSTree) Exists(prm common.ExistsPrm) (common.ExistsRes, error)

Exists returns the path to the file with object contents if it exists in the storage and an error otherwise.

func (*FSTree) Get

func (t *FSTree) Get(prm common.GetPrm) (common.GetRes, error)

Get returns an object from the storage by address.

func (*FSTree) GetRange added in v0.32.0

func (t *FSTree) GetRange(prm common.GetRangePrm) (common.GetRangeRes, error)

GetRange implements common.Storage.

func (*FSTree) Init added in v0.32.0

func (t *FSTree) Init() error

Init implements common.Storage.

func (*FSTree) Iterate

func (t *FSTree) Iterate(prm common.IteratePrm) (common.IterateRes, error)

Iterate iterates over all stored objects.

func (*FSTree) NumberOfObjects added in v0.26.1

func (t *FSTree) NumberOfObjects() (uint64, error)

NumberOfObjects walks the file tree rooted at FSTree's root and returns number of stored objects.

func (*FSTree) Open added in v0.32.0

func (t *FSTree) Open(ro bool) error

Open implements common.Storage.

func (*FSTree) Path added in v0.33.0

func (t *FSTree) Path() string

Path implements common.Storage.

func (*FSTree) Put

func (t *FSTree) Put(prm common.PutPrm) (common.PutRes, error)

Put puts an object in the storage.

func (*FSTree) PutStream added in v0.28.0

func (t *FSTree) PutStream(addr oid.Address, handler func(*os.File) error) error

PutStream puts executes handler on a file opened for write.

func (*FSTree) SetCompressor added in v0.32.0

func (t *FSTree) SetCompressor(cc *compression.Config)

SetCompressor implements common.Storage.

func (*FSTree) Type added in v0.32.0

func (*FSTree) Type() string

Type implements common.Storage.

type Info

type Info struct {
	// Permission bits of the root directory.
	Permissions fs.FileMode

	// Full path to the root directory.
	RootPath string
}

Info groups the information about file storage.

type Option added in v0.32.0

type Option func(*FSTree)

func WithDepth added in v0.32.0

func WithDepth(d uint64) Option

func WithDirNameLen added in v0.32.0

func WithDirNameLen(l int) Option

func WithPath added in v0.32.0

func WithPath(p string) Option

func WithPerm added in v0.32.0

func WithPerm(p fs.FileMode) Option

Jump to

Keyboard shortcuts

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