Documentation
¶
Index ¶
- Constants
- func CancelReservationBestEffort(ctx context.Context, svc *service.Service, logger *slog.Logger, ...)
- func CapacityRequestFromCreate(req models.CreateSandboxRequest) capacity.Request
- func CreateOnSelectedNode(ctx context.Context, svc *service.Service, logger *slog.Logger, ...) (*models.CreateSandboxResponse, error)
- func DeletePlacementBestEffort(ctx context.Context, svc *service.Service, logger *slog.Logger, ...)
- func FormatPromoteError(err error) string
- func FormatSealError(err error) string
- func OverlapCreateAndPromote(ctx context.Context, svc *service.Service, logger *slog.Logger, ...) (*models.CreateSandboxResponse, error)
- type CreateOptions
- type Decision
- type ErrorWriter
- type OverlapFailure
- type OverlapOptions
- type PrepareOptions
Constants ¶
const ( HeaderTarget = "X-Cluster-Create-Target" HeaderID = "X-Cluster-Create-ID" ReservationTTL = 120 * time.Second )
const ( OverlapPhaseCreate = "create" OverlapPhaseSeal = "seal" OverlapPhasePromote = "promote" )
OverlapPhase names which step failed on the overlapped reserved-path create. Handlers use errors.As(*OverlapFailure) to map to the right HTTP status.
Variables ¶
This section is empty.
Functions ¶
func CapacityRequestFromCreate ¶
func CapacityRequestFromCreate(req models.CreateSandboxRequest) capacity.Request
func CreateOnSelectedNode ¶
func CreateOnSelectedNode(ctx context.Context, svc *service.Service, logger *slog.Logger, req models.CreateSandboxRequest, reservationID string, opts CreateOptions) (*models.CreateSandboxResponse, error)
func FormatPromoteError ¶
FormatPromoteError matches the v1 handler's historical promote-fail message.
func FormatSealError ¶
FormatSealError matches the v1 handler's historical seal-fail message.
func OverlapCreateAndPromote ¶
func OverlapCreateAndPromote( ctx context.Context, svc *service.Service, logger *slog.Logger, req models.CreateSandboxRequest, reservationID string, opts OverlapOptions, ) (*models.CreateSandboxResponse, error)
OverlapCreateAndPromote runs CreateSandboxWithID in parallel with PutClusterSecretsForRecipient (the seal), joins both, and only then promotes via RecordPlacement (plans/warm-create-latency-tier1.5-seal-promote-overlap.md).
Promote is deliberately NOT overlapped with the create. The FSM releases the pending-reservation accounting on opPlace, and that accounting is what ClusterCreateMaxPendingPerWorker backpressure and SelectPlacement's double-booking guard count — promoting early would uncharge an in-flight local create. It is also what keeps the placement invisible to the owner watcher, which would otherwise start a concurrent recreate of a failover-enabled sandbox whose local create outlives one 5s watcher tick. The row must stay Reserved until the local create has succeeded.
Reserved path only — reservationID must be non-empty. Self-wins / CreateSandbox (no ID) stays sequential at the call site.
Types ¶
type CreateOptions ¶
type CreateOptions struct {
PromoteWithSpec bool
}
type Decision ¶
type Decision struct {
ReservationID string
}
func Prepare ¶
func Prepare(w http.ResponseWriter, r *http.Request, svc *service.Service, req models.CreateSandboxRequest, writeError ErrorWriter, opts PrepareOptions) (Decision, bool)
type ErrorWriter ¶
type ErrorWriter func(w http.ResponseWriter, status int, message string)
type OverlapFailure ¶
OverlapFailure is returned when the create leg, seal leg, or the post-join promote fails. Retract has already been attempted; the handler should surface Err (not invent a new shape). Phase distinguishes create vs seal vs promote for status mapping.
func AsOverlapFailure ¶
func AsOverlapFailure(err error) (*OverlapFailure, bool)
AsOverlapFailure extracts an OverlapFailure from err, if present.
func (*OverlapFailure) Error ¶
func (f *OverlapFailure) Error() string
func (*OverlapFailure) Unwrap ¶
func (f *OverlapFailure) Unwrap() error
type OverlapOptions ¶
type OverlapOptions struct {
// PromoteWithSpec includes the redacted create request in RecordPlacement.
// v1 always wants true; Daytona/E2B facades pass true; helpers that rely
// on the reservation-held spec pass false.
PromoteWithSpec bool
Timing *createtiming.CreateTiming
}
OverlapOptions configures reserved-path create∥seal.
type PrepareOptions ¶
type PrepareOptions struct {
PreferredSandboxID string
}