serverruntime

package
v1.0.40 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: MPL-2.0 Package serverruntime owns shared server lifecycle policy.

SPDX-License-Identifier: MPL-2.0

SPDX-License-Identifier: MPL-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckStartCapacity

func CheckStartCapacity(ctx context.Context, store *db.Store, server *db.Server, hostMemory func(context.Context, string) (int64, error)) error

CheckStartCapacity applies the same persisted active-memory accounting for every entrypoint. It checks admission; it does not reserve capacity or mutate server state. Same-node concurrent reservations remain a separate policy.

func PrepareConfig

func PrepareConfig(ctx context.Context, store configStore, server *db.Server, cfg *db.ServerConfig)

PrepareConfig fills missing runtime provider credentials without persisting them. A server also enables the existing launch-time name-to-CurseForge-slug default. Config-only recreation passes nil to preserve its explicit source. Global lookup remains best effort; explicit per-server values always win.

func Recreate

func Recreate(ctx context.Context, store recreationStore, client ContainerRecreator, server *db.Server, config *db.ServerConfig) (*docker.RecreateContainerResult, error)

Recreate records the canonical identity before callers can start a stopped replacement or finish their staged transaction. Failed recreation records an error status without advancing LastStarted. Callers retain success status, start intent, staged rollback, journals and events.

func Start

func Start(ctx context.Context, store recreationStore, client containerStarter, server *db.Server) error

Start preserves a failed start outcome even when cancellation races the daemon call. Success status, LastStarted, journal kinds and events are owned by the caller after the daemon has accepted the start.

Types

type AdmissionError

type AdmissionError struct {
	Kind  AdmissionKind
	Cause error
}

AdmissionError describes a refusal independently of its RPC presentation.

func (*AdmissionError) Error

func (e *AdmissionError) Error() string

func (*AdmissionError) Unwrap

func (e *AdmissionError) Unwrap() error

type AdmissionKind

type AdmissionKind int
const (
	InvalidNode AdmissionKind = iota
	Unavailable
	CapacityExceeded
)

type ContainerRecreator

type ContainerRecreator interface {
	RecreateContainer(context.Context, string, *db.Server, *db.ServerConfig) (*docker.RecreateContainerResult, error)
}

ContainerRecreator preserves Docker's canonical identity, including rollback to the original container and partial replacement failures.

type RecreationError

type RecreationError struct {
	Operation   error
	Persistence error
}

RecreationError distinguishes a failed daemon outcome from a successful replacement whose identity could not be saved. Staged callers must retain pending recovery markers in the latter case, rather than undo the live spec.

func (*RecreationError) Error

func (e *RecreationError) Error() string

func (*RecreationError) Unwrap

func (e *RecreationError) Unwrap() error

Jump to

Keyboard shortcuts

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