types

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MountMatches added in v0.1.14

func MountMatches(m Mount, include []MountEntry, exclude []string) (matchedName string, ok bool)

MountMatches checks whether a mount passes the include/exclude filter.

func SplitTrim

func SplitTrim(s string) []string

Types

type BackupConfig added in v0.1.14

type BackupConfig struct {
	Enabled       bool
	Schedule      string
	ReposOverride []string
	Retention     RetentionPolicy
	Password      string

	StopBefore  bool
	StopTimeout time.Duration

	// Per-container overrides for daemon-level timeouts. Zero means "use the
	// daemon config value".
	RepoTimeout       time.Duration
	HealthWaitTimeout time.Duration

	// RepoTimeouts holds per-repo overrides from buoy.repo-timeout.<name>
	// labels. Zero values mean "unset" (fall back to the container label,
	// repo config, then daemon config).
	RepoTimeouts map[string]time.Duration

	Include []MountEntry
	Exclude []string

	BackupFiles   []string
	BackupExclude []string
	BackupTags    []string

	MountOpts map[string]mountBackupOpts

	HookPreCmd   string
	HookPostCmd  string
	HookPreExec  string
	HookPostExec string
}

BackupConfig holds the parsed backup configuration from container labels.

func ParseBackupConfig added in v0.1.14

func ParseBackupConfig(labels map[string]string, defaultSchedule, defaultRetention string) BackupConfig

ParseBackupConfig extracts backup configuration from Docker labels.

func (BackupConfig) ResolveMountBackup added in v0.1.14

func (c BackupConfig) ResolveMountBackup(name string) (files, excludes, tags []string)

ResolveMountBackup returns the effective files, exclude patterns, and tags for a named mount entry.

type BackupResult added in v0.1.14

type BackupResult struct {
	Container string `json:"container"`
	OK        bool   `json:"ok"`
	Queued    bool   `json:"queued,omitempty"`
	Error     string `json:"error,omitempty"`
}

BackupResult is the outcome of a triggered backup operation.

type Container added in v0.1.14

type Container struct {
	ID             string
	Name           string
	Image          string
	State          string
	ExitCode       int
	Health         *container.Health
	Labels         map[string]string
	Mounts         []Mount
	ComposeProject string
	ComposeService string
}

Container represents a Docker container with its backup-relevant metadata.

func (*Container) IsComposeStack added in v0.1.14

func (c *Container) IsComposeStack() bool

IsComposeStack reports whether this container is part of a Docker Compose stack.

func (*Container) LogAttrs added in v0.1.14

func (c *Container) LogAttrs() []any

LogAttrs returns slog attributes for structured logging.

func (*Container) RepoPath added in v0.1.14

func (c *Container) RepoPath(base string) string

RepoPath returns the restic repository path for this container.

type Mount added in v0.1.14

type Mount struct {
	Type        string
	Name        string
	Source      string
	Destination string
	Mode        string
	RW          bool
}

Mount represents a volume or bind mount attached to a container.

type MountEntry added in v0.1.14

type MountEntry struct {
	Name string
	Key  string
}

MountEntry is a single entry in buoy.include, optionally named for per-mount backup option overrides.

type OrphanedFilter added in v0.1.14

type OrphanedFilter string

OrphanedFilter controls whether to include orphaned repos in API calls.

const (
	AllRepos    OrphanedFilter = ""
	Orphaned    OrphanedFilter = "true"
	NonOrphaned OrphanedFilter = "false"
)

type RepoEntry added in v0.1.10

type RepoEntry struct {
	URL            string    `json:"url"`
	RepoName       string    `json:"repo_name,omitempty"`
	ContainerID    string    `json:"container_id"`
	ContainerName  string    `json:"container_name"`
	ComposeProject string    `json:"compose_project,omitempty"`
	ComposeService string    `json:"compose_service,omitempty"`
	CreatedAt      time.Time `json:"created_at"`
	LastBackupAt   time.Time `json:"last_backup_at"`
	LastBackupOK   bool      `json:"last_backup_ok"`
	LastCheckAt    time.Time `json:"last_check_at"`
	LastCheckOK    bool      `json:"last_check_ok"`
	Orphaned       bool      `json:"orphaned"`
}

type RepoRef added in v0.1.10

type RepoRef struct {
	Name string
	URL  string
}

type RepoResult added in v0.1.14

type RepoResult struct {
	Repo  string `json:"repo"`
	OK    bool   `json:"ok"`
	Error string `json:"error,omitempty"`
}

RepoResult is the outcome of a per-repo operation (check, unlock, forget, prune).

type RepoStats added in v0.1.14

type RepoStats struct {
	Repo  string `json:"repo"`
	Stats *Stats `json:"stats,omitempty"`
	Error string `json:"error,omitempty"`
}

RepoStats holds statistics for a single repository.

type RetentionPolicy

type RetentionPolicy struct {
	KeepLast    int
	KeepHourly  int
	KeepDaily   int
	KeepWeekly  int
	KeepMonthly int
	KeepYearly  int
	KeepWithin  string
}

func ParseRetentionPolicy

func ParseRetentionPolicy(s string) RetentionPolicy

func (RetentionPolicy) IsZero added in v0.1.14

func (rp RetentionPolicy) IsZero() bool

IsZero reports whether the policy has no retention rules set.

type ScheduledRepo added in v0.1.14

type ScheduledRepo struct {
	URL          string    `json:"url"`
	RepoName     string    `json:"repo_name,omitempty"`
	Created      bool      `json:"created"`
	LastBackupAt time.Time `json:"last_backup_at"`
	LastBackupOK bool      `json:"last_backup_ok"`
}

ScheduledRepo holds per-repo information inside a ScheduledResponse.

type ScheduledResponse added in v0.1.14

type ScheduledResponse struct {
	ContainerID    string          `json:"container_id"`
	ContainerName  string          `json:"container_name"`
	ComposeProject string          `json:"compose_project,omitempty"`
	ComposeService string          `json:"compose_service,omitempty"`
	Schedule       string          `json:"schedule"`
	Repos          []ScheduledRepo `json:"repos,omitempty"`
	StopBefore     bool            `json:"stop_before"`
}

ScheduledResponse is the envelope for the scheduled containers list.

type Stats added in v0.1.10

type Stats struct {
	TotalSize              uint64  `json:"total_size"`
	TotalFileCount         uint64  `json:"total_file_count"`
	TotalBlobCount         uint64  `json:"total_blob_count"`
	SnapshotsCount         uint64  `json:"snapshots_count"`
	TotalUncompressedSize  uint64  `json:"total_uncompressed_size"`
	CompressionRatio       float64 `json:"compression_ratio"`
	CompressionProgress    float64 `json:"compression_progress"`
	CompressionSpaceSaving float64 `json:"compression_space_saving"`
}

type StatsResponse added in v0.1.14

type StatsResponse struct {
	Total *Stats      `json:"total"`
	Repos []RepoStats `json:"repos"`
}

StatsResponse is the envelope for repo statistics.

Jump to

Keyboard shortcuts

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