store

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 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 EnvironmentArtifactRecord

type EnvironmentArtifactRecord struct {
	ID        int64
	BuildID   string
	Target    string
	ImageRef  string
	Digest    string
	Status    string
	Error     string
	CreatedAt time.Time
	UpdatedAt time.Time
}

type EnvironmentBuildRecord

type EnvironmentBuildRecord struct {
	ID             string
	SpecID         string
	Status         string
	CurrentStep    string
	LogBlob        string
	ImageSizeBytes int64
	DigestLocal    string
	Error          string
	CreatedAt      time.Time
	FinishedAt     *time.Time
	UpdatedAt      time.Time
}

type EnvironmentSpecRecord

type EnvironmentSpecRecord struct {
	ID             string
	OwnerID        string
	Name           string
	BaseImage      string
	PythonPackages string // JSON array
	AptPackages    string // JSON array
	PythonVersion  string
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

type ExecLogRecord

type ExecLogRecord struct {
	ID        int64
	SandboxID string
	Command   string
	ExitCode  int
	Stdout    string
	Stderr    string
	Duration  string
	CreatedAt time.Time
}

type ProviderConfigRecord

type ProviderConfigRecord struct {
	Name      string
	Config    string // JSON
	Enabled   bool
	UpdatedAt time.Time
}

type RegistryConnectionRecord

type RegistryConnectionRecord struct {
	ID        string
	OwnerID   string
	Provider  string
	Username  string
	SecretRef string
	IsDefault bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(path string) (*SQLiteStore, error)

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) CountSandboxesByVM

func (s *SQLiteStore) CountSandboxesByVM(ctx context.Context, vmID string) (int, error)

func (*SQLiteStore) CreateEnvironmentBuild

func (s *SQLiteStore) CreateEnvironmentBuild(ctx context.Context, build *EnvironmentBuildRecord) error

func (*SQLiteStore) CreateEnvironmentSpec

func (s *SQLiteStore) CreateEnvironmentSpec(ctx context.Context, spec *EnvironmentSpecRecord) error

func (*SQLiteStore) CreateExecLog

func (s *SQLiteStore) CreateExecLog(ctx context.Context, log *ExecLogRecord) error

func (*SQLiteStore) CreateSandbox

func (s *SQLiteStore) CreateSandbox(ctx context.Context, sb *SandboxRecord) error

func (*SQLiteStore) CreateTemplate

func (s *SQLiteStore) CreateTemplate(ctx context.Context, t *TemplateRecord) error

func (*SQLiteStore) DeleteEnvironmentSpec

func (s *SQLiteStore) DeleteEnvironmentSpec(ctx context.Context, id string) error

func (*SQLiteStore) DeleteRegistryConnection

func (s *SQLiteStore) DeleteRegistryConnection(ctx context.Context, id string) error

func (*SQLiteStore) DeleteSandbox

func (s *SQLiteStore) DeleteSandbox(ctx context.Context, id string) error

func (*SQLiteStore) DeleteTemplate

func (s *SQLiteStore) DeleteTemplate(ctx context.Context, name string) error

func (*SQLiteStore) GetEnvironmentBuild

func (s *SQLiteStore) GetEnvironmentBuild(ctx context.Context, id string) (*EnvironmentBuildRecord, error)

func (*SQLiteStore) GetEnvironmentSpec

func (s *SQLiteStore) GetEnvironmentSpec(ctx context.Context, id string) (*EnvironmentSpecRecord, error)

func (*SQLiteStore) GetProviderConfig

func (s *SQLiteStore) GetProviderConfig(ctx context.Context, name string) (*ProviderConfigRecord, error)

func (*SQLiteStore) GetRegistryConnection

func (s *SQLiteStore) GetRegistryConnection(ctx context.Context, id string) (*RegistryConnectionRecord, error)

func (*SQLiteStore) GetSandbox

func (s *SQLiteStore) GetSandbox(ctx context.Context, id string) (*SandboxRecord, error)

func (*SQLiteStore) GetTemplate

func (s *SQLiteStore) GetTemplate(ctx context.Context, name string) (*TemplateRecord, error)

func (*SQLiteStore) ListEnvironmentArtifacts

func (s *SQLiteStore) ListEnvironmentArtifacts(ctx context.Context, buildID string) ([]*EnvironmentArtifactRecord, error)

func (*SQLiteStore) ListEnvironmentBuilds

func (s *SQLiteStore) ListEnvironmentBuilds(ctx context.Context, specID string) ([]*EnvironmentBuildRecord, error)

func (*SQLiteStore) ListEnvironmentSpecs

func (s *SQLiteStore) ListEnvironmentSpecs(ctx context.Context, ownerID string) ([]*EnvironmentSpecRecord, error)

func (*SQLiteStore) ListExecLogs

func (s *SQLiteStore) ListExecLogs(ctx context.Context, sandboxID string) ([]*ExecLogRecord, error)

func (*SQLiteStore) ListExpiredSandboxes

func (s *SQLiteStore) ListExpiredSandboxes(ctx context.Context, before time.Time) ([]*SandboxRecord, error)

func (*SQLiteStore) ListProviderConfigs

func (s *SQLiteStore) ListProviderConfigs(ctx context.Context) ([]*ProviderConfigRecord, error)

func (*SQLiteStore) ListRegistryConnections

func (s *SQLiteStore) ListRegistryConnections(ctx context.Context, ownerID string) ([]*RegistryConnectionRecord, error)

func (*SQLiteStore) ListSandboxes

func (s *SQLiteStore) ListSandboxes(ctx context.Context) ([]*SandboxRecord, error)

func (*SQLiteStore) ListSandboxesByOwner

func (s *SQLiteStore) ListSandboxesByOwner(ctx context.Context, ownerID string) ([]*SandboxRecord, error)

func (*SQLiteStore) ListTemplates

func (s *SQLiteStore) ListTemplates(ctx context.Context) ([]*TemplateRecord, error)

func (*SQLiteStore) SaveEnvironmentArtifact

func (s *SQLiteStore) SaveEnvironmentArtifact(ctx context.Context, artifact *EnvironmentArtifactRecord) error

func (*SQLiteStore) SaveProviderConfig

func (s *SQLiteStore) SaveProviderConfig(ctx context.Context, cfg *ProviderConfigRecord) error

func (*SQLiteStore) SaveRegistryConnection

func (s *SQLiteStore) SaveRegistryConnection(ctx context.Context, conn *RegistryConnectionRecord) error

func (*SQLiteStore) UpdateEnvironmentBuild

func (s *SQLiteStore) UpdateEnvironmentBuild(ctx context.Context, build *EnvironmentBuildRecord) error

func (*SQLiteStore) UpdateEnvironmentSpec

func (s *SQLiteStore) UpdateEnvironmentSpec(ctx context.Context, spec *EnvironmentSpecRecord) error

func (*SQLiteStore) UpdateSandboxExpiresAt

func (s *SQLiteStore) UpdateSandboxExpiresAt(ctx context.Context, id string, expiresAt time.Time) error

func (*SQLiteStore) UpdateSandboxState

func (s *SQLiteStore) UpdateSandboxState(ctx context.Context, id string, state string) error

func (*SQLiteStore) UpdateTemplate

func (s *SQLiteStore) UpdateTemplate(ctx context.Context, t *TemplateRecord) error

type SandboxRecord

type SandboxRecord struct {
	ID        string
	State     string
	Provider  string
	Image     string
	MemoryMB  int
	VCPUs     int
	Metadata  string // JSON
	OwnerID   string
	VMID      string
	CreatedAt time.Time
	ExpiresAt time.Time
	UpdatedAt time.Time
}

type Store

type Store interface {
	// Sandbox CRUD
	CreateSandbox(ctx context.Context, sb *SandboxRecord) error
	GetSandbox(ctx context.Context, id string) (*SandboxRecord, error)
	ListSandboxes(ctx context.Context) ([]*SandboxRecord, error)
	UpdateSandboxState(ctx context.Context, id string, state string) error
	UpdateSandboxExpiresAt(ctx context.Context, id string, expiresAt time.Time) error
	DeleteSandbox(ctx context.Context, id string) error
	ListExpiredSandboxes(ctx context.Context, before time.Time) ([]*SandboxRecord, error)
	ListSandboxesByOwner(ctx context.Context, ownerID string) ([]*SandboxRecord, error)
	CountSandboxesByVM(ctx context.Context, vmID string) (int, error)

	// Exec logs
	CreateExecLog(ctx context.Context, log *ExecLogRecord) error
	ListExecLogs(ctx context.Context, sandboxID string) ([]*ExecLogRecord, error)

	// Provider configs
	GetProviderConfig(ctx context.Context, name string) (*ProviderConfigRecord, error)
	SaveProviderConfig(ctx context.Context, cfg *ProviderConfigRecord) error
	ListProviderConfigs(ctx context.Context) ([]*ProviderConfigRecord, error)

	// Templates
	CreateTemplate(ctx context.Context, t *TemplateRecord) error
	GetTemplate(ctx context.Context, name string) (*TemplateRecord, error)
	ListTemplates(ctx context.Context) ([]*TemplateRecord, error)
	UpdateTemplate(ctx context.Context, t *TemplateRecord) error
	DeleteTemplate(ctx context.Context, name string) error

	// Environment specs
	CreateEnvironmentSpec(ctx context.Context, spec *EnvironmentSpecRecord) error
	GetEnvironmentSpec(ctx context.Context, id string) (*EnvironmentSpecRecord, error)
	ListEnvironmentSpecs(ctx context.Context, ownerID string) ([]*EnvironmentSpecRecord, error)
	UpdateEnvironmentSpec(ctx context.Context, spec *EnvironmentSpecRecord) error
	DeleteEnvironmentSpec(ctx context.Context, id string) error

	// Environment builds
	CreateEnvironmentBuild(ctx context.Context, build *EnvironmentBuildRecord) error
	GetEnvironmentBuild(ctx context.Context, id string) (*EnvironmentBuildRecord, error)
	ListEnvironmentBuilds(ctx context.Context, specID string) ([]*EnvironmentBuildRecord, error)
	UpdateEnvironmentBuild(ctx context.Context, build *EnvironmentBuildRecord) error

	// Environment artifacts
	SaveEnvironmentArtifact(ctx context.Context, artifact *EnvironmentArtifactRecord) error
	ListEnvironmentArtifacts(ctx context.Context, buildID string) ([]*EnvironmentArtifactRecord, error)

	// Registry connections
	SaveRegistryConnection(ctx context.Context, conn *RegistryConnectionRecord) error
	GetRegistryConnection(ctx context.Context, id string) (*RegistryConnectionRecord, error)
	ListRegistryConnections(ctx context.Context, ownerID string) ([]*RegistryConnectionRecord, error)
	DeleteRegistryConnection(ctx context.Context, id string) error

	// Lifecycle
	Close() error
}

Store defines the persistence interface.

type TemplateRecord

type TemplateRecord struct {
	Name         string
	Version      int
	Image        string
	Description  string
	Setup        string // JSON array
	AllowedHosts string // JSON array
	MemoryMB     int
	CPUCores     int
	TTLSeconds   int
	Env          string // JSON object
	Secrets      string // JSON array
	PoolSize     int
	CreatedAt    time.Time
	UpdatedAt    time.Time
}

Jump to

Keyboard shortcuts

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