runtimeclient

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeLeaseSignatureSchemaVersion = "redevplugin.runtime_execution_lease.v1"
	RuntimeLeaseKind                   = "runtime_execution_lease"
	RuntimeLeaseSignatureAlgorithm     = "ed25519"
)
View Source
const (
	RuntimeWorkerCountMin            = 1
	RuntimeWorkerCountMax            = 64
	RuntimeQueueCapacityMin          = 1
	RuntimeQueueCapacityMax          = 64
	RuntimePerPluginConcurrencyMin   = 1
	RuntimePerPluginConcurrencyMax   = 64
	RuntimeModuleCacheEntriesMin     = 1
	RuntimeModuleCacheEntriesMax     = 1024
	RuntimeModuleCacheSourceBytesMin = 1
	RuntimeModuleCacheSourceBytesMax = 128 << 20
)

Variables

View Source
var (
	ErrRuntimeDescriptorInvalid  = errors.New("runtime descriptor is invalid")
	ErrRuntimeDescriptorMismatch = errors.New("runtime descriptor does not match")
)
View Source
var (
	ErrRuntimeLeaseInvalid = errors.New("runtime execution lease is invalid")
	ErrRuntimeLeaseReplay  = errors.New("runtime execution lease has already been consumed")
)
View Source
var (
	ErrRuntimeLeaseSignatureKeyringRequired = errors.New("runtime lease signing keyring is required")
	ErrRuntimeLeaseSigningKeyNotFound       = errors.New("runtime lease signing key not found")
	ErrRuntimeLeaseSigningKeyRevoked        = errors.New("runtime lease signing key is revoked")
	ErrRuntimeLeasePublicKeyInvalid         = errors.New("runtime lease signing public key is invalid")
	ErrRuntimeLeaseSignatureRequired        = errors.New("runtime execution lease signature is required")
	ErrRuntimeLeaseSignatureInvalid         = errors.New("runtime execution lease signature is invalid")
)
View Source
var (
	// ErrRuntimeShardCount reports a ProcessManager shard count outside the
	// closed supported range.
	ErrRuntimeShardCount = errors.New("runtime shard count must be between 1 and 16")
	// ErrRuntimeBindingInvalid reports a plugin, lease, or generation binding
	// that does not identify the manager's current runtime shard.
	ErrRuntimeBindingInvalid = errors.New("runtime binding is invalid")
	// ErrManagerLifecycleOutcomeUnknown reports a failed manager transition
	// whose rollback also failed, so the caller must reconcile shard health.
	ErrManagerLifecycleOutcomeUnknown = errors.New("runtime manager lifecycle outcome is unknown")
	// ErrRuntimeHostServicesInvalid reports an incomplete or typed-nil set of
	// callbacks supplied at the Host/runtime ownership boundary.
	ErrRuntimeHostServicesInvalid = errors.New("runtime host services are invalid")
	// ErrRuntimeHostServicesRequired reports an operation attempted before the
	// manager completed its one-time Host-services binding.
	ErrRuntimeHostServicesRequired = errors.New("runtime host services are not bound")
	// ErrRuntimeHostServicesBound reports an attempt to replace Host services
	// after a successful binding. A successfully bound manager is never reusable
	// by another Host.
	ErrRuntimeHostServicesBound = errors.New("runtime host services are already bound")
)
View Source
var (
	ErrRuntimePathRequired           = errors.New("runtime path is required")
	ErrRuntimeNotReady               = errors.New("runtime is not ready")
	ErrRuntimeIPCUnavailable         = errors.New("runtime ipc transport is unavailable")
	ErrRuntimeHandshake              = errors.New("runtime ipc handshake failed")
	ErrRuntimeRequestFailed          = errors.New("runtime ipc request failed")
	ErrRuntimeArtifactDigest         = errors.New("runtime artifact digest mismatch")
	ErrRuntimeContainmentUnsupported = errors.New("runtime process containment is unsupported")
	// ErrRuntimeLimitsInvalid reports runtime capacity limits outside the
	// negotiated platform contract.
	ErrRuntimeLimitsInvalid = errors.New("runtime limits are invalid")
	// ErrRuntimeTimingInvalid reports a non-positive or internally inconsistent
	// process handshake and heartbeat timing configuration.
	ErrRuntimeTimingInvalid = errors.New("runtime timing is invalid")
)

