daemon

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Daemon

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

func NewDaemon

func NewDaemon(configPath string) (*Daemon, error)

func (*Daemon) Run

func (d *Daemon) Run() error

type GitOperations

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

func NewGitOperations

func NewGitOperations(logger *slog.Logger) *GitOperations

func (*GitOperations) SyncRepository

func (g *GitOperations) SyncRepository(repo configPkg.RepoConfig) error

SyncRepository performs the sync operation using go-git library

type HistoryManager

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

HistoryManager manages persistent sync history using JSON Lines format

func NewHistoryManager

func NewHistoryManager(cacheDir string, maxEntries, retentionDays, maxFileSizeMB int, logger *slog.Logger) (*HistoryManager, error)

NewHistoryManager creates a new history manager

func (*HistoryManager) CleanOldEntries

func (hm *HistoryManager) CleanOldEntries() error

CleanOldEntries removes entries older than the retention period

func (*HistoryManager) GetHistory

func (hm *HistoryManager) GetHistory(limit int, repoFilter string, failedOnly bool) ([]SyncHistoryEntry, error)

GetHistory retrieves sync history entries with optional filtering

func (*HistoryManager) RecordSync

func (hm *HistoryManager) RecordSync(repoPath, direction, status string, duration time.Duration, errorMsg string)

RecordSync records a sync operation to the history file

type Scheduler

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

func NewScheduler

func NewScheduler(logger *slog.Logger, historyManager *HistoryManager) *Scheduler

func (*Scheduler) GetStatus

func (s *Scheduler) GetStatus() map[string]SchedulerStatus

GetStatus returns the current status of all scheduled repositories

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context, repos []config.RepoConfig, sm *SyncManager)

func (*Scheduler) Stop

func (s *Scheduler) Stop()

type SchedulerStatus

type SchedulerStatus struct {
	Path     string
	Active   bool
	NextSync time.Time
}

type SyncHistoryEntry

type SyncHistoryEntry struct {
	Timestamp  time.Time `json:"timestamp"`
	RepoPath   string    `json:"repo_path"`
	Direction  string    `json:"direction"`
	Status     string    `json:"status"`
	DurationMs int64     `json:"duration_ms"`
	ErrorMsg   string    `json:"error_message,omitempty"`
}

SyncHistoryEntry represents a single sync operation record

type SyncManager

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

func NewSyncManager

func NewSyncManager(maxConcurrent int, logger *slog.Logger) *SyncManager

func (*SyncManager) SyncRepository

func (sm *SyncManager) SyncRepository(repo config.RepoConfig) error

Jump to

Keyboard shortcuts

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