fstree

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 20 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) GetBytes added in v0.41.0

func (t *FSTree) GetBytes(addr oid.Address) ([]byte, error)

GetBytes reads object from the FSTree by address into memory buffer in a canonical NeoFS binary format. Returns apistatus.ObjectNotFound if object is missing.

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) SetCompressor added in v0.32.0

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

SetCompressor implements common.Storage.

func (*FSTree) SetReportErrorFunc added in v0.36.0

func (t *FSTree) SetReportErrorFunc(_ func(string, error))

SetReportErrorFunc 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 WithNoSync added in v0.36.0

func WithNoSync(noSync bool) 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