Documentation ¶
Overview ¶
Package checker defines the framework for creating and restoring snapshots with a data integrity check
Package checker defines the framework for creating and restoring snapshots with a data integrity check
Index ¶
- type Checker
- func (chk *Checker) Cleanup()
- func (chk *Checker) DeleteSnapshot(ctx context.Context, snapID string) error
- func (chk *Checker) GetLiveSnapIDs() []string
- func (chk *Checker) GetSnapIDs() []string
- func (chk *Checker) GetSnapshotMetadata(snapID string) (*SnapshotMetadata, error)
- func (chk *Checker) IsSnapshotIDDeleted(snapID string) (bool, error)
- func (chk *Checker) RestoreSnapshot(ctx context.Context, snapID string, reportOut io.Writer) error
- func (chk *Checker) RestoreSnapshotToPath(ctx context.Context, snapID, destPath string, reportOut io.Writer) error
- func (chk *Checker) RestoreVerifySnapshot(ctx context.Context, snapID, destPath string, ssMeta *SnapshotMetadata, ...) error
- func (chk *Checker) TakeSnapshot(ctx context.Context, sourceDir string) (snapID string, err error)
- func (chk *Checker) VerifySnapshotMetadata() error
- type Comparer
- type SnapshotMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶ added in v0.6.0
type Checker struct { RestoreDir string // contains filtered or unexported fields }
Checker is an object that can take snapshots and restore them, performing a validation for data consistency.
func NewChecker ¶ added in v0.6.0
func NewChecker(snapIssuer snap.Snapshotter, snapmetaStore snapmeta.Store, validator Comparer) (*Checker, error)
NewChecker instantiates a new Checker, returning its pointer. A temporary directory is created to mount restored data.
func (*Checker) Cleanup ¶ added in v0.6.0
func (chk *Checker) Cleanup()
Cleanup cleans up the Checker's temporary restore data directory.
func (*Checker) DeleteSnapshot ¶ added in v0.6.0
DeleteSnapshot performs the Snapshotter's DeleteSnapshot action, and marks the snapshot with the given snapshot ID as deleted.
func (*Checker) GetLiveSnapIDs ¶ added in v0.6.0
GetLiveSnapIDs gets the list of snapshot IDs being tracked by the checker's snapshot store that do not have a deletion time associated with them.
func (*Checker) GetSnapIDs ¶ added in v0.6.0
GetSnapIDs gets the list of snapshot IDs being tracked by the checker's snapshot store.
func (*Checker) GetSnapshotMetadata ¶ added in v0.6.0
func (chk *Checker) GetSnapshotMetadata(snapID string) (*SnapshotMetadata, error)
GetSnapshotMetadata gets the metadata associated with the given snapshot ID.
func (*Checker) IsSnapshotIDDeleted ¶ added in v0.6.0
IsSnapshotIDDeleted reports whether the metadata associated with the provided snapshot ID has it marked as deleted.
func (*Checker) RestoreSnapshot ¶ added in v0.6.0
RestoreSnapshot restores a snapshot to the Checker's temporary restore directory using the Checker's Snapshotter, and performs a data consistency check on the resulting tree using the saved snapshot data.
func (*Checker) RestoreSnapshotToPath ¶ added in v0.6.0
func (chk *Checker) RestoreSnapshotToPath(ctx context.Context, snapID, destPath string, reportOut io.Writer) error
RestoreSnapshotToPath restores a snapshot to the requested path using the Checker's Snapshotter, and performs a data consistency check on the resulting tree using the saved snapshot data.
func (*Checker) RestoreVerifySnapshot ¶ added in v0.6.0
func (chk *Checker) RestoreVerifySnapshot(ctx context.Context, snapID, destPath string, ssMeta *SnapshotMetadata, reportOut io.Writer) error
RestoreVerifySnapshot restores a snapshot and verifies its integrity against the metadata provided.
func (*Checker) TakeSnapshot ¶ added in v0.6.0
TakeSnapshot gathers state information on the requested snapshot path, then performs the snapshot action defined by the Checker's Snapshotter.
func (*Checker) VerifySnapshotMetadata ¶ added in v0.6.0
VerifySnapshotMetadata compares the list of live snapshot IDs present in the Checker's metadata against a list of live snapshot IDs in the connected repository.
type Comparer ¶
type Comparer interface { Gather(ctx context.Context, path string) ([]byte, error) Compare(ctx context.Context, path string, data []byte, reportOut io.Writer) error }
Comparer describes an interface that gathers state data on a provided path, and compares that data to the state on another path.
type SnapshotMetadata ¶ added in v0.6.0
type SnapshotMetadata struct { SnapID string `json:"snapID"` SnapStartTime time.Time `json:"snapStartTime"` SnapEndTime time.Time `json:"snapEndTime"` DeletionTime time.Time `json:"deletionTime"` ValidationData []byte `json:"validationData"` }
SnapshotMetadata holds metadata associated with a given snapshot.