store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildLog

type BuildLog struct {
	ID           string    `json:"id"`
	DeploymentID string    `json:"deployment_id"`
	Line         string    `json:"line"`
	Timestamp    time.Time `json:"timestamp"`
}

BuildLog represents a single line of build output logged during image build.

type Deployment

type Deployment struct {
	ID          string           `json:"id"`
	AppName     string           `json:"app_name"`
	RepoURL     string           `json:"repo_url"`
	CommitHash  string           `json:"commit_hash"`
	Status      DeploymentStatus `json:"status"`
	ContainerID string           `json:"container_id"`
	CreatedAt   time.Time        `json:"created_at"`
	UpdatedAt   time.Time        `json:"updated_at"`
}

Deployment represents a single deployment record in the database.

type DeploymentStatus

type DeploymentStatus string

DeploymentStatus represents the current state of a deployment.

const (
	StatusPending  DeploymentStatus = "pending"
	StatusBuilding DeploymentStatus = "building"
	StatusRunning  DeploymentStatus = "running"
	StatusFailed   DeploymentStatus = "failed"
	StatusStopped  DeploymentStatus = "stopped"
)

type Store

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

Store wraps an embedded SQLite database connection and provides methods to persist and query deployment state and build logs.

func New

func New(dataDir string) (*Store, error)

New opens (or creates) the JumpGate SQLite database at the given data directory, runs schema migrations, and returns a ready-to-use Store.

func (*Store) AppendBuildLog

func (s *Store) AppendBuildLog(deploymentID, line string) error

AppendBuildLog inserts a single line of build output for a deployment.

func (*Store) Close

func (s *Store) Close() error

Close cleanly shuts down the database connection.

func (*Store) CreateDeployment

func (s *Store) CreateDeployment(d *Deployment) error

CreateDeployment inserts a new deployment record into the database. The ID is auto-generated as a UUID if empty.

func (*Store) DB

func (s *Store) DB() *sql.DB

DB returns the underlying *sql.DB for use in tests or advanced queries.

func (*Store) GetActiveDeployment

func (s *Store) GetActiveDeployment(appName string) (*Deployment, error)

GetActiveDeployment returns the currently running deployment for an app, or nil if no deployment is in Running status.

func (*Store) GetBuildLogs

func (s *Store) GetBuildLogs(deploymentID string) ([]BuildLog, error)

GetBuildLogs returns all build log lines for a deployment, ordered by timestamp.

func (*Store) GetDeployment

func (s *Store) GetDeployment(id string) (*Deployment, error)

GetDeployment retrieves a single deployment by its ID.

func (*Store) GetLatestDeployment

func (s *Store) GetLatestDeployment(appName string) (*Deployment, error)

GetLatestDeployment returns the most recent deployment for a given app name.

func (*Store) ListDeployments

func (s *Store) ListDeployments(appName string, limit int) ([]Deployment, error)

ListDeployments returns recent deployments for an app, ordered by creation time descending, up to the given limit.

func (*Store) UpdateDeploymentStatus

func (s *Store) UpdateDeploymentStatus(id string, status DeploymentStatus, containerID string) error

UpdateDeploymentStatus updates the status and optionally the container ID of an existing deployment.

Jump to

Keyboard shortcuts

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