Documentation
¶
Index ¶
- Variables
- type Store
- func (s *Store) Close() error
- func (s *Store) Create(ctx context.Context, sandbox *models.Sandbox) error
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) DeleteMounts(ctx context.Context, sandboxID string) error
- func (s *Store) DeletePort(ctx context.Context, sandboxID string, port int) error
- func (s *Store) Get(ctx context.Context, id string) (*models.Sandbox, error)
- func (s *Store) GetMounts(ctx context.Context, sandboxID string) ([]byte, error)
- func (s *Store) HasActiveImageRef(ctx context.Context, image string) (bool, error)
- func (s *Store) List(ctx context.Context) ([]*models.Sandbox, error)
- func (s *Store) PurgeDestroyedBefore(ctx context.Context, cutoff time.Time) (int64, error)
- func (s *Store) PutMounts(ctx context.Context, sandboxID string, sealed []byte) error
- func (s *Store) Touch(ctx context.Context, id string, at time.Time) error
- func (s *Store) UpdateLifecycle(ctx context.Context, id string, l models.Lifecycle) error
- func (s *Store) UpdateRuntime(ctx context.Context, id, containerID, containerIP, publicURL string) error
- func (s *Store) UpdateStatus(ctx context.Context, id string, status models.SandboxStatus, lastError string) error
- func (s *Store) Upsert(ctx context.Context, sandbox *models.Sandbox) error
- func (s *Store) UpsertPort(ctx context.Context, exposure models.ExposedPort) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("sandbox not found")
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) DeleteMounts ¶
DeleteMounts removes mount config for a sandbox. The cascade on the sandboxes table handles this when a sandbox is destroyed; explicit deletes are useful for replacing mounts.
func (*Store) DeletePort ¶
func (*Store) GetMounts ¶
GetMounts returns the encrypted mount blob, or ErrNotFound if no row exists.
func (*Store) HasActiveImageRef ¶
HasActiveImageRef reports whether any sandbox row references image with a status other than destroyed. Used by image GC: when this returns false the caller may safely remove the image from Docker. Single indexed query — constant cost regardless of how many destroyed rows have accumulated, so 10k destroyed historical rows do not slow the destroy hot path. Returns true on empty image as a conservative default (caller treats it as "still in use, do not delete").
func (*Store) PurgeDestroyedBefore ¶
PurgeDestroyedBefore deletes sandbox rows that are in the destroyed state and whose updated_at is older than cutoff. Returns the number of rows deleted. Only destroyed rows are eligible — live sandboxes are never touched, so this is safe to call concurrently with normal lifecycle operations. Cascades through the foreign key on exposed_ports and sandbox_mounts. Powered by idx_sandboxes_status, so cost scales with the number of destroyed rows being purged, not the total table size.
func (*Store) PutMounts ¶
PutMounts stores an encrypted mount blob for a sandbox. The blob is opaque to the store layer; encryption / decryption happens in the service layer.
func (*Store) UpdateLifecycle ¶
UpdateLifecycle replaces the four lifecycle timer fields on a sandbox row and bumps updated_at. Other fields are untouched. Returns ErrNotFound if no row matches id. The caller must validate the Lifecycle first; the store does not re-validate (it would couple two layers for no gain).