repository

package
v0.24.6 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 14 Imported by: 0

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

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

func NewArtifactStore(fsService *fs.Service, logger log.Logger, baseDir string) ArtifactStore

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

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.

func (*FileArtifactStore) List added in v0.22.0

List returns all currently stored artifacts by scanning the artifact directory.

func (*FileArtifactStore) Write added in v0.22.0

func (s *FileArtifactStore) Write(ctx context.Context, artifacts []platform.Artifact) ([]string, error)

Write atomically writes artifacts to disk and returns paths that changed.

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.

func NewGitSyncer added in v0.22.0

func NewGitSyncer(configProvider config.Provider, logger log.Logger) GitSyncer

NewGitSyncer creates a new git syncer with dependency injection.

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.

type Unit

type Unit struct {
	ID        int64
	Name      string
	Type      string
	SHA1Hash  []byte
	UpdatedAt time.Time
}

Unit represents a unit managed by quad-ops.

Jump to

Keyboard shortcuts

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