Functions

func CanonicalRuntimeLeaseSignaturePayload

func CanonicalRuntimeLeaseSignaturePayload(lease Lease, method string) ([]byte, error)

func ValidateRuntimeLimits

func ValidateRuntimeLimits(limits RuntimeLimits) error

Types

type ArtifactProvider

type ArtifactProvider interface {
	ReadArtifact(ctx context.Context, req ArtifactRequest) (ArtifactResult, error)
}

type ArtifactRequest

type ArtifactRequest struct {
	PackageHash    string `json:"package_hash"`
	Artifact       string `json:"artifact"`
	ArtifactSHA256 string `json:"artifact_sha256"`
}

type ArtifactResult

type ArtifactResult struct {
	Content []byte `json:"-"`
	SHA256  string `json:"sha256"`
}

type Ed25519RuntimeLeaseVerifier

type Ed25519RuntimeLeaseVerifier struct {
	Keyring RuntimeLeaseSigningKeyring
	Now     func() time.Time
}

func (Ed25519RuntimeLeaseVerifier) VerifyRuntimeLease

type HandleGrantValidationRequest

type HandleGrantValidationRequest struct {
	HandleGrantToken     string                   `json:"handle_grant_token"`
	PluginInstanceID     string                   `json:"plugin_instance_id"`
	ActiveFingerprint    string                   `json:"active_fingerprint"`
	RuntimeInstanceID    string                   `json:"runtime_instance_id,omitempty"`
	RuntimeGenerationID  string                   `json:"runtime_generation_id"`
	RuntimeShardID       string                   `json:"runtime_shard_id,omitempty"`
	OwnerSessionHash     string                   `json:"owner_session_hash"`
	OwnerUserHash        string                   `json:"owner_user_hash"`
	OwnerEnvHash         string                   `json:"owner_env_hash"`
	SessionChannelIDHash string                   `json:"session_channel_id_hash"`
	HandleID             string                   `json:"handle_id"`
	Method               string                   `json:"method"`
	ResourceScope        sessionctx.ResourceScope `json:"resource_scope"`
	PolicyRevision       uint64                   `json:"policy_revision"`
	ManagementRevision   uint64                   `json:"management_revision"`
	RevokeEpoch          uint64                   `json:"revoke_epoch"`
}

type HandleGrantValidationResult

type HandleGrantValidationResult struct {
	HandleGrantID       string                   `json:"handle_grant_id"`
	HandleID            string                   `json:"handle_id"`
	Method              string                   `json:"method"`
	RuntimeGenerationID string                   `json:"runtime_generation_id"`
	ResourceScope       sessionctx.ResourceScope `json:"resource_scope"`
	MaxBytesPerSecond   int64                    `json:"max_bytes_per_second,omitempty"`
	MaxTotalBytes       int64                    `json:"max_total_bytes,omitempty"`
}

type HandleGrantValidator

type HandleGrantValidator interface {
	ValidateHandleGrant(ctx context.Context, req HandleGrantValidationRequest) (HandleGrantValidationResult, error)
}

type Health

type Health struct {
	RuntimeInstanceID   string             `json:"runtime_instance_id"`
	RuntimeGenerationID string             `json:"runtime_generation_id"`
	IPCChannelID        string             `json:"ipc_channel_id,omitempty"`
	ConnectionNonce     string             `json:"connection_nonce,omitempty"`
	ContainmentIdentity string             `json:"-"`
	Descriptor          RuntimeDescriptor  `json:"descriptor"`
	Ready               bool               `json:"ready"`
	ActiveInvocations   int                `json:"active_invocations"`
	QueuedInvocations   int                `json:"queued_invocations"`
	Limits              RuntimeLimits      `json:"limits"`
	ModuleCache         ModuleCacheMetrics `json:"module_cache"`
}

type HeartbeatResult

type HeartbeatResult struct {
	RuntimeGenerationID  string             `json:"runtime_generation_id"`
	RuntimeUnixNano      int64              `json:"runtime_unix_nano"`
	MaxStalenessMillis   int64              `json:"max_staleness_ms"`
	HostSentUnixNanoEcho int64              `json:"host_sent_unix_nano"`
	ActiveInvocations    int                `json:"active_invocations"`
	QueuedInvocations    int                `json:"queued_invocations"`
	Limits               RuntimeLimits      `json:"limits"`
	ModuleCache          ModuleCacheMetrics `json:"module_cache"`
}

