datanode

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: EUPL-1.2 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidPassword  = errors.New("invalid password")
	ErrPasswordRequired = errors.New("password required")
)

Functions

This section is empty.

Types

type DataNode

type DataNode struct {
	// contains filtered or unexported fields
}

DataNode is an in-memory filesystem that is compatible with fs.FS.

func FromTar

func FromTar(tarball []byte) (*DataNode, error)

FromTar creates a new DataNode from a tarball.

func New

func New() *DataNode

New creates a new, empty DataNode.

func (*DataNode) AddData

func (d *DataNode) AddData(name string, content []byte)

AddData adds a file to the DataNode.

func (*DataNode) CopyFile

func (d *DataNode) CopyFile(sourcePath string, target string, perm os.FileMode) error

CopyFile copies a file from the DataNode to the local filesystem.

func (*DataNode) Exists

func (d *DataNode) Exists(name string, opts ...ExistsOptions) (bool, error)

Exists returns true if the file or directory exists.

func (*DataNode) Open

func (d *DataNode) Open(name string) (fs.File, error)

Open opens a file from the DataNode.

func (*DataNode) ReadDir

func (d *DataNode) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir reads and returns all directory entries for the named directory.

func (*DataNode) Stat

func (d *DataNode) Stat(name string) (fs.FileInfo, error)

Stat returns the FileInfo structure describing file.

func (*DataNode) ToTar

func (d *DataNode) ToTar() ([]byte, error)

ToTar serializes the DataNode to a tarball.

func (*DataNode) Walk

func (d *DataNode) Walk(root string, fn fs.WalkDirFunc, opts ...WalkOptions) error

Walk recursively descends the file tree rooted at root, calling fn for each file or directory.

type ExistsOptions

type ExistsOptions struct {
	WantType fs.FileMode
}

ExistsOptions allows customizing the Exists check.

type WalkOptions

type WalkOptions struct {
	MaxDepth   int
	Filter     func(path string, d fs.DirEntry) bool
	SkipErrors bool
}

WalkOptions allows customizing the Walk behavior.

Jump to

Keyboard shortcuts

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