format

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package format defines the durable, versioned container format shared by compactfs metadata, chunk references, and every export protocol.

Index

Constants

View Source
const (
	// Magic identifies the volume-format record stored in metadata.
	Magic = "CFSFRM01"
	// CurrentVersion is the only volume-format schema this package writes.
	CurrentVersion = uint16(2)
	// CodecRegistryVersion freezes the codec-name mapping used by chunk refs.
	CodecRegistryVersion = uint16(2)
)

Variables

View Source
var (
	ErrInvalidFormat   = errors.New("invalid compactfs volume format")
	ErrUnsupported     = errors.New("unsupported compactfs volume format")
	ErrInvalidArgument = errors.New("invalid compactfs format argument")
)

Functions

This section is empty.

Types

type Volume

type Volume struct {
	Version       uint16
	CodecRegistry uint16
	// ChunkSize is the raw maximum of every non-final chunk and the indexing
	// unit used by file manifests. Reopening with another value would reinterpret
	// file offsets, so it is fixed when the volume is created.
	ChunkSize uint64
	// Chunking and CDC bounds select backend subdivision inside each fixed
	// raw addressing window. This policy is immutable for the volume.
	Chunking string
	ChunkMin uint64
	ChunkAvg uint64
	ChunkMax uint64
	// HashAlgorithm names the raw-content address used by backend object keys.
	HashAlgorithm string
	// Features is reserved for backward-compatible, format-defined flags. A
	// reader must reject flags it does not understand.
	Features uint64
}

Volume is the immutable structural identity of a compactfs volume. It does not select one encoder for the whole volume: each chunk ref stores its wire codec from the frozen registry identified by CodecRegistry.

func New

func New(chunkSize int64) (Volume, error)

New returns the current format for a new volume.

func (Volume) Equal

func (v Volume) Equal(other Volume) bool

Equal compares every persisted structural field.

func (Volume) MarshalBinary

func (v Volume) MarshalBinary() ([]byte, error)

MarshalBinary returns the self-identifying record stored in metadata. The containing metadata transaction supplies durability and checksum; this body has fixed integer fields and only one length-prefixed string.

func (Volume) String

func (v Volume) String() string

String is intended for diagnostics; the metadata record remains binary.

func (*Volume) UnmarshalBinary

func (v *Volume) UnmarshalBinary(data []byte) error

UnmarshalBinary validates magic, schema, hash name, and trailing bytes.

func (Volume) Validate

func (v Volume) Validate() error

Validate checks whether this implementation can safely address and decode a volume. Unknown versions, codec registries, hash algorithms, or feature bits are rejected rather than treated as today's defaults.

Jump to

Keyboard shortcuts

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