verify

package
v3.0.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package verify health-checks a backup storage: manifest chain integrity, archive presence and checksums, dangling archives. It never deletes anything.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	// Kind classifies the problem.
	Kind IssueKind `json:"kind"`
	// BackupID identifies the affected manifest, empty for a dangling archive.
	BackupID string `json:"backup_id,omitempty"`
	// Manifest is the storage key of the affected manifest. It is the only name
	// left when the content is unusable: a manifest carrying no backup_id, or one
	// of two objects claiming the same one, cannot be pointed at any other way.
	Manifest string `json:"manifest,omitempty"`
	// ReplicasetUUID identifies the affected shard, when the problem is shard-local.
	ReplicasetUUID string `json:"replicaset_uuid,omitempty"`
	// Archive is the storage key of the affected archive, when there is one.
	Archive string `json:"archive,omitempty"`
	// Inherited reports a chain problem that originated in an ancestor manifest.
	Inherited bool `json:"inherited,omitempty"`
	// Informational marks a finding that a healthy storage can legitimately
	// contain. It is reported, because an operator reading the output wants to
	// see everything that is there, but it does not make the storage unhealthy.
	Informational bool `json:"informational,omitempty"`
	// Detail explains the problem in one line.
	Detail string `json:"detail"`
}

Issue is one problem found in the storage.

type IssueKind

type IssueKind string

IssueKind classifies one problem found in the storage.

const (
	// IssueMissingArchive marks a manifest referencing an archive that is not stored.
	IssueMissingArchive IssueKind = "missing_archive"
	// IssueUnreadableArchive marks an archive that exists but cannot be read to the end.
	IssueUnreadableArchive IssueKind = "unreadable_archive"
	// IssueChecksumMismatch marks an archive whose bytes do not match the manifest.
	IssueChecksumMismatch IssueKind = "checksum_mismatch"
	// IssueChecksumMissing marks a manifest that carries no checksum to compare against.
	IssueChecksumMissing IssueKind = "checksum_missing"
	// IssueDanglingArchive marks a stored archive no manifest refers to.
	IssueDanglingArchive IssueKind = "dangling_archive"
	// IssueUploadInProgress marks an unreferenced archive of a backup newer than
	// every stored manifest: an upload writes its archives before the manifest
	// that references them, so this is what a backup being uploaded looks like.
	IssueUploadInProgress IssueKind = "upload_in_progress"
	// IssueChainOrphan marks a manifest whose previous backup is absent.
	IssueChainOrphan IssueKind = "chain_orphan"
	// IssueChainFork marks a manifest sharing its previous backup with another one.
	IssueChainFork IssueKind = "chain_fork"
	// IssueVclockMismatch marks an increment that does not continue its ancestor.
	IssueVclockMismatch IssueKind = "vclock_mismatch"
	// IssueInvalidManifest marks a structurally invalid manifest.
	IssueInvalidManifest IssueKind = "invalid_manifest"
	// IssueUnreadableManifest marks a stored manifest that could not be read or decoded.
	IssueUnreadableManifest IssueKind = "unreadable_manifest"
	// IssueChainProblem marks a chain problem this package does not classify further.
	IssueChainProblem IssueKind = "chain_problem"
)

type Report

type Report struct {
	// Manifests is the number of manifests read from the storage.
	Manifests int `json:"manifests_checked"`
	// Archives is the number of archives referenced by those manifests.
	Archives int `json:"archives_checked"`
	// Issues lists every problem found, manifest by manifest in chain order,
	// dangling archives last.
	Issues []Issue `json:"issues"`
}

Report is the outcome of a storage health check.

func Verify

func Verify(ctx context.Context, store storage.Storage) (*Report, error)

Verify reads every manifest, recomputes the checksum of every archive it references, and lists archives no manifest refers to. It only reads: no object is written or deleted, whatever it finds.

func (*Report) OK

func (r *Report) OK() bool

OK reports whether the storage is healthy. Informational findings do not count: a backup being uploaded right now is not a defect, and a check that fails during every nightly backup teaches its operator to ignore it.

func (*Report) Problems

func (r *Report) Problems() int

Problems counts the findings that make the storage unhealthy.

Jump to

Keyboard shortcuts

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