fstree

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: GPL-3.0 Imports: 11 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
)

Variables

View Source
var ErrFileNotFound = errors.New("file not found")

ErrFileNotFound is returned when file is missing.

Functions

This section is empty.

Types

type FSTree

type FSTree struct {
	Info

	Depth      int
	DirNameLen int
}

FSTree represents object storage as filesystem tree.

func (*FSTree) Delete

func (t *FSTree) Delete(addr *objectSDK.Address) error

Delete removes object with the specified address from storage.

func (*FSTree) Exists

func (t *FSTree) Exists(addr *objectSDK.Address) (string, error)

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

func (*FSTree) Get

func (t *FSTree) Get(addr *objectSDK.Address) ([]byte, error)

Get returns object from storage by address.

func (*FSTree) Iterate

func (t *FSTree) Iterate(f func(addr *objectSDK.Address, data []byte) error) 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) Put

func (t *FSTree) Put(addr *objectSDK.Address, data []byte) error

Put puts object in 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.

Jump to

Keyboard shortcuts

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