feat: runtime manager
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package startruntime
|
||||
|
||||
// Stable error codes returned in `Result.ErrorCode`. The values match the
|
||||
// vocabulary frozen by `rtmanager/README.md §Error Model`,
|
||||
// `rtmanager/api/internal-openapi.yaml`, and
|
||||
// `rtmanager/api/runtime-jobs-asyncapi.yaml`. Although the constants live
|
||||
// in the start-service package they are the canonical home for every
|
||||
// lifecycle service in `internal/service/`. Stop, restart, patch,
|
||||
// cleanup, the REST handlers, and the stream consumers import these
|
||||
// names rather than redeclare them; renaming any of them is a contract
|
||||
// change.
|
||||
const (
|
||||
// ErrorCodeReplayNoOp reports that the request was an idempotent
|
||||
// replay against an already-running record with the same image_ref.
|
||||
ErrorCodeReplayNoOp = "replay_no_op"
|
||||
|
||||
// ErrorCodeStartConfigInvalid reports that the start request was
|
||||
// rejected before any Docker work because of a validation failure
|
||||
// (invalid image_ref shape, missing Docker network, unwritable state
|
||||
// directory).
|
||||
ErrorCodeStartConfigInvalid = "start_config_invalid"
|
||||
|
||||
// ErrorCodeImagePullFailed reports that the image pull stage failed.
|
||||
ErrorCodeImagePullFailed = "image_pull_failed"
|
||||
|
||||
// ErrorCodeContainerStartFailed reports that `docker create` or
|
||||
// `docker start` failed, or that the runtime record could not be
|
||||
// installed after a successful Run.
|
||||
ErrorCodeContainerStartFailed = "container_start_failed"
|
||||
|
||||
// ErrorCodeConflict reports an operation incompatible with the
|
||||
// current runtime state (lease busy, running record with a different
|
||||
// image_ref, cleanup attempted on a running runtime, restart or
|
||||
// patch attempted on a removed record).
|
||||
ErrorCodeConflict = "conflict"
|
||||
|
||||
// ErrorCodeServiceUnavailable reports that a steady-state dependency
|
||||
// (Docker daemon, PostgreSQL, Redis) was unreachable for this call.
|
||||
ErrorCodeServiceUnavailable = "service_unavailable"
|
||||
|
||||
// ErrorCodeInternal reports an unexpected error not classified by
|
||||
// the other codes.
|
||||
ErrorCodeInternal = "internal_error"
|
||||
|
||||
// ErrorCodeInvalidRequest reports that the request was rejected
|
||||
// because of structural input validation (empty required fields,
|
||||
// unknown enum values). Used by the stop / restart / patch /
|
||||
// cleanup services for malformed Input. The start service uses the
|
||||
// stricter `start_config_invalid` code instead because every start
|
||||
// validation failure also raises an admin notification intent.
|
||||
ErrorCodeInvalidRequest = "invalid_request"
|
||||
|
||||
// ErrorCodeNotFound reports that the runtime record requested by a
|
||||
// stop, restart, patch or cleanup operation does not exist. Those
|
||||
// services raise it; the start service never does (start installs
|
||||
// the record on first call).
|
||||
ErrorCodeNotFound = "not_found"
|
||||
|
||||
// ErrorCodeImageRefNotSemver reports that a patch operation was
|
||||
// rejected because either the current or the new image reference
|
||||
// could not be parsed as a semver tag.
|
||||
ErrorCodeImageRefNotSemver = "image_ref_not_semver"
|
||||
|
||||
// ErrorCodeSemverPatchOnly reports that a patch operation was
|
||||
// rejected because the major or minor component differs between the
|
||||
// current and new image references.
|
||||
ErrorCodeSemverPatchOnly = "semver_patch_only"
|
||||
)
|
||||
Reference in New Issue
Block a user