type Lease

type Lease struct {
	LeaseID                string      `json:"lease_id"`
	TokenID                string      `json:"token_id"`
	LeaseNonce             string      `json:"lease_nonce"`
	PluginID               string      `json:"plugin_id"`
	PluginVersion          string      `json:"plugin_version"`
	ActiveFingerprint      string      `json:"active_fingerprint"`
	SurfaceInstanceID      string      `json:"surface_instance_id,omitempty"`
	OwnerSessionHash       string      `json:"owner_session_hash,omitempty"`
	OwnerUserHash          string      `json:"owner_user_hash,omitempty"`
	OwnerEnvHash           string      `json:"owner_env_hash,omitempty"`
	SessionChannelIDHash   string      `json:"session_channel_id_hash,omitempty"`
	BridgeChannelID        string      `json:"bridge_channel_id,omitempty"`
	RuntimeGenerationID    string      `json:"runtime_generation_id"`
	PluginInstanceID       string      `json:"plugin_instance_id"`
	Method                 string      `json:"method"`
	Effect                 string      `json:"effect"`
	Execution              string      `json:"execution"`
	OperationID            string      `json:"operation_id,omitempty"`
	StreamID               string      `json:"stream_id,omitempty"`
	AuditCorrelationID     string      `json:"audit_correlation_id"`
	TargetDescriptorHashes []string    `json:"target_descriptor_hashes"`
	Limits                 LeaseLimits `json:"limits"`
	PolicyRevision         uint64      `json:"policy_revision"`
	ManagementRevision     uint64      `json:"management_revision"`
	RevokeEpoch            uint64      `json:"revoke_epoch"`
	RuntimeShardID         string      `json:"runtime_shard_id"`
	RuntimeInstanceID      string      `json:"runtime_instance_id"`
	IPCChannelID           string      `json:"ipc_channel_id"`
	ConnectionNonce        string      `json:"connection_nonce"`
	KeyID                  string      `json:"key_id"`
	Signature              string      `json:"signature"`
	IssuedAtUnixMillis     int64       `json:"issued_at_unix_ms"`
	ExpiresAtUnixMillis    int64       `json:"expires_at_unix_ms"`
}

func SignRuntimeLease

func SignRuntimeLease(lease Lease, method string, keyID string, privateKey ed25519.PrivateKey) (Lease, error)

type LeaseLimits

type LeaseLimits struct {
	TimeoutMillis           int64 `json:"timeout_ms"`
	MemoryBytes             int64 `json:"memory_bytes"`
	MaxPayloadBytes         int64 `json:"max_payload_bytes"`
	MaxStreamBytesPerSecond int64 `json:"max_stream_bytes_per_sec"`
}

type Manager

type Manager interface {
	// BindHostServices validates and atomically installs the Host callbacks used
	// by every shard. Concurrent calls are serialized. A failed call leaves the
	// manager unbound and retryable; a successful call makes every later call
	// return ErrRuntimeHostServicesBound.
	BindHostServices(services RuntimeHostServices) error
	Preflight(ctx context.Context, target runtimetarget.Target) (RuntimeDescriptor, error)
	Start(ctx context.Context, target runtimetarget.Target) (ManagerHealth, error)
	Stop(ctx context.Context) error
	Health(ctx context.Context) (ManagerHealth, error)
	BindPlugin(ctx context.Context, pluginInstanceID string) (RuntimeBinding, error)
	InvokeWorker(ctx context.Context, binding RuntimeBinding, lease Lease, method string, payload []byte) ([]byte, error)
	// Revoke never starts or preflights a shard. A non-ready shard is stopped
	// idempotently and contributes zero closed-resource counts.
	Revoke(ctx context.Context, req RevokeRequest) (RevokeResult, error)
	// RevokeSession never starts or preflights shards. Non-ready shards are
	// stopped idempotently, omitted from terminal acknowledgements, and
	// contribute zero counts to the complete aggregate result.
	RevokeSession(ctx context.Context, req SessionRevokeRequest) (SessionRevokeResult, error)
}

Manager owns the runtime shard lifecycle for exactly one Host. A new Manager starts unbound. BindHostServices must succeed before every other operation; failed binding may be retried, while successful binding is permanent. The concrete ProcessManager serializes binding and lifecycle transitions.

