Documentation
¶
Overview ¶
Package fslayer provides filesystem layer storage and management for snapshots.
Index ¶
- func BaseKey(imageRef string, arch string) string
- func CopyOpKey(src, dst string, contentHash string) string
- func DeleteManifest(dir, cacheKey string) error
- func DeriveKey(parentKey string, opKey string) string
- func ListManifests(dir string) ([]string, error)
- func ManifestExists(dir, cacheKey string) bool
- func RunOpKey(cmd []string, env []string, workDir string, user string) string
- func SaveManifest(manifest *FSManifest, dir string) error
- func SnapshotOpKey(layerHash string) string
- type FSManifest
- type Layer
- type LayerData
- type LayerEntry
- type LayerEntryKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteManifest ¶
DeleteManifest removes a manifest and its associated layers if they're not referenced by other manifests.
func DeriveKey ¶
DeriveKey derives a cache key from a parent key and an operation key. The resulting key is deterministic and uniquely identifies the state after applying the operation to the parent state.
func ListManifests ¶
ListManifests returns all manifest cache keys in a directory.
func ManifestExists ¶
ManifestExists checks if a manifest exists for the given cache key.
func SaveManifest ¶
func SaveManifest(manifest *FSManifest, dir string) error
SaveManifest saves a filesystem snapshot manifest to disk.
func SnapshotOpKey ¶
SnapshotOpKey generates an operation key for a snapshot with a layer hash.
Types ¶
type FSManifest ¶
type FSManifest struct {
Version int `json:"version"`
CacheKey string `json:"cacheKey"`
Layers []string `json:"layers"` // Layer hashes in order (base first)
BaseImageRef string `json:"baseImageRef"` // Original OCI image reference
Architecture string `json:"architecture"`
}
FSManifest describes a persisted filesystem snapshot.
func LoadManifest ¶
func LoadManifest(dir, cacheKey string) (*FSManifest, error)
LoadManifest loads a filesystem snapshot manifest from disk.
type Layer ¶
type Layer struct {
Hash string // SHA256 hash of the layer contents
IndexPath string // Path to .idx file
ContentsPath string // Path to .contents file
}
Layer represents a stored filesystem layer.
type LayerData ¶
type LayerData struct {
Entries []LayerEntry
}
LayerData holds all modifications in a filesystem layer.
type LayerEntry ¶
type LayerEntry struct {
Path string
Kind LayerEntryKind
Mode fs.FileMode
UID int
GID int
ModTime time.Time
Size int64
Data []byte // For regular files, the content; for symlinks, the target
}
LayerEntry represents a single entry in a filesystem layer.
type LayerEntryKind ¶
type LayerEntryKind uint8
LayerEntryKind describes the type of layer entry.
const ( LayerEntryRegular LayerEntryKind = iota LayerEntryDirectory LayerEntrySymlink LayerEntryDeleted // Whiteout marker )