mirror

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: 17 Imported by: 0

Documentation

Overview

internal/mirror/display.go

Index

Constants

This section is empty.

Variables

View Source
var ErrMirrorCorrupt = errors.New("mirror is corrupt")

Functions

func CountLiveGistMirrors added in v0.5.6

func CountLiveGistMirrors(cfg *config.Config) (int, error)

CountGistMirrors returns how many gist mirrors currently exist on disk, regardless of the inventory. Used by gitback health to report leftover gist mirrors when gist backup has been disabled — unlike FindOrphans, this deliberately does not compare against the inventory, since a disabled category's inventory isn't being kept current at all.

func CountQuarantined added in v0.5.6

func CountQuarantined(cfg *config.Config) (repositories int, gists int, err error)

CountQuarantined reports how many distinct mirrors currently have a quarantined copy, split into repositories and gists.

Distinct matters: a mirror quarantined more than once leaves several entries on disk, but it is one mirror needing attention. Counting lives here, next to the code that decides the quarantine layout, so the count can't drift from what quarantineMirror actually produces.

If one category can't be read, the other is still counted and the error is returned alongside the partial result.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, layout runtime.Layout, logger *logging.Logger) *Engine

func (*Engine) Sync

func (e *Engine) Sync(ctx context.Context) error

type Orphans added in v0.5.6

type Orphans struct {
	// Live mirrors: intact backups that `gitback sync` no longer updates.
	Repositories []string
	Gists        []string

	// Quarantined mirrors: corrupt, and their upstream is gone too, so
	// automatic recovery (a fresh clone) can never happen.
	QuarantinedRepositories []string
	QuarantinedGists        []string
}

Orphans lists mirrors present on disk but absent from the current inventory. Names are "owner/name" for repositories and the bare ID for gists, sorted and de-duplicated.

func FindOrphans added in v0.5.6

func FindOrphans(cfg *config.Config, layout runtime.Layout) (Orphans, error)

FindOrphans reports mirrors on disk that the current inventory no longer lists. It never modifies anything.

If a category can't be checked (e.g. its inventory is unreadable), the other category's results are still returned alongside a non-nil error, so one bad file doesn't hide everything else.

type SyncFunc added in v0.4.5

type SyncFunc func(
	context.Context,
	string,
) error

Jump to

Keyboard shortcuts

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