type ManagerHealth

type ManagerHealth struct {
	Ready      bool              `json:"ready"`
	Descriptor RuntimeDescriptor `json:"descriptor"`
	Shards     []ShardHealth     `json:"shards"`
}

type MemoryRuntimeLeaseReplayStore

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

func NewMemoryRuntimeLeaseReplayStore

func NewMemoryRuntimeLeaseReplayStore() *MemoryRuntimeLeaseReplayStore

func (*MemoryRuntimeLeaseReplayStore) ConsumeRuntimeLease

func (*MemoryRuntimeLeaseReplayStore) ListRuntimeLeaseReplays

type ModuleCacheMetrics

type ModuleCacheMetrics struct {
	Hits        uint64 `json:"hits"`
	Misses      uint64 `json:"misses"`
	Compiles    uint64 `json:"compiles"`
	Entries     int    `json:"entries"`
	SourceBytes int64  `json:"source_bytes"`
}

type ProcessManager

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

ProcessManager implements Manager with a fixed set of runtime process shards. Its lifecycle mutex makes Host binding, start, stop, and health transitions a single ordered state machine.

func NewProcessManager

func NewProcessManager(options ProcessManagerOptions) (*ProcessManager, error)

NewProcessManager creates an unbound manager without creating runtime shards.

func (*ProcessManager) BindHostServices

func (m *ProcessManager) BindHostServices(services RuntimeHostServices) error

BindHostServices installs one Host's services and creates the fixed shard set. Validation or shard construction failure leaves the manager unbound so the caller can retry. Once this method succeeds, services are immutable and every later binding attempt returns ErrRuntimeHostServicesBound.

func (*ProcessManager) BindPlugin

func (m *ProcessManager) BindPlugin(ctx context.Context, pluginInstanceID string) (RuntimeBinding, error)

func (*ProcessManager) Health

func (m *ProcessManager) Health(ctx context.Context) (ManagerHealth, error)

func (*ProcessManager) InvokeWorker

func (m *ProcessManager) InvokeWorker(ctx context.Context, binding RuntimeBinding, lease Lease, method string, payload []byte) ([]byte, error)

func (*ProcessManager) Preflight

func (*ProcessManager) Revoke

func (*ProcessManager) RevokeSession

func (*ProcessManager) Start

func (*ProcessManager) Stop

func (m *ProcessManager) Stop(ctx context.Context) error

type ProcessManagerOptions

type ProcessManagerOptions struct {
	ShardCount int
	Supervisor ProcessSupervisorOptions
}

ProcessManagerOptions configures a ProcessManager. ShardCount and all supervisor runtime limits are explicit; Supervisor.StreamSink must remain unset because the owning Host supplies it through BindHostServices.

type ProcessSupervisor

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

func NewProcessSupervisor

func NewProcessSupervisor(options ProcessSupervisorOptions) (*ProcessSupervisor, error)

NewProcessSupervisor validates all required runtime and Host-service inputs and creates a stopped supervisor. Timing and limits are never defaulted or widened. StreamSink must be a concrete non-nil implementation; typed-nil interface values are rejected.

func (*ProcessSupervisor) Health

func (*ProcessSupervisor) Heartbeat

func (s *ProcessSupervisor) Heartbeat(ctx context.Context) (HeartbeatResult, error)

func (*ProcessSupervisor) InvokeWorker

func (s *ProcessSupervisor) InvokeWorker(ctx context.Context, lease Lease, method string, payload []byte) ([]byte, error)

func (*ProcessSupervisor) Preflight

func (*ProcessSupervisor) Revoke

func (*ProcessSupervisor) RevokeSession

func (*ProcessSupervisor) Start

func (*ProcessSupervisor) Stop

func (s *ProcessSupervisor) Stop(ctx context.Context) error

type ProcessSupervisorOptions

type ProcessSupervisorOptions struct {
	RuntimePath           string
	RuntimeExecutable     *os.File
	RuntimeExecutionRoot  *os.File
	Descriptor            RuntimeDescriptor
	Args                  []string
	Env                   []string
	Dir                   string
	Diagnostics           observability.DiagnosticsSink
	Artifacts             ArtifactProvider
	HandleGrants          HandleGrantValidator
	RuntimeLeaseReplays   RuntimeLeaseReplayStore
	StorageFiles          storage.FilesBroker
	StorageKV             storage.KVBroker
	StorageSQLite         storage.SQLiteBroker
	Connectivity          connectivity.Broker
	NetworkExecutor       connectivity.NetworkExecutor
	StreamSink            RuntimeStreamSink
	Now                   func() time.Time
	HandshakeTimeout      time.Duration
	HeartbeatInterval     time.Duration
	MaxHeartbeatStaleness time.Duration
	Limits                RuntimeLimits
}

