merkle

package
v0.0.0-...-6ba75c9 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileNodeUUID      = 0x01
	DirectoryNodeUUID = 0x02
	SymlinkNodeUUID   = 0x03 // unused, but reserved for future use

	// DirectoryUUID is used to identify an (unnamed) directory
	// together with the hashes of its children.
	// (like the top-level directory in a tree artifact).
	DirectryUUID = 0xff
)

Variables

This section is empty.

Functions

func NewTreeHasher

func NewTreeHasher(fsys fs.FS, newHash func() hash.Hash) *treeHasher

Types

type Directory

type Directory struct {
	Files       metadataSlice[FileNode]
	Directories metadataSlice[DirectoryNode]
}

func (Directory) Hash

func (n Directory) Hash(h hash.Hash) []byte

type DirectoryNode

type DirectoryNode struct {
	Name metadataString
	Hash metadataBytes
}

func (DirectoryNode) Fingerprint

func (n DirectoryNode) Fingerprint(h hash.Hash)

type FileNode

type FileNode struct {
	Name        metadataString
	Size        metadataSize
	ContentHash metadataBytes
	Mtime       metadataTime
	Mode        metadataMode
}

func DefaultFileNode

func DefaultFileNode(contentHash []byte, info fs.FileInfo) FileNode

DefaultFileNode creates a FileNode with normalized metadata. This is the default metadata used in tar files, unless otherwise specified.

func DetailedFileNode

func DetailedFileNode(contentHash []byte, info fs.FileInfo) FileNode

DetailedFileNode creates a FileNode with detailed metadata. The extra metadata can be used for special purposes, but doing so avoids deduplication of the file.

func (FileNode) Fingerprint

func (n FileNode) Fingerprint(h hash.Hash)

type TreeHasher

type TreeHasher struct{}

Jump to

Keyboard shortcuts

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