Documentation
¶
Overview ¶
Package repository provides data access layer for quad-ops artifacts and sync operations.
Package repository provides data access layer for quad-ops artifacts and sync operations.
Package repository provides data access layer for quad-ops units.
Index ¶
- type ArtifactStore
- type DefaultGitSyncer
- type FileArtifactStore
- type GitSyncer
- type Repository
- type SyncResult
- type SystemdRepository
- func (r *SystemdRepository) Create(unit *Unit) (int64, error)
- func (r *SystemdRepository) Delete(_ int64) error
- func (r *SystemdRepository) FindAll() ([]Unit, error)
- func (r *SystemdRepository) FindByID(id int64) (Unit, error)
- func (r *SystemdRepository) FindByUnitType(unitType string) ([]Unit, error)
- type Unit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArtifactStore ¶ added in v0.22.0
type ArtifactStore interface {
// Write atomically writes artifacts to disk and returns paths that changed.
// Uses hash comparison to detect changes and atomic write semantics (temp + fsync + rename).
Write(ctx context.Context, artifacts []platform.Artifact) ([]string, error)
// List returns all currently stored artifacts by scanning the artifact directory.
List(ctx context.Context) ([]platform.Artifact, error)
// Delete removes artifacts at the specified paths.
Delete(ctx context.Context, paths []string) error
}
ArtifactStore manages writing, reading, and deleting platform artifacts with atomic writes and change detection.
func NewArtifactStore ¶ added in v0.22.0
NewArtifactStore creates a new file-based artifact store.
type DefaultGitSyncer ¶ added in v0.22.0
type DefaultGitSyncer struct {
// contains filtered or unexported fields
}
DefaultGitSyncer implements GitSyncer using the internal/git package.
func (*DefaultGitSyncer) SyncAll ¶ added in v0.22.0
func (s *DefaultGitSyncer) SyncAll(ctx context.Context, repos []config.Repository) ([]SyncResult, error)
SyncAll syncs all repositories in parallel and returns results for each.
func (*DefaultGitSyncer) SyncRepo ¶ added in v0.22.0
func (s *DefaultGitSyncer) SyncRepo(ctx context.Context, repo config.Repository) SyncResult
SyncRepo syncs a single repository and returns the result.
type FileArtifactStore ¶ added in v0.22.0
type FileArtifactStore struct {
// contains filtered or unexported fields
}
FileArtifactStore implements ArtifactStore using the file system.
func (*FileArtifactStore) Delete ¶ added in v0.22.0
func (s *FileArtifactStore) Delete(ctx context.Context, paths []string) error
Delete removes artifacts at the specified paths.
type GitSyncer ¶ added in v0.22.0
type GitSyncer interface {
// SyncAll syncs all repositories in parallel and returns results for each.
SyncAll(ctx context.Context, repos []config.Repository) ([]SyncResult, error)
// SyncRepo syncs a single repository and returns the result.
SyncRepo(ctx context.Context, repo config.Repository) SyncResult
}
GitSyncer manages synchronization of git repositories.
type Repository ¶
type Repository interface {
FindAll() ([]Unit, error)
FindByUnitType(unitType string) ([]Unit, error)
FindByID(id int64) (Unit, error)
Create(unit *Unit) (int64, error)
Delete(id int64) error
}
Repository defines the interface for unit data access operations.
func NewRepository ¶
func NewRepository(logger log.Logger, fsService *fs.Service) Repository
NewRepository creates a new systemd-based unit repository.
type SyncResult ¶ added in v0.22.0
type SyncResult struct {
Repository config.Repository // The repository that was synced
Success bool // Whether the sync succeeded
Error error // Error if sync failed
Changed bool // Whether the repository changed (new commits)
CommitHash string // Current commit hash after sync
}
SyncResult contains the result of syncing a single repository.
type SystemdRepository ¶ added in v0.19.0
type SystemdRepository struct {
// contains filtered or unexported fields
}
SystemdRepository implements Repository interface by querying systemd directly.
func (*SystemdRepository) Create ¶ added in v0.19.0
func (r *SystemdRepository) Create(unit *Unit) (int64, error)
Create creates or updates unit information (systemd-based approach doesn't store data).
func (*SystemdRepository) Delete ¶ added in v0.19.0
func (r *SystemdRepository) Delete(_ int64) error
Delete removes unit information (systemd-based approach doesn't store data).
func (*SystemdRepository) FindAll ¶ added in v0.19.0
func (r *SystemdRepository) FindAll() ([]Unit, error)
FindAll retrieves all quad-ops managed units by scanning systemd and the filesystem.
func (*SystemdRepository) FindByID ¶ added in v0.19.0
func (r *SystemdRepository) FindByID(id int64) (Unit, error)
FindByID retrieves a single unit by ID (name for systemd-based approach).
func (*SystemdRepository) FindByUnitType ¶ added in v0.19.0
func (r *SystemdRepository) FindByUnitType(unitType string) ([]Unit, error)
FindByUnitType retrieves units filtered by type.