ProcessSupervisorOptions defines the immutable process, broker, Host-service, timing, and resource-limit inputs for one runtime supervisor. All three timing values must be positive, and MaxHeartbeatStaleness must not be less than HeartbeatInterval.

type RevokeRequest

type RevokeRequest struct {
	ResourceScope    sessionctx.ResourceScope `json:"resource_scope"`
	PluginInstanceID string                   `json:"plugin_instance_id"`
	RevokeEpoch      uint64                   `json:"revoke_epoch"`
}

type RevokeResult

type RevokeResult struct {
	ResourceScope            sessionctx.ResourceScope `json:"resource_scope"`
	PluginInstanceID         string                   `json:"plugin_instance_id"`
	RevokeEpoch              uint64                   `json:"revoke_epoch"`
	ClosedSocketCount        int                      `json:"closed_socket_count"`
	ClosedStreamCount        int                      `json:"closed_stream_count"`
	ClosedStorageHandleCount int                      `json:"closed_storage_handle_count"`
	RuntimeStopped           bool                     `json:"runtime_stopped,omitempty"`
}

type RuntimeBinding

type RuntimeBinding struct {
	RuntimeShardID      string            `json:"runtime_shard_id"`
	RuntimeInstanceID   string            `json:"runtime_instance_id"`
	RuntimeGenerationID string            `json:"runtime_generation_id"`
	IPCChannelID        string            `json:"ipc_channel_id"`
	ConnectionNonce     string            `json:"connection_nonce"`
	Descriptor          RuntimeDescriptor `json:"descriptor"`
}

type RuntimeDescriptor

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

RuntimeDescriptor is the immutable identity of one host-built runtime. Construct it with the options-only NewRuntimeDescriptor API.

func NewRuntimeDescriptor

func NewRuntimeDescriptor(options RuntimeDescriptorOptions) (RuntimeDescriptor, error)

func (RuntimeDescriptor) BinarySHA256

func (d RuntimeDescriptor) BinarySHA256() string

func (RuntimeDescriptor) CompatibleWithPlatform

func (d RuntimeDescriptor) CompatibleWithPlatform() error

func (RuntimeDescriptor) ContractSetSHA256

func (d RuntimeDescriptor) ContractSetSHA256() string

func (RuntimeDescriptor) MarshalJSON

func (d RuntimeDescriptor) MarshalJSON() ([]byte, error)

func (RuntimeDescriptor) PlatformVersion

func (d RuntimeDescriptor) PlatformVersion() platformversion.SemVer

func (RuntimeDescriptor) RustIPCVersion

func (d RuntimeDescriptor) RustIPCVersion() string

func (RuntimeDescriptor) Target

func (*RuntimeDescriptor) UnmarshalJSON

func (d *RuntimeDescriptor) UnmarshalJSON(raw []byte) error

func (RuntimeDescriptor) WASMABIVersion

func (d RuntimeDescriptor) WASMABIVersion() string

type RuntimeDescriptorOptions

type RuntimeDescriptorOptions struct {
	PlatformVersion   platformversion.SemVer
	Target            runtimetarget.Target
	RustIPCVersion    string
	WASMABIVersion    string
	ContractSetSHA256 string
	BinarySHA256      string
}

type RuntimeHostServices

type RuntimeHostServices struct {
	StreamSink RuntimeStreamSink
}

RuntimeHostServices is the complete callback set a Host transfers to a Manager before any runtime shard can be created or started. BindHostServices captures these interface values for the lifetime of the manager.

type RuntimeLeasePublicKey

type RuntimeLeasePublicKey struct {
	Algorithm       string `json:"algorithm"`
	KeyID           string `json:"key_id"`
	PublicKeyBase64 string `json:"public_key_base64"`
}

func NormalizeRuntimeLeasePublicKeys

