dirtree

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIR  = "tree"
	FILE = "blob"
)

Variables

View Source
var LogContext = ocmlog.Context().WithContext(LogRealm)

LogContext is the default logging content used by dirtree functions. It uses its package location as message context and is based on the ocm logging context.

View Source
var LogRealm = logging.Package()

LogRealm is the realm used for logging output of this package.

Functions

This section is empty.

Types

type Context

type Context interface {
	logging.Context
	Hasher() hash.Hash
	FileMode(vfs.FileMode) Mode
	DirMode(vfs.FileMode) Mode
	LinkMode(vfs.FileMode) Mode
	WriteHeader(w io.Writer, typ string, size int64) error
}

func DefaultContext

func DefaultContext(ctx ...logging.Context) Context

DefaultContext provides a default directory tree hashing context. It is based on the Git tree hash mechanism.

type DirNode

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

func NewDirNode

func NewDirNode(ctx Context) *DirNode

func NewTarDirNode

func NewTarDirNode(ctx Context, tr *tar.Reader) (*DirNode, error)

func NewVFSDirNode

func NewVFSDirNode(ctx Context, p string, fss ...vfs.FileSystem) (*DirNode, error)

func (*DirNode) AddNode

func (d *DirNode) AddNode(name string, n Node) error

func (*DirNode) Complete

func (d *DirNode) Complete()

func (*DirNode) Completed

func (d *DirNode) Completed() bool

func (*DirNode) Context

func (d *DirNode) Context() Context

type FileNode

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

func NewFileNode

func NewFileNode(ctx Context, mode vfs.FileMode, size int64, r io.Reader) (*FileNode, error)

func NewLinkNode

func NewLinkNode(ctx Context, link string) (*FileNode, error)

func (*FileNode) Complete

func (n *FileNode) Complete()

func (*FileNode) Completed

func (n *FileNode) Completed() bool

func (*FileNode) Hash

func (n *FileNode) Hash() []byte

func (*FileNode) Mode

func (n *FileNode) Mode() Mode

func (*FileNode) Type

func (n *FileNode) Type() string

type Mode

type Mode = uint32
const (
	ModeSym  Mode = ModeBlob | 1<<(15-2)
	ModeDir  Mode = 1 << (15 - 1)
	ModeBlob Mode = 1 << (15)
)

func FileMode

func FileMode(m vfs.FileMode) Mode

type Node

type Node interface {
	Type() string
	Hash() []byte
	Mode() Mode
	Completed() bool

	Complete()
}

func NewVFSFileNode

func NewVFSFileNode(ctx Context, p string, fss ...vfs.FileSystem) (Node, error)

Jump to

Keyboard shortcuts

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