Documentation
¶
Overview ¶
Package types defines shared types and interfaces used across all doomsday packages. This package has zero internal dependencies — only Go stdlib.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrRepoNotFound = errors.New("repository not found") ErrRepoExists = errors.New("repository already exists") ErrDecryptFailed = errors.New("decryption failed: wrong key or corrupted data") ErrLockConflict = errors.New("repository is locked by another process") ErrCorrupted = errors.New("data corruption detected") ErrNotFound = errors.New("not found") ErrReadOnly = errors.New("repository is read-only") ErrInvalidKey = errors.New("invalid key or password") ErrVersionTooNew = errors.New("repository version is newer than this binary supports — please update doomsday") ErrRollback = errors.New("repository rollback detected — snapshot(s) missing that were previously seen") )
Sentinel errors used across packages.
Functions ¶
func ValidateName ¶
ValidateName checks that a backend file name is safe for use as a path component. Rejects names containing path separators, traversal sequences, or null bytes that could escape the repository directory.
Types ¶
type Backend ¶
type Backend interface {
// Location returns a human-readable description of the backend.
Location() string
// Save writes data from rd to the backend under the given type and name.
// The name should not include path separators — the backend maps FileType to directories.
Save(ctx context.Context, t FileType, name string, rd io.Reader) error
// Load reads a range of bytes from the named file.
// If length is 0, the entire file is returned starting from offset.
Load(ctx context.Context, t FileType, name string, offset, length int64) (io.ReadCloser, error)
// Stat returns info about the named file.
Stat(ctx context.Context, t FileType, name string) (FileInfo, error)
// Remove deletes the named file.
Remove(ctx context.Context, t FileType, name string) error
// List calls fn for each file of the given type.
// If fn returns an error, iteration stops and that error is returned.
List(ctx context.Context, t FileType, fn func(FileInfo) error) error
// Close releases any resources held by the backend.
Close() error
}
Backend is the storage abstraction for repository data. Implementations exist for local filesystem, SFTP, and S3-compatible stores.
type BlobID ¶
type BlobID [32]byte
BlobID is the HMAC-SHA256 content identifier for a blob (32 bytes).
func ParseBlobID ¶
ParseBlobID parses a hex-encoded blob ID string.
type BlobType ¶
type BlobType uint8
BlobType identifies the sub-category of a blob within a pack file.
type FileType ¶
type FileType int
FileType identifies the category of a file within the repository layout.
const ( FileTypePack FileType = iota // data/ — pack files containing blobs FileTypeIndex // index/ — blob-to-pack mapping files FileTypeSnapshot // snapshots/ — snapshot metadata FileTypeKey // keys/ — key files FileTypeConfig // config — repository configuration FileTypeLock // locks/ — lock files )
type PackedBlob ¶
type PackedBlob struct {
ID BlobID
Type BlobType
PackID string // name of the pack file
Offset uint32 // byte offset within the pack
Length uint32 // encrypted length in pack
UncompressedLength uint32 // original size before compression (0 if uncompressed)
}
PackedBlob describes a blob stored within a pack file.