func NormalizeRuntimeLeasePublicKeys(keys []RuntimeLeasePublicKey) ([]RuntimeLeasePublicKey, error)

func RuntimeLeasePublicKeyFromEd25519

func RuntimeLeasePublicKeyFromEd25519(keyID string, publicKey ed25519.PublicKey) (RuntimeLeasePublicKey, error)

type RuntimeLeaseReplayConsumeRequest

type RuntimeLeaseReplayConsumeRequest struct {
	Lease  Lease     `json:"lease"`
	Method string    `json:"method"`
	Now    time.Time `json:"-"`
}

type RuntimeLeaseReplayListRequest

type RuntimeLeaseReplayListRequest struct {
	PluginInstanceID string `json:"plugin_instance_id,omitempty"`
}

type RuntimeLeaseReplayLister

type RuntimeLeaseReplayLister interface {
	ListRuntimeLeaseReplays(ctx context.Context, req RuntimeLeaseReplayListRequest) ([]RuntimeLeaseReplayRecord, error)
}

type RuntimeLeaseReplayRecord

type RuntimeLeaseReplayRecord struct {
	LeaseID             string    `json:"lease_id"`
	LeaseNonceHash      string    `json:"lease_nonce_hash"`
	PluginInstanceID    string    `json:"plugin_instance_id"`
	RuntimeGenerationID string    `json:"runtime_generation_id"`
	Method              string    `json:"method"`
	PolicyRevision      uint64    `json:"policy_revision"`
	ManagementRevision  uint64    `json:"management_revision"`
	RevokeEpoch         uint64    `json:"revoke_epoch"`
	ConsumedAt          time.Time `json:"consumed_at"`
	ExpiresAt           time.Time `json:"expires_at"`
}

type RuntimeLeaseReplayStore

type RuntimeLeaseReplayStore interface {
	ConsumeRuntimeLease(ctx context.Context, req RuntimeLeaseReplayConsumeRequest) (RuntimeLeaseReplayRecord, error)
}

type RuntimeLeaseSigningKey

type RuntimeLeaseSigningKey struct {
	KeyID               string            `json:"key_id"`
	PublicKey           ed25519.PublicKey `json:"-"`
	RuntimeShardID      string            `json:"runtime_shard_id,omitempty"`
	RuntimeInstanceID   string            `json:"runtime_instance_id,omitempty"`
	RuntimeGenerationID string            `json:"runtime_generation_id,omitempty"`
	IPCChannelID        string            `json:"ipc_channel_id,omitempty"`
	ConnectionNonce     string            `json:"connection_nonce,omitempty"`
	Revoked             bool              `json:"revoked,omitempty"`
	Metadata            map[string]string `json:"metadata,omitempty"`
}

type RuntimeLeaseSigningKeyLookupRequest

type RuntimeLeaseSigningKeyLookupRequest struct {
	KeyID               string `json:"key_id"`
	RuntimeShardID      string `json:"runtime_shard_id,omitempty"`
	RuntimeInstanceID   string `json:"runtime_instance_id,omitempty"`
	RuntimeGenerationID string `json:"runtime_generation_id"`
	IPCChannelID        string `json:"ipc_channel_id,omitempty"`
	ConnectionNonce     string `json:"connection_nonce,omitempty"`
	PluginInstanceID    string `json:"plugin_instance_id,omitempty"`
	Method              string `json:"method,omitempty"`
}

type RuntimeLeaseSigningKeyring

type RuntimeLeaseSigningKeyring interface {
	LookupRuntimeLeaseSigningKey(ctx context.Context, req RuntimeLeaseSigningKeyLookupRequest) (RuntimeLeaseSigningKey, error)
}

type RuntimeLeaseVerificationRequest

type RuntimeLeaseVerificationRequest struct {
	Lease  Lease     `json:"lease"`
	Method string    `json:"method"`
	Now    time.Time `json:"-"`
}

type RuntimeLeaseVerifier

type RuntimeLeaseVerifier interface {
	VerifyRuntimeLease(ctx context.Context, req RuntimeLeaseVerificationRequest) error
}

type RuntimeLimits

type RuntimeLimits struct {
	WorkerCount            int   `json:"worker_count"`
	QueueCapacity          int   `json:"queue_capacity"`
	PerPluginConcurrency   int   `json:"per_plugin_concurrency"`
	ModuleCacheEntries     int   `json:"module_cache_entries"`
	ModuleCacheSourceBytes int64 `json:"module_cache_source_bytes"`
}

