Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("snapshot not found")
Functions ¶
This section is empty.
Types ¶
type Direct ¶
type Direct interface {
DataDir(ctx context.Context, ref string) (string, *types.SnapshotConfig, error)
}
Direct is an optional interface for snapshot backends that expose the local data directory for per-file handling (hardlink, reflink, etc.).
type Snapshot ¶
type Snapshot interface {
Type() string
// Create persists a snapshot from the given config and data stream, returning the snapshot ID.
Create(ctx context.Context, cfg *types.SnapshotConfig, stream io.Reader) (string, error)
// List returns all snapshots.
List(ctx context.Context) ([]*types.Snapshot, error)
// Inspect returns a single snapshot by ID or name.
Inspect(ctx context.Context, ref string) (*types.Snapshot, error)
// Delete removes snapshots by ID or name. Returns the list of actually deleted IDs.
Delete(ctx context.Context, refs []string) ([]string, error)
// Restore restores a snapshot by ID or name, returning the snapshot config and a data stream.
Restore(ctx context.Context, ref string) (*types.SnapshotConfig, io.ReadCloser, error)
// Export streams the snapshot as a gzip-compressed tar archive.
// The archive includes a snapshot.json metadata entry followed by data files.
Export(ctx context.Context, ref string) (io.ReadCloser, error)
// Import reads a gzip-compressed tar archive (with snapshot.json metadata),
// stores the snapshot, and returns the new snapshot ID.
// Name and description override values from snapshot.json if non-empty.
Import(ctx context.Context, r io.Reader, name, description string) (string, error)
RegisterGC(*gc.Orchestrator)
}
Snapshot manages snapshot lifecycle and storage.
type SnapshotIndex ¶
type SnapshotIndex struct {
Snapshots map[string]*SnapshotRecord `json:"snapshots"`
Names map[string]string `json:"names"` // name → snapshot ID
}
SnapshotIndex is the top-level DB structure for the snapshot module.
func (*SnapshotIndex) Resolve ¶
func (idx *SnapshotIndex) Resolve(ref string) (string, error)
Resolve resolves a ref (exact ID, name, or ID prefix ≥3 chars) to a full snapshot ID.
func (*SnapshotIndex) ResolveMany ¶
func (idx *SnapshotIndex) ResolveMany(refs []string) ([]string, error)
ResolveMany batch-resolves refs to exact snapshot IDs, deduplicating results.
Click to show internal directories.
Click to hide internal directories.