status

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package status provides sync status tracking and persistence for the registry.

Index

Constants

View Source
const (
	// StatusFileName is the name of the status file
	StatusFileName = "status.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type StatusPersistence

type StatusPersistence interface {
	// SaveStatus saves the sync status to persistent storage for a specific registry
	SaveStatus(ctx context.Context, registryName string, status *SyncStatus) error

	// LoadStatus loads the sync status from persistent storage for a specific registry
	// Returns an empty SyncStatus if the file doesn't exist (first run)
	LoadStatus(ctx context.Context, registryName string) (*SyncStatus, error)

	// LoadAllStatus loads sync status for all registries
	LoadAllStatus(ctx context.Context) (map[string]*SyncStatus, error)
}

StatusPersistence defines the interface for sync status persistence

func NewFileStatusPersistence

func NewFileStatusPersistence(basePath string) StatusPersistence

NewFileStatusPersistence creates a new file-based status persistence basePath is the base directory where per-registry status files will be stored

type SyncPhase

type SyncPhase string

SyncPhase represents the current phase of a synchronization operation

const (
	// SyncPhaseSyncing means sync is currently in progress
	SyncPhaseSyncing SyncPhase = "Syncing"

	// SyncPhaseComplete means sync completed successfully
	SyncPhaseComplete SyncPhase = "Complete"

	// SyncPhaseFailed means sync failed
	SyncPhaseFailed SyncPhase = "Failed"
)

type SyncStatus

type SyncStatus struct {
	// Phase represents the current synchronization phase
	Phase SyncPhase `yaml:"phase"`

	// Message provides additional information about the sync status
	Message string `yaml:"message,omitempty"`

	// LastAttempt is the timestamp of the last sync attempt
	LastAttempt *time.Time `yaml:"lastAttempt,omitempty"`

	// AttemptCount is the number of sync attempts since last success
	AttemptCount int `yaml:"attemptCount,omitempty"`

	// LastSyncTime is the timestamp of the last successful sync
	LastSyncTime *time.Time `yaml:"lastSyncTime,omitempty"`

	// LastSyncHash is the hash of the last successfully synced data
	// Used to detect changes in source data
	LastSyncHash string `yaml:"lastSyncHash,omitempty"`

	// LastAppliedFilterHash is the hash of the last applied filter
	LastAppliedFilterHash string `yaml:"lastAppliedFilterHash,omitempty"`

	// ServerCount is the total number of servers in the registry
	ServerCount int `yaml:"serverCount,omitempty"`
}

SyncStatus represents the current state of registry synchronization

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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