health

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintReport added in v0.5.1

func PrintReport(report *HealthReport)

Types

type AssetHealth added in v0.4.1

type AssetHealth struct {
	Total   int `json:"total"`
	Healthy int `json:"healthy"`
	Failed  int `json:"failed"`

	// Interrupted counts assets whose last sync attempt was cancelled
	// (state.Asset.Cause == logging.CauseCancelled) rather than
	// genuinely failed. Deliberately excluded from Failed and from
	// updateStatus's warning trigger — nothing is actually wrong; the
	// next sync will simply retry them.
	Interrupted int `json:"interrupted,omitempty"`
}

type DiskHealth added in v0.3.0

type DiskHealth struct {
	Path        string `json:"path"`
	Free        uint64 `json:"free"`
	Total       uint64 `json:"total"`
	FreePercent uint8  `json:"free_percent"`
	Device      uint64 `json:"-"` // Don't include this field when marshaling to JSON
}

type HealthReport

type HealthReport struct {
	GeneratedAt string `json:"generated_at"`

	Status string `json:"status"`

	Repositories AssetHealth `json:"repositories"`
	Gists        AssetHealth `json:"gists"`

	Quarantine QuarantineHealth `json:"quarantine"`

	// Orphaned lists mirrors on disk that discovery no longer lists.
	// Informational only: it never affects Status, because nothing is
	// broken. See mirror.FindOrphans.
	Orphaned OrphanHealth `json:"orphaned"`

	Sync      SyncHealth      `json:"sync"`
	Snapshots SnapshotHealth  `json:"snapshots"`
	Disks     []DiskHealth    `json:"disks"`
	Retention RetentionHealth `json:"retention"`

	Warnings        []string `json:"warnings,omitempty"`
	Recommendations []string `json:"recommendations,omitempty"`
}

func Generate

func Generate(cfg *config.Config, layout runtime.Layout) (*HealthReport, error)

type OrphanHealth added in v0.5.6

type OrphanHealth struct {
	// Mirrors are intact backups that `gitback sync` no longer updates.
	Mirrors OrphanList `json:"mirrors"`

	// Quarantine holds corrupt mirrors whose upstream is also gone, so
	// automatic recovery can never happen.
	Quarantine OrphanList `json:"quarantine"`
}

OrphanHealth separates intact-but-no-longer-updated mirrors from quarantined ones, because the appropriate action differs.

type OrphanList added in v0.5.6

type OrphanList struct {
	Repositories []string `json:"repositories,omitempty"`
	Gists        []string `json:"gists,omitempty"`
}

OrphanList is a set of mirror names, split by kind.

func (OrphanList) Count added in v0.5.6

func (l OrphanList) Count() int

Count returns the total number of names in the list.

type QuarantineHealth added in v0.5.1

type QuarantineHealth struct {
	Repositories int `json:"repositories"`
	Gists        int `json:"gists"`
}

type RetentionHealth added in v0.3.0

type RetentionHealth struct {
	Enabled bool `json:"enabled"`
	Keep    int  `json:"keep"`
}

type SnapshotHealth added in v0.3.0

type SnapshotHealth struct {
	Count  uint64 `json:"count"`
	Size   int64  `json:"size"`
	Latest string `json:"latest,omitempty"`
}

type SyncHealth added in v0.3.0

type SyncHealth struct {
	StartedAt   string `json:"started_at,omitempty"`
	CompletedAt string `json:"completed_at,omitempty"`
}

Jump to

Keyboard shortcuts

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