subjectcleanup

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package subjectcleanup coordinates restart-safe Subject expiry and teardown.

Index

Constants

View Source
const (
	StageCancelWork            = "cancel_work"
	StageDeleteSnapshots       = "delete_snapshots"
	StageStopDeleteSandboxes   = "stop_delete_sandboxes"
	StageReleaseResources      = "release_resources"
	StageRequestWorkspace      = "request_workspace_removal"
	StageAwaitAcknowledgements = "await_acknowledgements"
	StageSucceeded             = "succeeded"
	StageFailed                = "failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionCanceller

type SessionCanceller interface {
	CancelSandboxSessions(context.Context, string, int64, string, time.Time) (int64, error)
}

SessionCanceller uses the acknowledged Runner cancellation path for active work.

type Worker

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

Worker advances at most one persisted Subject cleanup stage per pass.

func NewWorker

func NewWorker(
	ctx context.Context,
	databaseURL string,
	sessions SessionCanceller,
	workerID string,
	claimDuration time.Duration,
	pollInterval time.Duration,
) (*Worker, error)

NewWorker connects the cleanup coordinator to PostgreSQL authority.

func (*Worker) Close

func (worker *Worker) Close()

func (*Worker) PollInterval

func (worker *Worker) PollInterval() time.Duration

PollInterval is the bounded restart and notification fallback cadence.

func (*Worker) RunOnce

func (worker *Worker) RunOnce(ctx context.Context, now time.Time) (bool, error)

RunOnce expires durable management records and advances one cleanup stage.

Jump to

Keyboard shortcuts

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