fstree

package
v0.0.0-...-79ba347 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: GPL-3.0 Imports: 17 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

func New(opts ...Option) *FSTree

func (*FSTree) Close

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

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

GetRange implements common.Storage.

func (*FSTree) Init

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

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

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

Open implements common.Storage.

func (*FSTree) Path

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

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

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

SetCompressor implements common.Storage.

func (*FSTree) SetReportErrorFunc

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

SetReportErrorFunc implements common.Storage.

func (*FSTree) Type

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

type Option func(*FSTree)

func WithDepth

func WithDepth(d uint64) Option

func WithDirNameLen

func WithDirNameLen(l int) Option

func WithNoSync

func WithNoSync(noSync bool) Option

func WithPath

func WithPath(p string) Option

func WithPerm

func WithPerm(p fs.FileMode) Option

Jump to

Keyboard shortcuts

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