store

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type BoltStore

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

BoltStore implements Store using BoltDB.

func NewBoltStore

func NewBoltStore(path string) (*BoltStore, error)

NewBoltStore opens or creates a BoltDB database at the given path.

func (*BoltStore) Close

func (s *BoltStore) Close() error

func (*BoltStore) DeleteSandbox

func (s *BoltStore) DeleteSandbox(id string) error

func (*BoltStore) DeleteSnapshot

func (s *BoltStore) DeleteSnapshot(id string) error

func (*BoltStore) GetSandbox

func (s *BoltStore) GetSandbox(id string) (*SandboxRecord, error)

func (*BoltStore) GetSnapshot

func (s *BoltStore) GetSnapshot(id string) (*SnapshotRecord, error)

func (*BoltStore) ListSandboxes

func (s *BoltStore) ListSandboxes() ([]*SandboxRecord, error)

func (*BoltStore) ListSnapshots

func (s *BoltStore) ListSnapshots(sandboxID string) ([]*SnapshotRecord, error)

func (*BoltStore) SaveSandbox

func (s *BoltStore) SaveSandbox(record *SandboxRecord) error

func (*BoltStore) SaveSnapshot

func (s *BoltStore) SaveSnapshot(record *SnapshotRecord) error

type SandboxRecord

type SandboxRecord struct {
	ID        string            `json:"id"`
	Image     string            `json:"image"`
	Status    string            `json:"status"`
	Config    map[string]any    `json:"config,omitempty"`
	Labels    map[string]string `json:"labels,omitempty"`
	CreatedAt time.Time         `json:"created_at"`
	ExpiresAt time.Time         `json:"expires_at,omitempty"`
}

SandboxRecord represents a persisted sandbox entry.

type SnapshotRecord

type SnapshotRecord struct {
	ID        string    `json:"id"`
	SandboxID string    `json:"sandbox_id"`
	Name      string    `json:"name"`
	ImageID   string    `json:"image_id"`
	CreatedAt time.Time `json:"created_at"`
}

SnapshotRecord represents a persisted snapshot entry.

type Store

type Store interface {
	// Sandbox operations
	SaveSandbox(record *SandboxRecord) error
	GetSandbox(id string) (*SandboxRecord, error)
	ListSandboxes() ([]*SandboxRecord, error)
	DeleteSandbox(id string) error

	// Snapshot operations
	SaveSnapshot(record *SnapshotRecord) error
	GetSnapshot(id string) (*SnapshotRecord, error)
	ListSnapshots(sandboxID string) ([]*SnapshotRecord, error)
	DeleteSnapshot(id string) error

	// Close the store
	Close() error
}

Store defines the interface for state persistence.

Jump to

Keyboard shortcuts

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