status

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 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 FileStatusPersistence

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

FileStatusPersistence implements StatusPersistence using local filesystem

func (*FileStatusPersistence) LoadStatus

func (f *FileStatusPersistence) LoadStatus(_ context.Context) (*SyncStatus, error)

LoadStatus loads the sync status from a JSON file Returns an empty SyncStatus if the file doesn't exist

func (*FileStatusPersistence) SaveStatus

func (f *FileStatusPersistence) SaveStatus(_ context.Context, status *SyncStatus) error

SaveStatus saves the sync status to a JSON file

type StatusPersistence

type StatusPersistence interface {
	// SaveStatus saves the sync status to persistent storage
	SaveStatus(ctx context.Context, status *SyncStatus) error

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

StatusPersistence defines the interface for sync status persistence

func NewFileStatusPersistence

func NewFileStatusPersistence(filePath string) StatusPersistence

NewFileStatusPersistence creates a new file-based status persistence

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

Jump to

Keyboard shortcuts

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