func DefaultRuntimeLimits

func DefaultRuntimeLimits() RuntimeLimits

type RuntimeProcessExitFailure

type RuntimeProcessExitFailure struct {
	ExitCode int
	Code     observability.RuntimeProcessFailureCode
}

RuntimeProcessExitFailure binds one released runtime process exit status to the stable diagnostic code reported by ProcessSupervisor.

func RuntimeProcessExitFailures

func RuntimeProcessExitFailures() []RuntimeProcessExitFailure

RuntimeProcessExitFailures returns an owned copy of the fixed exit mapping.

type RuntimeStreamSink

type RuntimeStreamSink interface {
	AppendRuntimeStream(ctx context.Context, streamID, kind string, data []byte) error
	CloseRuntimeStream(ctx context.Context, streamID string) error
	FailRuntimeStream(ctx context.Context, streamID string, code capability.ExecutionFailureCode, cause error) error
}

RuntimeStreamSink is the required Host-owned destination for stream events emitted by runtime hostcalls. A nil or typed-nil implementation is invalid.

type SQLiteRuntimeLeaseReplayStore

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

func NewSQLiteRuntimeLeaseReplayStore

func NewSQLiteRuntimeLeaseReplayStore(ctx context.Context, path string) (*SQLiteRuntimeLeaseReplayStore, error)

func (*SQLiteRuntimeLeaseReplayStore) Close

func (*SQLiteRuntimeLeaseReplayStore) ConsumeRuntimeLease

func (*SQLiteRuntimeLeaseReplayStore) ListRuntimeLeaseReplays

type SessionRevokeCounts

type SessionRevokeCounts struct {
	QueuedInvocations     uint64 `json:"queued_invocations"`
	RunningInvocations    uint64 `json:"running_invocations"`
	StorageHostcalls      uint64 `json:"storage_hostcalls"`
	ActiveNetworkRequests uint64 `json:"active_network_requests"`
	Sockets               uint64 `json:"sockets"`
	NetworkStreams        uint64 `json:"network_streams"`
}

type SessionRevokeRequest

type SessionRevokeRequest struct {
	SessionScope          sessionctx.SessionScope `json:"-"`
	SessionRevokeSequence uint64                  `json:"session_revoke_sequence"`
}

type SessionRevokeResult

type SessionRevokeResult struct {
	SessionScope          sessionctx.SessionScope    `json:"-"`
	SessionRevokeSequence uint64                     `json:"session_revoke_sequence"`
	Shards                []SessionRevokeShardResult `json:"shards"`
	Counts                SessionRevokeCounts        `json:"counts"`
	RuntimeStopped        bool                       `json:"runtime_stopped,omitempty"`
}

type SessionRevokeShardResult

type SessionRevokeShardResult struct {
	RuntimeShardID      string              `json:"runtime_shard_id"`
	RuntimeGenerationID string              `json:"runtime_generation_id"`
	State               SessionRevokeState  `json:"state"`
	Counts              SessionRevokeCounts `json:"counts"`
}

type SessionRevokeState

type SessionRevokeState string
const SessionRevokeStateComplete SessionRevokeState = "complete"

type ShardHealth

type ShardHealth struct {
	RuntimeShardID string `json:"runtime_shard_id"`
	Health
}

type StaticRuntimeLeaseSigningKeyring

type StaticRuntimeLeaseSigningKeyring struct {
	Keys []RuntimeLeaseSigningKey
}

func (StaticRuntimeLeaseSigningKeyring) LookupRuntimeLeaseSigningKey

type WorkerErrorOrigin

type WorkerErrorOrigin string
const (
	WorkerErrorOriginRuntime  WorkerErrorOrigin = "runtime"
	WorkerErrorOriginHostcall WorkerErrorOrigin = "hostcall"
	WorkerErrorOriginPlugin   WorkerErrorOrigin = "plugin"
)

type WorkerExecutionError

type WorkerExecutionError struct {
	Code    string
	Message string
	Origin  WorkerErrorOrigin
}

func (*WorkerExecutionError) Error

func (e *WorkerExecutionError) Error() string

func (*WorkerExecutionError) Unwrap

func (e *WorkerExecutionError) Unwrap() error

Jump to

Keyboard shortcuts

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