types

package
v0.0.0-...-fc2aea3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAgentName                = "agent"
	DefaultAgentServiceName         = "beam-agent"
	DefaultAgentServiceDescription  = "Beam Agent"
	AgentTailnetHostnamePrefix      = "beam-agent-"
	GatewayTailnetHostname          = "beam-gateway"
	DefaultAgentBinaryPath          = "/usr/local/bin/beam-agent"
	DefaultAgentBinaryPattern       = "/usr/local/bin/beam-agent-%s-%s"
	DefaultAgentStateDir            = "/var/lib/beam/agent"
	DefaultAgentServiceManager      = "auto"
	AgentServiceManagerSystemd      = "systemd"
	AgentServiceManagerLaunchd      = "launchd"
	AgentServiceManagerNone         = "none"
	AgentServiceUnitExtension       = ".service"
	AgentSystemdNetworkOnlineTarget = "network-online.target"
	AgentSystemdDockerService       = "docker.service"
	AgentSystemdUnitDir             = "/etc/systemd/system"
	AgentSystemdRuntimeDir          = "/run/systemd/system"
	AgentLaunchdUserDir             = "Library/LaunchAgents"
	AgentLaunchdSystemDir           = "/Library/LaunchDaemons"
	AgentLaunchdLabel               = "dev.beam.agent"
	AgentLaunchdPlistExtension      = ".plist"
	AgentLaunchdSystemDomain        = "system"
	AgentLaunchdUserDomainPrefix    = "gui/"
	AgentSystemctlCommand           = "systemctl"
	AgentLaunchctlCommand           = "launchctl"
	AgentPathEnv                    = "PATH"
	AgentServiceDefaultPath         = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
	AgentServiceLogFile             = "agent.log"
	AgentServiceErrorLogFile        = "agent.err.log"
	AgentHomeEnv                    = "HOME"
	AgentXDGConfigHomeEnv           = "XDG_CONFIG_HOME"
	AgentRegistryAddr               = "127.0.0.1:5000"
	AgentWorkerEntrypoint           = "/usr/local/bin/worker"
	AgentTmpSizeLimit               = "30Gi"
	AgentStateDirName               = "agent"
	AgentLockFileName               = "agent.lock"
	AgentJoinTokenFileName          = "join-token"
	AgentRuntimeStateFileName       = "agent-state.json"
	BeamStateDirName                = "beam"
	LoopbackHost                    = "127.0.0.1"
	HostnameEnv                     = "HOSTNAME"
	PodNameEnv                      = "POD_NAME"
	GatewayTSNetHostnameEnv         = "BETA9_GATEWAY_TSNET_HOSTNAME"
	CacheCoordinatorTokenEnv        = "CACHE_COORDINATOR_TOKEN"
	NvidiaVisibleDevicesAll         = "all"
	NvidiaVisibleDevicesEnv         = "NVIDIA_VISIBLE_DEVICES"
	MicroVMVFIODevicesEnv           = "BEAM_MICROVM_VFIO_DEVICES"
	MicroVMGPUTypeEnv               = "BEAM_MICROVM_GPU_TYPE"
	AgentDockerHostsEnv             = "BEAM_AGENT_DOCKER_HOST_ALIASES"
	AgentInContainerEnv             = "BEAM_AGENT_CONTAINER"
	AgentHostnameEnv                = "BEAM_AGENT_HOSTNAME"
	AgentRegistryForwardEnv         = "BEAM_AGENT_LOCAL_REGISTRY_FORWARD"
	AgentTargetHostEnv              = "BEAM_AGENT_LOCAL_TARGET_HOST"
	AgentFingerprintEnv             = "BEAM_AGENT_MACHINE_FINGERPRINT"
	AgentStateDirEnv                = "BEAM_AGENT_STATE_DIR"
	AgentCacheDirEnv                = "BEAM_AGENT_CACHE_DIR"
	AgentBinaryPathEnv              = "BEAM_AGENT_BIN_PATH"
	AgentSourceDirEnv               = "BEAM_AGENT_SOURCE_DIR"
	AgentBuildCacheDirEnv           = "BEAM_AGENT_BUILD_CACHE_DIR"
	AgentWorkerImageEnv             = "BEAM_WORKER_IMAGE"
	AgentDownloadURLEnv             = "BEAM_AGENT_URL"
	AgentInstallDockerEnv           = "BEAM_AGENT_INSTALL_DOCKER"
	AgentStorageModeEnv             = "BEAM_AGENT_WORKSPACE_STORAGE_MODE"
	AgentCPUAffinityEnforcedEnv     = "BEAM_AGENT_CPU_AFFINITY_ENFORCED"
	AgentWorkerPlatformEnv          = "BEAM_AGENT_WORKER_PLATFORM"
	AgentVerboseEnv                 = "BEAM_AGENT_VERBOSE"
	AgentNoColorEnv                 = "NO_COLOR"
	AgentGatewayURLEnv              = "BEAM_GATEWAY_HTTP_URL"
	AgentImagesPath                 = "/images"
	AgentImageCachePath             = "/images/cache"
	AgentImageMountPattern          = "/images/mnt/%s"
	AgentTmpPath                    = "/tmp"
	AgentWorkspacePath              = "/workspace/data"
	AgentCachePath                  = "/var/lib/beta9/cache"
	AgentCheckpointPath             = "/checkpoints"
	AgentLogsPath                   = "/var/log/worker"
	AgentConfigPath                 = "/etc/beam/agent-worker.json"
	AgentCacheFSMountPath           = "/cache"
	HostKubeletDevicePluginsPath    = "/var/lib/kubelet/device-plugins"
	HostKubeletDeviceCheckpointPath = "/var/lib/kubelet/device-plugins/kubelet_internal_checkpoint"
	HostNetnsPath                   = "/var/run/netns"
	// WorkerLinkPrefix starts the name of every link a worker creates on its
	// host, which the agent's tailnet ignores.
	WorkerLinkPrefix                = "b9"
	HostCgroupPath                  = "/sys/fs/cgroup"
	HostFuseDevicePath              = "/dev/fuse"
	HostKernelModulesPath           = "/lib/modules"
	AgentDockerLabelManaged         = "dev.beam.agent.worker"
	AgentDockerLabelWorkerID        = "dev.beam.agent.worker_id"
	AgentDockerLabelMachineID       = "dev.beam.agent.machine_id"
	AgentDockerLabelPoolName        = "dev.beam.agent.pool_name"
	AgentDockerLabelWorkerImageID   = "dev.beam.agent.worker_image_id"
	AgentTelemetrySourceAgent       = "agent"
	AgentTelemetrySourceWorker      = "worker"
	AgentMachineStatusSchedulable   = "schedulable"
	AgentMachineStatusUnschedulable = "unschedulable"
	AgentMachineStatusDisconnected  = "disconnected"
	AgentMachineStatusPreflightFail = "preflight_failed"
	AgentPreflightSeverityInfo      = "info"
	AgentPreflightSeverityError     = "error"
)
View Source
const (
	WorkerConfigPathEnv     = "CONFIG_PATH"
	WorkerConfigJSONEnv     = "CONFIG_JSON"
	WorkerIDEnv             = "WORKER_ID"
	WorkerTokenEnv          = "WORKER_TOKEN"
	WorkerPoolEnv           = "WORKER_POOL_NAME"
	WorkerMachineEnv        = "WORKER_MACHINE_ID"
	WorkerPersistentEnv     = "WORKER_PERSISTENT"
	WorkerGenerationEnv     = "WORKER_GENERATION"
	WorkerRouteTransportEnv = "WORKER_ROUTE_TRANSPORT"
	WorkerRouteTargetEnv    = "WORKER_ROUTE_LOCAL_TARGET_HOST"
	WorkerCPUEnv            = "CPU_LIMIT"
	WorkerMemoryEnv         = "MEMORY_LIMIT"
	WorkerGPUEnv            = "GPU_TYPE"
	WorkerGPUCountEnv       = "GPU_COUNT"
	WorkerGPUVirtualizedEnv = "WORKER_GPU_VIRTUALIZED"
	// The agent's GPU assignment ("all" or a device list); unlike
	// NVIDIA_VISIBLE_DEVICES it survives container toolkit rewrites.
	WorkerGPUDevicesEnv             = "WORKER_GPU_DEVICES"
	WorkerPodHostEnv                = "POD_HOSTNAME"
	WorkerPodIPEnv                  = "POD_IP"
	WorkerPodUIDEnv                 = "POD_UID"
	WorkerHostnameEnv               = HostnameEnv
	WorkerNetworkPrefixEnv          = "NETWORK_PREFIX"
	WorkerDefaultInterfaceEnv       = "WORKER_DEFAULT_INTERFACE"
	WorkerIptablesModeEnv           = "WORKER_IPTABLES_MODE"
	WorkerStartConcurrencyEnv       = "WORKER_CONTAINER_START_CONCURRENCY"
	WorkerNetworkSlotsEnv           = "CONTAINER_NETWORK_SLOT_POOL_SIZE"
	CheckpointUploadConcurrencyEnv  = "BETA9_CHECKPOINT_UPLOAD_CONCURRENCY"
	CheckpointArchiveConcurrencyEnv = "BETA9_CHECKPOINT_ARCHIVE_CONCURRENCY"
	MicroVMCheckpointConcurrencyEnv = "BETA9_MICROVM_CHECKPOINT_CONCURRENCY"
	MicroVMSnapshotIOConcurrencyEnv = "BETA9_MICROVM_SNAPSHOT_IO_CONCURRENCY"
	CheckpointDiskPipelineEnv       = "BETA9_CHECKPOINT_DISK_PIPELINE"
	WorkerNetworkCleanupBatchEnv    = "BETA9_NETWORK_CLEANUP_BATCH"
	WorkerMinimalConfigEnv          = "BEAM_WORKER_MINIMAL_CONFIG"
	WorkerCacheAdvertiseAddrEnv     = "BEAM_WORKER_CACHE_ADVERTISE_ADDR"

	ContainerGatewayGRPCHostEnv = "BETA9_GATEWAY_HOST"
	ContainerGatewayGRPCPortEnv = "BETA9_GATEWAY_PORT"
	ContainerGatewayHTTPHostEnv = "BETA9_GATEWAY_HOST_HTTP"
	ContainerGatewayHTTPPortEnv = "BETA9_GATEWAY_PORT_HTTP"
	ContainerHostnameEnv        = "CONTAINER_HOSTNAME"
	ContainerRunnerReadyPathEnv = "BETA9_RUNNER_READY_PATH"
	ContainerRunnerReadyPath    = "/run/beta9/runner-ready"
)
View Source
const (
	CacheLocalityEnv    = "CACHE_LOCALITY"
	CacheNodeEnv        = "CACHE_NODE_ID"
	CacheHostNetworkEnv = "CACHE_HOST_NETWORK"
	CacheServerOnlyEnv  = "CACHE_SERVER_ONLY"
	CacheServerPortEnv  = "CACHE_SERVER_PORT"
)
View Source
const (
	PrivatePoolFallbackInternal = "internal"
	PrivatePoolFallbackWait     = "wait"
	PrivatePoolFallbackFail     = "fail"
)
View Source
const (
	TokenTypeClusterAdmin     string = "admin"
	TokenTypeWorkspacePrimary string = "workspace_primary"
	TokenTypeWorkspace        string = "workspace"
	// Legacy: endpoints are now deployed by the repo's CI with a cluster admin
	// token. Kept for existing rows; image builds from it are platform work.
	TokenTypePlatformDeployer string = "platform_deployer"
	TokenTypeWorker           string = "worker"
	// TokenTypeWorkerPrivate is a worker token minted for private-pool (agent)
	// compute running on customer machines. It carries the pool owner's
	// workspace and marks the worker as untrusted customer compute, so the
	// gateway scopes its cache namespace and credential access by workspace.
	TokenTypeWorkerPrivate       string = "worker_private"
	TokenTypeWorkspaceRestricted string = "workspace_restricted"
)
View Source
const (
	CheckpointCompatibilityLegacyPrefix     string = "v1:"
	CheckpointCompatibilityGPUDevicesPrefix string = "v2:"
)
View Source
const (
	DatabaseKindPostgres      = "postgres"
	DatabaseKindPostgresAlias = "postgresql"
	DatabaseKindRedis         = "redis"
	DatabaseKindValkey        = "valkey"

	// A journaled disk commits every flush to object storage.
	DatabaseDurabilityObjectStoreFlush = "object-store-flush"

	PostgresDataMountPath = "/var/lib/postgresql/data"
)
View Source
const (
	StubTypeFunction               string = "function"
	StubTypeFunctionDeployment     string = "function/deployment"
	StubTypeFunctionServe          string = "function/serve"
	StubTypeContainer              string = "container"
	StubTypeShell                  string = "shell"
	StubTypeTaskQueue              string = "taskqueue"
	StubTypeTaskQueueDeployment    string = "taskqueue/deployment"
	StubTypeTaskQueueServe         string = "taskqueue/serve"
	StubTypeEndpoint               string = "endpoint"
	StubTypeEndpointDeployment     string = "endpoint/deployment"
	StubTypeEndpointServe          string = "endpoint/serve"
	StubTypeASGI                   string = "asgi"
	StubTypeASGIDeployment         string = "asgi/deployment"
	StubTypeASGIServe              string = "asgi/serve"
	StubTypeScheduledJob           string = "schedule"
	StubTypeScheduledJobDeployment string = "schedule/deployment"
	StubTypeBot                    string = "bot"
	StubTypeBotDeployment          string = "bot/deployment"
	StubTypeBotServe               string = "bot/serve"
	StubTypePod                    string = "pod"
	StubTypePodDeployment          string = "pod/deployment"
	StubTypePodRun                 string = "pod/run"
	StubTypeSandbox                string = "sandbox"
	StubTypeVM                     string = "vm"
)
View Source
const (
	BackendRouteScheme               = "route"
	BackendRouteTransportDirect      = "direct"
	BackendRouteTransportTSNet       = "tsnet_restricted"
	BackendRouteTransportLocalDirect = "local_direct"
	BackendRouteStateOpening         = "opening"
	BackendRouteStateReady           = "ready"
	BackendRouteStateDegraded        = "degraded"
	BackendRouteStateClosing         = "closing"
	BackendRouteProtocolTCP          = "tcp"
	BackendRouteKindWorker           = "worker"
	BackendRouteKindContainer        = "container"
	DefaultAgentTSNetRouteProxyPort  = 29443
	DefaultAgentWorkerContainerMode  = "worker-container"
	DefaultAgentLocalDevMode         = "local-dev"
)
View Source
const (
	ComputePoolStatusActive = "active"

	ComputeSourceAutosolver     ComputeCapacitySource = "autosolver"
	ComputeSourceCLIReservation ComputeCapacitySource = "cli_reservation"
	ComputeSourceAttached       ComputeCapacitySource = "attached"
	ComputeSourceManual         ComputeCapacitySource = "manual"
	ComputeSourceAWS            ComputeCapacitySource = "aws"

	ComputeReservationPending     ComputeReservationStatus = "pending"
	ComputeReservationActive      ComputeReservationStatus = "active"
	ComputeReservationTerminating ComputeReservationStatus = "terminating"
	ComputeReservationDeleted     ComputeReservationStatus = "deleted"
	ComputeReservationFailed      ComputeReservationStatus = "failed"

	ComputeActionCreate ComputeSolveActionType = "create"
	ComputeActionKeep   ComputeSolveActionType = "keep"
	ComputeActionDelete ComputeSolveActionType = "delete"
)
View Source
const (
	CreditGateModeNoop = "noop"
	CreditGateModeHTTP = "http"
)
View Source
const (
	WorkerPoolManagementSourceConfig WorkerPoolManagementSource = "config"
	WorkerPoolManagementSourceAPI    WorkerPoolManagementSource = "api"

	WorkerPoolControllerLocal WorkerPoolController = "local"
	WorkerPoolControllerAgent WorkerPoolController = "agent"
)
View Source
const (
	ManagedComputeDefaultMinimumCreditCents int64   = 2500
	ManagedComputeDefaultBillableMarginPct  float64 = 0.10

	ManagedComputeDefaultBYOCMemoryHourlyMicrosPerGB int64 = 4_500
	ManagedComputeDefaultBYOCCPUHourlyMicrosPerVCPU  int64 = 9_500
)
View Source
const (
	DurableDiskDriverEnv          = "BETA9_DURABLE_DISK_DRIVER"
	DiskSpareRefillQuietEnv       = "BETA9_DISK_SPARE_REFILL_QUIET"
	DiskChunkUploadConcurrencyEnv = "BETA9_DISK_CHUNK_UPLOAD_CONCURRENCY"
)
View Source
const (
	// DurableDiskRootMountPath marks a durable disk as the machine root
	// instead of an ordinary bind mount.
	DurableDiskRootMountPath = "/"
	// DurableDiskDefaultRootName names the root disk when the request does
	// not provide one.
	DurableDiskDefaultRootName = "root"
)

The machine-root durable disk contract, shared between the gateway (which expands a persistent root request into a disk entry) and the worker (which recognizes the mount and hosts the container's overlay upper layer on it).

View Source
const (
	QMPCommandCapabilities         = "qmp_capabilities"
	QMPCommandQuit                 = "quit"
	QMPCommandBlockdevAdd          = "blockdev-add"
	QMPCommandBlockdevDel          = "blockdev-del"
	QMPCommandBlockdevSnapshot     = "blockdev-snapshot"
	QMPCommandTransaction          = "transaction"
	QMPCommandQueryBlockstats      = "query-blockstats"
	QMPCommandQueryNamedBlockNodes = "query-named-block-nodes"
	QMPCommandBlockCommit          = "block-commit"
	QMPCommandQueryJobs            = "query-jobs"
	QMPCommandJobCancel            = "job-cancel"
	QMPCommandJobDismiss           = "job-dismiss"
)

QMP command names the qcow disk engine drives against qemu-storage-daemon.

View Source
const (
	CacheAuditStatusMaterialized    = "materialized"
	CacheAuditStatusMiss            = "miss"
	CacheAuditStatusHostUnavailable = "host_unavailable"
	CacheAuditStatusOriginFailure   = "origin_failure"
	CacheAuditStatusReplicaFailure  = "replica_failure"
	CacheAuditStatusSkipped         = "skipped"
)

Platform cache audit statuses for EventPlatformCacheSchema.Status.

View Source
const (
	EventComputeActionPoolReserved               = "pool.reserved"
	EventComputeActionPoolCreated                = "pool.created"
	EventComputeActionPoolDeleted                = "pool.deleted"
	EventComputeActionPoolExtended               = "pool.extended"
	EventComputeActionPoolCreditExhausted        = "pool.credit_exhausted"
	EventComputeActionPoolBillingDegraded        = "pool.billing_degraded"
	EventComputeActionPoolCreditLow              = "pool.credit_low"
	EventComputeActionReservationUsageRecorded   = "reservation.usage_recorded"
	EventComputeActionReservationRenewed         = "reservation.renewed"
	EventComputeActionReservationTerminating     = "reservation.terminating"
	EventComputeActionReservationStatusUpdated   = "reservation.status_updated"
	EventComputeActionPoolHeartbeat              = "pool.heartbeat"
	EventComputeActionPoolSchedulable            = "pool.schedulable"
	EventComputeActionPoolUnschedulable          = "pool.unschedulable"
	EventComputeActionContainerPlaced            = "container.placed"
	EventComputeActionOnDemandCreated            = "ondemand.reservation_created"
	EventComputeActionOnDemandTerminated         = "ondemand.reservation_terminated"
	EventComputeActionOnDemandBudgetExhausted    = "ondemand.budget_exhausted"
	EventComputeActionJoinTokenCreated           = "join_token.created"
	EventComputeActionJoinTokenRevoked           = "join_token.revoked"
	EventComputeActionMachineJoined              = "machine.joined"
	EventComputeActionMachineHeartbeat           = "machine.heartbeat"
	EventComputeActionMachineDisconnected        = "machine.disconnected"
	EventComputeActionMachineReleased            = "machine.released"
	EventComputeActionMachineAvailabilityUpdated = "machine.availability_updated"
	EventComputeActionMachineNetworkUpdated      = "machine.network_updated"
	EventComputeActionSSHKeyCreated              = "ssh_key.created"
	EventComputeActionSSHKeyDownloaded           = "ssh_key.downloaded"
	EventComputeActionSSHKeyRotated              = "ssh_key.rotated"
	EventComputeActionSSHKeyApplied              = "ssh_key.applied"
	EventComputeActionSSHFailed                  = "ssh.failed"
	EventComputeActionWorkerSlotCreated          = "worker_slot.created"
	EventComputeActionWorkerSlotPruned           = "worker_slot.pruned"
	EventComputeActionWorkerDisabled             = "worker.disabled"
	EventComputeActionTransportCredentialVended  = "transport.credential_vended"
	EventComputeActionTransportPrewarm           = "transport.prewarm"
	EventComputeActionTransportSnapshot          = "transport.snapshot"
	EventComputeActionRouteStatusUpdated         = "route.status_updated"
)
View Source
const (
	EventComputeAttrAvailableWorkerCount     = "available_worker_count"
	EventComputeAttrContainerCount           = "container_count"
	EventComputeAttrCPUUtilizationPct        = "cpu_utilization_pct"
	EventComputeAttrDiskPath                 = "disk_path"
	EventComputeAttrDiskTotalMB              = "disk_total_mb"
	EventComputeAttrDiskUsagePct             = "disk_usage_pct"
	EventComputeAttrDiskUsedMB               = "disk_used_mb"
	EventComputeAttrFreeGPUCount             = "free_gpu_count"
	EventComputeAttrHostCPUUtilizationPct    = "host_cpu_utilization_pct"
	EventComputeAttrHostMemoryUsedMB         = "host_memory_used_mb"
	EventComputeAttrHostMemoryUtilizationPct = "host_memory_utilization_pct"
	EventComputeAttrHourlyCostCents          = "hourly_cost_cents"
	EventComputeAttrMemoryUsedMB             = "memory_used_mb"
	EventComputeAttrMemoryUtilizationPct     = "memory_utilization_pct"
	EventComputeAttrPendingContainerCount    = "pending_container_count"
	EventComputeAttrPendingWorkerCount       = "pending_worker_count"
	EventComputeAttrPoolMode                 = "pool_mode"
	EventComputeAttrSchedulingLatencyMs      = "scheduling_latency_ms"
	EventComputeAttrTransport                = "transport"
	EventComputeAttrWorkerCount              = "worker_count"

	// Failover and on-demand attrs. All money is denominated in cents.
	EventComputeAttrReasons              = "reasons"
	EventComputeAttrChain                = "chain"
	EventComputeAttrFailover             = "failover"
	EventComputeAttrRequestedGPU         = "requested_gpu"
	EventComputeAttrPlacedGPU            = "placed_gpu"
	EventComputeAttrWaitMs               = "wait_ms"
	EventComputeAttrProvider             = "provider"
	EventComputeAttrGPU                  = "gpu"
	EventComputeAttrNodeCount            = "node_count"
	EventComputeAttrBudgetHourlyCents    = "budget_hourly_cents"
	EventComputeAttrBudgetHourlyMaxCents = "budget_hourly_max_cents"
	EventComputeAttrBudgetDailyCents     = "budget_daily_cents"
	EventComputeAttrBudgetDailyMaxCents  = "budget_daily_max_cents"
	EventComputeAttrOnDemandHourlyCents  = "ondemand_hourly_cost_cents"
	EventComputeAttrOnDemandNodeCount    = "ondemand_node_count"
)
View Source
const (
	EventAttrBytes              = "bytes"
	EventAttrCause              = "cause"
	EventAttrContainerID        = "container_id"
	EventAttrContainerStatus    = "container_status"
	EventAttrCurrentContainers  = "current_containers"
	EventAttrDesiredContainers  = "desired_containers"
	EventAttrAttempts           = "attempts"
	EventAttrExitCode           = "exit_code"
	EventAttrError              = "error"
	EventAttrFailureClass       = "failure_class"
	EventAttrFailureClasses     = "failure_classes"
	EventAttrFailureCount       = "failure_count"
	EventAttrForce              = "force"
	EventAttrGracePeriodSeconds = "grace_period_seconds"
	EventAttrLifecycle          = "lifecycle"
	EventAttrLastError          = "last_error"
	EventAttrLockKey            = "lock_key"
	EventAttrMode               = "mode"
	EventAttrPreviousStatus     = "previous_status"
	EventAttrMappedExitCode     = "mapped_exit_code"
	EventAttrOOMKilled          = "oom_killed"
	EventAttrRawExitCode        = "raw_exit_code"
	EventAttrReason             = "reason"
	EventAttrRuntime            = "runtime"
	EventAttrRuntimePID         = "runtime_pid"
	EventAttrExitReason         = "exit_reason"
	EventAttrSource             = "source"
	EventAttrStatus             = "status"
	EventAttrTaskID             = "task_id"
	EventAttrPoolSelector       = "pool_selector"
	EventAttrTimeoutSeconds     = "timeout_seconds"
	EventAttrTotalRequests      = "total_requests"
	EventAttrDurationUs         = "duration_us"
	EventAttrDurationNs         = "duration_ns"
)
View Source
const (
	EventCauseClientContextDone = "client_context_done"
	EventLogStreamStdout        = "stdout"
	EventLogStreamStderr        = "stderr"
	EventLogStreamSystem        = "system"
	EventStreamSourceContainer  = "container_stream"
	EventStreamSourceClient     = "client_stream"
	RunnerEventTypeLifecycle    = "lifecycle"
	RunnerEventTypeEvent        = "event"
)
View Source
const (
	FunctionLifecycleCheckpointContainerRequestReady = "container_request_ready"
	FunctionLifecycleCheckpointStartTask             = "start_task"
	FunctionLifecycleCheckpointGetArgs               = "get_args"
	FunctionLifecycleCheckpointSetResult             = "set_result"
)
View Source
const (
	GatewayObjectTypeDeployment = "BETA9_DEPLOYMENT"
	GatewayObjectTypeTask       = "BETA9_TASK"
	GatewayObjectTypeStub       = "BETA9_STUB"
	GatewayObjectTypeContainer  = "BETA9_CONTAINER"
	GatewayObjectTypeWorkspace  = "BETA9_WORKSPACE"
	GatewayObjectTypeApp        = "BETA9_APP"
	GatewayObjectTypeMachine    = "BETA9_MACHINE"
)
View Source
const (
	EventEndpointRoute   = "endpoint.route"
	EventEndpointReplica = "endpoint.replica"
	EventEndpointConfig  = "endpoint.config"
	EventEndpointGitOps  = "endpoint.gitops"
	EventEndpointHarness = "endpoint.harness"
)

Managed endpoint events. Every event carries the endpoint id so the admin RPCs and UI can query history per endpoint (and per GPU target).

View Source
const (
	DefaultGatewayServiceName          string = "gateway"
	DefaultDurableDisksPath            string = "/var/lib/beta9/durable-disks"
	DefaultObjectPrefix                string = "objects"
	DefaultVolumesPrefix               string = "volumes"
	DefaultOutputsPrefix               string = "outputs"
	DefaultCheckpointsPrefix           string = "checkpoints"
	DefaultDurableDisksPrefix          string = "durable-disks"
	DurableDiskChunksPrefix            string = "chunks"
	DurableDiskSnapshotsPrefix         string = "snapshots"
	FailedDeploymentContainerThreshold int    = 3
	FailedContainerThreshold           int    = 1
)
View Source
const (
	StubTypeManagedEndpoint           string = "managed_endpoint" // platform-run model server
	StubTypeManagedEndpointDeployment string = "managed_endpoint/deployment"
	StubTypePlatformDeployer          string = "platform_deployer" // CI job that deploys hosted apps
)
View Source
const (
	DefaultServeContainerTimeout = time.Minute * 10
	DefaultCPUWorkerPoolName     = "default"
	ContainerRuntimeTokenEnv     = "BETA9_TOKEN"
)
View Source
const (
	WorkerStatusAvailable WorkerStatus = "available"
	WorkerStatusPending   WorkerStatus = "pending"
	WorkerStatusDisabled  WorkerStatus = "disabled"
	WorkerStateTtlS       int          = 60
)
View Source
const (
	DefaultRuncStartConcurrency   int   = 32
	DefaultGvisorStartConcurrency int   = 32
	RuncStartConcurrencyPerCPU    int64 = 2
	GvisorStartConcurrencyPerCPU  int64 = 4
)
View Source
const (
	StubStateDegraded = "degraded"
	StubStateWarning  = "warning"
	StubStateHealthy  = "healthy"
)
View Source
const (
	ContainerRequestStatusFailed ContainerRequestStatus = "failed"
	ContainerRequestStatusTTL                           = 10 * time.Minute

	ContainerSchedulingFailureBacklogPushFailed               ContainerSchedulingFailureReason = "backlog_push_failed"
	ContainerSchedulingFailureNoController                    ContainerSchedulingFailureReason = "no_controller"
	ContainerSchedulingFailureWorkerCapacityTimeout           ContainerSchedulingFailureReason = "worker_capacity_timeout"
	ContainerSchedulingFailureProvisioningLimit               ContainerSchedulingFailureReason = "worker_provisioning_limit"
	ContainerSchedulingFailureRetryLimit                      ContainerSchedulingFailureReason = "retry_limit"
	ContainerSchedulingFailureManagedFallbackConcurrencyLimit ContainerSchedulingFailureReason = "managed_fallback_concurrency_limit"
	ContainerSchedulingFailureManagedFallbackNoCapacity       ContainerSchedulingFailureReason = "managed_fallback_no_capacity"
	// ContainerSchedulingFailureNoOpportunisticCapacity is reported when an
	// OpportunisticOnly request finds no idle worker: at once for managed
	// endpoint replicas, and once the scheduling window ends for Spot.
	ContainerSchedulingFailureNoOpportunisticCapacity ContainerSchedulingFailureReason = "no_opportunistic_capacity"
)
View Source
const (
	ContainerExitCodeTTL       = 5 * time.Minute
	ContainerFailureHistoryTTL = time.Hour
	ContainerFailureCooldown   = time.Minute
)
View Source
const (
	ContainerDurationEmissionInterval      time.Duration = 5 * time.Second
	ContainerResourceUsageEmissionInterval time.Duration = 3 * time.Second
)
View Source
const (
	StorageModeMountPoint  = "mountpoint"
	StorageModeGeese       = "geese"
	StorageModeLocal       = "local"
	StorageModeDurableDisk = "durable_disk"
)
View Source
const (
	DurableDiskDriverSnapshot        = "snapshot"
	DurableDiskDriverQcow            = "qcow"
	CheckpointModelCacheVolumePrefix = "checkpoint-model-cache"
)
View Source
const (
	DiskSnapshotStatusPending   DiskSnapshotStatus = "pending"
	DiskSnapshotStatusAvailable DiskSnapshotStatus = "available"
	DiskSnapshotStatusFailed    DiskSnapshotStatus = "failed"

	DiskSnapshotFormatDirV1         = "dir.v1"
	DiskSnapshotFormatPostgresWalV1 = "postgres.wal.v1"
	DiskSnapshotFormatRedisAOFV1    = "redis.aof.v1"
	// DiskSnapshotFormatQcowV1 is a block snapshot: one immutable qcow2 layer
	// stored as sparse content-addressed chunks, chained via ParentSnapshotId.
	DiskSnapshotFormatQcowV1 = "qcow.v1"
)
View Source
const (
	TaskHeartbeatInterval      = time.Second
	TaskHeartbeatTTL           = time.Minute
	TaskQueueRunningLeaseTTL   = 5 * time.Second
	TaskQueueAdmissionLeaseTTL = time.Minute
)

Shared task liveness policy. Admission gets a longer lease while decoding; active monitors and accepted completions use the same renewal cadence.

View Source
const (
	VMStateRunning  = "running"
	VMStateStarting = "starting"
	VMStateStopped  = "stopped"
	VMStateStopping = "stopping"
	VMStatePaused   = "paused"
	VMStatePausing  = "pausing"
	VMStateError    = "error"
	VMStateDeleted  = "deleted"
)

VM lifecycle states are persisted and exposed by the management API.

View Source
const (
	DefaultVMRootSizeBytes int64 = 50 << 30
	MaxVMRootSizeBytes     int64 = 100 << 30
)

Writable VM root capacity in bytes, layered over the separate base image.

View Source
const (
	VMSSHPort                         = 2222
	VMTerminalPort                    = 7681
	VMDesktopPort                     = 8080
	VMKioskStatusPort          uint32 = 8081
	VMKioskMCPPort             uint32 = 8082
	VMKioskMediaPort           uint32 = 8443
	VMKioskMaxICEFrameBytes           = 8192
	VMKioskMaxCommandArgs             = 128
	VMKioskMaxMCPServers              = 16
	VMKioskMaxCommandBytes            = 32 << 10
	VMKioskMaxEnvBytes                = 16 << 10
	VMKioskMaxConfigBytes             = 64 << 10
	VMKioskMaxSDPBytes                = 64 << 10
	VMKioskMaxMediaSections           = 8
	VMKioskMaxGatewayAddresses        = 8
)

VM service ports are shared by validation, routing and the guest protocol.

View Source
const (
	VMKioskControlPath  = "/_beam/kiosk"
	VMKioskMCPPath      = "/mcp"
	VMKioskStreamPath   = "/stream"
	VMKioskActionHeader = "X-Beam-Kiosk-Action"
)

Kiosk browser protocol, routed only after VM traffic authentication.

View Source
const (
	VMDesktopTransportEnv = "BEAM_VM_DESKTOP_TRANSPORT"
	VMDesktopLauncherPath = "/opt/beam-vm/desktop"
	VMDesktopSessionPath  = "/opt/beam-vm/kiosk"
)
View Source
const (
	VMDesktopTransportWebRTC     VMDesktopTransport = "webrtc"
	VMDesktopTransportWebSockets VMDesktopTransport = "websockets"
	VMKioskTransportWebRTC                          = VMDesktopTransportWebRTC
	VMKioskTransportWebSockets                      = VMDesktopTransportWebSockets
)
View Source
const (
	VMArtifactTemplate = "template"
	VMArtifactSnapshot = "snapshot"
)
View Source
const (
	WorkerLifecycleStatsKey                  string        = "beta9.worker.usage.spawner.lifecycle"
	WorkerDurationStatsKey                   string        = "beta9.worker.usage.spawner.duration"
	WorkerEventHeartbeatID                   string        = "__heartbeat__"
	WorkerUserCodeVolume                     string        = "/mnt/code"
	WorkerUserOutputVolume                   string        = "/outputs"
	WorkerContainerVolumePath                string        = "/volumes"
	WorkerContainerUploadsHostPath           string        = "/tmp/container-uploads"
	WorkerContainerUploadsMountPath          string        = "/tmp/.beta9"
	WorkerDurationEmissionInterval           time.Duration = 30 * time.Second
	WorkerKeepAliveInterval                  time.Duration = 10 * time.Second
	WorkerShellPort                          int32         = 2222
	WorkerSandboxProcessManagerPort          int32         = 7111
	WorkerSandboxProcessManagerWorkerPath    string        = "/usr/local/bin/goproc"
	WorkerSandboxProcessManagerContainerPath string        = "/usr/bin/goproc"
	WorkerSandboxFilesystemWorkerPath        string        = "/bin/busybox"
	WorkerSandboxFilesystemContainerPath     string        = "/usr/lib/beta9/busybox"
)
View Source
const (
	WorkerContainerExitCodeOomKillMessage   = "Container killed due to an out-of-memory error"
	WorkerContainerExitCodeSchedulerMessage = "Container stopped"
	WorkerContainerExitCodeTtlMessage       = "Container stopped due to TTL expiration"
	WorkerContainerExitCodeUserMessage      = "Container stopped by user"
	WorkerContainerExitCodeAdminMessage     = "Container stopped by admin"
	WorkerContainerExitCodeEvictedMessage   = "Container evicted to make room for a higher priority workload"
)
View Source
const (
	// Used specifically for runc states.
	// Not the same as the scheduler container states.
	RuncContainerStatusCreated string = "created"
	RuncContainerStatusRunning string = "running"
	RuncContainerStatusPaused  string = "paused"
	RuncContainerStatusStopped string = "stopped"
)
View Source
const (
	BuildContainerPrefix string = "build-"
)
View Source
const CPUInventoryKey = "cpu"

CPUInventoryKey is the GPU key for CPU-only placement.

View Source
const CPUTierProtocolVersion uint32 = 1

CPUTierProtocolVersion is reported by workers that can run tiered work.

View Source
const CheckpointRuntimeFilesystem = "filesystem"
View Source
const ContainerStateTtlS int64 = 120
View Source
const ContainerStateTtlSManagedEndpoint int64 = 1800

Managed endpoint processes are long-lived and report engine liveness through their controller. Keep their ownership record across a bounded gateway outage; explicit stops still use the ordinary STOPPING lease and finalization barrier.

View Source
const ContainerStateTtlSWhilePending int64 = 1800
View Source
const ContainerStateTtlSWhileStopping int64 = 300
View Source
const DiskFilesystemExt4 = "ext4"

DiskFilesystemExt4 is the filesystem qcow volumes are formatted with and the value recorded in snapshot rows and manifests.

View Source
const DiskSnapshotMaxPublishDepth = 128
View Source
const EngineVLLM = "vllm"

EngineVLLM is the engine whose streaming usage reporting the gateway tunes.

View Source
const FailoverOnDemandPoolCreator = "scheduling.failover"

FailoverOnDemandPoolCreator marks pools owned by the failover reconciler.

View Source
const (
	ForceResourceLimitsMetadata = "x-beta9-force-resource-limits"
)
View Source
const MaxUsageCounter int64 = 1<<53 - 1

MaxUsageCounter fits exactly in a float64 (the meter) and in JavaScript clients.

View Source
const MicrosPerCent = 10_000

MicrosPerCent converts between the operator-facing unit (cents) and the micro-dollars used internally by reservations and offers.

View Source
const StackSpecMaxBytes = 256 << 10
View Source
const VMAppName = "__beam_vms__"

VMAppName owns every VM stub in a workspace. App listings skip it because VMs are managed through the VM service, not as apps.

View Source
const VMStopReasonPreempted = "preempted"

VMStopReasonPreempted marks a Spot VM stopped to reclaim its capacity. It stays stopped until an explicit start; wake and auto-resume do not restart it.

View Source
const WorkspaceQuotaTtlS int64 = 600

Variables

View Source
var (
	ErrDatabaseKind             = errors.New("kind must be postgres, redis, mysql or mongo")
	ErrDatabaseExists           = errors.New("a service with this name already exists")
	ErrDatabaseNotFound         = errors.New("database service not found")
	ErrDatabaseImageUnsupported = errors.New("image service is not available on this gateway")
)
View Source
var (
	/*
		Stripe events utilize a format of <resource>.<action>
		1.	<resource>: This indicates the type of object or resource that the event pertains to, such as payment_intent, invoice, customer, subscription, etc.
		2.	<action>: This indicates the specific action or change that occurred with that resource, such as created, updated, deleted, succeeded, etc.
	*/
	EventTaskUpdated = "task.updated"
	EventTaskCreated = "task.created"
	EventStubState   = "stub.state.%s" // healthy, degraded, warning

	EventContainerLifecycle = "container.lifecycle"
	EventContainerMetrics   = "container.metrics"
	EventContainerEvent     = "container.event"
	EventContainerLog       = "container.log"
	EventPlatformLog        = "platform.log"
	EventWorkerLifecycle    = "worker.lifecycle"
	EventStubDeploy         = "stub.deploy"
	EventStubServe          = "stub.serve"
	EventStubRun            = "stub.run"
	EventStubClone          = "stub.clone"

	EventGatewayEndpointCalled = "gateway.endpoint.called"
	// Per-stub request counts and latency histogram, one record per flush window.
	EventEndpointRequestStats = "endpoint.request_stats"

	EventComputePool      = "compute.pool"
	EventComputeJoinToken = "compute.join_token"
	EventComputeMachine   = "compute.machine"
	EventComputeTransport = "compute.transport"
	EventComputeRoute     = "compute.route"

	EventStubCacheRequiredContent = "stub.cache.required_content"
	EventPlatformCache            = "platform.cache"
)
View Source
var (
	EventWorkerLifecycleStarted = "started"
	EventWorkerLifecycleStopped = "stopped"
	EventWorkerLifecycleDeleted = "deleted"
)
View Source
var (
	// Scheduler keys
	UsageMetricsSchedulerContainerScheduled = "container_scheduled_count"
	UsageMetricsSchedulerContainerRequested = "container_requested_count"

	// Worker keys
	UsageMetricsWorkerContainerDuration = "container_duration_milliseconds"
	UsageMetricsWorkerContainerCost     = "container_cost_cents"

	// Gateway keys
	UsageMetricsManagedComputeReservationSeconds = "managed_compute_reservation_seconds"
	UsageMetricsManagedComputeReservationCost    = "managed_compute_reservation_cost_cents"
	UsageMetricsNodeUsage                        = "node_usage"

	// Managed endpoint accounting: one event per settled charge and party
	// (spend for the caller, earned for the provider), carrying every Usage
	// field. The meter for each field is EndpointUsageMeter(field).
	UsageMetricsEndpointUsage = "endpoint_usage"
)
View Source
var ContainerEventDefinitions = map[ContainerEventID]ContainerEventDefinition{
	ContainerEventSchedulerStopRequested:    {ID: ContainerEventSchedulerStopRequested, Domain: EventDomainScheduler, Label: "Scheduler stop requested"},
	ContainerEventWorkerStopEventReceived:   {ID: ContainerEventWorkerStopEventReceived, Domain: EventDomainWorker, Label: "Worker stop event received"},
	ContainerEventWorkerOrphanStateMissing:  {ID: ContainerEventWorkerOrphanStateMissing, Domain: EventDomainWorker, Label: "Worker orphan state missing"},
	ContainerEventWorkerPendingReconciled:   {ID: ContainerEventWorkerPendingReconciled, Domain: EventDomainWorker, Label: "Pending reconciled to running"},
	ContainerEventWorkerStoppingGraceKill:   {ID: ContainerEventWorkerStoppingGraceKill, Domain: EventDomainWorker, Label: "Stopping grace kill"},
	ContainerEventWorkerEvicted:             {ID: ContainerEventWorkerEvicted, Domain: EventDomainWorker, Label: "Evicted"},
	ContainerEventRuntimeExited:             {ID: ContainerEventRuntimeExited, Domain: EventDomainRuntime, Label: "Runtime exited"},
	ContainerEventRuntimeOOMKilled:          {ID: ContainerEventRuntimeOOMKilled, Domain: EventDomainRuntime, Label: "Runtime OOM killed"},
	ContainerEventApplicationOOMKilled:      {ID: ContainerEventApplicationOOMKilled, Domain: EventDomainRuntime, Label: "Application OOM killed"},
	ContainerEventGatewayAttachDisconnected: {ID: ContainerEventGatewayAttachDisconnected, Domain: EventDomainGateway, Label: "Attach disconnected"},
	ContainerEventGatewayServeLockDeleted:   {ID: ContainerEventGatewayServeLockDeleted, Domain: EventDomainGateway, Label: "Serve lock deleted"},
	ContainerEventGatewayServeLockPreserved: {ID: ContainerEventGatewayServeLockPreserved, Domain: EventDomainGateway, Label: "Serve lock preserved"},
	ContainerEventAutoscalerScaleDecision:   {ID: ContainerEventAutoscalerScaleDecision, Domain: EventDomainAutoscaler, Label: "Autoscaler scale decision"},
	ContainerEventTaskCancelRequested:       {ID: ContainerEventTaskCancelRequested, Domain: EventDomainTask, Label: "Task cancel requested"},
	ContainerEventTaskCancelApplied:         {ID: ContainerEventTaskCancelApplied, Domain: EventDomainTask, Label: "Task cancel applied"},
	ContainerEventLogsFirstByte:             {ID: ContainerEventLogsFirstByte, Domain: EventDomainLogs, Label: "First log byte"},
	ContainerEventLogsLastByte:              {ID: ContainerEventLogsLastByte, Domain: EventDomainLogs, Label: "Last log byte"},
	ContainerEventLogsFlushCompleted:        {ID: ContainerEventLogsFlushCompleted, Domain: EventDomainLogs, Label: "Log flush completed"},
	ContainerEventLogsDropped:               {ID: ContainerEventLogsDropped, Domain: EventDomainLogs, Label: "Log dropped"},
	ContainerEventRunnerStartTask:           {ID: ContainerEventRunnerStartTask, Domain: EventDomainRunner, Label: "Runner start task"},
	ContainerEventRunnerGetArgs:             {ID: ContainerEventRunnerGetArgs, Domain: EventDomainRunner, Label: "Runner get args"},
	ContainerEventRunnerProcessStarted:      {ID: ContainerEventRunnerProcessStarted, Domain: EventDomainRunner, Label: "Runner process started"},
	ContainerEventRunnerModuleLoaded:        {ID: ContainerEventRunnerModuleLoaded, Domain: EventDomainRunner, Label: "Runner module loaded"},
	ContainerEventRunnerMainEntered:         {ID: ContainerEventRunnerMainEntered, Domain: EventDomainRunner, Label: "Runner main entered"},
	ContainerEventResultSetResult:           {ID: ContainerEventResultSetResult, Domain: EventDomainResult, Label: "Result set"},
	ContainerEventResultEndTask:             {ID: ContainerEventResultEndTask, Domain: EventDomainResult, Label: "End task"},
	ContainerEventResultLoadedByGateway:     {ID: ContainerEventResultLoadedByGateway, Domain: EventDomainResult, Label: "Result loaded by gateway"},
	ContainerEventResultSentToClient:        {ID: ContainerEventResultSentToClient, Domain: EventDomainResult, Label: "Result sent to client"},
}
View Source
var ContainerLifecycleDefinitions = map[ContainerLifecycleID]ContainerLifecycleDefinition{
	ContainerLifecycleStartup:                     {ID: ContainerLifecycleStartup, Domain: EventDomainRuntime, Label: "Container startup", Required: true},
	ContainerLifecycleSchedulerQueuePush:          {ID: ContainerLifecycleSchedulerQueuePush, Domain: EventDomainScheduler, ParentID: ContainerLifecycleStartup, Label: "Queue request"},
	ContainerLifecycleSchedulerBacklogWait:        {ID: ContainerLifecycleSchedulerBacklogWait, Domain: EventDomainScheduler, ParentID: ContainerLifecycleStartup, Label: "Scheduler backlog wait"},
	ContainerLifecycleSchedulerWorkerList:         {ID: ContainerLifecycleSchedulerWorkerList, Domain: EventDomainScheduler, ParentID: ContainerLifecycleSchedulerBacklogWait, Label: "Load workers"},
	ContainerLifecycleSchedulerBatchPlan:          {ID: ContainerLifecycleSchedulerBatchPlan, Domain: EventDomainScheduler, ParentID: ContainerLifecycleSchedulerBacklogWait, Label: "Plan batch"},
	ContainerLifecycleSchedulerWorkerSelection:    {ID: ContainerLifecycleSchedulerWorkerSelection, Domain: EventDomainScheduler, ParentID: ContainerLifecycleStartup, Label: "Worker selection"},
	ContainerLifecycleSchedulerReserveCapacity:    {ID: ContainerLifecycleSchedulerReserveCapacity, Domain: EventDomainScheduler, ParentID: ContainerLifecycleSchedulerBacklogWait, Label: "Reserve capacity"},
	ContainerLifecycleSchedulerReservation:        {ID: ContainerLifecycleSchedulerReservation, Domain: EventDomainScheduler, ParentID: ContainerLifecycleStartup, Label: "Capacity reservation"},
	ContainerLifecycleSchedulerProvisionWorker:    {ID: ContainerLifecycleSchedulerProvisionWorker, Domain: EventDomainScheduler, ParentID: ContainerLifecycleStartup, Label: "Worker provisioning"},
	ContainerLifecycleSchedulerImageCredentials:   {ID: ContainerLifecycleSchedulerImageCredentials, Domain: EventDomainScheduler, ParentID: ContainerLifecycleSchedulerBacklogWait, Label: "Attach image credentials"},
	ContainerLifecycleSchedulerBuildCredentials:   {ID: ContainerLifecycleSchedulerBuildCredentials, Domain: EventDomainScheduler, ParentID: ContainerLifecycleSchedulerBacklogWait, Label: "Attach build registry credentials"},
	ContainerLifecycleSchedulerWorkerQueuePush:    {ID: ContainerLifecycleSchedulerWorkerQueuePush, Domain: EventDomainScheduler, ParentID: ContainerLifecycleSchedulerBacklogWait, Label: "Push to worker queue"},
	ContainerLifecycleWorkerQueueReceive:          {ID: ContainerLifecycleWorkerQueueReceive, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Worker queue receive"},
	ContainerLifecycleImageLoad:                   {ID: ContainerLifecycleImageLoad, Domain: EventDomainImage, ParentID: ContainerLifecycleStartup, Label: "Image load", Required: true},
	ContainerLifecycleImageEmbeddedCacheMetadata:  {ID: ContainerLifecycleImageEmbeddedCacheMetadata, Domain: EventDomainImage, ParentID: ContainerLifecycleImageLoad, Label: "Embedded image cache metadata copy"},
	ContainerLifecycleImageEmbeddedCacheStore:     {ID: ContainerLifecycleImageEmbeddedCacheStore, Domain: EventDomainImage, ParentID: ContainerLifecycleImageLoad, Label: "Embedded image cache store"},
	ContainerLifecycleImageEmbeddedCacheWait:      {ID: ContainerLifecycleImageEmbeddedCacheWait, Domain: EventDomainImage, ParentID: ContainerLifecycleImageLoad, Label: "Wait for embedded image cache"},
	ContainerLifecycleImageEmbeddedCacheRestore:   {ID: ContainerLifecycleImageEmbeddedCacheRestore, Domain: EventDomainImage, ParentID: ContainerLifecycleImageLoad, Label: "Embedded image cache restore"},
	ContainerLifecycleImageV1DataCacheDeferred:    {ID: ContainerLifecycleImageV1DataCacheDeferred, Domain: EventDomainImage, ParentID: ContainerLifecycleImageLoad, Label: "Defer v1 data archive restore"},
	ContainerLifecycleImageV1DataCacheRestore:     {ID: ContainerLifecycleImageV1DataCacheRestore, Domain: EventDomainImage, ParentID: ContainerLifecycleImageLoad, Label: "V1 data archive restore"},
	ContainerLifecycleSetWorkerAddress:            {ID: ContainerLifecycleSetWorkerAddress, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Set worker address"},
	ContainerLifecyclePortAllocation:              {ID: ContainerLifecyclePortAllocation, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Port allocation"},
	ContainerLifecycleReadBundleConfig:            {ID: ContainerLifecycleReadBundleConfig, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Read bundle config"},
	ContainerLifecycleWorkspaceMount:              {ID: ContainerLifecycleWorkspaceMount, Domain: EventDomainMount, ParentID: ContainerLifecycleStartup, Label: "Mount workspace storage"},
	ContainerLifecycleSetupMounts:                 {ID: ContainerLifecycleSetupMounts, Domain: EventDomainMount, ParentID: ContainerLifecycleStartup, Label: "Setup mounts"},
	ContainerLifecycleBindMountDirs:               {ID: ContainerLifecycleBindMountDirs, Domain: EventDomainMount, ParentID: ContainerLifecycleStartup, Label: "Create bind mount sources"},
	ContainerLifecycleDurableDiskPrepare:          {ID: ContainerLifecycleDurableDiskPrepare, Domain: EventDomainMount, ParentID: ContainerLifecycleStartup, Label: "Attach durable disks"},
	ContainerLifecycleSpecFromRequest:             {ID: ContainerLifecycleSpecFromRequest, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Spec from request"},
	ContainerLifecycleSetContainerAddr:            {ID: ContainerLifecycleSetContainerAddr, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Set container address"},
	ContainerLifecycleSetAddressMap:               {ID: ContainerLifecycleSetAddressMap, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Set address map"},
	ContainerLifecycleOverlaySetup:                {ID: ContainerLifecycleOverlaySetup, Domain: EventDomainMount, ParentID: ContainerLifecycleStartup, Label: "Overlay setup"},
	ContainerLifecycleNetworkSetup:                {ID: ContainerLifecycleNetworkSetup, Domain: EventDomainNetwork, ParentID: ContainerLifecycleStartup, Label: "Network setup"},
	ContainerLifecycleNetworkCreateVeth:           {ID: ContainerLifecycleNetworkCreateVeth, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkSetup, Label: "Create veth pair"},
	ContainerLifecycleNetworkSetupBridge:          {ID: ContainerLifecycleNetworkSetupBridge, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkSetup, Label: "Setup bridge"},
	ContainerLifecycleNetworkCreateNamespace:      {ID: ContainerLifecycleNetworkCreateNamespace, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkSetup, Label: "Create namespace"},
	ContainerLifecycleNetworkConfigureNamespace:   {ID: ContainerLifecycleNetworkConfigureNamespace, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkSetup, Label: "Configure namespace"},
	ContainerLifecycleNetworkIPLock:               {ID: ContainerLifecycleNetworkIPLock, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkConfigureNamespace, Label: "Acquire IP lock"},
	ContainerLifecycleNetworkIPLoad:               {ID: ContainerLifecycleNetworkIPLoad, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkConfigureNamespace, Label: "Load allocated IPs"},
	ContainerLifecycleNetworkIPAssign:             {ID: ContainerLifecycleNetworkIPAssign, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkConfigureNamespace, Label: "Assign container IP"},
	ContainerLifecycleNetworkSetContainerIP:       {ID: ContainerLifecycleNetworkSetContainerIP, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkConfigureNamespace, Label: "Persist container IP"},
	ContainerLifecycleNetworkRestrictions:         {ID: ContainerLifecycleNetworkRestrictions, Domain: EventDomainNetwork, ParentID: ContainerLifecycleNetworkSetup, Label: "Network restrictions"},
	ContainerLifecycleGPUAssignment:               {ID: ContainerLifecycleGPUAssignment, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "GPU assignment"},
	ContainerLifecycleNetworkExpose:               {ID: ContainerLifecycleNetworkExpose, Domain: EventDomainNetwork, ParentID: ContainerLifecycleStartup, Label: "Expose ports"},
	ContainerLifecycleRuntimePrepare:              {ID: ContainerLifecycleRuntimePrepare, Domain: EventDomainRuntime, ParentID: ContainerLifecycleStartup, Label: "Runtime prepare"},
	ContainerLifecycleConfigWrite:                 {ID: ContainerLifecycleConfigWrite, Domain: EventDomainRuntime, ParentID: ContainerLifecycleStartup, Label: "Config write"},
	ContainerLifecycleStartQueueWait:              {ID: ContainerLifecycleStartQueueWait, Domain: EventDomainWorker, ParentID: ContainerLifecycleStartup, Label: "Worker start queue wait"},
	ContainerLifecycleRuntimeStartToPID:           {ID: ContainerLifecycleRuntimeStartToPID, Domain: EventDomainRuntime, ParentID: ContainerLifecycleStartup, Label: "Runtime start to PID", Required: true},
	ContainerLifecycleSandboxApplyCPUQuota:        {ID: ContainerLifecycleSandboxApplyCPUQuota, Domain: EventDomainRuntime, ParentID: ContainerLifecycleStartup, Label: "Apply sandbox CPU quota"},
	ContainerLifecycleRunnerApplyCPUQuota:         {ID: ContainerLifecycleRunnerApplyCPUQuota, Domain: EventDomainRuntime, ParentID: ContainerLifecycleStartup, Label: "Apply function CPU quota"},
	ContainerLifecycleSandboxProcessManagerReady:  {ID: ContainerLifecycleSandboxProcessManagerReady, Domain: EventDomainRuntime, ParentID: ContainerLifecycleStartup, Label: "Sandbox process manager ready"},
	ContainerLifecycleServeReady:                  {ID: ContainerLifecycleServeReady, Domain: EventDomainServe, ParentID: ContainerLifecycleStartup, Label: "Serve ready"},
	ContainerLifecycleResultDelivery:              {ID: ContainerLifecycleResultDelivery, Domain: EventDomainResult, ParentID: ContainerLifecycleStartup, Label: "Result delivery"},
	ContainerLifecycleContainerRequestToStartTask: {ID: ContainerLifecycleContainerRequestToStartTask, Domain: EventDomainTask, Label: "Container request to runner start"},
	ContainerLifecycleContainerRunningToStartTask: {ID: ContainerLifecycleContainerRunningToStartTask, Domain: EventDomainRunner, Label: "Container running to runner start"},
	ContainerLifecycleRunnerStartToGetArgs:        {ID: ContainerLifecycleRunnerStartToGetArgs, Domain: EventDomainRunner, Label: "Runner start to get args"},
	ContainerLifecycleRunnerGetArgsToSetResult:    {ID: ContainerLifecycleRunnerGetArgsToSetResult, Domain: EventDomainRunner, Label: "Get args to set result"},
	ContainerLifecycleRunnerStartToSetResult:      {ID: ContainerLifecycleRunnerStartToSetResult, Domain: EventDomainRunner, Label: "Runner start to set result"},
	ContainerLifecycleResultSetToEndTask:          {ID: ContainerLifecycleResultSetToEndTask, Domain: EventDomainResult, Label: "Set result to end task"},
	ContainerLifecycleRunnerStartToEndTask:        {ID: ContainerLifecycleRunnerStartToEndTask, Domain: EventDomainRunner, Label: "Runner start to end task"},
	ContainerLifecycleRunnerGatewayChannelOpen:    {ID: ContainerLifecycleRunnerGatewayChannelOpen, Domain: EventDomainRunner, Label: "Open gateway channel"},
	ContainerLifecycleRunnerStartTaskRPC:          {ID: ContainerLifecycleRunnerStartTaskRPC, Domain: EventDomainRunner, Label: "StartTask RPC"},
	ContainerLifecycleRunnerGetArgsRPC:            {ID: ContainerLifecycleRunnerGetArgsRPC, Domain: EventDomainRunner, Label: "GetArgs RPC"},
	ContainerLifecycleRunnerUserCodeImport:        {ID: ContainerLifecycleRunnerUserCodeImport, Domain: EventDomainRunner, Label: "Import user code"},
	ContainerLifecycleRunnerHandlerExecution:      {ID: ContainerLifecycleRunnerHandlerExecution, Domain: EventDomainRunner, Label: "Run handler"},
	ContainerLifecycleRunnerSetResultRPC:          {ID: ContainerLifecycleRunnerSetResultRPC, Domain: EventDomainRunner, Label: "SetResult RPC"},
	ContainerLifecycleRunnerEndTaskRPC:            {ID: ContainerLifecycleRunnerEndTaskRPC, Domain: EventDomainRunner, Label: "EndTask RPC"},
	ContainerLifecycleClipRead:                    {ID: ContainerLifecycleClipRead, Domain: EventDomainClip, Label: "CLIP lazy read"},
	ContainerLifecycleClipOCIRead:                 {ID: ContainerLifecycleClipOCIRead, Domain: EventDomainClip, Label: "CLIP OCI lazy read"},
	ContainerLifecycleClipArchiveRead:             {ID: ContainerLifecycleClipArchiveRead, Domain: EventDomainClip, ParentID: ContainerLifecycleClipRead, Label: "CLIP archive read"},
	ContainerLifecycleClipDiskCacheRead:           {ID: ContainerLifecycleClipDiskCacheRead, Domain: EventDomainClip, ParentID: ContainerLifecycleClipRead, Label: "CLIP disk cache read"},
	ContainerLifecycleClipContentCacheRead:        {ID: ContainerLifecycleClipContentCacheRead, Domain: EventDomainClip, ParentID: ContainerLifecycleClipRead, Label: "CLIP content cache read"},
	ContainerLifecycleClipCheckpointRead:          {ID: ContainerLifecycleClipCheckpointRead, Domain: EventDomainClip, ParentID: ContainerLifecycleClipRead, Label: "CLIP checkpoint read"},
	ContainerLifecycleClipLayerDecompress:         {ID: ContainerLifecycleClipLayerDecompress, Domain: EventDomainClip, ParentID: ContainerLifecycleClipRead, Label: "CLIP layer decompress"},
	ContainerLifecycleClipLayerDecompressWait:     {ID: ContainerLifecycleClipLayerDecompressWait, Domain: EventDomainClip, ParentID: ContainerLifecycleClipRead, Label: "CLIP layer decompress wait"},
}
View Source
var DefaultTaskPolicy = TaskPolicy{
	MaxRetries: 3,
	Timeout:    3600,
}
View Source
var ErrCPUTierIneligible = errors.New("CPU tiers apply only to hosted CPU workloads")
View Source
var ErrStackSpecTooLarge = fmt.Errorf("stack spec exceeds 256 KiB")
View Source
var EventComputeSchemaVersion = "1.0"
View Source
var EventContainerEventSchemaVersion = "1.0"
View Source
var EventContainerLifecycleSchemaVersion = "1.0"
View Source
var EventContainerLogSchemaVersion = "1.0"
View Source
var EventContainerMetricsSchemaVersion = "1.0"
View Source
var EventEndpointRequestStatsSchemaVersion = "1.0"
View Source
var EventEndpointSchemaVersion = "1.0"
View Source
var EventGatewayEndpointSchemaVersion = "1.0"
View Source
var EventPlatformCacheSchemaVersion = "1.0"
View Source
var EventPlatformLogSchemaVersion = "1.0"
View Source
var EventStubCacheRequiredContentSchemaVersion = "1.0"
View Source
var EventStubSchemaVersion = "1.0"
View Source
var EventStubStateSchemaVersion = "1.0"
View Source
var EventTaskSchemaVersion = "1.0"
View Source
var EventWorkerLifecycleSchemaVersion = "1.0"
View Source
var MaxTaskRetries = 5
View Source
var MaxTaskTTL = 24 * 60 * 60
View Source
var RequestLatencyBoundsMs = []int64{5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000, 30000}

RequestLatencyBoundsMs are the upper bounds of the latency histogram buckets; the last bucket is open-ended.

View Source
var UsageFieldNames = []string{"requests", "prompt_tokens", "completion_tokens", "cached_tokens",
	"micro_usd", "prompt_micro_usd", "completion_micro_usd", "cached_micro_usd", "request_micro_usd"}
View Source
var WorkerContainerExitCodes = map[ContainerExitCode]string{
	ContainerExitCodeSuccess:            "Success",
	ContainerExitCodeUnknownError:       "UnknownError: An unknown error occurred.",
	ContainerExitCodeStartupFailed:      "StartupFailed: Container failed to start. Check the container logs.",
	ContainerExitCodeIncorrectImageArch: "InvalidArch: Image must be built for the " + runtime.GOARCH + " architecture.",
	ContainerExitCodeInvalidCustomImage: "InvalidCustomImage: Custom image not found. Check your image reference and registry credentials.",
	ContainerExitCodeIncorrectImageOs:   "InvalidOS: Image must be built for Linux.",
}

Functions

func BackendRouteAddress

func BackendRouteAddress(routeID string) string

func BackendRouteID

func BackendRouteID(machineID, workerID, containerID, kind string, port int32) string

func CentsToMicros

func CentsToMicros(cents int64) int64

func CheckpointModelCacheVolumeName

func CheckpointModelCacheVolumeName(stubName string) string

func ComputeDollarsToMicros

func ComputeDollarsToMicros(value float64) int64

func ComputeMicrosToDollars

func ComputeMicrosToDollars(value int64) float64

func ComputeWholeHours

func ComputeWholeHours(d time.Duration) int64

func EndpointUsageMeter

func EndpointUsageMeter(field string) string

EndpointUsageMeter names the billing meter that sums one Usage field over endpoint_usage events, grouped by workspace_id, endpoint_id and kind.

func EventSummaryKeyForLifecycle

func EventSummaryKeyForLifecycle(id ContainerLifecycleID) string

func FailoverOnDemandPoolName

func FailoverOnDemandPoolName(gpu string) string

FailoverOnDemandPoolName returns the managed pool name for a GPU chain.

func GPUKey

func GPUKey(gpu string) string

GPUKey canonicalizes a GPU type name: "h100" -> "H100", "" -> "cpu".

func GPUTypesToMap

func GPUTypesToMap(gpuTypes []GpuType) map[string]int

func GpuTypesToSlice

func GpuTypesToSlice(gpuTypes []GpuType) []string

func GpuTypesToStrings

func GpuTypesToStrings(gpus []GpuType) []string

func IsContainerRootCauseCandidate

func IsContainerRootCauseCandidate(id ContainerEventID) bool

func IsDiskSnapshotFilesystemFormat

func IsDiskSnapshotFilesystemFormat(format string) bool

func IsGatewayTailnetHostname

func IsGatewayTailnetHostname(name string) bool

IsGatewayTailnetHostname reports whether a tailnet peer is a gateway.

func IsTokenType

func IsTokenType(tokenType string) bool

IsTokenType reports whether the gateway issues tokens of this type. Tokens of retired types stay in the database but don't authenticate.

func IsWorkerTokenType

func IsWorkerTokenType(tokenType string) bool

IsWorkerTokenType reports whether the token type belongs to a worker process: cluster workers (in-cluster and external pools) or private-pool agent workers.

func KnownGPUType

func KnownGPUType(gpu GpuType) bool

func MicrosToCents

func MicrosToCents(micros int64) int64

func MountPointCredentialKey

func MountPointCredentialKey(mountPath, bucketName string) string

func NormalizeBackendRouteTransport

func NormalizeBackendRouteTransport(transport string) string

NormalizeBackendRouteTransport canonicalizes transport names (dashes to underscores) and applies the default.

func NormalizeDatabaseKind

func NormalizeDatabaseKind(kind string) string

func NormalizeDurableDiskDriver

func NormalizeDurableDiskDriver(driver string) string

func NormalizeEventReason

func NormalizeEventReason(reason string) string

func NormalizeGPUStrings

func NormalizeGPUStrings(gpus []string) []string

func ParseBackendRouteAddress

func ParseBackendRouteAddress(address string) (string, bool)

func ParseComputeTTL

func ParseComputeTTL(value string) (time.Duration, error)

func ParseConditionFromQueryFilters

func ParseConditionFromQueryFilters(out interface{}, queryFilters ...QueryFilter)

func PricingRat

func PricingRat(value string) (*big.Rat, error)

PricingRat parses one price into an exact rational; empty is zero.

func SafeDurableDiskName

func SafeDurableDiskName(name string) string

func SecretBindingsToProto

func SecretBindingsToProto(bindings []SecretBinding) []*pb.SecretBinding

func SnapshotImageID

func SnapshotImageID(stubID string, at time.Time) string

SnapshotImageID names the image a sandbox's filesystem is saved as.

func SnapshotImageStub

func SnapshotImageStub(imageID string) (string, bool)

SnapshotImageStub returns the stub a filesystem snapshot image was taken from. Built images are named by a hash of their build and have none.

func StableStorageNodeID

func StableStorageNodeID(machineID, workerID string) string

func StubConfigForcesResourceLimits

func StubConfigForcesResourceLimits(config string) bool

func StubConfigWithForcedResourceLimits

func StubConfigWithForcedResourceLimits(config string) (string, error)

StubConfigWithForcedResourceLimits carries the request-scoped override over the existing stub config wire path. Keeping the config as raw JSON preserves fields introduced by newer clients that this gateway does not know yet.

func StubScopedContainerPrefixes

func StubScopedContainerPrefixes() []string

StubScopedContainerPrefixes identifies container IDs carrying a stub UUID.

func TempContainerWorkspace

func TempContainerWorkspace(containerId string) string

func ValidateComputePoolName

func ValidateComputePoolName(name string) error

func ValidateCpuAndMemory

func ValidateCpuAndMemory(cpu, memory int64, stubLimits StubLimits) (valid bool, errorMsg string)

ValidateCpuAndMemory enforces limits on CPU and memory (min and max)

func ValidateOpenRouterDocument

func ValidateOpenRouterDocument(document any) error

ValidateOpenRouterDocument validates one model entry, not the OpenAI list envelope. Compilation happens once; inference and scheduling never call it.

func WorkerImageVersion

func WorkerImageVersion(image, fallback string) string

func WorkerShutdownGraceSeconds

func WorkerShutdownGraceSeconds(stopGrace int64) int64

WorkerShutdownGraceSeconds covers task drain, systemd shutdown and disk cleanup.

func WorkerStartConcurrency

func WorkerStartConcurrency(workerConfig WorkerConfig, worker *Worker) int

func WorkerStartConcurrencyForPool

func WorkerStartConcurrencyForPool(poolConfig WorkerPoolConfig, globalRuntime, runtimeType string, workerCPU int64) int

func WorkspaceBucketName

func WorkspaceBucketName(prefix, workspaceID string) string

func WorkspaceMountPath

func WorkspaceMountPath(workspaceName string, parts ...string) string

WorkspaceMountPath is the canonical source path sent to a worker. The worker resolves it against its configured workspace mount root.

Types

type AbstractionConfig

type AbstractionConfig struct {
	Bot BotConfig `key:"bot" json:"bot"`
	Pod PodConfig `key:"pod" json:"pod"`
	VM  VMConfig  `key:"vm" json:"vm"`
}

type AgentJoinOptions

type AgentJoinOptions struct {
	GatewayURL                string
	JoinToken                 string
	JoinTokenFile             string
	DevMode                   bool
	ExecutorOverride          string
	TransportOverride         string
	WorkerImage               string
	CacheDir                  string
	MaxCPU                    string
	MaxMemory                 string
	MaxGPUs                   uint
	GPUIDs                    string
	NetworkSlots              uint
	ContainerStartConcurrency uint
	Stdout                    io.Writer
	Stderr                    io.Writer
}

type App

type App struct {
	Id          uint     `db:"id" json:"id" serializer:"id,source:external_id"`
	ExternalId  string   `db:"external_id" json:"external_id,omitempty" serializer:"external_id"`
	Name        string   `db:"name" json:"name" serializer:"name"`
	Description string   `db:"description" json:"description" serializer:"description"`
	WorkspaceId uint     `db:"workspace_id" json:"workspace_id"` // Foreign key to Workspace
	CreatedAt   Time     `db:"created_at" json:"created_at" serializer:"created_at"`
	UpdatedAt   Time     `db:"updated_at" json:"updated_at" serializer:"updated_at"`
	DeletedAt   NullTime `db:"deleted_at" json:"deleted_at" serializer:"deleted_at"`
}

@go2proto

func (*App) ToProto

func (a *App) ToProto() *pb.App

type AppActivityBucket

type AppActivityBucket struct {
	Time   time.Time `json:"time"`
	Total  int       `json:"total"`
	Failed int       `json:"failed"`
}

AppActivityBucket is one hour of an app's 24h activity strip: tasks created (task-based stubs) plus sandboxes created (sandbox stubs), and how many of those tasks ended in error.

type AppConfig

type AppConfig struct {
	ClusterName    string               `key:"clusterName" json:"cluster_name"`
	DebugMode      bool                 `key:"debugMode" json:"debug_mode"`
	PrettyLogs     bool                 `key:"prettyLogs" json:"pretty_logs"`
	Database       DatabaseConfig       `key:"database" json:"database"`
	Events         EventsConfig         `key:"events" json:"events"`
	GatewayService GatewayServiceConfig `key:"gateway" json:"gateway_service"`
	FileService    FileServiceConfig    `key:"fileService" json:"file_service"`
	ImageService   ImageServiceConfig   `key:"imageService" json:"image_service"`
	Storage        StorageConfig        `key:"storage" json:"storage"`
	Worker         WorkerConfig         `key:"worker" json:"worker"`
	Scheduling     SchedulingConfig     `key:"scheduling" json:"scheduling"`
	Providers      ProviderConfig       `key:"providers" json:"providers"`
	Tailscale      TailscaleConfig      `key:"tailscale" json:"tailscale"`
	Monitoring     MonitoringConfig     `key:"monitoring" json:"monitoring"`
	ManagedCompute ManagedComputeConfig `key:"managedCompute" json:"managed_compute"`
	Abstractions   AbstractionConfig    `key:"abstractions" json:"abstractions"`
	Cache          cache.Config         `key:"cache" json:"cache"`
	// ManagedEndpoints configures the platform-owned inference endpoints
	// (GitOps-driven stubs filled onto spare GPU capacity, served under /v1).
	ManagedEndpoints ManagedEndpointsConfig `key:"managedEndpoints" json:"managed_endpoints"`
}

type AppFilter

type AppFilter struct {
	Name   string `query:"name"`
	Cursor string `query:"cursor"`
	Limit  uint32 `query:"limit"`

	// Scoping computed server-side from live state. Untagged on purpose so the
	// query binder can never set them from the request.
	IncludeExternalIds []string
	ExcludeExternalIds []string
}

type AppState

type AppState string

AppState is how an app reads in the dashboard. It is derived, not stored: running containers live in Redis, deployments in Postgres.

const (
	// AppStateRunning: at least one container is running for any stub in the app.
	AppStateRunning AppState = "running"
	// AppStateIdle: nothing running right now, but at least one deployment is
	// active, so the app scales up on the next request.
	AppStateIdle AppState = "idle"
	// AppStateStopped: nothing deployed and nothing running.
	AppStateStopped AppState = "stopped"
)

func ParseAppState

func ParseAppState(s string) (AppState, bool)

type AppStateCounts

type AppStateCounts struct {
	All     int `json:"all" serializer:"all"`
	Running int `json:"running" serializer:"running"`
	Idle    int `json:"idle" serializer:"idle"`
	Stopped int `json:"stopped" serializer:"stopped"`
}

type Autoscaler

type Autoscaler struct {
	Type              AutoscalerType `json:"type"`
	MaxContainers     uint           `json:"max_containers"`
	TasksPerContainer uint           `json:"tasks_per_container"`
	MinContainers     uint           `json:"min_containers"`
}

type AutoscalerType

type AutoscalerType string
const (
	QueueDepthAutoscaler AutoscalerType = "queue_depth"
)

type AvailableHost

type AvailableHost struct {
	Hostname    string
	ContainerId string
}

type BackendRoute

type BackendRoute struct {
	RouteID     string `json:"route_id"`
	WorkspaceID string `json:"workspace_id"`
	PoolName    string `json:"pool_name"`
	MachineID   string `json:"machine_id"`
	WorkerID    string `json:"worker_id"`
	ContainerID string `json:"container_id"`
	Kind        string `json:"kind"`
	Port        int32  `json:"port"`
	Protocol    string `json:"protocol"`
	Transport   string `json:"transport"`
	LocalTarget string `json:"local_target"`
	ProxyTarget string `json:"proxy_target"`
	State       string `json:"state"`
	Error       string `json:"error"`
	UpdatedAt   int64  `json:"updated_at"`
}

type BaseFilter

type BaseFilter struct {
	Limit  uint32 `query:"limit"`
	Offset int    `query:"offset"`
}

type BotConfig

type BotConfig struct {
	SystemPrompt              string `key:"systemPrompt" json:"system_prompt"`
	StepIntervalS             uint   `key:"stepIntervalS" json:"step_interval_s"`
	SessionInactivityTimeoutS uint   `key:"sessionInactivityTimeoutS" json:"session_inactivity_timeout_s"`
}

type BuildAptConfig

type BuildAptConfig struct {
	// Mirror replaces http://archive.ubuntu.com/ubuntu and
	// http://security.ubuntu.com/ubuntu in the base image's sources for the
	// duration of each RUN step, e.g. http://mirrors.edge.kernel.org/ubuntu.
	Mirror string `key:"mirror" json:"mirror"`
	// Proxy is set as Acquire::http::Proxy (an apt-cacher-ng, for instance).
	Proxy string `key:"proxy" json:"proxy"`
	// TimeoutS is Acquire::http::Timeout / Acquire::https::Timeout; 0 keeps apt's default.
	TimeoutS int `key:"timeoutS" json:"timeout_s"`
	// Retries is Acquire::Retries; 0 keeps apt's default.
	Retries int `key:"retries" json:"retries"`
}

BuildAptConfig is applied to apt during image builds whose base image has apt installed. Public archives are slow or stall from some regions (archive.ubuntu.com measured at ~90 KB/s from us-east-1, with apt's default 120 s timeouts turning a stalled connection into a many-minute build), so a build gets short timeouts with retries and, when configured, a nearby mirror or caching proxy.

type BuildOptions

type BuildOptions struct {
	SourceImage      *string    `json:"source_image"`
	Dockerfile       *string    `json:"dockerfile"`
	BuildCtxObject   *string    `json:"build_context"`
	SourceImageCreds string     `json:"source_image_creds"`
	BuildSecrets     []string   `json:"build_secrets"`
	GitSource        *GitSource `json:"git_source,omitempty"`
}

@go2proto

type BuildRegistryCredentialsConfig

type BuildRegistryCredentialsConfig struct {
	// Type of credentials: "aws", "gcp", "azure", "basic", "token"
	Type string `key:"type" json:"type"`
	// Credentials is a map of credential key-value pairs
	// For AWS: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_SESSION_TOKEN (optional)
	// For GCP: GCP_ACCESS_TOKEN or GOOGLE_APPLICATION_CREDENTIALS
	// For Azure: AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID
	// For basic auth: USERNAME, PASSWORD
	// For token auth: NGC_API_KEY, GITHUB_TOKEN, DOCKERHUB_TOKEN
	Credentials map[string]string `key:"credentials" json:"credentials"`
}

BuildRegistryCredentialsConfig stores credentials for generating tokens for the build registry Supports: aws (ECR), gcp (GCR/GAR), basic (username/password), token (API keys)

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string `key:"allowOrigins" json:"allow_origins"`
	AllowedMethods []string `key:"allowMethods" json:"allow_methods"`
	AllowedHeaders []string `key:"allowHeaders" json:"allow_headers"`
}

type CPUShareMultiplier

type CPUShareMultiplier float64

CPUShareMultiplier is the number of vCPUs a pool schedules per physical CPU, where zero means 1. CPU limits, memory and billing stay physical.

func (CPUShareMultiplier) Schedulable

func (m CPUShareMultiplier) Schedulable(physical int64) int64

Schedulable converts physical CPU millicores into schedulable millicores.

func (CPUShareMultiplier) Validate

func (m CPUShareMultiplier) Validate() error

type CPUTier

type CPUTier string
const (
	CPUTierSpot        CPUTier = "spot"
	CPUTierShared      CPUTier = "shared"
	CPUTierPerformance CPUTier = "performance"
)

func (CPUTier) Borrows

func (t CPUTier) Borrows() bool

Borrows reports whether the tier runs on other tiers' idle capacity.

func (CPUTier) CPUReservation

func (t CPUTier) CPUReservation(p WorkerPoolConfig, cpu int64) int64

CPUReservation is the CPU that work on tier t asking for cpu takes from the capacity of a worker in pool p. Overflow work takes a physical CPU for each vCPU, so the workers it shares never overbook it.

func (CPUTier) DrainSeconds

func (t CPUTier) DrainSeconds() uint32

DrainSeconds is the notice work on a borrowing tier gets before it stops.

func (CPUTier) MatchesPool

func (t CPUTier) MatchesPool(p WorkerPoolConfig) bool

MatchesPool reports whether work on tier t may run in pool p. Tiered work runs on pools that sell its tier or one it borrows from, and untiered work on any pool. Work that never shares CPU also overflows onto Shared pools.

func (CPUTier) Overflows

func (t CPUTier) Overflows(p WorkerPoolConfig) bool

Overflows reports whether work on tier t runs in pool p only as overflow, once the pools it would otherwise use are full: untiered and Performance work on a Shared pool, where it doesn't share CPU (see CPUReservation).

func (CPUTier) Validate

func (t CPUTier) Validate(cpu, memory int64, nativeVM, gpu bool) error

Validate checks that a workload's shape fits the tier.

type CPUTierPolicy

type CPUTierPolicy struct {
	Enabled        bool    `json:"enabled"`
	DefaultCPUTier CPUTier `json:"default_cpu_tier"`
}

CPUTierPolicy is a workspace's CPU tier enrollment, owned by the billing service: whether it may choose any tier, and the tier its workloads get when they choose none.

func (CPUTierPolicy) Resolve

func (p CPUTierPolicy) Resolve(requested CPUTier) (CPUTier, error)

Resolve returns the requested tier, or the default when none is requested. Only a tier that never shares CPU can be the default.

type CRIUConfig

type CRIUConfig struct {
	Mode   CRIUConfigMode   `key:"mode" json:"mode"`
	Nvidia NvidiaCRIUConfig `key:"nvidia" json:"nvidia"`
}

type CRIUConfigMode

type CRIUConfigMode string
var (
	CRIUConfigModeNvidia CRIUConfigMode = "nvidia"
)

type CacheContentKind

type CacheContentKind string

CacheContentKind identifies the source of a required-content report.

const (
	CacheContentKindClipV1       CacheContentKind = "clip_v1"
	CacheContentKindClipV2       CacheContentKind = "clip_v2"
	CacheContentKindVolume       CacheContentKind = "volume"
	CacheContentKindCheckpoint   CacheContentKind = "checkpoint"
	CacheContentKindDiskSnapshot CacheContentKind = "disk_snapshot"
)

type CacheRequiredContentItem

type CacheRequiredContentItem struct {
	Hash               string           `json:"hash"`
	RoutingKey         string           `json:"routing_key"`
	SizeBytes          int64            `json:"size_bytes,omitempty"`
	ExpectedHash       string           `json:"expected_hash,omitempty"`
	ImageID            string           `json:"image_id,omitempty"`
	Source             string           `json:"source,omitempty"`
	SourceBucket       string           `json:"source_bucket,omitempty"`
	Kind               CacheContentKind `json:"kind,omitempty"`
	CheckpointID       string           `json:"checkpoint_id,omitempty"`
	Accelerator        string           `json:"accelerator,omitempty"`
	DiskName           string           `json:"disk_name,omitempty"`
	SnapshotGeneration int64            `json:"snapshot_generation,omitempty"`
	// Retired withdraws the checkpoint named by CheckpointID from what the
	// stub requires: it has been restored, and will not be again. It carries
	// no hash, so a reader that predates it skips it.
	Retired bool `json:"retired,omitempty"`
}

CacheRequiredContentItem describes a single piece of content a stub needs. Locality-scoped recent-stub indexes decide where it is kept warm. Source is a non-secret descriptor (OCI layer identity or workspace object path) used to resolve an origin fetch; it never carries credentials.

func (CacheRequiredContentItem) CoalescingKey

func (i CacheRequiredContentItem) CoalescingKey() string

CoalescingKey identifies requirements that replace one another. A mutable volume path and a stub's RAM checkpoint need only their latest report; retaining every historical hash keeps obsolete bytes protected forever.

type CapacityUpdateType

type CapacityUpdateType int
const (
	AddCapacity CapacityUpdateType = iota
	RemoveCapacity
)

type Catalog

type Catalog struct {
	Name          string `json:"name,omitempty" yaml:"name"`
	Description   string `json:"description,omitempty" yaml:"description"`
	ContextLength uint32 `json:"context_length,omitempty" yaml:"context_length"`
}

Catalog is the display metadata of a published app.

type Charge

type Charge struct {
	ID          string        `json:"id"`
	Status      ChargeStatus  `json:"status"`
	WorkspaceID string        `json:"workspace_id"` // the caller, never the platform workspace
	TokenID     string        `json:"token_id,omitempty"`
	AppID       string        `json:"app_id"`
	Version     uint          `json:"version"`
	Route       EndpointRoute `json:"route,omitempty"`
	Pricing     Pricing       `json:"pricing"`
	Work        Work          `json:"work"`
	Cost        Cost          `json:"cost"`
	// Provider attribution: set when a workspace-contributed machine served
	// the work; ProviderShareMicroUSD is its cut of Cost.MicroUSD.
	ProviderWorkspaceID   string `json:"provider_workspace_id,omitempty"`
	ProviderShareMicroUSD int64  `json:"provider_share_micro_usd,omitempty"`
	// Diagnostics of the serving attempt (not billing inputs).
	ReplicaID      string    `json:"replica_id,omitempty"`
	ContainerID    string    `json:"container_id,omitempty"`
	MachineID      string    `json:"machine_id,omitempty"`
	GPU            string    `json:"gpu,omitempty"`
	ConfigRevision uint64    `json:"config_revision,omitempty"`
	StatusCode     int       `json:"status_code,omitempty"`
	Stream         bool      `json:"stream,omitempty"`
	DurationMs     int64     `json:"duration_ms,omitempty"`
	TTFTMs         int64     `json:"ttft_ms,omitempty"`
	QueueWaitMs    int64     `json:"queue_wait_ms,omitempty"`
	Error          string    `json:"error,omitempty"`
	AcceptedAt     time.Time `json:"accepted_at"`
	SettledAt      time.Time `json:"settled_at,omitempty"`
}

Charge is the authoritative record of one request against a managed endpoint, keyed by request id so a duplicate completion settles the same charge once. The caller, the app version and the price are snapshotted when the request is accepted.

func (*Charge) Settle

func (c *Charge) Settle(w Work, now time.Time) error

Settle prices the reported work as one completed request and marks the charge settled. Flat-priced work ignores any reported tokens.

func (*Charge) Usage

func (c *Charge) Usage() Usage

Usage is the charge as what the caller was metered for.

func (*Charge) Void

func (c *Charge) Void(reason string, now time.Time)

Void closes a charge without billing it.

type ChargeStatus

type ChargeStatus string

ChargeStatus is the settlement state of a Charge.

const (
	ChargeSettled ChargeStatus = "settled" // priced and counted, or a completed unbilled request
	ChargeVoid    ChargeStatus = "void"    // failed or preempted; never billed
)

type Checkpoint

type Checkpoint struct {
	Id                uint     `db:"id" json:"id" serializer:"id,source:external_id" go2proto:"ignore"`
	CheckpointId      string   `db:"checkpoint_id" json:"checkpoint_id" serializer:"checkpoint_id"`
	ExternalId        string   `db:"external_id" json:"external_id,omitempty" serializer:"external_id"`
	SourceContainerId string   `db:"source_container_id" json:"source_container_id" serializer:"source_container_id"`
	ContainerIp       string   `db:"container_ip" json:"container_ip" serializer:"container_ip"`
	Status            string   `db:"status" json:"status" serializer:"status"`
	RemoteKey         string   `db:"remote_key" json:"remote_key" serializer:"remote_key"`
	WorkspaceId       uint     `db:"workspace_id" json:"workspace_id" go2proto:"ignore"` // Foreign key to Workspace
	StubId            uint     `db:"stub_id" json:"stub_id" go2proto:"ignore"`           // Foreign key to Stub
	StubType          string   `db:"stub_type" json:"stub_type" serializer:"stub_type"`
	AppId             uint     `db:"app_id" json:"app_id,omitempty" go2proto:"ignore"` // Foreign key to App
	ExposedPorts      []uint32 `db:"exposed_ports" json:"exposed_ports" serializer:"exposed_ports"`
	CreatedAt         Time     `db:"created_at" json:"created_at" serializer:"created_at"`
	LastRestoredAt    Time     `db:"last_restored_at" json:"last_restored_at" serializer:"last_restored_at"`
	DeletedAt         NullTime `db:"deleted_at" json:"deleted_at" serializer:"deleted_at"`
	CacheHash         string   `db:"cache_hash" json:"cache_hash" serializer:"cache_hash"`
	CacheSizeBytes    int64    `db:"cache_size_bytes" json:"cache_size_bytes" serializer:"cache_size_bytes"`
	OriginKey         string   `db:"origin_key" json:"origin_key" serializer:"origin_key"`
	Locality          string   `db:"locality" json:"locality" serializer:"locality"`
	Accelerator       string   `db:"accelerator" json:"accelerator" serializer:"accelerator"`
	Runtime           string   `db:"runtime" json:"runtime" serializer:"runtime"`
	// Internal placement metadata, carried separately by worker RPCs.
	CompatibilityKey string `db:"compatibility_key" json:"compatibility_key,omitempty" go2proto:"ignore"`
}

@go2proto

func NewCheckpointFromProto

func NewCheckpointFromProto(in *pb.Checkpoint) *Checkpoint

func (*Checkpoint) CompatibleWithWorker

func (c *Checkpoint) CompatibleWithWorker(key string) bool

CompatibleWithWorker lets workers retaining NVIDIA devices restore matching older checkpoints; older workers cannot restore checkpoints retaining devices.

func (*Checkpoint) IsFilesystemOnly

func (c *Checkpoint) IsFilesystemOnly() bool

func (*Checkpoint) RequiresGPUDeviceSpec

func (c *Checkpoint) RequiresGPUDeviceSpec() bool

RequiresGPUDeviceSpec identifies checkpoints with saved NVIDIA device entries. Workers that clear those entries cannot restore them.

func (*Checkpoint) ToProto

func (c *Checkpoint) ToProto() *pb.Checkpoint

type CheckpointStatus

type CheckpointStatus string
const (
	CheckpointStatusAvailable        CheckpointStatus = "available"
	CheckpointStatusCheckpointFailed CheckpointStatus = "checkpoint_failed"
	CheckpointStatusRestoreFailed    CheckpointStatus = "restore_failed"
	CheckpointStatusNotFound         CheckpointStatus = "not_found"
)

type CheckpointTrigger

type CheckpointTrigger struct {
	Type            string `json:"type,omitempty"`
	HttpPath        string `json:"http_path,omitempty"`
	HttpPort        uint32 `json:"http_port,omitempty"`
	TimeoutSeconds  uint32 `json:"timeout_seconds,omitempty"`
	IntervalSeconds uint32 `json:"interval_seconds,omitempty"`
}

@go2proto

func NewCheckpointTriggerFromProto

func NewCheckpointTriggerFromProto(in *pb.CheckpointTrigger) *CheckpointTrigger

func (*CheckpointTrigger) ToProto

func (t *CheckpointTrigger) ToProto() *pb.CheckpointTrigger

type ClipVersion

type ClipVersion uint32
const (
	ClipVersion1 ClipVersion = 1
	ClipVersion2 ClipVersion = 2
)

type ComputeCapacitySource

type ComputeCapacitySource string

func (ComputeCapacitySource) Canonical

func (ComputeCapacitySource) IsAttached

func (s ComputeCapacitySource) IsAttached() bool

type ComputeDemand

type ComputeDemand struct {
	PoolName       string
	Selector       string
	GPUs           []string
	Nodes          uint32
	OfferID        string
	CPUMillicores  int64
	MemoryMB       int64
	TTL            time.Duration
	MaxSpendMicros int64
	Providers      []string
	Regions        []string
	MinReliability float64
}

func (ComputeDemand) Pool

func (d ComputeDemand) Pool() ComputePool

type ComputeOffer

type ComputeOffer struct {
	ID                string
	Provider          string // aggregator/vendor (e.g. "shadeform"), used for pool filtering
	Cloud             string // underlying cloud the vendor sources from (e.g. "imwt")
	InstanceType      string
	Region            string
	GPU               string
	GPUCount          uint32
	NodeCount         uint32
	CPUMillicores     int64
	MemoryMB          int64
	StorageMB         int64
	HourlyCostMicros  int64
	Reliability       float64
	Available         uint32
	DisplayName       string
	Category          string
	RegionDisplayName string
	Latitude          float64
	Longitude         float64
	Labels            map[string]string
	Raw               []byte
}

func (ComputeOffer) CostPerNode

func (o ComputeOffer) CostPerNode() float64

type ComputeOfferRequest

type ComputeOfferRequest struct {
	GPUs            []string
	Nodes           uint32
	OfferID         string
	Providers       []string
	Regions         []string
	MinReliability  float64
	MaxHourlyMicros int64
}

type ComputePool

type ComputePool struct {
	Name           string
	Selector       string
	GPUs           []string
	Nodes          uint32
	OfferID        string
	TTL            time.Duration
	MaxSpendMicros int64
	Providers      []string
	Regions        []string
	MinReliability float64
	Source         ComputeCapacitySource
}

func (ComputePool) MatchesOffer

func (p ComputePool) MatchesOffer(offer ComputeOffer) bool

func (ComputePool) NormalizedSelector

func (p ComputePool) NormalizedSelector(workspaceID, stubID string) string

func (ComputePool) RequiresReservation

func (p ComputePool) RequiresReservation() bool

func (ComputePool) Validate

func (p ComputePool) Validate() error

type ComputeReservation

type ComputeReservation struct {
	ID                    string
	PoolName              string
	Name                  string
	Selector              string
	Provider              string
	Cloud                 string
	Region                string
	OfferID               string
	InstanceType          string
	InstanceID            string
	MachineID             string
	GPU                   string
	GPUCount              uint32
	NodeCount             uint32
	CPUMillicores         int64
	MemoryMB              int64
	StorageMB             int64
	HourlyCostMicros      int64
	CommittedMicros       int64
	Source                ComputeCapacitySource
	Status                ComputeReservationStatus
	CreatedAt             time.Time
	ExpiresAt             time.Time
	BillingRenewalAt      time.Time
	BillingCursorAt       time.Time
	LastStatusCheckAt     time.Time
	LastBillingCheckAt    time.Time
	LastReconcileAt       time.Time
	IdleSince             time.Time // First tick with no work on on-demand failover capacity; cleared when work lands, drives scale-down
	LastStatusMessage     string
	LastError             string
	TerminatingReason     string
	RegistrationTokenHash string
	PublicIP              string
	SSHHost               string
	SSHPort               uint32
}

func (ComputeReservation) ActiveAt

func (r ComputeReservation) ActiveAt(now time.Time) bool

func (ComputeReservation) Managed

func (r ComputeReservation) Managed() bool

func (ComputeReservation) Offer

func (r ComputeReservation) Offer() ComputeOffer

type ComputeReservationRequest

type ComputeReservationRequest struct {
	PoolName          string
	MachineID         string
	Name              string
	Selector          string
	Offer             ComputeOffer
	Count             uint32
	TTL               time.Duration
	MaxSpendMicros    int64
	Source            ComputeCapacitySource
	RegistrationToken string
	BootstrapCommand  string
}

type ComputeReservationStatus

type ComputeReservationStatus string

type ComputeSolveAction

type ComputeSolveAction struct {
	Type        ComputeSolveActionType
	Offer       ComputeOffer
	Reservation ComputeReservation
	Count       uint32
	CostMicros  int64
	Reason      string
}

type ComputeSolveActionType

type ComputeSolveActionType string

type ComputeSolveInput

type ComputeSolveInput struct {
	Demand       ComputeDemand
	Offers       []ComputeOffer
	Reservations []ComputeReservation
	Now          time.Time
	MaxOffers    int
}

type ComputeSolvePlan

type ComputeSolvePlan struct {
	Feasible              bool
	Reason                string
	Actions               []ComputeSolveAction
	TotalCapacity         uint32
	ExistingCapacity      uint32
	NewCapacity           uint32
	IncrementalCostMicros int64
	CommittedCostMicros   int64
}

type ComputeVendor

type ComputeVendor interface {
	Name() string
	ListOffers(ctx context.Context, req ComputeOfferRequest) ([]ComputeOffer, error)
	CreateReservation(ctx context.Context, req ComputeReservationRequest) (*ComputeReservation, error)
	GetReservation(ctx context.Context, id string) (*ComputeReservation, error)
	// ExtendReservation pushes a new expiry to any provider-side auto-delete
	// threshold so the provider cannot kill an instance our control plane
	// still considers alive. Vendors without provider-side thresholds no-op.
	ExtendReservation(ctx context.Context, id string, expiresAt time.Time) error
	DeleteReservation(ctx context.Context, id string) error
}

type ConcurrencyLimit

type ConcurrencyLimit struct {
	Id                uint      `db:"id" json:"-" redis:"-"`
	ExternalId        string    `db:"external_id" json:"external_id,omitempty" redis:"external_id"`
	WorkspaceId       uint      `db:"workspace_id" json:"workspace_id,omitempty" redis:"workspace_id"`
	GPULimit          uint32    `db:"gpu_limit" json:"gpu_limit" redis:"gpu_limit"`
	CPUMillicoreLimit uint32    `db:"cpu_millicore_limit" json:"cpu_millicore_limit" redis:"cpu_millicore_limit"`
	CreatedAt         time.Time `db:"created_at" json:"created_at,omitempty" redis:"-"`
	UpdatedAt         time.Time `db:"updated_at" json:"updated_at,omitempty" redis:"-"`
}

@go2proto

func NewConcurrencyLimitFromProto

func NewConcurrencyLimitFromProto(in *pb.ConcurrencyLimit) *ConcurrencyLimit

func (*ConcurrencyLimit) ToProto

func (c *ConcurrencyLimit) ToProto() *pb.ConcurrencyLimit

type Container

type Container struct {
	ContainerId  string          `redis:"container_id" json:"container_id"`
	StubId       string          `redis:"stub_id" json:"stub_id"`
	Status       ContainerStatus `redis:"status" json:"status"`
	ScheduledAt  time.Time       `redis:"scheduled_at" json:"scheduled_at"`
	StartedAt    time.Time       `redis:"started_at" json:"started_at"`
	WorkspaceId  string          `redis:"workspace_id" json:"workspace_id"`
	WorkerId     string          `redis:"worker_id" json:"worker_id"`
	MachineId    string          `redis:"machine_id" json:"machine_id"`
	DeploymentId string          `redis:"deployment_id" json:"deployment_id"`
}

@go2proto

func NewContainerFromProto

func NewContainerFromProto(in *pb.Container) *Container

func (*Container) ToProto

func (c *Container) ToProto() *pb.Container

type ContainerAlreadyScheduledError

type ContainerAlreadyScheduledError struct {
	Msg string
}

func (*ContainerAlreadyScheduledError) Error

type ContainerCostHookConfig

type ContainerCostHookConfig struct {
	Endpoint string `key:"endpoint" json:"endpoint"`
	Token    string `key:"token" json:"token"`
}

type ContainerEvent

type ContainerEvent struct {
	ContainerId string
	Change      int
}

type ContainerEventDefinition

type ContainerEventDefinition struct {
	ID       ContainerEventID `json:"id"`
	Domain   EventDomain      `json:"domain"`
	Label    string           `json:"label"`
	Required bool             `json:"required"`
}

type ContainerEventID

type ContainerEventID string
const (
	ContainerEventSchedulerStopRequested    ContainerEventID = "scheduler.stop_requested"
	ContainerEventWorkerStopEventReceived   ContainerEventID = "worker.stop_event_received"
	ContainerEventWorkerOrphanStateMissing  ContainerEventID = "worker.orphan_state_missing"
	ContainerEventWorkerPendingReconciled   ContainerEventID = "worker.pending_reconciled_running"
	ContainerEventWorkerStoppingGraceKill   ContainerEventID = "worker.stopping_grace_kill"
	ContainerEventWorkerEvicted             ContainerEventID = "worker.evicted"
	ContainerEventRuntimeExited             ContainerEventID = "runtime.exited"
	ContainerEventRuntimeOOMKilled          ContainerEventID = "runtime.oom_killed"
	ContainerEventApplicationOOMKilled      ContainerEventID = "runtime.application_oom_killed"
	ContainerEventGatewayAttachDisconnected ContainerEventID = "gateway.attach_disconnected"
	ContainerEventGatewayServeLockDeleted   ContainerEventID = "gateway.serve_lock_deleted"
	ContainerEventGatewayServeLockPreserved ContainerEventID = "gateway.serve_lock_preserved"
	ContainerEventAutoscalerScaleDecision   ContainerEventID = "autoscaler.scale_decision"
	ContainerEventTaskCancelRequested       ContainerEventID = "task.cancel_requested"
	ContainerEventTaskCancelApplied         ContainerEventID = "task.cancel_applied"
	ContainerEventLogsFirstByte             ContainerEventID = "logs.first_byte"
	ContainerEventLogsLastByte              ContainerEventID = "logs.last_byte"
	ContainerEventLogsFlushCompleted        ContainerEventID = "logs.flush_completed"
	ContainerEventLogsDropped               ContainerEventID = "logs.dropped"
	ContainerEventRunnerStartTask           ContainerEventID = "runner.start_task"
	ContainerEventRunnerGetArgs             ContainerEventID = "runner.get_args"
	ContainerEventRunnerProcessStarted      ContainerEventID = "runner.process_started"
	ContainerEventRunnerModuleLoaded        ContainerEventID = "runner.module_loaded"
	ContainerEventRunnerMainEntered         ContainerEventID = "runner.main_entered"
	ContainerEventResultSetResult           ContainerEventID = "result.set_result"
	ContainerEventResultEndTask             ContainerEventID = "result.end_task"
	ContainerEventResultLoadedByGateway     ContainerEventID = "result.loaded_by_gateway"
	ContainerEventResultSentToClient        ContainerEventID = "result.sent_to_client"
)

type ContainerEventOptions

type ContainerEventOptions struct {
	Source  EventSource
	Message EventMessage
	Reason  string
	TaskID  string
	Attrs   map[string]string
}

type ContainerEventRecord

type ContainerEventRecord struct {
	SeqNum      uint64            `json:"seq_num"`
	StoredAtNs  uint64            `json:"stored_at_ns,omitempty"`
	CloudEvent  json.RawMessage   `json:"cloud_event"`
	Type        string            `json:"type"`
	EventID     string            `json:"event_id,omitempty"`
	Domain      string            `json:"domain,omitempty"`
	ParentID    string            `json:"parent_id,omitempty"`
	Timestamp   time.Time         `json:"timestamp,omitempty"`
	StartTime   time.Time         `json:"start_time,omitempty"`
	EndTime     time.Time         `json:"end_time,omitempty"`
	DurationMs  int64             `json:"duration_ms,omitempty"`
	Success     *bool             `json:"success,omitempty"`
	Reason      string            `json:"reason,omitempty"`
	Source      string            `json:"source,omitempty"`
	Message     string            `json:"message,omitempty"`
	Attrs       map[string]string `json:"attrs,omitempty"`
	Stream      string            `json:"stream,omitempty"`
	Line        string            `json:"line,omitempty"`
	Data        json.RawMessage   `json:"data,omitempty"`
	ContainerID string            `json:"container_id,omitempty"`
	StubID      string            `json:"stub_id,omitempty"`
	StubType    string            `json:"stub_type,omitempty"`
	TaskID      string            `json:"task_id,omitempty"`
	WorkspaceID string            `json:"workspace_id,omitempty"`
	AppID       string            `json:"app_id,omitempty"`
	MachineID   string            `json:"machine_id,omitempty"`
	WorkerID    string            `json:"worker_id,omitempty"`
	PID         int32             `json:"pid,omitempty"`
	ProcessArgs []string          `json:"process_args,omitempty"`
	ProcessCwd  string            `json:"process_cwd,omitempty"`
	ProcessSeq  uint64            `json:"process_seq,omitempty"`
}

type ContainerEventsResponse

type ContainerEventsResponse struct {
	ContainerID    string                 `json:"container_id"`
	WorkspaceID    string                 `json:"workspace_id,omitempty"`
	StubID         string                 `json:"stub_id,omitempty"`
	Status         string                 `json:"status,omitempty"`
	StopReason     string                 `json:"stop_reason,omitempty"`
	RootCauseEvent string                 `json:"root_cause_event,omitempty"`
	Summary        map[string]int64       `json:"summary"`
	Events         []ContainerEventRecord `json:"events"`
	Missing        []string               `json:"missing"`
	Streams        []string               `json:"streams,omitempty"`
}

type ContainerExitCode

type ContainerExitCode int
const (
	ContainerExitCodeInvalidCustomImage ContainerExitCode = 555
	ContainerExitCodeIncorrectImageArch ContainerExitCode = 556
	ContainerExitCodeIncorrectImageOs   ContainerExitCode = 557
	ContainerExitCodeUnknownError       ContainerExitCode = 1
	ContainerExitCodeSuccess            ContainerExitCode = 0
	ContainerExitCodeOomKill            ContainerExitCode = 137 // 128 + 9 (base value + SIGKILL), used to indicate OOM kill
	ContainerExitCodeSigterm            ContainerExitCode = 143 // 128 + 15 (base value + SIGTERM), used to indicate a graceful termination
	ContainerExitCodeScheduler          ContainerExitCode = 558
	ContainerExitCodeTtl                ContainerExitCode = 559
	ContainerExitCodeUser               ContainerExitCode = 560
	ContainerExitCodeAdmin              ContainerExitCode = 561
	// ContainerExitCodeEvicted is reported for evictable containers the
	// scheduler stopped to make room for a non-evictable request.
	ContainerExitCodeEvicted       ContainerExitCode = 562
	ContainerExitCodeStartupFailed ContainerExitCode = 563
)

func (ContainerExitCode) IsFailed

func (c ContainerExitCode) IsFailed() bool

type ContainerIpAssignment

type ContainerIpAssignment struct {
	ContainerID string `json:"container_id"`
	IPAddress   string `json:"ip_address"`
}

type ContainerLease

type ContainerLease struct {
	ContainerId  string
	Err          error
	Status       ContainerStatus
	Started      bool
	Evicting     bool
	DrainSeconds uint32
}

ContainerLease is what the routine status heartbeat found for a container. Err is set when nothing could be renewed: ErrContainerStateNotFound when the container has no state, ErrContainerNotAssigned when its state is not the calling worker's. Otherwise Status is the persisted status after the call: a PENDING or RUNNING container was renewed, a STOPPING one was left as it is. Started is set when the call moved it from PENDING to RUNNING.

type ContainerLeaseRenewal

type ContainerLeaseRenewal struct {
	ContainerId    string
	RuntimeStarted bool
}

ContainerLeaseRenewal is one container in a worker's routine status heartbeat. RuntimeStarted says the worker has seen the container's process start, so a state that is still PENDING becomes RUNNING.

type ContainerLifecycleDefinition

type ContainerLifecycleDefinition struct {
	ID       ContainerLifecycleID `json:"id"`
	Domain   EventDomain          `json:"domain"`
	ParentID ContainerLifecycleID `json:"parent_id,omitempty"`
	Label    string               `json:"label"`
	Required bool                 `json:"required"`
}

type ContainerLifecycleID

type ContainerLifecycleID string
const (
	ContainerLifecycleStartup                     ContainerLifecycleID = "container.startup"
	ContainerLifecycleSchedulerQueuePush          ContainerLifecycleID = "scheduler.queue_push"
	ContainerLifecycleSchedulerBacklogWait        ContainerLifecycleID = "scheduler.backlog_wait"
	ContainerLifecycleSchedulerWorkerList         ContainerLifecycleID = "scheduler.worker_list"
	ContainerLifecycleSchedulerBatchPlan          ContainerLifecycleID = "scheduler.batch_plan"
	ContainerLifecycleSchedulerWorkerSelection    ContainerLifecycleID = "scheduler.worker_selection"
	ContainerLifecycleSchedulerReserveCapacity    ContainerLifecycleID = "scheduler.reserve_capacity"
	ContainerLifecycleSchedulerReservation        ContainerLifecycleID = "scheduler.reservation"
	ContainerLifecycleSchedulerProvisionWorker    ContainerLifecycleID = "scheduler.provision_worker"
	ContainerLifecycleSchedulerImageCredentials   ContainerLifecycleID = "scheduler.attach_image_credentials"
	ContainerLifecycleSchedulerBuildCredentials   ContainerLifecycleID = "scheduler.attach_build_registry_credentials"
	ContainerLifecycleSchedulerWorkerQueuePush    ContainerLifecycleID = "scheduler.worker_queue_push"
	ContainerLifecycleWorkerQueueReceive          ContainerLifecycleID = "worker.queue_receive"
	ContainerLifecycleImageLoad                   ContainerLifecycleID = "image.load"
	ContainerLifecycleImageEmbeddedCacheMetadata  ContainerLifecycleID = "image.embedded_cache_metadata_copy"
	ContainerLifecycleImageEmbeddedCacheStore     ContainerLifecycleID = "image.embedded_cache_store"
	ContainerLifecycleImageEmbeddedCacheWait      ContainerLifecycleID = "image.embedded_cache_wait"
	ContainerLifecycleImageEmbeddedCacheRestore   ContainerLifecycleID = "image.embedded_cache_restore"
	ContainerLifecycleImageV1DataCacheDeferred    ContainerLifecycleID = "image.v1_data_cache_deferred"
	ContainerLifecycleImageV1DataCacheRestore     ContainerLifecycleID = "image.v1_data_cache_restore"
	ContainerLifecycleSetWorkerAddress            ContainerLifecycleID = "worker.set_worker_address"
	ContainerLifecyclePortAllocation              ContainerLifecycleID = "worker.port_allocation"
	ContainerLifecycleReadBundleConfig            ContainerLifecycleID = "worker.read_bundle_config"
	ContainerLifecycleWorkspaceMount              ContainerLifecycleID = "mount.workspace"
	ContainerLifecycleSetupMounts                 ContainerLifecycleID = "mount.setup"
	ContainerLifecycleBindMountDirs               ContainerLifecycleID = "mount.bind_source_dirs"
	ContainerLifecycleDurableDiskPrepare          ContainerLifecycleID = "mount.durable_disk"
	ContainerLifecycleSpecFromRequest             ContainerLifecycleID = "worker.spec_from_request"
	ContainerLifecycleSetContainerAddr            ContainerLifecycleID = "worker.set_container_address"
	ContainerLifecycleSetAddressMap               ContainerLifecycleID = "worker.set_address_map"
	ContainerLifecycleOverlaySetup                ContainerLifecycleID = "mount.overlay_setup"
	ContainerLifecycleNetworkSetup                ContainerLifecycleID = "network.setup"
	ContainerLifecycleNetworkCreateVeth           ContainerLifecycleID = "network.create_veth"
	ContainerLifecycleNetworkSetupBridge          ContainerLifecycleID = "network.setup_bridge"
	ContainerLifecycleNetworkCreateNamespace      ContainerLifecycleID = "network.create_namespace"
	ContainerLifecycleNetworkConfigureNamespace   ContainerLifecycleID = "network.configure_namespace"
	ContainerLifecycleNetworkIPLock               ContainerLifecycleID = "network.ip_lock"
	ContainerLifecycleNetworkIPLoad               ContainerLifecycleID = "network.ip_load"
	ContainerLifecycleNetworkIPAssign             ContainerLifecycleID = "network.ip_assign"
	ContainerLifecycleNetworkSetContainerIP       ContainerLifecycleID = "network.set_container_ip"
	ContainerLifecycleNetworkRestrictions         ContainerLifecycleID = "network.restrictions"
	ContainerLifecycleGPUAssignment               ContainerLifecycleID = "worker.gpu_assignment"
	ContainerLifecycleNetworkExpose               ContainerLifecycleID = "network.expose_ports"
	ContainerLifecycleRuntimePrepare              ContainerLifecycleID = "runtime.prepare"
	ContainerLifecycleConfigWrite                 ContainerLifecycleID = "runtime.config_write"
	ContainerLifecycleStartQueueWait              ContainerLifecycleID = "worker.start_queue_wait"
	ContainerLifecycleRuntimeStartToPID           ContainerLifecycleID = "runtime.start_to_pid"
	ContainerLifecycleSandboxApplyCPUQuota        ContainerLifecycleID = "sandbox.apply_cpu_quota"
	ContainerLifecycleRunnerApplyCPUQuota         ContainerLifecycleID = "runner.apply_cpu_quota"
	ContainerLifecycleSandboxProcessManagerReady  ContainerLifecycleID = "sandbox.process_manager_ready"
	ContainerLifecycleServeReady                  ContainerLifecycleID = "serve.ready"
	ContainerLifecycleResultDelivery              ContainerLifecycleID = "result.delivery"
	ContainerLifecycleContainerRequestToStartTask ContainerLifecycleID = "function.container_request_to_start_task"
	ContainerLifecycleContainerRunningToStartTask ContainerLifecycleID = "container.running_to_start_task"
	ContainerLifecycleRunnerStartToGetArgs        ContainerLifecycleID = "runner.start_task_to_get_args"
	ContainerLifecycleRunnerGetArgsToSetResult    ContainerLifecycleID = "runner.get_args_to_set_result"
	ContainerLifecycleRunnerStartToSetResult      ContainerLifecycleID = "runner.start_task_to_set_result"
	ContainerLifecycleResultSetToEndTask          ContainerLifecycleID = "result.set_result_to_end_task"
	ContainerLifecycleRunnerStartToEndTask        ContainerLifecycleID = "runner.start_task_to_end_task"
	ContainerLifecycleRunnerGatewayChannelOpen    ContainerLifecycleID = "runner.gateway_channel_open"
	ContainerLifecycleRunnerStartTaskRPC          ContainerLifecycleID = "runner.start_task_rpc"
	ContainerLifecycleRunnerGetArgsRPC            ContainerLifecycleID = "runner.get_args_rpc"
	ContainerLifecycleRunnerUserCodeImport        ContainerLifecycleID = "runner.user_code_import"
	ContainerLifecycleRunnerHandlerExecution      ContainerLifecycleID = "runner.handler_execution"
	ContainerLifecycleRunnerSetResultRPC          ContainerLifecycleID = "runner.set_result_rpc"
	ContainerLifecycleRunnerEndTaskRPC            ContainerLifecycleID = "runner.end_task_rpc"
	ContainerLifecycleClipRead                    ContainerLifecycleID = "clip.read"
	ContainerLifecycleClipOCIRead                 ContainerLifecycleID = "clip.oci_read"
	ContainerLifecycleClipArchiveRead             ContainerLifecycleID = "clip.archive_read"
	ContainerLifecycleClipDiskCacheRead           ContainerLifecycleID = "clip.disk_cache_read"
	ContainerLifecycleClipContentCacheRead        ContainerLifecycleID = "clip.content_cache_read"
	ContainerLifecycleClipCheckpointRead          ContainerLifecycleID = "clip.checkpoint_read"
	ContainerLifecycleClipLayerDecompress         ContainerLifecycleID = "clip.layer_decompress"
	ContainerLifecycleClipLayerDecompressWait     ContainerLifecycleID = "clip.layer_decompress_wait"
)

type ContainerLifecycleOptions

type ContainerLifecycleOptions struct {
	Source EventSource
	TaskID string
	Attrs  map[string]string
}

type ContainerNetworkPolicy

type ContainerNetworkPolicy string
const (
	ContainerNetworkPolicyOpen      ContainerNetworkPolicy = "open"
	ContainerNetworkPolicyBlock     ContainerNetworkPolicy = "block"
	ContainerNetworkPolicyAllowList ContainerNetworkPolicy = "allowlist"
)

type ContainerRequest

type ContainerRequest struct {
	ContainerId              string          `json:"container_id"`
	EntryPoint               []string        `json:"entry_point"`
	Env                      []string        `json:"env"`
	Cpu                      int64           `json:"cpu"`
	Memory                   int64           `json:"memory"`
	Gpu                      string          `json:"gpu"`
	GpuRequest               []string        `json:"gpu_request"`
	GpuCount                 uint32          `json:"gpu_count"`
	ImageId                  string          `json:"image_id"`
	StubId                   string          `json:"stub_id"`
	WorkspaceId              string          `json:"workspace_id"`
	Workspace                Workspace       `json:"workspace"`
	Stub                     StubWithRelated `json:"stub"`
	Timestamp                time.Time       `json:"timestamp"`
	Mounts                   []Mount         `json:"mounts"`
	RetryCount               int             `json:"retry_count"`
	PoolSelector             string          `json:"pool_selector"`
	Preemptable              bool            `json:"preemptable"`
	CheckpointEnabled        bool            `json:"checkpoint_enabled"`
	BuildOptions             BuildOptions    `json:"build_options"`
	Ports                    []uint32        `json:"ports"`
	CostPerMs                float64         `json:"cost_per_ms"`
	AppId                    string          `json:"app_id"`
	Checkpoint               *Checkpoint     `json:"checkpoint"`
	ConfigPath               string          `json:"config_path"`
	ImageCredentials         string          `json:"image_credentials"`
	BuildRegistryCredentials string          `json:"build_registry_credentials"`
	BlockNetwork             bool            `json:"block_network"`
	AllowList                []string        `json:"allow_list"`
	DockerEnabled            bool            `json:"docker_enabled"` // Enable Docker-in-Docker
	RuntimeSecretNames       []string        `json:"runtime_secret_names,omitempty"`
	RuntimeTokenRequired     bool            `json:"runtime_token_required,omitempty"`

	// MachineId pins scheduling to a single agent machine; empty means any
	// machine. The scheduler fills it in after placement on agent pools.
	MachineId         string             `json:"machine_id,omitempty"`
	CheckpointTrigger *CheckpointTrigger `json:"checkpoint_trigger,omitempty"`
	TaskId            string             `json:"task_id,omitempty"`
	DeliveryToken     string             `json:"-" go2proto:"ignore"`
	// Hostname preserved across checkpoint and restore.
	Hostname             string `json:"hostname,omitempty"`
	ProvisioningAttempts int    `json:"provisioning_attempts,omitempty" go2proto:"ignore"`
	// Evictable marks a container that the scheduler may stop to make room for
	// a non-evictable request (managed endpoint replicas).
	Evictable bool `json:"evictable,omitempty"`
	// OpportunisticOnly restricts placement to capacity that is already free:
	// the request never triggers pool scale-up or provisioning.
	OpportunisticOnly bool `json:"opportunistic_only,omitempty"`
	// EvictContainerIds lists evictable containers the worker must stop before
	// starting this one. Set by the scheduler, never by callers.
	EvictContainerIds []string `json:"evict_container_ids,omitempty"`
	// EvictDrainSeconds is how long the worker lets the victims in
	// EvictContainerIds drain after SIGTERM before killing them. Set by the
	// scheduler from the victims' own DrainSeconds.
	EvictDrainSeconds uint32 `json:"evict_drain_seconds,omitempty"`
	// DrainSeconds is the grace this container gets to finish in-flight work
	// when it is evicted. Only meaningful with Evictable.
	DrainSeconds uint32 `json:"drain_seconds,omitempty"`
	// EvictOrder ranks evictable containers on a worker: lower values are
	// evicted first. Ties fall to the most recently started container.
	EvictOrder int32 `json:"evict_order,omitempty"`
	// UseVM asks for a microvm pool: the sandbox boots in its own virtual
	// machine. Only such requests are ever scheduled onto microvm workers, and
	// they never fall back to a container runtime.
	UseVM          bool            `json:"use_vm,omitempty"`
	SecretBindings []SecretBinding `json:"secret_bindings,omitempty"`
	// ReservedCpu is the CPU the request takes from its worker's capacity (see
	// CPUTier.CPUReservation). The scheduler sets it when it places the request
	// and the worker when it accepts it; zero means Cpu.
	ReservedCpu int64 `json:"reserved_cpu,omitempty" go2proto:"ignore"`
	// contains filtered or unexported fields
}

@go2proto

func NewContainerRequestFromProto

func NewContainerRequestFromProto(in *pb.ContainerRequest) *ContainerRequest

func (*ContainerRequest) Borrowed

func (r *ContainerRequest) Borrowed() bool

Borrowed reports whether the request runs on borrowed capacity (Spot).

func (*ContainerRequest) CPUTier

func (r *ContainerRequest) CPUTier() CPUTier

CPUTier is the tier the request's stub chose. It decodes only that field rather than the whole config, as the scheduler reads it several times per request.

func (*ContainerRequest) CapacityCpu

func (c *ContainerRequest) CapacityCpu() int64

CapacityCpu is the CPU the request takes from its worker's capacity.

func (*ContainerRequest) CapacityMemory

func (c *ContainerRequest) CapacityMemory() int64

CapacityMemory includes runtime overhead in MiB without changing the requested application budget. Native VMs reserve their control RAM and VMM.

func (*ContainerRequest) Clone

func (c *ContainerRequest) Clone() *ContainerRequest

func (*ContainerRequest) EgressAllowList

func (c *ContainerRequest) EgressAllowList() []string

func (*ContainerRequest) HasDurableDiskMount

func (c *ContainerRequest) HasDurableDiskMount() bool

func (*ContainerRequest) IsBuildRequest

func (c *ContainerRequest) IsBuildRequest() bool

IsBuildRequest reports whether the request builds a container image.

func (*ContainerRequest) IsPersistentVM

func (r *ContainerRequest) IsPersistentVM() bool

func (*ContainerRequest) MayEvict

func (c *ContainerRequest) MayEvict() bool

Keyless GPU restores can use idle capacity, but cannot evict workloads before the runtime has validated their compatibility.

func (*ContainerRequest) NetworkPolicy

func (c *ContainerRequest) NetworkPolicy() ContainerNetworkPolicy

func (*ContainerRequest) NetworkRestricted

func (c *ContainerRequest) NetworkRestricted() bool

func (*ContainerRequest) PrivateWorkerRequest

func (c *ContainerRequest) PrivateWorkerRequest() *ContainerRequest

func (*ContainerRequest) RequiresGPU

func (c *ContainerRequest) RequiresGPU() bool

func (*ContainerRequest) StorageAvailable

func (c *ContainerRequest) StorageAvailable() bool

func (*ContainerRequest) ToProto

func (c *ContainerRequest) ToProto() *pb.ContainerRequest

func (*ContainerRequest) VMID

func (r *ContainerRequest) VMID() string

func (*ContainerRequest) VolumeCacheCompatible

func (c *ContainerRequest) VolumeCacheCompatible() bool

type ContainerRequestStatus

type ContainerRequestStatus string

type ContainerResourceLimitsConfig

type ContainerResourceLimitsConfig struct {
	CPUEnforced         bool `key:"cpuEnforced" json:"cpu_enforced"`
	CPUAffinityEnforced bool `key:"cpuAffinityEnforced" json:"cpu_affinity_enforced"`
	MemoryEnforced      bool `key:"memoryEnforced" json:"memory_enforced"`
}

type ContainerResourceUsage

type ContainerResourceUsage struct {
	ContainerID       string `json:"ContainerID"`
	CpuMillicoresUsed int64  `json:"CpuMillicoresUsed"`
	MemoryUsed        int    `json:"MemoryUsed"`
	GpuMemoryUsed     int64  `json:"GpuMemoryUsed"`
	GpuMemoryTotal    int64  `json:"GpuMemoryTotal"`
	GpuType           string `json:"GpuType"`
}

type ContainerRunnerEvent

type ContainerRunnerEvent struct {
	Type        string            `json:"type"`
	ID          string            `json:"id"`
	Timestamp   string            `json:"timestamp"`
	StartTime   string            `json:"start_time"`
	EndTime     string            `json:"end_time"`
	DurationMs  int64             `json:"duration_ms"`
	Success     *bool             `json:"success"`
	ContainerID string            `json:"container_id"`
	StubID      string            `json:"stub_id"`
	StubType    string            `json:"stub_type"`
	TaskID      string            `json:"task_id"`
	Message     string            `json:"message"`
	Attrs       map[string]string `json:"attrs"`
}

type ContainerRuntime

type ContainerRuntime string
const (
	ContainerRuntimeRunc    ContainerRuntime = "runc"
	ContainerRuntimeGvisor  ContainerRuntime = "gvisor"
	ContainerRuntimeMicroVM ContainerRuntime = "microvm"
)

func (ContainerRuntime) String

func (r ContainerRuntime) String() string

type ContainerSchedulingFailureReason

type ContainerSchedulingFailureReason string

type ContainerState

type ContainerState struct {
	ContainerId string          `redis:"container_id" json:"container_id"`
	StubId      string          `redis:"stub_id" json:"stub_id"`
	Status      ContainerStatus `redis:"status" json:"status"`
	ScheduledAt int64           `redis:"scheduled_at" json:"scheduled_at"`
	WorkspaceId string          `redis:"workspace_id" json:"workspace_id"`
	Gpu         string          `redis:"gpu" json:"gpu"`
	GpuCount    uint32          `redis:"gpu_count" json:"gpu_count"`
	Cpu         int64           `redis:"cpu" json:"cpu"`
	Memory      int64           `redis:"memory" json:"memory"`
	StartedAt   int64           `redis:"started_at" json:"started_at"`
	WorkerId    string          `redis:"worker_id" json:"worker_id"`
	MachineId   string          `redis:"machine_id" json:"machine_id"`
	// Evictable mirrors ContainerRequest.Evictable: the scheduler may stop
	// this container to place a non-evictable request.
	Evictable bool `redis:"evictable" json:"evictable,omitempty"`
	// Evicting is set once the scheduler has picked this container as a
	// victim; its resources are no longer counted as held.
	Evicting     bool   `redis:"evicting" json:"evicting,omitempty"`
	DrainSeconds uint32 `redis:"drain_seconds" json:"drain_seconds,omitempty"`
	EvictOrder   int32  `redis:"evict_order" json:"evict_order,omitempty"`
	// ReservedCpu mirrors ContainerRequest.ReservedCpu for the scheduled request.
	ReservedCpu int64 `redis:"reserved_cpu" json:"reserved_cpu,omitempty" go2proto:"ignore"`
}

@go2proto

func (*ContainerState) CapacityCpu

func (s *ContainerState) CapacityCpu() int64

CapacityCpu is the CPU the container takes from its worker's capacity.

type ContainerStatus

type ContainerStatus string
const (
	ContainerStatusPending  ContainerStatus = "PENDING"
	ContainerStatusRunning  ContainerStatus = "RUNNING"
	ContainerStatusStopping ContainerStatus = "STOPPING"
)

type Cost

type Cost struct {
	MicroUSD           int64 `json:"micro_usd"`
	PromptMicroUSD     int64 `json:"prompt_micro_usd"` // uncached input
	CompletionMicroUSD int64 `json:"completion_micro_usd"`
	CachedMicroUSD     int64 `json:"cached_micro_usd"`
	RequestMicroUSD    int64 `json:"request_micro_usd"`
}

Cost is the exact micro-USD price of Work: the total and its four components.

type CreateDatabaseParams

type CreateDatabaseParams struct {
	Kind       string `json:"kind"`
	Name       string `json:"name"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	Database   string `json:"database"`
	Size       string `json:"size"`
	Pool       string `json:"pool"`
	AlwaysOn   bool   `json:"always_on"`
	SnapshotID string `json:"snapshot_id,omitempty"`
	// ZeroLoss answers each Postgres or Redis commit only once object storage
	// has it, instead of up to a second before.
	ZeroLoss bool `json:"zero_loss,omitempty"`
	// Millicores and megabytes; zero means the product default.
	Cpu    int64 `json:"cpu"`
	Memory int64 `json:"memory"`
}

type CreditGateConfig

type CreditGateConfig struct {
	Mode            string        `key:"mode" json:"mode"`
	Endpoint        string        `key:"endpoint" json:"endpoint"`
	AuthToken       string        `key:"authToken" json:"auth_token"`
	Timeout         time.Duration `key:"timeout" json:"timeout"`
	CacheTTL        time.Duration `key:"cacheTTL" json:"cache_ttl"`
	StaleTTL        time.Duration `key:"staleTTL" json:"stale_ttl"`
	FailOpen        *bool         `key:"failOpen" json:"fail_open"`
	EnforceInterval time.Duration `key:"enforceInterval" json:"enforce_interval"`
}

CreditGateConfig configures the scheduler's prepaid-credit check.

In "http" mode container admission and the periodic enforcement sweep check whether the workspace still has credit. Decisions are cached in Redis for CacheTTL. Stale approvals are refreshed asynchronously and may be reused for up to StaleTTL; stale denials and cache misses are refreshed synchronously. With no usable cached decision FailOpen decides if billing is unavailable.

func (CreditGateConfig) CacheTTLOrDefault

func (c CreditGateConfig) CacheTTLOrDefault() time.Duration

func (CreditGateConfig) Enabled

func (c CreditGateConfig) Enabled() bool

Enabled reports whether the gate consults billing at all: http mode with an endpoint. Anything else allows everything.

func (CreditGateConfig) EnforceIntervalOrDefault

func (c CreditGateConfig) EnforceIntervalOrDefault() time.Duration

func (CreditGateConfig) FailOpenOrDefault

func (c CreditGateConfig) FailOpenOrDefault() bool

FailOpenOrDefault: allow when billing cannot be reached and nothing is cached, unless explicitly set to false.

func (CreditGateConfig) StaleTTLOrDefault

func (c CreditGateConfig) StaleTTLOrDefault() time.Duration

func (CreditGateConfig) TimeoutOrDefault

func (c CreditGateConfig) TimeoutOrDefault() time.Duration

TimeoutOrDefault bounds one billing call. The check may run an off-session Stripe charge (auto top-up) before answering, so it needs Stripe latency headroom; a cached decision serves the next 30s either way.

type CreditStatus

type CreditStatus struct {
	OK             bool   `json:"ok"`
	AvailableCents int64  `json:"available_cents"`
	RequiredCents  int64  `json:"required_cents"`
	Code           string `json:"code,omitempty"`
	Message        string `json:"message,omitempty"`
}

CreditStatus is a workspace's prepaid-credit position as the gate sees it.

type DatabaseConfig

type DatabaseConfig struct {
	Redis    RedisConfig    `key:"redis" json:"redis"`
	Postgres PostgresConfig `key:"postgres" json:"postgres"`
	S2       S2Config       `key:"s2" json:"s2"`
}

type DatabaseReadiness

type DatabaseReadiness struct {
	DeploymentID string `json:"deployment_id"`
	Ready        bool   `json:"ready"`
	TLSVerified  bool   `json:"tls_verified"`
	Error        string `json:"error,omitempty"`
}

type DatabaseServiceInfo

type DatabaseServiceInfo struct {
	Name                         string `json:"name"`
	Kind                         string `json:"kind"`
	DeploymentID                 string `json:"deployment_id"`
	StubID                       string `json:"stub_id"`
	AppID                        string `json:"app_id,omitempty"`
	Version                      uint   `json:"version"`
	Active                       bool   `json:"active"`
	ZeroLoss                     bool   `json:"zero_loss"`
	Host                         string `json:"host"`
	Username                     string `json:"username"`
	Database                     string `json:"database,omitempty"`
	ConnectionString             string `json:"connection_string,omitempty"`
	ConnectionEnvName            string `json:"connection_env_name"`
	ConnectionStringSecret       string `json:"connection_string_secret"`
	UsernameSecret               string `json:"username_secret"`
	PasswordSecret               string `json:"password_secret"`
	DatabaseSecret               string `json:"database_secret,omitempty"`
	PooledConnectionString       string `json:"pooled_connection_string,omitempty"`
	PooledConnectionStringSecret string `json:"pooled_connection_string_secret,omitempty"`
}

type DatabaseServingConfig

type DatabaseServingConfig struct {
	Kind                    string   `json:"kind,omitempty" serializer:"kind,omitempty"`
	Port                    uint32   `json:"port,omitempty" serializer:"port,omitempty"`
	ReadinessProbe          string   `json:"readiness_probe,omitempty" serializer:"readiness_probe,omitempty"`
	ConnectionEnvName       string   `json:"connection_env_name,omitempty" serializer:"connection_env_name,omitempty"`
	ConnectionURL           string   `json:"connection_url,omitempty" serializer:"connection_url,omitempty"`
	CredentialSecretNames   []string `json:"credential_secret_names,omitempty" serializer:"credential_secret_names,omitempty"`
	DurabilityMode          string   `json:"durability_mode,omitempty" serializer:"durability_mode,omitempty"`
	CommitLagMs             uint32   `json:"commit_lag_ms,omitempty" serializer:"commit_lag_ms,omitempty"`
	UsernameSecretName      string   `json:"username_secret_name,omitempty" serializer:"username_secret_name,omitempty"`
	PasswordSecretName      string   `json:"password_secret_name,omitempty" serializer:"password_secret_name,omitempty"`
	DatabaseSecretName      string   `json:"database_secret_name,omitempty" serializer:"database_secret_name,omitempty"`
	ConnectionURLSecretName string   `json:"connection_url_secret_name,omitempty" serializer:"connection_url_secret_name,omitempty"`
}

func (*DatabaseServingConfig) ClearSecretNames

func (d *DatabaseServingConfig) ClearSecretNames()

func (*DatabaseServingConfig) CommitLag

func (c *DatabaseServingConfig) CommitLag() time.Duration

CommitLag is how long a journaled disk may answer flushes before their commits; zero answers each only once it is committed.

func (*DatabaseServingConfig) IsJournaled

func (c *DatabaseServingConfig) IsJournaled() bool

func (*DatabaseServingConfig) IsPostgres

func (c *DatabaseServingConfig) IsPostgres() bool

func (*DatabaseServingConfig) IsRedisCompatible

func (c *DatabaseServingConfig) IsRedisCompatible() bool

func (*DatabaseServingConfig) NormalizedKind

func (c *DatabaseServingConfig) NormalizedKind() string

type DefaultConcurrencyLimitConfig

type DefaultConcurrencyLimitConfig struct {
	CPUMillicores uint32 `key:"cpuMillicores" json:"cpu_millicores"`
	GPUCount      uint32 `key:"gpuCount" json:"gpu_count"`
}

type DeletedWorkerReason

type DeletedWorkerReason string
const (
	DeletedWorkerReasonPodWithoutState            DeletedWorkerReason = "pod_without_state"
	DeletedWorkerReasonPodExceededPendingAgeLimit DeletedWorkerReason = "pod_exceeded_pending_age_limit"
	DeletedWorkerReasonPodCompleted               DeletedWorkerReason = "pod_completed"
	DeletedWorkerReasonWorkerStateWithoutJob      DeletedWorkerReason = "worker_state_without_job"
)

func (DeletedWorkerReason) String

func (d DeletedWorkerReason) String() string

type Deployment

type Deployment struct {
	Id          uint     `db:"id" json:"id" serializer:"id,source:external_id"`
	ExternalId  string   `db:"external_id" json:"external_id,omitempty" serializer:"external_id"`
	Name        string   `db:"name" json:"name" serializer:"name"`
	Active      bool     `db:"active" json:"active" serializer:"active"`
	Subdomain   string   `db:"subdomain" json:"subdomain" serializer:"subdomain"`
	WorkspaceId uint     `db:"workspace_id" json:"workspace_id"` // Foreign key to Workspace
	StubId      uint     `db:"stub_id" json:"stub_id"`           // Foreign key to Stub
	StubType    string   `db:"stub_type" json:"stub_type" serializer:"stub_type"`
	Version     uint     `db:"version" json:"version" serializer:"version"`
	CreatedAt   Time     `db:"created_at" json:"created_at" serializer:"created_at"`
	UpdatedAt   Time     `db:"updated_at" json:"updated_at" serializer:"updated_at"`
	DeletedAt   NullTime `db:"deleted_at" json:"deleted_at" serializer:"deleted_at"`
	AppId       uint     `db:"app_id" json:"app_id,omitempty"` // Foreign key to App
}

type DeploymentFilter

type DeploymentFilter struct {
	BaseFilter
	StubIds          StringSlice `query:"stub_ids"`
	WorkspaceID      uint        `query:"workspace_id"`
	StubType         StringSlice `query:"stub_type"`
	Name             string      `query:"name"`
	Active           *bool       `query:"active"`
	Version          uint        `query:"version"`
	Cursor           string      `query:"cursor"`
	CreatedAtStart   string      `query:"created_at_start"`
	CreatedAtEnd     string      `query:"created_at_end"`
	Pagination       bool        `query:"pagination"`
	Subdomain        string      `query:"subdomain"`
	SearchQuery      string      `query:"search_query"`
	MinContainersGTE uint        `query:"min_containers"`
	ShowDeleted      bool        `query:"show_deleted"`
	AppId            string      `query:"app_id"`
}

type DeploymentWithRelated

type DeploymentWithRelated struct {
	Deployment
	Workspace   Workspace `db:"workspace" json:"workspace" serializer:"workspace"`
	Stub        Stub      `db:"stub" json:"stub" serializer:"stub"`
	App         App       `db:"app" json:"app" serializer:"app"`
	StubId      string    `serializer:"stub_id,source:stub.id"`
	AppId       string    `serializer:"app_id,source:app.id"`
	WorkspaceId string    `serializer:"workspace_id,source:workspace.id"`
	URL         string    `db:"-" json:"url,omitempty" serializer:"url,omitempty"`
	InvokeURL   string    `db:"-" json:"invoke_url,omitempty" serializer:"invoke_url,omitempty"`
}

type Disk

type Disk struct {
	Id          uint     `db:"id" json:"id"`
	ExternalId  string   `db:"external_id" json:"external_id"`
	WorkspaceId uint     `db:"workspace_id" json:"workspace_id"`
	Name        string   `db:"name" json:"name"`
	Size        string   `db:"size" json:"size"`
	Filesystem  string   `db:"filesystem" json:"filesystem"`
	Driver      string   `db:"driver" json:"driver"`
	MountPath   string   `db:"mount_path" json:"mount_path"`
	CreatedAt   Time     `db:"created_at" json:"created_at"`
	UpdatedAt   Time     `db:"updated_at" json:"updated_at"`
	DeletedAt   NullTime `db:"deleted_at" json:"deleted_at,omitempty"`
}

Disk is a first-class durable disk resource. Durable disks provide node-local durable state that is snapshotted to object storage. A disk is referenced by name when attached to a stub/service.

type DiskCreateInput

type DiskCreateInput struct {
	WorkspaceID uint   `json:"workspace_id"`
	Name        string `json:"name"`
	Size        string `json:"size"`
	Filesystem  string `json:"filesystem"`
	Driver      string `json:"driver"`
	MountPath   string `json:"mount_path"`
}

DiskCreateInput is the shared input for single and batched disk creation.

type DiskSnapshot

type DiskSnapshot struct {
	Id                  uint               `db:"id" json:"id,omitempty"`
	ExternalId          string             `db:"external_id" json:"external_id"`
	WorkspaceId         uint               `db:"workspace_id" json:"workspace_id"`
	StubId              uint               `db:"stub_id" json:"stub_id,omitempty"`
	DiskName            string             `db:"disk_name" json:"disk_name"`
	Format              string             `db:"format" json:"format"`
	Status              DiskSnapshotStatus `db:"status" json:"status"`
	Reason              string             `db:"reason" json:"reason,omitempty"`
	ParentSnapshotId    string             `db:"parent_snapshot_id" json:"parent_snapshot_id,omitempty"`
	Generation          int64              `db:"generation" json:"generation"`
	SizeBytes           int64              `db:"size_bytes" json:"size_bytes"`
	Filesystem          string             `db:"filesystem" json:"filesystem"`
	Driver              string             `db:"driver" json:"driver"`
	ManifestKey         string             `db:"manifest_key" json:"manifest_key"`
	ManifestDigest      string             `db:"manifest_digest" json:"manifest_digest"`
	ManifestSizeBytes   int64              `db:"manifest_size_bytes" json:"manifest_size_bytes"`
	ChunkCount          int64              `db:"chunk_count" json:"chunk_count"`
	LogicalSizeBytes    int64              `db:"logical_size_bytes" json:"logical_size_bytes"`
	StoredSizeBytes     int64              `db:"stored_size_bytes" json:"stored_size_bytes"`
	BucketName          string             `db:"bucket_name" json:"bucket_name"`
	ObjectPrefix        string             `db:"object_prefix" json:"object_prefix"`
	SourcePool          string             `db:"source_pool" json:"source_pool,omitempty"`
	SourceWorkerId      string             `db:"source_worker_id" json:"source_worker_id,omitempty"`
	SourceStorageNodeId string             `db:"source_storage_node_id" json:"source_storage_node_id,omitempty"`
	CreatedAt           Time               `db:"created_at" json:"created_at"`
	UpdatedAt           Time               `db:"updated_at" json:"updated_at"`
	CompletedAt         NullTime           `db:"completed_at" json:"completed_at,omitempty"`
	DeletedAt           NullTime           `db:"deleted_at" json:"deleted_at,omitempty"`
	Public              bool               `db:"public" json:"public"`
}

type DiskSnapshotChunk

type DiskSnapshotChunk struct {
	Index       int64  `json:"index"`
	OffsetBytes int64  `json:"offset_bytes"`
	SizeBytes   int64  `json:"size_bytes"`
	ObjectKey   string `json:"object_key"`
	Digest      string `json:"digest"`
}

type DiskSnapshotFile

type DiskSnapshotFile struct {
	Path            string              `json:"path"`
	Type            string              `json:"type"`
	Mode            int64               `json:"mode"`
	Uid             int                 `json:"uid,omitempty"`
	Gid             int                 `json:"gid,omitempty"`
	SizeBytes       int64               `json:"size_bytes,omitempty"`
	ModTimeUnixNano int64               `json:"mtime_unix_nano,omitempty"`
	ChangeUnixNano  int64               `json:"ctime_unix_nano,omitempty"`
	DeviceId        uint64              `json:"device_id,omitempty"`
	Inode           uint64              `json:"inode,omitempty"`
	LinkName        string              `json:"link_name,omitempty"`
	Chunks          []DiskSnapshotChunk `json:"chunks,omitempty"`
}

type DiskSnapshotFilter

type DiskSnapshotFilter struct {
	WorkspaceId         uint
	WorkspaceExternalId string
	DiskName            string
	Statuses            []DiskSnapshotStatus
	Limit               uint64
}

type DiskSnapshotManifest

type DiskSnapshotManifest struct {
	Version          int                `json:"version"`
	Format           string             `json:"format"`
	DiskName         string             `json:"disk_name"`
	Filesystem       string             `json:"filesystem"`
	Generation       int64              `json:"generation"`
	ParentSnapshotId string             `json:"parent_snapshot_id,omitempty"`
	LogicalSizeBytes int64              `json:"logical_size_bytes"`
	StoredSizeBytes  int64              `json:"stored_size_bytes"`
	Files            []DiskSnapshotFile `json:"files,omitempty"`
	CreatedAt        time.Time          `json:"created_at"`
}

type DiskSnapshotStatus

type DiskSnapshotStatus string

type DiskWithRelated

type DiskWithRelated struct {
	Disk
	Workspace Workspace `db:"workspace" json:"workspace"`
}

type DockerImageRegistryConfig

type DockerImageRegistryConfig struct {
	Username string `key:"username" json:"username"`
	Password string `key:"password" json:"password"`
}

type DurableDiskMountConfig

type DurableDiskMountConfig struct {
	Name       string `json:"name"`
	Size       string `json:"size"`
	Filesystem string `json:"filesystem"`
	Driver     string `json:"driver"`
	// Snapshot used to seed a new disk.
	SourceSnapshotId string `json:"source_snapshot_id,omitempty"`
}

@go2proto

func NewDurableDiskMountConfigFromProto

func NewDurableDiskMountConfigFromProto(in *pb.DurableDisk) *DurableDiskMountConfig

type EgressConfig

type EgressConfig struct {
	Enabled                    bool `key:"enabled" json:"enabled"`
	TLSPort                    int  `key:"tlsPort" json:"tls_port"`
	HTTPPort                   int  `key:"httpPort" json:"http_port"`
	OtherPort                  int  `key:"otherPort" json:"other_port"`
	MaxConnectionsPerContainer int  `key:"maxConnectionsPerContainer" json:"max_connections_per_container"`
}

Listener port zero allocates a free worker-local port.

type EndpointKind

type EndpointKind string

EndpointKind is the engine kind a model server declares.

const (
	EndpointKindLLM       EndpointKind = "llm"
	EndpointKindEmbedding EndpointKind = "embedding"
	EndpointKindImage     EndpointKind = "image"
	EndpointKindCustom    EndpointKind = "custom"
	// EndpointKindDecision is a System One decision model: it answers typed
	// Choice, Score and Noul questions about a state on TypeSafe's
	// POST /v1/systemone contract and reports input/output token usage.
	EndpointKindDecision EndpointKind = "decision"
)

type EndpointReplica

type EndpointReplica struct {
	ID                  string          `json:"id"`
	EndpointID          string          `json:"endpoint_id"`
	Version             uint            `json:"version"`
	GPU                 string          `json:"gpu"`
	GPUCount            uint32          `json:"gpu_count"`
	Protected           bool            `json:"protected"` // this replica belongs to the protected minimum
	Locality            string          `json:"locality,omitempty"`
	PoolName            string          `json:"pool_name,omitempty"`
	ContainerID         string          `json:"container_id"`
	WorkerID            string          `json:"worker_id,omitempty"`
	MachineID           string          `json:"machine_id,omitempty"`
	ProviderWorkspaceID string          `json:"provider_workspace_id,omitempty"` // set on contributed machines; earns a revenue share
	Address             string          `json:"address,omitempty"`
	Status              ReplicaStatus   `json:"status"`
	StatusReason        string          `json:"status_reason,omitempty"`
	SecretHash          string          `json:"secret_hash,omitempty"` // SHA-256 of BEAM_REPLICA_SECRET
	HarnessEnabled      bool            `json:"harness_enabled"`
	EngineReady         bool            `json:"engine_ready,omitempty"` // harness readiness; HTTP health must also pass before serving
	Probe               ReplicaProbe    `json:"probe"`                  // snapshotted at start; Port 0 means "ready when running"
	Config              ReplicaConfig   `json:"config"`
	Capacity            ReplicaCapacity `json:"capacity"`
	Capabilities        json.RawMessage `json:"capabilities,omitempty"`
	EngineMetrics       json.RawMessage `json:"engine_metrics,omitempty"`
	StartedAt           time.Time       `json:"started_at"`
	LoadingSince        time.Time       `json:"loading_since,omitempty"`
	ReadyAt             time.Time       `json:"ready_at,omitempty"`
	LastHeartbeat       time.Time       `json:"last_heartbeat"`
	EndedAt             time.Time       `json:"ended_at,omitempty"`
	DrainDeadline       time.Time       `json:"drain_deadline,omitempty"`
}

EndpointReplica is one running container serving an endpoint on one GPU type.

func (*EndpointReplica) Alive

func (r *EndpointReplica) Alive() bool

Alive reports whether the replica counts toward the live set (draining and evicting do not).

func (*EndpointReplica) EnterLoading

func (r *EndpointReplica) EnterLoading(now time.Time, reason string)

EnterLoading starts a fresh loading phase unless one is already running.

func (*EndpointReplica) LoadingFor

func (r *EndpointReplica) LoadingFor(now time.Time) time.Duration

func (*EndpointReplica) Serving

func (r *EndpointReplica) Serving() bool

type EndpointRoute

type EndpointRoute string

EndpointRoute is a route suffix under /v1: OpenAI-style paths, TypeSafe's systemone, and Beam's model-scoped invoke.

const (
	EndpointRouteChatCompletions  EndpointRoute = "chat/completions"
	EndpointRouteCompletions      EndpointRoute = "completions"
	EndpointRouteEmbeddings       EndpointRoute = "embeddings"
	EndpointRouteImageGenerations EndpointRoute = "images/generations"
	EndpointRouteImageEdits       EndpointRoute = "images/edits"
	EndpointRouteAudioSpeech      EndpointRoute = "audio/speech"
	EndpointRouteSystemOne        EndpointRoute = "systemone"
	EndpointRouteInvoke           EndpointRoute = "invoke"
)

func (EndpointRoute) ModelScoped

func (r EndpointRoute) ModelScoped() bool

ModelScoped reports whether the route is addressed as /models/{id}/{route} rather than by its OpenAI path.

type EndpointStatus

type EndpointStatus string
const (
	EndpointStatusActive  EndpointStatus = "active"
	EndpointStatusRetired EndpointStatus = "retired"
)

type ErrCheckpointNotFound

type ErrCheckpointNotFound struct {
	CheckpointId string
}

func (*ErrCheckpointNotFound) Error

func (e *ErrCheckpointNotFound) Error() string

type ErrContainerNotAssigned

type ErrContainerNotAssigned struct {
}

ErrContainerNotAssigned reports a container whose state is assigned to another worker, or to no worker yet.

func (*ErrContainerNotAssigned) Error

func (e *ErrContainerNotAssigned) Error() string

type ErrContainerStateNotFound

type ErrContainerStateNotFound struct {
	ContainerId string
}

func (*ErrContainerStateNotFound) Error

func (e *ErrContainerStateNotFound) Error() string

func (*ErrContainerStateNotFound) From

func (e *ErrContainerStateNotFound) From(err error) bool

type ErrDiskSnapshotNotAvailable

type ErrDiskSnapshotNotAvailable struct {
	SnapshotId string
}

func (*ErrDiskSnapshotNotAvailable) Error

type ErrDiskSnapshotNotFound

type ErrDiskSnapshotNotFound struct {
	SnapshotId string
}

func (*ErrDiskSnapshotNotFound) Error

func (e *ErrDiskSnapshotNotFound) Error() string

type ErrExceededTaskLimit

type ErrExceededTaskLimit struct {
	MaxPendingTasks uint
}

func (*ErrExceededTaskLimit) Error

func (e *ErrExceededTaskLimit) Error() string

type ErrInvalidWorkerStatus

type ErrInvalidWorkerStatus struct {
}

func (*ErrInvalidWorkerStatus) Error

func (e *ErrInvalidWorkerStatus) Error() string

type ErrNoSuitableWorkerFound

type ErrNoSuitableWorkerFound struct {
}

func (*ErrNoSuitableWorkerFound) Error

func (e *ErrNoSuitableWorkerFound) Error() string

type ErrWorkerNotFound

type ErrWorkerNotFound struct {
	WorkerId string
}

func (*ErrWorkerNotFound) Error

func (e *ErrWorkerNotFound) Error() string

func (*ErrWorkerNotFound) From

func (e *ErrWorkerNotFound) From(err error) bool

type ErrWorkerPoolStateNotFound

type ErrWorkerPoolStateNotFound struct {
	PoolName string
}

func (*ErrWorkerPoolStateNotFound) Error

func (*ErrWorkerPoolStateNotFound) From

func (e *ErrWorkerPoolStateNotFound) From(err error) bool

type EventActor

type EventActor struct {
	Caller       string `json:"caller,omitempty"`
	AgentSession string `json:"agent_session,omitempty"`
}

EventActor is the request attribution (X-Beta9-Caller / X-Beta9-Agent-Session) on control-plane events.

type EventCallbackConfig

type EventCallbackConfig struct {
	URL        string            `key:"url" json:"url"`
	Format     string            `key:"format" json:"format"`
	EventTypes []string          `key:"eventTypes" json:"event_types"`
	Headers    map[string]string `key:"headers" json:"headers"`
	Timeout    time.Duration     `key:"timeout" json:"timeout"`
}

type EventClient

type EventClient interface {
	PushEvent(event cloudevents.Event) error
}

type EventComputeSchema

type EventComputeSchema struct {
	Timestamp    time.Time         `json:"timestamp"`
	WorkspaceID  string            `json:"workspace_id,omitempty"`
	PoolName     string            `json:"pool_name,omitempty"`
	MachineID    string            `json:"machine_id,omitempty"`
	WorkerID     string            `json:"worker_id,omitempty"`
	ContainerID  string            `json:"container_id,omitempty"`
	RouteID      string            `json:"route_id,omitempty"`
	Action       string            `json:"action"`
	Status       string            `json:"status,omitempty"`
	Transport    string            `json:"transport,omitempty"`
	Executor     string            `json:"executor,omitempty"`
	Fallback     string            `json:"fallback,omitempty"`
	Source       string            `json:"source,omitempty"`
	Hostname     string            `json:"hostname,omitempty"`
	OS           string            `json:"os,omitempty"`
	Arch         string            `json:"arch,omitempty"`
	CPUCount     uint32            `json:"cpu_count,omitempty"`
	MemoryMB     uint64            `json:"memory_mb,omitempty"`
	GPUCount     uint32            `json:"gpu_count,omitempty"`
	NodeCount    uint32            `json:"node_count,omitempty"`
	MachineCount uint32            `json:"machine_count,omitempty"`
	GPUs         []string          `json:"gpus,omitempty"`
	Schedulable  *bool             `json:"schedulable,omitempty"`
	Message      string            `json:"message,omitempty"`
	Attrs        map[string]string `json:"attrs,omitempty"`
}

type EventContainerEventSchema

type EventContainerEventSchema struct {
	ID          ContainerEventID  `json:"id"`
	Domain      EventDomain       `json:"domain"`
	Timestamp   time.Time         `json:"timestamp"`
	ContainerID string            `json:"container_id,omitempty"`
	StubID      string            `json:"stub_id,omitempty"`
	StubType    string            `json:"stub_type,omitempty"`
	TaskID      string            `json:"task_id,omitempty"`
	WorkspaceID string            `json:"workspace_id,omitempty"`
	AppID       string            `json:"app_id,omitempty"`
	WorkerID    string            `json:"worker_id,omitempty"`
	MachineID   string            `json:"machine_id,omitempty"`
	CPU         int64             `json:"cpu,omitempty"`
	GPUCount    uint32            `json:"gpu_count,omitempty"`
	Reason      string            `json:"reason,omitempty"`
	Source      string            `json:"source,omitempty"`
	Message     string            `json:"message,omitempty"`
	Attrs       map[string]string `json:"attrs,omitempty"`
}

type EventContainerLifecycleSchema

type EventContainerLifecycleSchema struct {
	ID          ContainerLifecycleID `json:"id"`
	Domain      EventDomain          `json:"domain"`
	ParentID    ContainerLifecycleID `json:"parent_id,omitempty"`
	StartTime   time.Time            `json:"start_time"`
	EndTime     time.Time            `json:"end_time,omitempty"`
	DurationMs  int64                `json:"duration_ms,omitempty"`
	ContainerID string               `json:"container_id,omitempty"`
	StubID      string               `json:"stub_id,omitempty"`
	StubType    string               `json:"stub_type,omitempty"`
	TaskID      string               `json:"task_id,omitempty"`
	WorkspaceID string               `json:"workspace_id,omitempty"`
	AppID       string               `json:"app_id,omitempty"`
	WorkerID    string               `json:"worker_id,omitempty"`
	MachineID   string               `json:"machine_id,omitempty"`
	Success     *bool                `json:"success,omitempty"`
	Source      string               `json:"source,omitempty"`
	Attrs       map[string]string    `json:"attrs,omitempty"`
}

type EventContainerLogSchema

type EventContainerLogSchema struct {
	Timestamp   time.Time `json:"timestamp"`
	ContainerID string    `json:"container_id,omitempty"`
	StubID      string    `json:"stub_id,omitempty"`
	StubType    string    `json:"stub_type,omitempty"`
	TaskID      string    `json:"task_id,omitempty"`
	WorkspaceID string    `json:"workspace_id,omitempty"`
	AppID       string    `json:"app_id,omitempty"`
	WorkerID    string    `json:"worker_id,omitempty"`
	MachineID   string    `json:"machine_id,omitempty"`
	Stream      string    `json:"stream,omitempty"`
	Line        string    `json:"line"`
	PID         int32     `json:"pid,omitempty"`
	ProcessArgs []string  `json:"process_args,omitempty"`
	ProcessCwd  string    `json:"process_cwd,omitempty"`
	ProcessSeq  uint64    `json:"process_seq,omitempty"`
}

type EventContainerMetricsData

type EventContainerMetricsData struct {
	SampleIntervalMs   int64   `json:"sample_interval_ms,omitempty"`
	CPUUsed            uint64  `json:"cpu_used"`
	CPUTotal           uint64  `json:"cpu_total"`
	CPUPercent         float32 `json:"cpu_pct"`
	MemoryRSS          uint64  `json:"memory_rss_bytes"`
	MemoryVMS          uint64  `json:"memory_vms_bytes"`
	MemorySwap         uint64  `json:"memory_swap_bytes"`
	MemoryTotal        uint64  `json:"memory_total_bytes"`
	DiskReadBytes      uint64  `json:"disk_read_bytes"`
	DiskWriteBytes     uint64  `json:"disk_write_bytes"`
	NetworkBytesRecv   uint64  `json:"network_recv_bytes"`
	NetworkBytesSent   uint64  `json:"network_sent_bytes"`
	NetworkPacketsRecv uint64  `json:"network_recv_packets"`
	NetworkPacketsSent uint64  `json:"network_sent_packets"`
	GPUMemoryUsed      uint64  `json:"gpu_memory_used_bytes"`
	GPUMemoryTotal     uint64  `json:"gpu_memory_total_bytes"`
	GPUType            string  `json:"gpu_type"`
}

type EventContainerMetricsSchema

type EventContainerMetricsSchema struct {
	WorkerID         string                    `json:"worker_id"`
	MachineID        string                    `json:"machine_id,omitempty"`
	ContainerID      string                    `json:"container_id"`
	WorkspaceID      string                    `json:"workspace_id"`
	StubID           string                    `json:"stub_id"`
	StubType         string                    `json:"stub_type,omitempty"`
	AppID            string                    `json:"app_id,omitempty"`
	CPU              int64                     `json:"cpu,omitempty"`
	GPUCount         uint32                    `json:"gpu_count,omitempty"`
	ContainerMetrics EventContainerMetricsData `json:"metrics"`
}

type EventDomain

type EventDomain string
const (
	EventDomainGateway    EventDomain = "gateway"
	EventDomainScheduler  EventDomain = "scheduler"
	EventDomainWorker     EventDomain = "worker"
	EventDomainImage      EventDomain = "image"
	EventDomainClip       EventDomain = "clip"
	EventDomainMount      EventDomain = "mount"
	EventDomainNetwork    EventDomain = "network"
	EventDomainRuntime    EventDomain = "runtime"
	EventDomainRunner     EventDomain = "runner"
	EventDomainLogs       EventDomain = "logs"
	EventDomainResult     EventDomain = "result"
	EventDomainServe      EventDomain = "serve"
	EventDomainShutdown   EventDomain = "shutdown"
	EventDomainTask       EventDomain = "task"
	EventDomainAutoscaler EventDomain = "autoscaler"
)

func ContainerEventDomain

func ContainerEventDomain(id ContainerEventID) EventDomain

type EventEndpointRequestStatsSchema

type EventEndpointRequestStatsSchema struct {
	StubID        string    `json:"stub_id"`
	WorkspaceID   string    `json:"workspace_id"`
	AppID         string    `json:"app_id,omitempty"`
	WindowStart   time.Time `json:"window_start"`
	WindowSeconds int       `json:"window_seconds"`
	Requests      int64     `json:"requests"`
	Status4xx     int64     `json:"status_4xx"`
	Status5xx     int64     `json:"status_5xx"`
	DurationSumMs int64     `json:"duration_sum_ms"`
	DurationMaxMs int64     `json:"duration_max_ms"`
	// LatencyBuckets[i] counts requests with duration <= RequestLatencyBoundsMs[i];
	// the final element counts the rest.
	LatencyBuckets  []int64   `json:"latency_buckets"`
	LatencyBoundsMs []int64   `json:"latency_bounds_ms"`
	Timestamp       time.Time `json:"timestamp"`
}

type EventEndpointRouteSchema

type EventEndpointRouteSchema struct {
	EndpointID  string `json:"endpoint_id"`
	WorkspaceID string `json:"workspace_id"`
	TokenID     string `json:"token_id,omitempty"`
	RequestID   string `json:"request_id"`
	Route       string `json:"route"`
	Model       string `json:"model"`
	Version     uint   `json:"version"`
	ReplicaID   string `json:"replica_id"`
	ContainerID string `json:"container_id,omitempty"`
	MachineID   string `json:"machine_id,omitempty"`
	GPU         string `json:"gpu"`
	Locality    string `json:"locality,omitempty"`
	// ConfigRevision is the replica's acknowledged live config at the time.
	ConfigRevision uint64 `json:"config_revision,omitempty"`
	// Provider attribution: set when the serving replica ran on a
	// workspace-contributed machine; ProviderShareMicroUSD is that
	// workspace's cut of CostMicroUSD.
	ProviderWorkspaceID   string    `json:"provider_workspace_id,omitempty"`
	ProviderShareMicroUSD int64     `json:"provider_share_micro_usd,omitempty"`
	StatusCode            int       `json:"status_code"`
	Stream                bool      `json:"stream"`
	Retried               bool      `json:"retried"`
	RouteReason           string    `json:"route_reason,omitempty"`
	KVHitSource           string    `json:"kv_hit_source,omitempty"`
	PromptTokens          int64     `json:"prompt_tokens"`
	CompletionTokens      int64     `json:"completion_tokens"`
	CachedTokens          int64     `json:"cached_tokens"`
	Images                int64     `json:"images"`
	CostMicroUSD          int64     `json:"cost_micro_usd"`
	PromptMicroUSD        int64     `json:"prompt_micro_usd"`
	CompletionMicroUSD    int64     `json:"completion_micro_usd"`
	CachedMicroUSD        int64     `json:"cached_micro_usd"`
	RequestMicroUSD       int64     `json:"request_micro_usd"`
	ImageMicroUSD         int64     `json:"image_micro_usd"`
	DurationMs            int64     `json:"duration_ms"`
	TTFTMs                int64     `json:"ttft_ms"`
	QueueWaitMs           int64     `json:"queue_wait_ms"`
	Error                 string    `json:"error,omitempty"`
	Timestamp             time.Time `json:"timestamp"`
}

EventEndpointRouteSchema is emitted once per /v1 request.

type EventEndpointSchema

type EventEndpointSchema struct {
	EndpointID  string         `json:"endpoint_id"`
	Action      string         `json:"action"`
	WorkspaceID string         `json:"workspace_id,omitempty"`
	StubID      string         `json:"stub_id,omitempty"`
	Version     uint           `json:"version,omitempty"`
	ReplicaID   string         `json:"replica_id,omitempty"`
	ContainerID string         `json:"container_id,omitempty"`
	WorkerID    string         `json:"worker_id,omitempty"`
	PoolName    string         `json:"pool_name,omitempty"`
	GPU         string         `json:"gpu,omitempty"`
	Revision    uint64         `json:"revision,omitempty"`
	Message     string         `json:"message,omitempty"`
	Data        map[string]any `json:"data,omitempty"`
	Timestamp   time.Time      `json:"timestamp"`
}

EventEndpointSchema is the shared envelope for endpoint.* events. Action names the sub-event (e.g. "replica.ready", "config.fleet", "rollout.promoted").

type EventGatewayEndpointSchema

type EventGatewayEndpointSchema struct {
	Method       string `json:"method"`
	Path         string `json:"path"`
	WorkspaceID  string `json:"workspace_id,omitempty"`
	StatusCode   int    `json:"status_code"`
	UserAgent    string `json:"user_agent,omitempty"`
	RemoteIP     string `json:"remote_ip,omitempty"`
	RequestID    string `json:"request_id,omitempty"`
	ContentType  string `json:"content_type,omitempty"`
	Accept       string `json:"accept,omitempty"`
	ErrorMessage string `json:"error_message,omitempty"`
}

type EventHistoryResponse

type EventHistoryResponse struct {
	Events  []ContainerEventRecord `json:"events"`
	Streams []string               `json:"streams,omitempty"`
}

type EventMessage

type EventMessage string
const (
	EventMessageSchedulerStopRequested         EventMessage = "scheduler received stop request"
	EventMessageAttachStreamEnded              EventMessage = "container stream ended during attach"
	EventMessageAttachClientDisconnected       EventMessage = "client attach stream disconnected"
	EventMessageServeLockPreserved             EventMessage = "attach stream ended without deleting serve lock"
	EventMessageAutoscalerScaleDecision        EventMessage = "endpoint autoscaler selected desired container count"
	EventMessageRunnerCalledStartTask          EventMessage = "runner called start_task"
	EventMessageRunnerLoadedFunctionArgs       EventMessage = "runner loaded function args"
	EventMessageFunctionResultStored           EventMessage = "function result stored in redis"
	EventMessageFunctionResultLoadedByGateway  EventMessage = "function result loaded by gateway"
	EventMessageFunctionResultSentToClient     EventMessage = "function result sent to client"
	EventMessageFunctionStreamCancelRequested  EventMessage = "function stream client disconnected before completion"
	EventMessageFunctionStreamCancelApplied    EventMessage = "function stream cancellation applied"
	EventMessageTaskEndStatePersisted          EventMessage = "task end state persisted"
	EventMessageGatewayTaskStopRequested       EventMessage = "gateway task stop requested"
	EventMessageGatewayTaskCancellationApplied EventMessage = "gateway task cancellation applied"
	EventMessageHTTPTaskStopRequested          EventMessage = "HTTP task cancellation requested"
	EventMessageHTTPTaskCancellationApplied    EventMessage = "HTTP task cancellation applied"
	EventMessageLogCaptureFlushed              EventMessage = "container log capture flushed"
	EventMessageLogBufferDroppedRateLimit      EventMessage = "container log buffer dropped a rate limit message"
	EventMessageLogBufferDroppedMessage        EventMessage = "container log buffer dropped a message"
	EventMessageLogBufferDroppedRawMessage     EventMessage = "container log buffer dropped a raw message"
	EventMessageLogCaptureReceivedFirstByte    EventMessage = "container log capture received first byte"
	EventMessageLogCaptureReceivedFinalByte    EventMessage = "container log capture received final byte"
	EventMessageWorkerStopEventReceived        EventMessage = "worker received stop event"
	EventMessageWorkerOrphanStateMissing       EventMessage = "container state was missing during worker heartbeat"
	EventMessagePendingReconciledRunning       EventMessage = "pending state reconciled to running after runtime start"
	EventMessageStoppingGraceKill              EventMessage = "container exceeded stopping grace period and will be force killed"
	EventMessageEvicted                        EventMessage = "container evicted to make room for a higher priority workload"
	EventMessageRuntimeExited                  EventMessage = "runtime process exited"
	EventMessageRuntimeOOMKilled               EventMessage = "runtime process was oom killed"
	EventMessageApplicationOOMKilled           EventMessage = "Application process killed by OOM (exit code 137); sandbox remains running"
)

func (EventMessage) String

func (m EventMessage) String() string

type EventPlatformCacheSchema

type EventPlatformCacheSchema struct {
	Locality            string           `json:"locality"`
	LogicalHost         string           `json:"logical_host,omitempty"`
	WorkspaceID         string           `json:"workspace_id,omitempty"`
	StubID              string           `json:"stub_id,omitempty"`
	WorkerID            string           `json:"worker_id,omitempty"`
	MachineID           string           `json:"machine_id,omitempty"`
	PoolName            string           `json:"pool_name,omitempty"`
	NodeID              string           `json:"node_id,omitempty"`
	Hash                string           `json:"hash,omitempty"`
	RoutingKey          string           `json:"routing_key,omitempty"`
	Kind                CacheContentKind `json:"kind,omitempty"`
	Status              string           `json:"status"`
	Operation           string           `json:"operation,omitempty"`
	Source              string           `json:"source,omitempty"`
	Message             string           `json:"message,omitempty"`
	CachePath           string           `json:"cache_path,omitempty"`
	SizeBytes           int64            `json:"size_bytes,omitempty"`
	FreedBytes          int64            `json:"freed_bytes,omitempty"`
	ProtectedFreedBytes int64            `json:"protected_freed_bytes,omitempty"`
	EvictedObjects      int              `json:"evicted_objects,omitempty"`
	ProtectedObjects    int              `json:"protected_objects,omitempty"`
	UsagePct            float64          `json:"usage_pct,omitempty"`
	WatermarkPct        float64          `json:"watermark_pct,omitempty"`
	AvailableBytes      uint64           `json:"available_bytes,omitempty"`
	ReserveBytes        int64            `json:"reserve_bytes,omitempty"`
	TargetFreeBytes     int64            `json:"target_free_bytes,omitempty"`
	TotalCandidates     int              `json:"total_candidates,omitempty"`
	ProtectedCandidates int              `json:"protected_candidates,omitempty"`
	RecentCandidates    int              `json:"recent_candidates,omitempty"`
	EligibleCandidates  int              `json:"eligible_candidates,omitempty"`
	Timestamp           time.Time        `json:"timestamp"`
}

EventPlatformCacheSchema is an operational/audit event for cache materialization status, persisted to the platform cache stream in S2.

type EventPlatformLogSchema

type EventPlatformLogSchema struct {
	Timestamp   time.Time `json:"timestamp"`
	WorkspaceID string    `json:"workspace_id,omitempty"`
	PoolName    string    `json:"pool_name,omitempty"`
	MachineID   string    `json:"machine_id,omitempty"`
	Service     string    `json:"service,omitempty"`
	InstanceID  string    `json:"instance_id,omitempty"`
	WorkerID    string    `json:"worker_id,omitempty"`
	Level       string    `json:"level,omitempty"`
	Stream      string    `json:"stream,omitempty"`
	Line        string    `json:"line"`
}

type EventQuery

type EventQuery struct {
	Limit       uint64   `json:"limit,omitempty"`
	WorkspaceID string   `json:"workspace_id,omitempty"`
	StubID      string   `json:"stub_id,omitempty"`
	StubType    string   `json:"stub_type,omitempty"`
	AppID       string   `json:"app_id,omitempty"`
	TaskID      string   `json:"task_id,omitempty"`
	ContainerID string   `json:"container_id,omitempty"`
	EventTypes  []string `json:"event_types,omitempty"`
	// ExcludeEventTypes drops records of the given event types (wildcards
	// supported); used so task reads from the multiplexed stub task stream do
	// not return log records unless explicitly requested.
	ExcludeEventTypes []string `json:"exclude_event_types,omitempty"`
	// ExcludeActions drops records whose payload "action" field matches; used
	// to keep dense actions (e.g. machine.heartbeat) from consuming the limit.
	ExcludeActions []string   `json:"exclude_actions,omitempty"`
	StartTime      *time.Time `json:"start_time,omitempty"`
	EndTime        *time.Time `json:"end_time,omitempty"`
	SeqNum         *uint64    `json:"seq_num,omitempty"`
	Timestamp      *uint64    `json:"timestamp,omitempty"`
	TailOffset     *int64     `json:"tail_offset,omitempty"`
	Until          *uint64    `json:"until,omitempty"`
	WaitSeconds    *int32     `json:"wait,omitempty"`
	Clamp          *bool      `json:"clamp,omitempty"`
}

type EventSink

type EventSink = func(event []cloudevents.Event)

type EventSource

type EventSource string
const (
	EventSourceScheduler                EventSource = "scheduler"
	EventSourceSchedulerStop            EventSource = "scheduler.stop"
	EventSourceGatewayAttach            EventSource = "gateway.attach"
	EventSourceGatewayStartTask         EventSource = "gateway.start_task"
	EventSourceGatewayEndTask           EventSource = "gateway.end_task"
	EventSourceGatewayFunctionStream    EventSource = "gateway.function_stream"
	EventSourceGatewayFunctionGetArgs   EventSource = "gateway.function_get_args"
	EventSourceGatewayFunctionSetResult EventSource = "gateway.function_set_result"
	EventSourceGatewayStopTask          EventSource = "gateway.stop_task"
	EventSourceAPITaskStop              EventSource = "api.task.stop"
	EventSourceEndpointAutoscaler       EventSource = "endpoint.autoscaler"
	EventSourceWorkerEventBus           EventSource = "worker.event_bus"
	EventSourceWorkerEventStream        EventSource = "worker.event_stream"
	EventSourceWorkerLogger             EventSource = "worker.logger"
	EventSourceWorkerNetwork            EventSource = "worker.network"
	EventSourceWorkerRuntime            EventSource = "worker.runtime"
	EventSourceWorkerStatusHeartbeat    EventSource = "worker.status_heartbeat"
	EventSourceWorkerEviction           EventSource = "worker.eviction"
	EventSourceRunnerStdout             EventSource = "runner.stdout"
	EventSourceClipFUSE                 EventSource = "clip.fuse"
)

func (EventSource) String

func (s EventSource) String() string

type EventStubCacheRequiredContentSchema

type EventStubCacheRequiredContentSchema struct {
	WorkspaceID string                     `json:"workspace_id"`
	StubID      string                     `json:"stub_id"`
	Locality    string                     `json:"locality"`
	Kind        CacheContentKind           `json:"kind"`
	ItemCount   int                        `json:"item_count"`
	TotalBytes  int64                      `json:"total_bytes"`
	Items       []CacheRequiredContentItem `json:"items"`
	Timestamp   time.Time                  `json:"timestamp"`
}

EventStubCacheRequiredContentSchema is the coalesced required-content report for a stub, persisted to the stub cache stream in S2. Locality records where the content was observed; the reconciler uses the locality-scoped recent-stub index to decide where to materialize it.

type EventStubSchema

type EventStubSchema struct {
	ID           string   `json:"id"`
	StubType     StubType `json:"stub_type"`
	WorkspaceID  string   `json:"workspace_id"`
	StubConfig   string   `json:"stub_config"`
	ParentStubID string   `json:"parent_stub_id"`
	EventActor
}

type EventStubStateSchema

type EventStubStateSchema struct {
	ID               string   `json:"id"`
	WorkspaceID      string   `json:"workspace_id"`
	State            string   `json:"state"`
	PreviousState    string   `json:"previous_state"`
	Reason           string   `json:"reason"`
	FailedContainers []string `json:"failed_containers"`
}

type EventTaskSchema

type EventTaskSchema struct {
	ID                string     `json:"id"`
	Status            TaskStatus `json:"status"`
	FailureReason     string     `json:"failure_reason,omitempty"`
	ContainerID       string     `json:"container_id"`
	StartedAt         *time.Time `json:"started_at"`
	EndedAt           *time.Time `json:"ended_at"`
	WorkspaceID       string     `json:"workspace_id"`
	StubID            string     `json:"stub_id"`
	StubType          StubType   `json:"stub_type,omitempty"`
	CreatedAt         time.Time  `json:"created_at"`
	UpdatedAt         time.Time  `json:"updated_at"`
	AppID             string     `json:"app_id"`
	DeploymentID      string     `json:"deployment_id,omitempty"`
	DeploymentName    string     `json:"deployment_name,omitempty"`
	DeploymentVersion string     `json:"deployment_version,omitempty"`
}

type EventWorkerLifecycleSchema

type EventWorkerLifecycleSchema struct {
	WorkerID  string              `json:"worker_id"`
	MachineID string              `json:"machine_id"`
	Status    string              `json:"status"`
	PoolName  string              `json:"pool_name"`
	Reason    DeletedWorkerReason `json:"reason"`
}

type EventsConfig

type EventsConfig struct {
	Callbacks []EventCallbackConfig `key:"callbacks" json:"callbacks"`
}

type ExitCodeError

type ExitCodeError struct {
	ExitCode ContainerExitCode
}

func (*ExitCodeError) Error

func (e *ExitCodeError) Error() string

type FailoverChain

type FailoverChain struct {
	// Pools are tried in order once the requested GPU type lacks free capacity.
	Pools []string `key:"pools" json:"pools"`

	// OnDemand, when set, is the terminal step: real hardware is reserved only
	// once every pool in {requested GPU pools ∪ Pools} has refused for capacity.
	OnDemand *FailoverOnDemandStep `key:"onDemand" json:"on_demand"`
}

FailoverChain is the failover preference order for one GPU type. Pools matching the requested GPU type are always preferred over any chain entry.

type FailoverConfig

type FailoverConfig struct {
	Enabled bool `key:"enabled" json:"enabled"`

	// Chains is keyed by GPU type (e.g. "A10G"). A request binds to the chain
	// of the first GPU in its request list that has one.
	Chains map[string]FailoverChain `key:"chains" json:"chains"`

	// Health thresholds drive pool.schedulable/unschedulable events. They are
	// observability only and are never an input to placement decisions.
	Health FailoverHealthConfig `key:"health" json:"health"`

	OnDemand OnDemandConfig `key:"onDemand" json:"on_demand"`
}

FailoverConfig routes container requests to alternate pools when the pools matching the requested GPU have no free capacity. Capacity decides placement, never a clock: a chain is a preference order, not a schedule.

func (FailoverConfig) Validate

func (c FailoverConfig) Validate(pools map[string]WorkerPoolConfig) error

Validate reports configuration that can never behave as an operator intends: an empty chain, a pool listed twice, a chain that fails over to a pool already serving the chain's own GPU type, or an on-demand step with no cap.

A name that matches no configured pool is not an error: chains may target pools created through the managed-pool API, which are absent from the config file. The scheduler skips chain pools it cannot resolve.

type FailoverHealthConfig

type FailoverHealthConfig struct {
	MaxPendingWorkers      int64 `key:"maxPendingWorkers" json:"max_pending_workers"`
	MaxSchedulingLatencyMs int64 `key:"maxSchedulingLatencyMs" json:"max_scheduling_latency_ms"`
	MinMachinesAvailable   int64 `key:"minMachinesAvailable" json:"min_machines_available"`
}

type FailoverOnDemandStep

type FailoverOnDemandStep struct {
	GPUs      []GpuType         `key:"gpus" json:"gpus"`
	Providers []MachineProvider `key:"providers" json:"providers"`
	MaxNodes  int               `key:"maxNodes" json:"max_nodes"`
}

FailoverOnDemandStep bounds what the control plane may reserve for a chain.

type FileInfo

type FileInfo struct {
	Name        string
	IsDir       bool
	Size        int64
	Mode        int32
	ModTime     int64
	Owner       string
	Group       string
	Path        string
	Permissions uint32
}

@go2proto

type FileSearchMatch

type FileSearchMatch struct {
	Range   FileSearchRange
	Content string
}

@go2proto

type FileSearchPosition

type FileSearchPosition struct {
	Line   int32
	Column int32
}

@go2proto

type FileSearchRange

type FileSearchRange struct {
	Start FileSearchPosition
	End   FileSearchPosition
}

@go2proto

type FileSearchResult

type FileSearchResult struct {
	Path    string
	Matches []FileSearchMatch
}

@go2proto

type FileServiceConfig

type FileServiceConfig struct {
	Enabled bool `key:"enabled" json:"enabled"`
}

type FilterFieldMapping

type FilterFieldMapping struct {
	ClientField   string
	ClientValues  []string
	DatabaseField string
}

FilterFieldMapping represents a mapping between a client-provided field and its corresponding database field, along with the values for filtering on the database field.

type Fleet

type Fleet struct {
	GitSHA    string                   `json:"git_sha,omitempty"`
	Endpoints map[string]FleetEndpoint `json:"endpoints"`
	UpdatedAt time.Time                `json:"updated_at"`
}

Fleet is config.yaml: for each app, whether it is published and which GPU types it fills, with a priority among the apps on that type and an optional replica cap. It is the only thing that decides where replicas run.

func (*Fleet) Entries

func (f *Fleet) Entries(gpu string) []FleetEntry

Entries returns the enabled apps on a GPU type in priority order.

func (*Fleet) GPUs

func (f *Fleet) GPUs() []string

GPUs returns the GPU keys any enabled app fills, sorted.

func (*Fleet) Normalize

func (f *Fleet) Normalize()

func (*Fleet) Placements

func (f *Fleet) Placements(id string) map[string]FleetPlacement

Placements returns the GPU types an enabled app fills.

func (*Fleet) Prune

func (f *Fleet) Prune(apps map[string]*ManagedEndpoint) []string

Prune drops apps that are not deployed and GPU types their app does not declare, so one broken deploy never blocks the rest of the fleet.

func (*Fleet) Serverless

func (f *Fleet) Serverless(id string) bool

Serverless reports whether requests may start on-demand replicas of an app.

func (*Fleet) Validate

func (f *Fleet) Validate() error

Validate checks publication, GPU keys, priorities and caps. Call Normalize first.

type FleetEndpoint

type FleetEndpoint struct {
	Enabled     bool                      `json:"enabled" yaml:"enabled"`
	GPUs        map[string]FleetPlacement `json:"gpus" yaml:"gpus"`
	Publication `yaml:",inline"`
}

type FleetEntry

type FleetEntry struct {
	EndpointID     string
	Priority       uint32
	MinReplicas    uint32
	MaxReplicas    uint32
	ProtectMinimum bool
	Serverless     bool
}

FleetEntry is an app's place in one GPU type's priority order.

type FleetPlacement

type FleetPlacement struct {
	Priority    uint32 `json:"priority" yaml:"priority"`
	MinReplicas uint32 `json:"min_replicas,omitempty" yaml:"minReplicas"`
	MaxReplicas uint32 `json:"max_replicas,omitempty" yaml:"maxReplicas"`
	Preemption  *bool  `json:"preemption,omitempty" yaml:"preemption"`
	Serverless  bool   `json:"serverless,omitempty" yaml:"serverless"`
}

FleetPlacement is one app on one GPU type. Minimums fill first, in priority order, then spare capacity fills up to MaxReplicas (0 is uncapped). Disabling preemption protects only the minimum; extras stay evictable. Serverless placements start replicas only while work waits for them.

func (FleetPlacement) ProtectsMinimum

func (p FleetPlacement) ProtectsMinimum() bool

ProtectsMinimum: a hot minimum that ordinary serverless workloads may not preempt.

func (*FleetPlacement) UnmarshalYAML

func (p *FleetPlacement) UnmarshalYAML(unmarshal func(any) error) error

YAML otherwise truncates fractional replica counts when decoding into uint32.

type GPUBlackListConfig

type GPUBlackListConfig struct {
	GPUTypes []string `key:"gpuTypes" json:"gpu_types"`
	Message  string   `key:"message" json:"message"`
}

type GRPCConfig

type GRPCConfig struct {
	ExternalPort   int    `key:"externalPort" json:"external_port"`
	ExternalHost   string `key:"externalHost" json:"external_host"`
	TLS            bool   `key:"tls" json:"tls"`
	Port           int    `key:"port" json:"port"`
	MaxRecvMsgSize int    `key:"maxRecvMsgSize" json:"max_recv_msg_size"`
	MaxSendMsgSize int    `key:"maxSendMsgSize" json:"max_send_msg_size"`
}

type GatewayServiceConfig

type GatewayServiceConfig struct {
	TaskCompletion TaskCompletionConfig `key:"taskCompletion" json:"task_completion"`
	// DeploymentRevision orders configuration publications across rolling
	// gateway replicas. Helm rollbacks receive a new revision as well.
	DeploymentRevision int64          `key:"deploymentRevision" json:"deployment_revision"`
	MCPOAuth           MCPOAuthConfig `key:"mcpOAuth" json:"mcp_oauth"`
	Host               string         `key:"host" json:"host"`
	InvokeURLType      string         `key:"invokeURLType" json:"invoke_url_type"`
	GRPC               GRPCConfig     `key:"grpc" json:"grpc"`
	HTTP               HTTPConfig     `key:"http" json:"http"`
	ShutdownTimeout    time.Duration  `key:"shutdownTimeout" json:"shutdown_timeout"`
	StubLimits         StubLimits     `key:"stubLimits" json:"stub_limits"`
	// Applied to workspaces that have no explicit concurrency limit row.
	// Both values must be > 0 for the default to take effect; otherwise
	// workspaces without a row remain unlimited (legacy behavior).
	DefaultConcurrencyLimit DefaultConcurrencyLimitConfig `key:"defaultConcurrencyLimit" json:"default_concurrency_limit"`
	// CreditGate decides whether a workspace has prepaid credit to run
	// serverless workloads. Independent of the concurrency limit, which is a
	// capacity cap, not a paywall.
	CreditGate CreditGateConfig `key:"creditGate" json:"credit_gate"`
}

type GeeseConfig

type GeeseConfig struct {
	Debug                  bool          `key:"debug" json:"debug"`                                // --debug
	FsyncOnClose           bool          `key:"fsyncOnClose" json:"fsync_on_close"`                // --fsync-on-close
	MountOptions           []string      `key:"mountOptions" json:"mount_options"`                 // --mount-options
	MemoryLimit            int64         `key:"memoryLimit" json:"memory_limit"`                   // --memory-limit
	MaxFlushers            int           `key:"maxFlushers" json:"max_flushers"`                   // --max-flushers
	MaxParallelParts       int           `key:"maxParallelParts" json:"max_parallel_parts"`        // --max-parallel-parts
	PartSizeMB             int64         `key:"partSizeMB" json:"part_size_mb"`                    // multipart upload part size for the first 1000 parts (default 64)
	HTTPTimeout            time.Duration `key:"httpTimeout" json:"http_timeout"`                   // --http-timeout
	ReadAheadKB            int           `key:"readAheadKB" json:"read_ahead_kb"`                  // --read-ahead-kb
	ReadAheadLargeKB       int           `key:"readAheadLargeKB" json:"read_ahead_large_kb"`       // --read-ahead-large-kb
	ReadAheadParallelKB    int           `key:"readAheadParallelKB" json:"read_ahead_parallel_kb"` // --read-ahead-parallel-kb
	FuseReadAheadKB        int           `key:"fuseReadAheadKB" json:"fuse_read_ahead_kb"`         // --fuse-read-ahead-kb
	DirMode                string        `key:"dirMode" json:"dir_mode"`                           // --dir-mode, e.g., "0777"
	FileMode               string        `key:"fileMode" json:"file_mode"`                         // --file-mode, e.g., "0666"
	ListType               int           `key:"listType" json:"list_type"`                         // --list-type
	AccessKey              string        `key:"accessKey" json:"access_key"`
	SecretKey              string        `key:"secretKey" json:"secret_key"`
	EndpointUrl            string        `key:"endpointURL" json:"endpoint_url"` // --endpoint
	BucketName             string        `key:"bucketName" json:"bucket_name"`
	Region                 string        `key:"region" json:"region"`
	DisableVolumeCaching   bool          `key:"disableVolumeCaching" json:"disable_volume_caching"`
	StagedWriteModeEnabled bool          `key:"stagedWriteModeEnabled" json:"staged_write_mode_enabled"`
	StagedWritePath        string        `key:"stagedWritePath" json:"staged_write_path"`
	StagedWriteDebounce    time.Duration `key:"stagedWriteDebounce" json:"staged_write_debounce"`
	CacheStreamingEnabled  bool          `key:"cacheStreamingEnabled" json:"cache_streaming_enabled"`
	CacheDirectIO          bool          `key:"cacheDirectIO" json:"cache_direct_io"`
	CacheThroughEnabled    bool          `key:"cacheThroughEnabled" json:"cache_through_enabled"`
}

type GitOpsEndpointState

type GitOpsEndpointState struct {
	Path      string       `json:"path"`
	ID        string       `json:"id,omitempty"`
	Status    GitOpsStatus `json:"status"`
	Error     string       `json:"error,omitempty"`
	StubID    string       `json:"stub_id,omitempty"`
	Version   uint         `json:"version,omitempty"`
	UpdatedAt time.Time    `json:"updated_at"`
}

GitOpsEndpointState is the outcome of the last deploy of one app directory.

type GitOpsState

type GitOpsState struct {
	RepoURL     string                         `json:"repo_url"`
	Ref         string                         `json:"ref"`
	LastSHA     string                         `json:"last_sha,omitempty"`
	LastRunAt   time.Time                      `json:"last_run_at,omitempty"`
	LastError   string                         `json:"last_error,omitempty"`  // failed app deploys, one per line
	FleetError  string                         `json:"fleet_error,omitempty"` // why config.yaml was rejected
	PerEndpoint map[string]GitOpsEndpointState `json:"per_endpoint"`          // by app path
	PendingSHA  string                         `json:"pending_sha,omitempty"` // announced by a deploy that has not applied yet
	PendingAt   time.Time                      `json:"pending_at,omitempty"`
}

GitOpsState is what the last CI run of the endpoints repo reported.

type GitOpsStatus

type GitOpsStatus string
const (
	GitOpsStatusApplied GitOpsStatus = "applied"
	GitOpsStatusFailed  GitOpsStatus = "failed"
	GitOpsStatusRetired GitOpsStatus = "retired"
)

type GitSource

type GitSource struct {
	RepoURL        string `json:"repo_url"`
	Ref            string `json:"ref"`
	Commit         string `json:"commit"` // resolved by the gateway; the image id keys on it
	Token          string `json:"token,omitempty"`
	WorkingDir     string `json:"working_dir,omitempty"`
	DockerfilePath string `json:"dockerfile_path,omitempty"`
	StartCommand   string `json:"start_command,omitempty"`
	BuildCommand   string `json:"build_command,omitempty"`
	Dockerfile     string `json:"dockerfile,omitempty"` // built in the checkout ahead of any Dockerfile in it
}

GitSource builds an image from a git repository: the build worker clones it as the build context and uses its Dockerfile, or generates one with nixpacks when there is none.

@go2proto

func NewGitSourceFromProto

func NewGitSourceFromProto(in *pb.GitSource) *GitSource

func (*GitSource) ToProto

func (g *GitSource) ToProto() *pb.GitSource

type GpuSpec

type GpuSpec struct {
	Count      uint32         `json:"count,omitempty"` // GPUs per replica
	EngineArgs []string       `json:"engine_args,omitempty"`
	Config     map[string]any `json:"config,omitempty"`
}

GpuSpec is how a model server runs on one GPU type.

type GpuType

type GpuType string
const (
	GPU_A10         GpuType = "A10"
	GPU_A10G        GpuType = "A10G"
	GPU_A100        GpuType = "A100"
	GPU_A100_40     GpuType = "A100-40"
	GPU_A100_80     GpuType = "A100-80"
	GPU_A16         GpuType = "A16"
	GPU_A30         GpuType = "A30"
	GPU_A40         GpuType = "A40"
	GPU_A4000       GpuType = "A4000"
	GPU_A5000       GpuType = "A5000"
	GPU_L4          GpuType = "L4"
	GPU_L40         GpuType = "L40"
	GPU_T4          GpuType = "T4"
	GPU_GAUDI2      GpuType = "GAUDI2"
	GPU_GH200       GpuType = "GH200"
	GPU_H100        GpuType = "H100"
	GPU_H200        GpuType = "H200"
	GPU_B200        GpuType = "B200"
	GPU_B300        GpuType = "B300"
	GPU_A6000       GpuType = "A6000"
	GPU_RTX4000_ADA GpuType = "RTX4000Ada"
	GPU_RTX4090     GpuType = "RTX4090"
	GPU_RTX5090     GpuType = "RTX5090"
	GPU_RTX6000     GpuType = "RTX6000"
	GPU_RTX6000_ADA GpuType = "RTX6000Ada"
	GPU_RTX_PRO6000 GpuType = "RTXPro6000"
	GPU_L40S        GpuType = "L40S"
	GPU_V100        GpuType = "V100"
	GPU_V100_32     GpuType = "V100-32"

	NO_GPU  GpuType = "NO_GPU"
	GPU_ANY GpuType = "any"
)

func AllGPUTypes

func AllGPUTypes() []GpuType

func GPUTypesFromString

func GPUTypesFromString(gpu string) []GpuType

func NormalizeGPUType

func NormalizeGPUType(value string) GpuType

func (*GpuType) MarshalJSON

func (g *GpuType) MarshalJSON() ([]byte, error)

func (GpuType) String

func (g GpuType) String() string

func (*GpuType) UnmarshalJSON

func (g *GpuType) UnmarshalJSON(data []byte) error

type HTTPConfig

type HTTPConfig struct {
	ExternalPort     int        `key:"externalPort" json:"external_port"`
	ExternalHost     string     `key:"externalHost" json:"external_host"`
	TLS              bool       `key:"tls" json:"tls"`
	Port             int        `key:"port" json:"port"`
	EnablePrettyLogs bool       `key:"enablePrettyLogs" json:"enable_pretty_logs"`
	CORS             CORSConfig `key:"cors" json:"cors"`
}

func (*HTTPConfig) GetExternalURL

func (h *HTTPConfig) GetExternalURL() string

type HetznerPrivateNetworkConfig

type HetznerPrivateNetworkConfig struct {
	ID            int64             `key:"id" json:"id"`
	Name          string            `key:"name" json:"name"`
	RegionIDs     map[string]int64  `key:"regionIds" json:"region_ids"`
	RegionNames   map[string]string `key:"regionNames" json:"region_names"`
	RequireSubnet *bool             `key:"requireSubnet" json:"require_subnet"`
}

type HetznerProviderConfig

type HetznerProviderConfig struct {
	ApiToken             string                         `key:"apiToken" json:"api_token"`
	BaseURL              string                         `key:"baseURL" json:"base_url"`
	Image                string                         `key:"image" json:"image"`
	ImageByRegion        map[string]string              `key:"imageByRegion" json:"image_by_region"`
	SSHKeys              []string                       `key:"sshKeys" json:"ssh_keys"`
	SSHKeysByRegion      map[string][]string            `key:"sshKeysByRegion" json:"ssh_keys_by_region"`
	PrivateNetwork       HetznerPrivateNetworkConfig    `key:"privateNetwork" json:"private_network"`
	ServerTypePrices     map[string]float64             `key:"serverTypePrices" json:"server_type_prices"`
	ServerTypeCategories map[string]string              `key:"serverTypeCategories" json:"server_type_categories"`
	RegionMetadata       map[string]HetznerRegionConfig `key:"regionMetadata" json:"region_metadata"`
	DefaultRegions       []string                       `key:"defaultRegions" json:"default_regions"`
}

type HetznerRegionConfig

type HetznerRegionConfig struct {
	DisplayName string  `key:"displayName" json:"display_name"`
	Latitude    float64 `key:"latitude" json:"latitude"`
	Longitude   float64 `key:"longitude" json:"longitude"`
}

type Image

type Image struct {
	Commands             []string `json:"commands"`
	PythonVersion        string   `json:"python_version"`
	PythonPackages       []string `json:"python_packages"`
	BaseImage            *string  `json:"base_image"`
	BaseImageCredentials *string  `json:"base_image_creds"`
}

type ImageRegistriesConfig

type ImageRegistriesConfig struct {
	Docker DockerImageRegistryConfig `key:"docker" json:"docker"`
	S3     S3ImageRegistryConfig     `key:"s3" json:"s3"`
}

type ImageServiceConfig

type ImageServiceConfig struct {
	LocalCacheEnabled              bool                           `key:"localCacheEnabled" json:"local_cache_enabled"`
	RegistryStore                  string                         `key:"registryStore" json:"registry_store"`
	RegistryCredentialProviderName string                         `key:"registryCredentialProvider" json:"registry_credential_provider_name"`
	Registries                     ImageRegistriesConfig          `key:"registries" json:"registries"`
	PythonVersion                  string                         `key:"pythonVersion" json:"python_version"`
	EnableTLS                      bool                           `key:"enableTLS" json:"enable_tls"`
	BuildContainerCpu              int64                          `key:"buildContainerCpu" json:"build_container_cpu"`
	BuildContainerMemory           int64                          `key:"buildContainerMemory" json:"build_container_memory"`
	BuildContainerPoolSelector     string                         `key:"buildContainerPoolSelector" json:"build_container_pool_selector"`
	Runner                         RunnerConfig                   `key:"runner" json:"runner"`
	ArchiveNanosecondsPerByte      int64                          `key:"archiveNanosecondsPerByte" json:"archive_nanoseconds_per_byte"`
	ClipVersion                    uint32                         `key:"clipVersion" json:"clip_version"`
	BuildRegistry                  string                         `key:"buildRegistry" json:"build_registry"`
	BuildRepositoryName            string                         `key:"buildRepositoryName" json:"build_repository_name"`
	BuildRegistryCredentials       BuildRegistryCredentialsConfig `key:"buildRegistryCredentials" json:"build_registry_credentials"`
	BuildRegistryInsecure          bool                           `key:"buildRegistryInsecure" json:"build_registry_insecure"`
	// LayeredBuilds publishes a build's changes as layers packed straight from
	// the working container instead of buildah commit + push + re-index.
	// Dockerfiles outside the supported subset still go through buildah bud.
	LayeredBuilds bool `key:"layeredBuilds" json:"layered_builds"`
	// BuildApt tunes apt inside the RUN steps of a layered build. The settings
	// are bind-mounted into each step and never land in the image.
	BuildApt BuildAptConfig `key:"buildApt" json:"build_apt"`
	// BuildLayerCacheMaxPct bounds the persistent buildah layer store to this
	// fraction of the filesystem it sits on; after a build, the oldest images
	// are removed until it fits. Zero disables the bound.
	BuildLayerCacheMaxPct float64 `key:"buildLayerCacheMaxPct" json:"build_layer_cache_max_pct"`
}

func (ImageServiceConfig) EffectiveBuildRegistry

func (c ImageServiceConfig) EffectiveBuildRegistry() string

EffectiveBuildRegistry resolves the publishing registry for gateway and agent workers.

type InsufficientCreditsError

type InsufficientCreditsError struct {
	WorkspaceId string
	Code        string
	Reason      string
}

InsufficientCreditsError is returned when a workspace has no prepaid credit (or has been blocked by billing) and so may not run serverless workloads.

func (*InsufficientCreditsError) Error

func (e *InsufficientCreditsError) Error() string

type JobResourceOverheadConfig

type JobResourceOverheadConfig struct {
	CPU    string `key:"cpu" json:"cpu"`
	Memory string `key:"memory" json:"memory"`
}

JobResourceOverheadConfig is extra CPU/memory added to the worker pod's requests and limits on top of the capacity the scheduler hands out to containers. When jobResourcesEnforced is on, the pod limit is otherwise exactly the schedulable capacity, so a fully packed worker leaves nothing for the worker process itself (FUSE image/volume servers, log shipping, runtime) and container I/O gets throttled with the containers.

type LogQuery

type LogQuery struct {
	Limit       uint64     `json:"limit,omitempty"`
	Page        uint64     `json:"page,omitempty"`
	ObjectID    string     `json:"object_id,omitempty"`
	ObjectType  string     `json:"object_type,omitempty"`
	WorkspaceID string     `json:"workspace_id,omitempty"`
	StubID      string     `json:"stub_id,omitempty"`
	AppID       string     `json:"app_id,omitempty"`
	TaskID      string     `json:"task_id,omitempty"`
	ContainerID string     `json:"container_id,omitempty"`
	MachineID   string     `json:"machine_id,omitempty"`
	WorkerID    string     `json:"worker_id,omitempty"`
	Query       string     `json:"query,omitempty"`
	StartTime   *time.Time `json:"start_time,omitempty"`
	EndTime     *time.Time `json:"end_time,omitempty"`
	SeqNum      *uint64    `json:"seq_num,omitempty"`
	TailOffset  *int64     `json:"tail_offset,omitempty"`
	WaitSeconds *int32     `json:"wait,omitempty"`
	Clamp       *bool      `json:"clamp,omitempty"`

	HistoryStart *time.Time `json:"-"`
	HistoryEnd   *time.Time `json:"-"`
}

type LogRecord

type LogRecord struct {
	SeqNum      uint64    `json:"seq_num"`
	StoredAtNs  uint64    `json:"stored_at_ns,omitempty"`
	Timestamp   time.Time `json:"timestamp"`
	Message     string    `json:"message"`
	Stream      string    `json:"stream,omitempty"`
	ContainerID string    `json:"container_id,omitempty"`
	StubID      string    `json:"stub_id,omitempty"`
	StubType    string    `json:"stub_type,omitempty"`
	TaskID      string    `json:"task_id,omitempty"`
	WorkspaceID string    `json:"workspace_id,omitempty"`
	AppID       string    `json:"app_id,omitempty"`
	MachineID   string    `json:"machine_id,omitempty"`
	WorkerID    string    `json:"worker_id,omitempty"`
	PID         int32     `json:"pid,omitempty"`
	ProcessArgs []string  `json:"process_args,omitempty"`
	ProcessCwd  string    `json:"process_cwd,omitempty"`
	ProcessSeq  uint64    `json:"process_seq,omitempty"`
}

type LogsResponse

type LogsResponse struct {
	ObjectID      string      `json:"object_id,omitempty"`
	ObjectType    string      `json:"object_type,omitempty"`
	Logs          []LogRecord `json:"logs"`
	TotalExpected int         `json:"total_expected"`
	NextCursor    string      `json:"next_cursor,omitempty"`
	Streams       []string    `json:"streams,omitempty"`
}

type MCPOAuthConfig

type MCPOAuthConfig struct {
	Issuer              string `key:"issuer" json:"issuer"`
	Resource            string `key:"resource" json:"resource"`
	IntrospectionURL    string `key:"introspectionURL" json:"introspection_url"`
	IntrospectionSecret string `key:"introspectionSecret" json:"-"`
}

OAuth is opt-in. The public issuer/resource are canonical identifiers; the introspection URL can use the cluster's private account-service endpoint.

type MachineProvider

type MachineProvider string

type MachineStatus

type MachineStatus string
const (
	MachineStatusRegistered MachineStatus = "registered"
	MachineStatusPending    MachineStatus = "pending"
	MachineStatusAvailable  MachineStatus = "available"
	MachineStatusDisabled   MachineStatus = "disabled"
)

type ManagedComputeBYOCAWSConfig

type ManagedComputeBYOCAWSConfig struct {
	TemplateURL             string `key:"templateUrl" json:"template_url"`
	ControlRolePrincipalARN string `key:"controlRolePrincipalArn" json:"control_role_principal_arn"`
}

type ManagedComputeBYOCConfig

type ManagedComputeBYOCConfig struct {
	Pricing ManagedComputeBYOCPricingConfig `key:"pricing" json:"pricing"`
	AWS     ManagedComputeBYOCAWSConfig     `key:"aws" json:"aws"`
}

type ManagedComputeBYOCPricingConfig

type ManagedComputeBYOCPricingConfig struct {
	MemoryHourlyMicrosPerGB int64 `key:"memoryHourlyMicrosPerGB" json:"memory_hourly_micros_per_gb"`
	CPUHourlyMicrosPerVCPU  int64 `key:"cpuHourlyMicrosPerVCPU" json:"cpu_hourly_micros_per_vcpu"`
}

func (ManagedComputeBYOCPricingConfig) CPUHourlyMicrosPerVCPUOrDefault

func (c ManagedComputeBYOCPricingConfig) CPUHourlyMicrosPerVCPUOrDefault() int64

func (ManagedComputeBYOCPricingConfig) MemoryHourlyMicrosPerGBOrDefault

func (c ManagedComputeBYOCPricingConfig) MemoryHourlyMicrosPerGBOrDefault() int64

type ManagedComputeBillingConfig

type ManagedComputeBillingConfig struct {
	Mode               string                                 `key:"mode" json:"mode"`
	Endpoint           string                                 `key:"endpoint" json:"endpoint"`
	AuthToken          string                                 `key:"authToken" json:"auth_token"`
	PoolRoutes         []ManagedComputeBillingPoolRouteConfig `key:"poolRoutes" json:"pool_routes"`
	Required           bool                                   `key:"required" json:"required"`
	Timeout            time.Duration                          `key:"timeout" json:"timeout"`
	ReconcileInterval  time.Duration                          `key:"reconcileInterval" json:"reconcile_interval"`
	MinimumCreditCents int64                                  `key:"minimumCreditCents" json:"minimum_credit_cents"`
	// FailureGracePeriod is how long balance checks may keep failing (billing
	// unreachable, timing out or erroring) before managed reservations are
	// terminated. Pools keep running and accruing cost unchecked meanwhile.
	// Zero means the default; a negative value terminates on the first
	// failed check. Independent of CreditGracePeriod.
	FailureGracePeriod time.Duration `key:"failureGracePeriod" json:"failure_grace_period"`
	// CreditGracePeriod is how long a pool keeps running after its balance
	// first reads as exhausted, so an auto top-up or a manual purchase can
	// land before reserved machines are released. Zero means the default;
	// a negative value terminates immediately (the old behaviour).
	CreditGracePeriod time.Duration `key:"creditGracePeriod" json:"credit_grace_period"`
}

func (ManagedComputeBillingConfig) CreditGracePeriodOrDefault

func (c ManagedComputeBillingConfig) CreditGracePeriodOrDefault() time.Duration

func (ManagedComputeBillingConfig) FailureGracePeriodOrDefault

func (c ManagedComputeBillingConfig) FailureGracePeriodOrDefault() time.Duration

func (ManagedComputeBillingConfig) MinimumCreditCentsOrDefault

func (c ManagedComputeBillingConfig) MinimumCreditCentsOrDefault() int64

func (ManagedComputeBillingConfig) ReconcileIntervalOrDefault

func (c ManagedComputeBillingConfig) ReconcileIntervalOrDefault() time.Duration

func (ManagedComputeBillingConfig) TimeoutOrDefault

func (c ManagedComputeBillingConfig) TimeoutOrDefault() time.Duration

type ManagedComputeBillingPoolRouteConfig

type ManagedComputeBillingPoolRouteConfig struct {
	PoolNamePrefix     string `key:"poolNamePrefix" json:"pool_name_prefix"`
	Endpoint           string `key:"endpoint" json:"endpoint"`
	AuthToken          string `key:"authToken" json:"auth_token"`
	MinimumCreditCents int64  `key:"minimumCreditCents" json:"minimum_credit_cents"`
}

func (ManagedComputeBillingPoolRouteConfig) BillingConfig

type ManagedComputeConfig

type ManagedComputeConfig struct {
	BillableMarginPct *float64                    `key:"billableMarginPct" json:"billable_margin_pct"`
	Billing           ManagedComputeBillingConfig `key:"billing" json:"billing"`
	BYOC              ManagedComputeBYOCConfig    `key:"byoc" json:"byoc"`
	SSH               ManagedComputeSSHConfig     `key:"ssh" json:"ssh"`
}

func (ManagedComputeConfig) BillableMarginPctOrDefault

func (c ManagedComputeConfig) BillableMarginPctOrDefault() float64

type ManagedComputeSSHConfig

type ManagedComputeSSHConfig struct {
	Enabled bool `key:"enabled" json:"enabled"`
}

type ManagedEndpoint

type ManagedEndpoint struct {
	StubID  string         `json:"stub_id"`
	Version uint           `json:"version"`
	GitSHA  string         `json:"git_sha,omitempty"`
	Status  EndpointStatus `json:"status"`
	// Published is set when config.yaml enables the app; only published apps
	// are routable and their Publication is what config.yaml last applied.
	Published bool `json:"published"`
	Publication
	Spec      ManagedEndpointSpec `json:"spec"`
	CreatedAt time.Time           `json:"created_at"`
	UpdatedAt time.Time           `json:"updated_at"`
}

ManagedEndpoint is the record of one deployed app: its current stub and version, how it runs, and what config.yaml published.

func (*ManagedEndpoint) Callable

func (e *ManagedEndpoint) Callable() bool

func (*ManagedEndpoint) Enabled

func (e *ManagedEndpoint) Enabled() bool

Enabled: deployed and not retired. Callable: enabled and published under /v1.

type ManagedEndpointSpec

type ManagedEndpointSpec struct {
	ID           string             `json:"id"`
	Kind         EndpointKind       `json:"kind,omitempty"`
	Engine       string             `json:"engine,omitempty"`
	Port         uint32             `json:"port,omitempty"`
	Health       string             `json:"health,omitempty"`
	Metrics      string             `json:"metrics,omitempty"` // Prometheus path scraped for LLM engines without a harness
	Gpu          map[string]GpuSpec `json:"gpu,omitempty"`
	Rollout      Rollout            `json:"rollout,omitempty"`
	DrainSeconds uint32             `json:"drain_seconds"`
	Entrypoint   []string           `json:"entrypoint,omitempty"`
}

ManagedEndpointSpec is how app.py says a model server runs; only the platform publishing path may attach it to a stub.

func (*ManagedEndpointSpec) Normalize

func (s *ManagedEndpointSpec) Normalize()

func (*ManagedEndpointSpec) Validate

func (s *ManagedEndpointSpec) Validate() error

type ManagedEndpointStubConfig

type ManagedEndpointStubConfig struct {
	Endpoint *ManagedEndpointSpec `json:"endpoint,omitempty"`
}

ManagedEndpointStubConfig is the spec a managed endpoint stub carries.

type ManagedEndpointsConfig

type ManagedEndpointsConfig struct {
	Enabled     bool                          `key:"enabled" json:"enabled"`
	RoutePrefix string                        `key:"routePrefix" json:"route_prefix"`
	Preemption  ManagedEndpointsPreemption    `key:"preemption" json:"preemption"`
	Reconcile   ManagedEndpointsReconcile     `key:"reconcile" json:"reconcile"`
	Routing     ManagedEndpointsRoutingConfig `key:"routing" json:"routing"`
	// HeartbeatInterval is what replicas are told to heartbeat at.
	HeartbeatInterval time.Duration `key:"heartbeatInterval" json:"heartbeat_interval"`
	// ReplicaStaleAfter marks replicas failed when no heartbeat/probe arrives.
	ReplicaStaleAfter time.Duration `key:"replicaStaleAfter" json:"replica_stale_after"`
	// ProviderRevenueShare is the fraction of billed token revenue credited to
	// the workspace whose contributed machine served the request.
	ProviderRevenueShare float64 `key:"providerRevenueShare" json:"provider_revenue_share"`
}

ManagedEndpointsConfig is the cluster-level configuration for the managed endpoints platform. Only Enabled is required to turn it on; every other value has a production default (see ApplyDefaults). Endpoint stubs are owned by the cluster admin workspace and deployed by the endpoints repo's CI.

func (*ManagedEndpointsConfig) ApplyDefaults

func (c *ManagedEndpointsConfig) ApplyDefaults()

ApplyDefaults fills zero values with production defaults so consumers can read the config directly.

type ManagedEndpointsPreemption

type ManagedEndpointsPreemption struct {
	Enabled bool `key:"enabled" json:"enabled"`
}

type ManagedEndpointsReconcile

type ManagedEndpointsReconcile struct {
	Interval time.Duration `key:"interval" json:"interval"`
	// FailureBackoff delays rescheduling after a replica fails.
	FailureBackoff time.Duration `key:"failureBackoff" json:"failure_backoff"`
}

type ManagedEndpointsRoutingConfig

type ManagedEndpointsRoutingConfig struct {
	SlowStartSeconds uint32 `key:"slowStartSeconds" json:"slow_start_seconds"`
	// Cluster-wide in-flight caps, leased in Redis per request across every
	// gateway; the engines' own bound is the replicas' MaxConcurrency.
	PerWorkspaceConcurrency uint32 `key:"perWorkspaceConcurrency" json:"per_workspace_concurrency"`
	PerEndpointConcurrency  uint32 `key:"perEndpointConcurrency" json:"per_endpoint_concurrency"`
}

type MeterRow

type MeterRow struct {
	WindowStart time.Time
	Value       float64
	GroupBy     map[string]string
}

MeterRow is one aggregate returned by the billing meter: a window for one subject, split by the requested dimensions.

type MetricAverage

type MetricAverage struct {
	Value float64 `json:"value"`
}

type MetricsAggregationBucket

type MetricsAggregationBucket struct {
	Key                     int64         `json:"key"`
	KeyAsString             string        `json:"key_as_string"`
	DocCount                int           `json:"doc_count"`
	ContainerCount          MetricAverage `json:"container_count"`
	ContainerSeconds        MetricAverage `json:"container_seconds"`
	CPUConcurrency          MetricAverage `json:"cpu_concurrency"`
	GPUConcurrency          MetricAverage `json:"gpu_concurrency"`
	DiskReadBytesRateAvg    MetricAverage `json:"disk_read_bytes_per_second_avg"`
	DiskWriteBytesRateAvg   MetricAverage `json:"disk_write_bytes_per_second_avg"`
	NetworkRecvBytesRateAvg MetricAverage `json:"network_recv_bytes_per_second_avg"`
	NetworkSentBytesRateAvg MetricAverage `json:"network_sent_bytes_per_second_avg"`
	CPUPercentAvg           MetricAverage `json:"cpu_pct_avg"`
	CPUTotalAvg             MetricAverage `json:"cpu_total_avg"`
	CPUUsedAvg              MetricAverage `json:"cpu_used_avg"`
	CPUUsedTotal            MetricAverage `json:"cpu_used_total"`
	DiskReadBytesAvg        MetricAverage `json:"disk_read_bytes_avg"`
	DiskWriteBytesAvg       MetricAverage `json:"disk_write_bytes_avg"`
	GPUMemoryTotalBytesAvg  MetricAverage `json:"gpu_memory_total_bytes_avg"`
	GPUMemoryUsedBytesAvg   MetricAverage `json:"gpu_memory_used_bytes_avg"`
	GPUMemoryUsedBytesTotal MetricAverage `json:"gpu_memory_used_bytes_total"`
	MemoryRSSBytesAvg       MetricAverage `json:"memory_rss_bytes_avg"`
	MemoryRSSBytesTotal     MetricAverage `json:"memory_rss_bytes_total"`
	MemoryTotalBytesAvg     MetricAverage `json:"memory_total_bytes_avg"`
	MemoryVMSBytesAvg       MetricAverage `json:"memory_vms_bytes_avg"`
	MemorySwapBytesAvg      MetricAverage `json:"memory_swap_bytes_avg"`
	NetworkRecvBytesAvg     MetricAverage `json:"network_recv_bytes_avg"`
	NetworkSentBytesAvg     MetricAverage `json:"network_sent_bytes_avg"`
	NetworkRecvPacketsAvg   MetricAverage `json:"network_recv_packets_avg"`
	NetworkSentPacketsAvg   MetricAverage `json:"network_sent_packets_avg"`
}

type MetricsCollector

type MetricsCollector string
var (
	MetricsCollectorPrometheus MetricsCollector = "prometheus"
	MetricsCollectorOpenMeter  MetricsCollector = "openmeter"
	MetricsCollectorNone       MetricsCollector = "none"
)

type MetricsTimeseriesResponse

type MetricsTimeseriesResponse struct {
	ScannedRecords uint64 `json:"scanned_records"`
	Truncated      bool   `json:"truncated"`
	Timeseries     struct {
		AggregationBuckets []MetricsAggregationBucket `json:"aggregation_buckets"`
	} `json:"timeseries"`
}

type MonitoringConfig

type MonitoringConfig struct {
	MetricsCollector         string                  `key:"metricsCollector" json:"metrics_collector"`
	Prometheus               PrometheusConfig        `key:"prometheus" json:"prometheus"`
	OpenMeter                OpenMeterConfig         `key:"openmeter" json:"openmeter"`
	Telemetry                TelemetryConfig         `key:"telemetry" json:"telemetry"`
	ContainerMetricsInterval time.Duration           `key:"containerMetricsInterval" json:"container_metrics_interval"`
	VictoriaMetrics          VictoriaMetricsConfig   `key:"victoriametrics" json:"victoriametrics"`
	ContainerCostHookConfig  ContainerCostHookConfig `key:"containerCostHook" json:"container_cost_hook"`
}

func (MonitoringConfig) Metered

func (m MonitoringConfig) Metered() bool

Metered reports whether a collector is configured.

func (MonitoringConfig) Metering

func (m MonitoringConfig) Metering() MonitoringConfig

Metering is the part of a monitoring config that records and prices container usage: the collector with its credentials and the cost hook. A control-plane managed worker boots without one and receives the control plane's at startup.

func (*MonitoringConfig) SetMetering

func (m *MonitoringConfig) SetMetering(metering MonitoringConfig)

SetMetering replaces the metering part of m, keeping its local settings.

type Mount

type Mount struct {
	LocalPath        string                  `json:"local_path"`
	MountPath        string                  `json:"mount_path"`
	LinkPath         string                  `json:"link_path"`
	ReadOnly         bool                    `json:"read_only"`
	MountType        string                  `json:"mount_type"`
	MountPointConfig *MountPointConfig       `json:"mountpoint_config"`
	DurableDisk      *DurableDiskMountConfig `json:"durable_disk,omitempty"`
}

@go2proto

func NewMountFromProto

func NewMountFromProto(in *pb.Mount) *Mount

func (*Mount) ToProto

func (m *Mount) ToProto() *pb.Mount

type MountPointConfig

type MountPointConfig struct {
	BucketName     string `json:"s3_bucket"`
	AccessKey      string `json:"access_key"`
	SecretKey      string `json:"secret_key"`
	EndpointURL    string `json:"bucket_url"`
	Region         string `json:"region"`
	ReadOnly       bool   `json:"read_only"`
	ForcePathStyle bool   `json:"force_path_style"`
}

@go2proto

func NewMountPointConfigFromProto

func NewMountPointConfigFromProto(in *pb.MountPointConfig) *MountPointConfig

func (*MountPointConfig) ToProto

func (m *MountPointConfig) ToProto() *pb.MountPointConfig

func (MountPointConfig) WithoutCredentials

func (m MountPointConfig) WithoutCredentials() MountPointConfig

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool
}

@go2proto

func (NullTime) Now

func (t NullTime) Now() NullTime

func (*NullTime) Scan

func (t *NullTime) Scan(value interface{}) error

func (NullTime) Serialize

func (t NullTime) Serialize() interface{}

func (NullTime) Value

func (t NullTime) Value() (driver.Value, error)

type NvidiaCRIUConfig

type NvidiaCRIUConfig struct {
}

type Object

type Object struct {
	Id          uint   `db:"id" json:"id" serializer:"id,source:external_id"`
	ExternalId  string `db:"external_id" json:"external_id,omitempty" serializer:"external_id"`
	Hash        string `db:"hash" json:"hash" serializer:"hash"`
	Size        int64  `db:"size" json:"size" serializer:"size"`
	WorkspaceId uint   `db:"workspace_id" json:"workspace_id"` // Foreign key to Workspace
	CreatedAt   Time   `db:"created_at" json:"created_at"`
}

@go2proto

func NewObjectFromProto

func NewObjectFromProto(in *pb.Object) *Object

func (*Object) ToProto

func (o *Object) ToProto() *pb.Object

type ObjectStoreConfig

type ObjectStoreConfig struct {
	BucketName     string `key:"bucketName" json:"bucket_name"`
	AccessKey      string `key:"accessKey" json:"access_key"`
	SecretKey      string `key:"secretKey" json:"secret_key"`
	EndpointURL    string `key:"endpointURL" json:"bucket_url"`
	Region         string `key:"region" json:"region"`
	ReadOnly       bool   `key:"readOnly" json:"read_only"`
	ForcePathStyle bool   `key:"forcePathStyle" json:"force_path_style"`
}

type OnDemandBudgetConfig

type OnDemandBudgetConfig struct {
	MaxHourlyCents int64 `key:"maxHourlyCents" json:"max_hourly_cents"`
	MaxDailyCents  int64 `key:"maxDailyCents" json:"max_daily_cents"`
}

OnDemandBudgetConfig caps platform spend on failover hardware. Operators type cents; micro-dollars stay internal to the reservation wire format.

type OnDemandConfig

type OnDemandConfig struct {
	Budget             OnDemandBudgetConfig `key:"budget" json:"budget"`
	ScaleDownAfterIdle time.Duration        `key:"scaleDownAfterIdle" json:"scale_down_after_idle"`
}

type OpenMeterConfig

type OpenMeterConfig struct {
	ServerUrl string `key:"serverUrl" json:"server_url"`
	ApiKey    string `key:"apiKey" json:"api_key"`
}

type OpenRouterDatacenter

type OpenRouterDatacenter struct {
	CountryCode string `json:"country_code"`
}

type OpenRouterMetadata

type OpenRouterMetadata struct {
	HuggingFaceID       string                 `json:"hugging_face_id,omitempty"`
	Quantization        string                 `json:"quantization,omitempty"`
	MaxOutputTokens     uint32                 `json:"max_output_tokens,omitempty"`
	SupportedParameters map[string]any         `json:"supported_parameters,omitempty"`
	Streaming           *bool                  `json:"streaming,omitempty"`
	Datacenters         []OpenRouterDatacenter `json:"datacenters,omitempty"`
}

OpenRouterMetadata opts an endpoint into the provider catalog. It lives in config.yaml, separately from the SDK/runtime spec, so correcting provider metadata neither rebuilds the image nor replaces serving replicas. Prices and context length remain authoritative in the endpoint's app.

func (*OpenRouterMetadata) Output

func (m *OpenRouterMetadata) Output(kind string) map[string]any

Output supplies the declared features for the endpoint's single output. An empty descriptor map makes no claims about optional feature support.

func (*OpenRouterMetadata) UnmarshalYAML

func (m *OpenRouterMetadata) UnmarshalYAML(unmarshal func(any) error) error

Decode through JSON to preserve strict scalar types and descriptor maps: yaml.v2 otherwise truncates floats into integer fields and coerces strings.

func (*OpenRouterMetadata) Validate

func (m *OpenRouterMetadata) Validate() error

func (*OpenRouterMetadata) ValidateFor

func (m *OpenRouterMetadata) ValidateFor(kind EndpointKind, catalog Catalog, pricing Pricing) error

ValidateFor checks the metadata against the published app: token pricing belongs to text models, embeddings price only their input, and LLM output limits must fit the declared context length.

type PodConfig

type PodConfig struct {
	TCP PodTCPConfig `key:"tcp" json:"tcp"`
}

type PodTCPConfig

type PodTCPConfig struct {
	Enabled      bool   `key:"enabled" json:"enabled"`
	ExternalPort int    `key:"externalPort" json:"external_port"`
	ExternalHost string `key:"externalHost" json:"external_host"`
	Port         int    `key:"port" json:"port"`
	CertFile     string `key:"certFile" json:"cert_file"`
	KeyFile      string `key:"keyFile" json:"key_file"`
	// ServiceProxyTarget is host:port of this listener as workers reach it.
	// When set, containers that reference *.ExternalHost are pinned to a
	// worker-side proxy to it, which opens TLS for clients that don't, instead
	// of resolving ExternalHost over DNS. Agent-hosted workers ask the gateway
	// for its public listener instead.
	ServiceProxyTarget string `key:"serviceProxyTarget" json:"service_proxy_target"`
	// ServiceProxyVerify makes the proxy verify the target's certificate, as it
	// does whenever CertFile is set.
	ServiceProxyVerify bool `key:"serviceProxyVerify" json:"service_proxy_verify"`
}

func (*PodTCPConfig) GetExternalURL

func (p *PodTCPConfig) GetExternalURL() string

type PoolConfig

type PoolConfig struct {
	Name           string   `json:"name,omitempty"`
	GPUs           []string `json:"gpu,omitempty"`
	Nodes          uint32   `json:"nodes,omitempty"`
	OfferID        string   `json:"offer_id,omitempty"`
	TTL            string   `json:"ttl,omitempty"`
	MaxSpend       float64  `json:"max_spend,omitempty"`
	Providers      []string `json:"providers,omitempty"`
	Regions        []string `json:"regions,omitempty"`
	MinReliability float64  `json:"min_reliability,omitempty"`
	Selector       string   `json:"selector,omitempty"`
	Fallback       string   `json:"fallback,omitempty"`
}

func (*PoolConfig) RequiresReservation

func (p *PoolConfig) RequiresReservation() bool

type PoolMetrics

type PoolMetrics struct {
	WorkspaceID          string  `json:"workspace_id"`
	PoolName             string  `json:"pool_name"`
	MachineCount         int     `json:"machine_count"`
	ContainerCount       uint32  `json:"container_count"`
	GPUCount             uint32  `json:"gpu_count"`
	FreeGPUCount         uint32  `json:"free_gpu_count"`
	CPUUtilizationPct    float64 `json:"cpu_utilization_pct"`
	MemoryUtilizationPct float64 `json:"memory_utilization_pct"`
	GPUUtilizationPct    float64 `json:"gpu_utilization_pct"`
	DiskUsagePct         float64 `json:"disk_usage_pct"`
	HourlyCost           float64 `json:"hourly_cost"`
	EstimatedCost        float64 `json:"estimated_cost"`
}

type PoolMetricsPoint

type PoolMetricsPoint struct {
	Timestamp int64         `json:"timestamp"`
	Pools     []PoolMetrics `json:"pools"`
}

type PoolMetricsTimeseriesResponse

type PoolMetricsTimeseriesResponse struct {
	Workspaces     []string           `json:"workspaces"`
	Points         []PoolMetricsPoint `json:"points"`
	ScannedRecords uint64             `json:"scanned_records"`
	Truncated      bool               `json:"truncated"`
}

type PoolMode

type PoolMode string
var (
	PoolModeLocal    PoolMode = "local"
	PoolModeExternal PoolMode = "external"
	PoolModePrivate  PoolMode = "private"
	// Provider pools are workspace-contributed machines that serve managed
	// endpoints only; the workspace earns a share of the tokens sold on them.
	PoolModeProvider PoolMode = "provider"
)

func (PoolMode) AgentHosted

func (m PoolMode) AgentHosted() bool

AgentHosted reports whether pools of this mode run on agent-managed machines outside the cluster. Such workers hold no static credentials and use gateway-brokered access for images and caches.

type PostgresConfig

type PostgresConfig struct {
	Host          string `key:"host" json:"host"`
	Port          int    `key:"port" json:"port"`
	Name          string `key:"name" json:"name"`
	Username      string `key:"username" json:"username"`
	Password      string `key:"password" json:"password"`
	TimeZone      string `key:"timezone" json:"timezone"`
	EnableTLS     bool   `key:"enableTLS" json:"enable_tls"`
	EncryptionKey string `key:"encryptionKey" json:"encryption_key"`
	// EncryptCredentials stores token keys and workspace signing keys encrypted
	// with EncryptionKey and encrypts existing rows. Gateways without support
	// for encrypted rows cannot authenticate them, so enable it after rollout,
	// and keep it enabled: sealed token keys are only found by hash.
	EncryptCredentials bool `key:"encryptCredentials" json:"encrypt_credentials"`
	// MaxOpenConns caps this process's database connections; 0 is unbounded.
	MaxOpenConns int `key:"maxOpenConns" json:"max_open_conns"`
	// WarmConnections opens a bounded pool before accepting requests. Zero
	// disables prewarming; the target is capped at MaxOpenConns and 128.
	WarmConnections int `key:"warmConnections" json:"warm_connections"`
	// VMBurstBatchSize groups simultaneous VM and stub mutations into durable
	// statement. Values <= 1 disable batching; the collection window is 1 ms.
	VMBurstBatchSize int `key:"vmBurstBatchSize" json:"vm_burst_batch_size"`
}

type Pricing

type Pricing struct {
	Request            string `json:"request,omitempty" yaml:"request"`
	PromptTokens       string `json:"prompt_tokens,omitempty" yaml:"prompt_tokens"`
	CompletionTokens   string `json:"completion_tokens,omitempty" yaml:"completion_tokens"`
	CachedPromptTokens string `json:"cached_prompt_tokens,omitempty" yaml:"cached_prompt_tokens"`
}

Pricing has exactly two forms: a flat price per successful request, or per-token prices. Free offerings declare an explicit "0"; an empty Pricing is unpriced and rejected at publication.

func (Pricing) Free

func (p Pricing) Free() bool

Free reports whether every declared price is zero.

func (Pricing) PerRequest

func (p Pricing) PerRequest() bool

func (Pricing) PerToken

func (p Pricing) PerToken() bool

func (Pricing) Price

func (p Pricing) Price(w Work) (Cost, error)

Price computes the exact cost of w under p. The total is rounded once to micro-USD; the micro-dollars lost to flooring each component go to the components with the largest fractions, so the breakdown reconciles.

func (Pricing) Validate

func (p Pricing) Validate() error

type ProcessInfo

type ProcessInfo struct {
	Running  bool     `json:"running"`
	PID      int32    `json:"pid"`
	Cmd      string   `json:"cmd"`
	Cwd      string   `json:"cwd"`
	Env      []string `json:"env"`
	ExitCode int32    `json:"exit_code"`
}

@go2proto

type PrometheusConfig

type PrometheusConfig struct {
	AgentUrl      string `key:"agentUrl" json:"agent_url"`
	AgentUsername string `key:"agentUsername" json:"agent_username"`
	AgentPassword string `key:"agentPassword" json:"agent_password"`
	ScrapeWorkers bool   `key:"scrapeWorkers" json:"scrape_workers"`
	Port          int    `key:"port" json:"port"`
}

type ProviderConfig

type ProviderConfig struct {
	Vast      VastProviderConfig      `key:"vast" json:"vast"`
	Shadeform ShadeformProviderConfig `key:"shadeform" json:"shadeform"`
	Hetzner   HetznerProviderConfig   `key:"hetzner" json:"hetzner"`
}

type Publication

type Publication struct {
	Catalog           Catalog             `json:"catalog" yaml:"catalog"`
	Public            bool                `json:"public" yaml:"public"`
	AllowedWorkspaces []string            `json:"allowed_workspaces,omitempty" yaml:"allowed_workspaces"`
	Pricing           Pricing             `json:"pricing" yaml:"pricing"`
	OpenRouter        *OpenRouterMetadata `json:"openrouter,omitempty" yaml:"openrouter"`
}

Publication is what config.yaml declares about one app besides placement.

func (*Publication) Allows

func (p *Publication) Allows(workspaceID, workspaceName string) bool

Allows reports whether a workspace may discover and call the app.

type PythonStandaloneConfig

type PythonStandaloneConfig struct {
	Versions              map[string]string `key:"versions" json:"versions"`
	InstallScriptTemplate string            `key:"installScriptTemplate" json:"install_script_template"`
}

type PythonVersion

type PythonVersion string
const (
	Python3   PythonVersion = "python3"
	Python38  PythonVersion = "python3.8"
	Python39  PythonVersion = "python3.9"
	Python310 PythonVersion = "python3.10"
	Python311 PythonVersion = "python3.11"
	Python312 PythonVersion = "python3.12"
)

func (PythonVersion) String

func (p PythonVersion) String() string

type QueryFilter

type QueryFilter struct {
	Field string
	Value interface{}
}

type QuotaDoesNotExistError

type QuotaDoesNotExistError struct{}

func (*QuotaDoesNotExistError) Error

func (e *QuotaDoesNotExistError) Error() string

type RedisConfig

type RedisConfig struct {
	Addrs              []string      `key:"addrs" json:"addrs"`
	Mode               RedisMode     `key:"mode" json:"mode"`
	ClientName         string        `key:"clientName" json:"client_name"`
	EnableTLS          bool          `key:"enableTLS" json:"enable_tls"`
	InsecureSkipVerify bool          `key:"insecureSkipVerify" json:"insecure_skip_verify"`
	MinIdleConns       int           `key:"minIdleConns" json:"min_idle_conns"`
	MaxIdleConns       int           `key:"maxIdleConns" json:"max_idle_conns"`
	ConnMaxIdleTime    time.Duration `key:"connMaxIdleTime" json:"conn_max_idle_time"`
	ConnMaxLifetime    time.Duration `key:"connMaxLifetime" json:"conn_max_lifetime"`
	DialTimeout        time.Duration `key:"dialTimeout" json:"dial_timeout"`
	ReadTimeout        time.Duration `key:"readTimeout" json:"read_timeout"`
	WriteTimeout       time.Duration `key:"writeTimeout" json:"write_timeout"`
	MaxRedirects       int           `key:"maxRedirects" json:"max_redirects"`
	MaxRetries         int           `key:"maxRetries" json:"max_retries"`
	PoolSize           int           `key:"poolSize" json:"pool_size"`
	Username           string        `key:"username" json:"username"`
	Password           string        `key:"password" json:"password"`
	RouteByLatency     bool          `key:"routeByLatency" json:"route_by_latency"`
}

type RedisMode

type RedisMode string
const (
	RedisModeSingle  RedisMode = "single"
	RedisModeCluster RedisMode = "cluster"
)

type ReplicaCapacity

type ReplicaCapacity struct {
	InFlight            int64 `json:"in_flight"`
	MaxConcurrency      int64 `json:"max_concurrency"`
	Running             int64 `json:"running"`
	Waiting             int64 `json:"waiting"`
	KVCacheFreeMilli    int64 `json:"kv_cache_free_milli"`
	DecodeTokensPerSec  int64 `json:"decode_tokens_per_sec"`
	PromptTokensPerSec  int64 `json:"prompt_tokens_per_sec"`
	TTFTMs              int64 `json:"ttft_ms"`
	TPOTMs              int64 `json:"tpot_ms"`
	PrefixCacheHitMilli int64 `json:"prefix_cache_hit_milli"`
}

ReplicaCapacity is the harness-reported serving capacity.

type ReplicaConfig

type ReplicaConfig struct {
	Revision      uint64          `json:"revision"`
	Config        json.RawMessage `json:"config,omitempty"`
	Author        string          `json:"author,omitempty"` // caller's label
	Actor         string          `json:"actor,omitempty"`  // authenticated token
	SetAt         time.Time       `json:"set_at,omitempty"`
	AckedRevision uint64          `json:"acked_revision"`
	Applied       bool            `json:"applied"`
	Error         string          `json:"error,omitempty"`
	Effective     json.RawMessage `json:"effective,omitempty"`
	AckedAt       time.Time       `json:"acked_at,omitempty"`
}

ReplicaConfig is the live harness config of one replica: the revision last asked for and the engine's answer to it. It dies with the replica.

func (*ReplicaConfig) Ack

func (c *ReplicaConfig) Ack(revision uint64, applied bool, errMsg string, effective json.RawMessage, now time.Time) bool

Ack records the engine's answer to an issued, not yet superseded revision.

func (ReplicaConfig) Acked

func (c ReplicaConfig) Acked() bool

type ReplicaProbe

type ReplicaProbe struct {
	Port    uint32 `json:"port"`
	Health  string `json:"health,omitempty"`
	Metrics string `json:"metrics,omitempty"`
}

ReplicaProbe is the readiness contract of one deployment version.

type ReplicaStatus

type ReplicaStatus string
const (
	ReplicaStatusScheduling ReplicaStatus = "scheduling"
	ReplicaStatusLoading    ReplicaStatus = "loading"
	ReplicaStatusReady      ReplicaStatus = "ready"
	ReplicaStatusDraining   ReplicaStatus = "draining"
	ReplicaStatusEvicting   ReplicaStatus = "evicting"
	ReplicaStatusEvicted    ReplicaStatus = "evicted"
	ReplicaStatusFailed     ReplicaStatus = "failed"
	ReplicaStatusStopped    ReplicaStatus = "stopped"
)

func (ReplicaStatus) Terminal

func (s ReplicaStatus) Terminal() bool

type Rollout

type Rollout string

Rollout says how a new version replaces the old: wait for spare capacity (default) or replace running replicas in place.

const (
	RolloutWaitForCapacity Rollout = "wait_for_capacity"
	RolloutReplace         Rollout = "replace"
)

type RouteMetrics

type RouteMetrics struct {
	EndpointID       string        `json:"endpoint_id"`
	GPU              string        `json:"gpu,omitempty"`
	ReplicaID        string        `json:"replica_id,omitempty"`
	ConfigRevision   uint64        `json:"config_revision,omitempty"`
	Window           time.Duration `json:"window"`
	Requests         int64         `json:"requests"`
	Errors           int64         `json:"errors"`
	PromptTokens     int64         `json:"prompt_tokens"`
	CompletionTokens int64         `json:"completion_tokens"`
	CostMicroUSD     int64         `json:"cost_micro_usd"`
	DurationSumMs    int64         `json:"duration_sum_ms"`
	TTFTSumMs        int64         `json:"ttft_sum_ms"`
	TTFTCount        int64         `json:"ttft_count"`
	QueueWaitSumMs   int64         `json:"queue_wait_sum_ms"`
}

RouteMetrics are routing diagnostics aggregated over minute buckets; they are derived from settled charges but are not the billing record.

func (*RouteMetrics) Fields

func (m *RouteMetrics) Fields() map[string]*int64

func (RouteMetrics) MeanTPOTMs

func (m RouteMetrics) MeanTPOTMs() int64

func (RouteMetrics) MeanTTFTMs

func (m RouteMetrics) MeanTTFTMs() int64

type RunnerConfig

type RunnerConfig struct {
	BaseImageName     string                 `key:"baseImageName" json:"base_image_name"`
	BaseImageRegistry string                 `key:"baseImageRegistry" json:"base_image_registry"`
	Tags              map[string]string      `key:"tags" json:"tags"`
	PythonStandalone  PythonStandaloneConfig `key:"pythonStandalone" json:"python_standalone"`
}

type Runtime

type Runtime struct {
	Cpu      int64     `json:"cpu"`
	Gpu      GpuType   `json:"gpu"`
	GpuCount uint32    `json:"gpu_count"`
	Memory   int64     `json:"memory"`
	ImageId  string    `json:"image_id"`
	Gpus     []GpuType `json:"gpus"`
}

type RuntimeConfig

type RuntimeConfig struct {
	// gVisor-specific configuration
	GVisorPlatform  string   `key:"gvisorPlatform" json:"gvisor_platform"`    // "kvm", "systrap", or "ptrace"
	GVisorRoot      string   `key:"gvisorRoot" json:"gvisor_root"`            // Root directory for gVisor state (default: "/run/gvisor")
	GVisorExtraArgs []string `key:"gvisorExtraArgs" json:"gvisor_extra_args"` // Additional runsc flags appended for this pool
}

func (RuntimeConfig) WithDefaults

func (c RuntimeConfig) WithDefaults(runtime string) RuntimeConfig

type S2Config

type S2Config struct {
	ApiKey            string `key:"apiKey" json:"api_key"`
	Basin             string `key:"basin" json:"basin"`
	StreamPrefix      string `key:"streamPrefix" json:"stream_prefix"`
	LogApiKey         string `key:"logApiKey" json:"log_api_key"`
	LogStreamPrefix   string `key:"logStreamPrefix" json:"log_stream_prefix"`
	EventApiKey       string `key:"eventApiKey" json:"event_api_key"`
	EventStreamPrefix string `key:"eventStreamPrefix" json:"event_stream_prefix"`
}

type S3ImageRegistryConfig

type S3ImageRegistryConfig struct {
	BucketName     string `key:"bucketName" json:"bucket_name"`
	AccessKey      string `key:"accessKey" json:"access_key"`
	SecretKey      string `key:"secretKey" json:"secret_key"`
	Region         string `key:"region" json:"region"`
	Endpoint       string `key:"endpoint" json:"endpoint"`
	ForcePathStyle bool   `key:"forcePathStyle" json:"force_path_style"`
}

type SandboxStatus

type SandboxStatus string
const (
	SandboxStatusPending  SandboxStatus = "pending"
	SandboxStatusRunning  SandboxStatus = "running"
	SandboxStatusStopping SandboxStatus = "stopping"
	SandboxStatusExited   SandboxStatus = "exited"
)

type ScheduledJob

type ScheduledJob struct {
	Id         uint64 `db:"id"`
	ExternalId string `db:"external_id"`

	JobId    uint64              `db:"job_id"`
	JobName  string              `db:"job_name"`
	Schedule string              `db:"job_schedule"`
	Payload  ScheduledJobPayload `db:"job_payload"`

	StubId       uint         `db:"stub_id"`
	DeploymentId uint         `db:"deployment_id"`
	CreatedAt    time.Time    `db:"created_at"`
	UpdatedAt    time.Time    `db:"updated_at"`
	DeletedAt    sql.NullTime `db:"deleted_at"`
}

type ScheduledJobPayload

type ScheduledJobPayload struct {
	StubId        string      `json:"stub_id"`
	WorkspaceName string      `json:"workspace_name"`
	TaskPayload   TaskPayload `json:"task_payload"`
}

func (*ScheduledJobPayload) Scan

func (p *ScheduledJobPayload) Scan(value interface{}) error

func (ScheduledJobPayload) Value

func (p ScheduledJobPayload) Value() (driver.Value, error)

type SchedulingConfig

type SchedulingConfig struct {
	Failover FailoverConfig `key:"failover" json:"failover"`
}

type Schema

type Schema struct {
	Fields map[string]SchemaField `json:"fields"`
}

func NewSchemaFromProto

func NewSchemaFromProto(in *pb.Schema) *Schema

func (*Schema) ToProto

func (s *Schema) ToProto() *pb.Schema

func (*Schema) ToString

func (s *Schema) ToString() string

type SchemaField

type SchemaField struct {
	Type   string  `json:"type"`
	Fields *Schema `json:"fields,omitempty"` // Only for type == "object"
}

type Secret

type Secret struct {
	Hosts         pq.StringArray `db:"hosts" json:"hosts"`
	Placeholder   string         `db:"placeholder" json:"placeholder,omitempty"`
	Id            uint           `db:"id" json:"-"`
	ExternalId    string         `db:"external_id" json:"external_id,omitempty"`
	CreatedAt     time.Time      `db:"created_at" json:"created_at,omitempty"`
	UpdatedAt     time.Time      `db:"updated_at" json:"updated_at,omitempty"`
	Name          string         `db:"name" json:"name"`
	Value         string         `db:"value" json:"value,omitempty"`
	WorkspaceId   uint           `db:"workspace_id" json:"workspace_id,omitempty"`
	LastUpdatedBy *uint          `db:"last_updated_by" json:"last_updated_by,omitempty"`
	// EnvName is the variable a bound secret is injected under. Stub config only, not a column.
	EnvName string `db:"-" json:"env_name,omitempty"`
}

func (Secret) EnvVarName

func (s Secret) EnvVarName() string

EnvVarName is the variable the secret is exposed as inside the container.

type SecretBinding

type SecretBinding struct {
	EnvName     string   `json:"env_name"`
	Placeholder string   `json:"placeholder"`
	Hosts       []string `json:"hosts"`
	Value       string   `json:"value,omitempty"`
	SecretName  string   `json:"secret_name"`
}

SecretBinding stays on the worker; only its placeholder enters the guest. @go2proto

func CloneSecretBindings

func CloneSecretBindings(bindings []SecretBinding) []SecretBinding

func SecretBindingsFromProto

func SecretBindingsFromProto(bindings []*pb.SecretBinding) []SecretBinding

type ServingConfig

type ServingConfig struct {
	AppKind         string                 `json:"app_kind,omitempty" serializer:"app_kind,omitempty"`
	ServingProtocol string                 `json:"serving_protocol,omitempty" serializer:"serving_protocol,omitempty"`
	Database        *DatabaseServingConfig `json:"database,omitempty" serializer:"database,omitempty"`
}

type ShadeformProviderConfig

type ShadeformProviderConfig struct {
	ApiKey  string `key:"apiKey" json:"api_key"`
	BaseURL string `key:"baseURL" json:"base_url"`
}

type Stack

type Stack struct {
	Id          uint            `db:"id" json:"-"`
	ExternalId  string          `db:"external_id" json:"id"`
	WorkspaceId uint            `db:"workspace_id" json:"-"`
	Name        string          `db:"name" json:"name"`
	Spec        json.RawMessage `db:"spec" json:"spec"`
	CreatedAt   time.Time       `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time       `db:"updated_at" json:"updated_at"`
}

Stack holds dashboard layout and agent deployment state in Spec.

type StopContainerArgs

type StopContainerArgs struct {
	ContainerId string              `json:"container_id"`
	Force       bool                `json:"force"`
	Reason      StopContainerReason `json:"reason"`
}

func ToStopContainerArgs

func ToStopContainerArgs(m map[string]any) (*StopContainerArgs, error)

func (StopContainerArgs) ToMap

func (a StopContainerArgs) ToMap() (map[string]any, error)

type StopContainerReason

type StopContainerReason string
const (
	// StopContainerReasonTtl is used when a container is stopped due to some TTL expiration
	StopContainerReasonTtl StopContainerReason = "TTL"
	// StopContainerReasonUser is used when a container is stopped by a user request
	StopContainerReasonUser StopContainerReason = "USER"
	// StopContainerReasonScheduler is used when a container is stopped by the scheduler
	StopContainerReasonScheduler StopContainerReason = "SCHEDULER"
	// StopContainerReasonAdmin is used when a container is stopped by an admin request (i.e. draining a worker)
	StopContainerReasonAdmin StopContainerReason = "ADMIN"
	// StopContainerReasonInsufficientCredits is used when the scheduler stops a
	// container because its workspace has run out of prepaid credit
	StopContainerReasonInsufficientCredits StopContainerReason = "INSUFFICIENT_CREDITS"
	// StopContainerReasonEvicted is used when the scheduler stops an evictable
	// container to make room for a non-evictable request
	StopContainerReasonEvicted StopContainerReason = "EVICTED"

	StopContainerReasonUnknown StopContainerReason = "UNKNOWN"
)

func (StopContainerReason) ExitCode

func (r StopContainerReason) ExitCode() (ContainerExitCode, bool)

ExitCode returns the terminal code shared by assigned and pending stops.

type StorageConfig

type StorageConfig struct {
	WorkspaceStorage WorkspaceStorageConfig `key:"workspaceStorage" json:"workspace_storage"`
}

type StringSlice

type StringSlice []string

Custom type for a slice of strings

func (*StringSlice) UnmarshalParam

func (s *StringSlice) UnmarshalParam(src string) error

UnmarshalParam implements the echo query parameter unmarshaler interface

type Stub

type Stub struct {
	Id            uint     `db:"id" json:"id,omitempty" serializer:"id,source:external_id"`
	ExternalId    string   `db:"external_id" json:"external_id,omitempty" serializer:"external_id"`
	Name          string   `db:"name" json:"name" serializer:"name"`
	Type          StubType `db:"type" json:"type" serializer:"type"`
	Config        string   `db:"config" json:"config" serializer:"config"`
	ConfigVersion uint     `db:"config_version" json:"config_version" serializer:"config_version"`
	ObjectId      uint     `db:"object_id" json:"object_id"`       // Foreign key to Object
	WorkspaceId   uint     `db:"workspace_id" json:"workspace_id"` // Foreign key to Workspace
	CreatedAt     Time     `db:"created_at" json:"created_at" serializer:"created_at"`
	UpdatedAt     Time     `db:"updated_at" json:"updated_at" serializer:"updated_at"`
	Public        bool     `db:"public" json:"public" serializer:"public"`
	AppId         uint     `db:"app_id" json:"app_id,omitempty"` // Foreign key to App
}

@go2proto

func NewStubFromProto

func NewStubFromProto(in *pb.Stub) *Stub

func (*Stub) SanitizeConfig

func (s *Stub) SanitizeConfig() error

func (*Stub) ToProto

func (s *Stub) ToProto() *pb.Stub

func (*Stub) UnmarshalConfig

func (s *Stub) UnmarshalConfig() (*StubConfigV1, error)

type StubConfigLimitedValues

type StubConfigLimitedValues struct {
	Inputs        *Schema    `json:"inputs"`
	Outputs       *Schema    `json:"outputs"`
	TaskPolicy    TaskPolicy `json:"task_policy"`
	PythonVersion string     `json:"python_version"`
	Runtime       Runtime    `json:"runtime"`
}

type StubConfigV1

type StubConfigV1 struct {
	Runtime            Runtime            `json:"runtime"`
	CPUTier            CPUTier            `json:"cpu_tier,omitempty"`
	Handler            string             `json:"handler"`
	OnStart            string             `json:"on_start"`
	OnDeploy           string             `json:"on_deploy"`
	OnDeployStubId     string             `json:"on_deploy_stub_id"`
	PythonVersion      string             `json:"python_version"`
	KeepWarmSeconds    int                `json:"keep_warm_seconds"`
	MaxPendingTasks    uint               `json:"max_pending_tasks"`
	CallbackUrl        string             `json:"callback_url"`
	TaskPolicy         TaskPolicy         `json:"task_policy"`
	Workers            uint               `json:"workers"`
	ConcurrentRequests uint               `json:"concurrent_requests"`
	Authorized         bool               `json:"authorized"`
	Volumes            []*pb.Volume       `json:"volumes"`
	Secrets            []Secret           `json:"secrets,omitempty"`
	Env                []string           `json:"env,omitempty"`
	Autoscaler         *Autoscaler        `json:"autoscaler"`
	Extra              json.RawMessage    `json:"extra"`
	CheckpointEnabled  bool               `json:"checkpoint_enabled"`
	CheckpointTrigger  *CheckpointTrigger `json:"checkpoint_trigger,omitempty"`
	WorkDir            string             `json:"work_dir"`
	EntryPoint         []string           `json:"entry_point"`
	Ports              []uint32           `json:"ports"`
	Inputs             *Schema            `json:"inputs"`
	Outputs            *Schema            `json:"outputs"`
	TCP                bool               `json:"tcp"`
	BlockNetwork       bool               `json:"block_network"`
	AllowList          []string           `json:"allow_list"`
	DockerEnabled      bool               `json:"docker_enabled"`
	// UseVM runs sandboxes in a microvm pool instead of a container runtime.
	UseVM bool `json:"use_vm,omitempty"`
	// Hostname to set inside the container.
	Hostname string `json:"hostname,omitempty"`
	// MachineID pins the stub's containers to one agent machine (pod/shell
	// `--machine`); not exposed to the SDK decorators.
	MachineID string            `json:"machine_id,omitempty"`
	IsService bool              `json:"is_service"`
	Serving   *ServingConfig    `json:"serving,omitempty"`
	Pool      *PoolConfig       `json:"pool,omitempty"`
	Disks     []*pb.DurableDisk `json:"disks,omitempty"`
	// ManagedEndpoint carries the platform endpoint/service spec for
	// managed_endpoint/* and managed_service/* stubs.
	ManagedEndpoint *ManagedEndpointStubConfig `json:"managed_endpoint,omitempty"`

	PreparationCacheKey string `json:"preparation_cache_key,omitempty"`
}

func (*StubConfigV1) EffectiveAppKind

func (c *StubConfigV1) EffectiveAppKind() string

func (*StubConfigV1) EffectiveDatabaseConfig

func (c *StubConfigV1) EffectiveDatabaseConfig() *DatabaseServingConfig

func (*StubConfigV1) EffectiveServingConfig

func (c *StubConfigV1) EffectiveServingConfig() *ServingConfig

func (*StubConfigV1) EffectiveServingProtocol

func (c *StubConfigV1) EffectiveServingProtocol() string

func (*StubConfigV1) IsPersistentVM

func (s *StubConfigV1) IsPersistentVM() bool

IsPersistentVM identifies a microVM whose lifecycle belongs to the VM service.

func (*StubConfigV1) PoolSelector

func (c *StubConfigV1) PoolSelector() string

func (*StubConfigV1) RequiresGPU

func (c *StubConfigV1) RequiresGPU() bool

func (*StubConfigV1) SetReplicaCount

func (c *StubConfigV1) SetReplicaCount(containers uint)

func (*StubConfigV1) UnmarshalJSON

func (c *StubConfigV1) UnmarshalJSON(data []byte) error

func (*StubConfigV1) ValidateCPUTier

func (c *StubConfigV1) ValidateCPUTier() error

ValidateCPUTier checks that the stub's resources fit its CPU tier.

type StubFilter

type StubFilter struct {
	WorkspaceID string      `query:"workspace_id"`
	StubIds     StringSlice `query:"stub_ids"` // The query parameter name is "values"
	StubTypes   StringSlice `query:"stub_types"`
	Cursor      string      `query:"cursor"`
	Pagination  bool        `query:"pagination"`
	AppId       string      `query:"app_id"`
	Limit       uint32      `query:"limit"`

	PreparationCacheKey string `query:"-"`
}

Struct that includes the custom type

type StubGetURLFilter

type StubGetURLFilter struct {
	StubId      string `param:"stubId"`
	WorkspaceId string `param:"workspaceId"`
	URLType     string `query:"urlType"`
}

type StubLimits

type StubLimits struct {
	Cpu          uint64             `key:"cpu" json:"cpu"`
	Memory       uint64             `key:"memory" json:"memory"`
	MaxReplicas  uint64             `key:"maxReplicas" json:"max_replicas"`
	MaxGpuCount  uint32             `key:"maxGpuCount" json:"max_gpu_count"`
	GPUBlackList GPUBlackListConfig `key:"gpuBlackList" json:"gpu_black_list"`
}

type StubType

type StubType string

@go2proto

func (StubType) IsDeployment

func (t StubType) IsDeployment() bool

func (StubType) IsManagedEndpoint

func (t StubType) IsManagedEndpoint() bool

func (StubType) IsPlatformWorkload

func (t StubType) IsPlatformWorkload() bool

IsPlatformWorkload: runs in the platform workspace, exempt from customer credit and pool quotas.

func (StubType) IsSandbox

func (t StubType) IsSandbox() bool

IsSandbox identifies workloads that share sandbox execution and storage. Persistent VMs retain their own kind for lifecycle and billing.

func (StubType) IsServe

func (t StubType) IsServe() bool

func (StubType) Kind

func (t StubType) Kind() string

func (StubType) RouteKind

func (t StubType) RouteKind() string

RouteKind keeps VM runtime operations on the shared sandbox transport.

type StubUpsertInput

type StubUpsertInput struct {
	Name        string          `json:"name"`
	Type        string          `json:"type"`
	Config      json.RawMessage `json:"config"`
	ObjectID    uint            `json:"object_id"`
	WorkspaceID uint            `json:"workspace_id"`
	AppID       uint            `json:"app_id"`
}

StubUpsertInput is the shared input for single and batched stub creation.

type StubWithRelated

type StubWithRelated struct {
	Stub
	Workspace Workspace `db:"workspace" json:"workspace" serializer:"workspace"`
	Object    Object    `db:"object" json:"object" serializer:"object"`
	App       *App      `db:"app" json:"app" serializer:"app"`
}

@go2proto

func NewStubWithRelatedFromProto

func NewStubWithRelatedFromProto(in *pb.StubWithRelated) *StubWithRelated

func (*StubWithRelated) ToProto

func (s *StubWithRelated) ToProto() *pb.StubWithRelated

type TailscaleAgentSSHConfig

type TailscaleAgentSSHConfig struct {
	Enabled bool `key:"enabled" json:"enabled"`
}

TailscaleAgentSSHConfig runs Tailscale SSH on agent nodes in control-plane owned pools. Workspace-owned private/BYOC machines never get it.

type TailscaleConfig

type TailscaleConfig struct {
	ControlURL   string                  `key:"controlUrl" json:"control_url"`
	AuthKey      string                  `key:"authKey" json:"auth_key"`
	AgentAuthKey string                  `key:"agentAuthKey" json:"agent_auth_key"`
	HostName     string                  `key:"hostName" json:"host_name"`
	Enabled      bool                    `key:"enabled" json:"enabled"`
	Debug        bool                    `key:"debug" json:"debug"`
	AgentSSH     TailscaleAgentSSHConfig `key:"agentSsh" json:"agent_ssh"`

	// ServerlessAgentAuthKey carries the additional, operator-owned SSH tag.
	// It must never be issued to workspace-owned or reserved capacity.
	ServerlessAgentAuthKey string `key:"serverlessAgentAuthKey" json:"serverless_agent_auth_key"`
}

type Task

type Task struct {
	Id            uint       `db:"id" json:"id,omitempty" serializer:"id,source:external_id"`
	ExternalId    string     `db:"external_id" json:"external_id,omitempty" serializer:"external_id"`
	Status        TaskStatus `db:"status" json:"status,omitempty" serializer:"status"`
	FailureReason string     `db:"failure_reason" json:"failure_reason,omitempty" serializer:"failure_reason"`
	ContainerId   string     `db:"container_id" json:"container_id,omitempty" serializer:"container_id"`
	StartedAt     NullTime   `db:"started_at" json:"started_at,omitempty" serializer:"started_at"`
	EndedAt       NullTime   `db:"ended_at" json:"ended_at,omitempty" serializer:"ended_at"`
	WorkspaceId   uint       `db:"workspace_id" json:"workspace_id,omitempty"` // Foreign key to Workspace
	StubId        uint       `db:"stub_id" json:"stub_id,omitempty"`           // Foreign key to Stub
	AppId         *uint      `db:"app_id" json:"app_id,omitempty"`             // Foreign key to App
	CreatedAt     Time       `db:"created_at" json:"created_at,omitempty" serializer:"created_at"`
	UpdatedAt     Time       `db:"updated_at" json:"updated_at,omitempty" serializer:"updated_at"`
}

type TaskCancellationReason

type TaskCancellationReason string
const (
	TaskExpired               TaskCancellationReason = "expired"
	TaskExceededRetryLimit    TaskCancellationReason = "exceeded_retry_limit"
	TaskRequestCancelled      TaskCancellationReason = "request_cancelled"
	TaskInvalidRequestPayload TaskCancellationReason = "invalid_request_payload"
	TaskBackendUnavailable    TaskCancellationReason = "backend_unavailable"
)

type TaskCompletionConfig

type TaskCompletionConfig struct {
	Timeout             time.Duration `key:"timeout" json:"timeout"`
	ResultUploadTimeout time.Duration `key:"resultUploadTimeout" json:"result_upload_timeout"`
}

type TaskCountByTime

type TaskCountByTime struct {
	Time         time.Time       `db:"time" json:"time"`
	Count        uint            `count:"count" json:"count"`
	StatusCounts json.RawMessage `db:"status_counts" json:"status_counts"`
}

type TaskCountPerDeployment

type TaskCountPerDeployment struct {
	DeploymentName string `db:"deployment_name" json:"deployment_name"`
	TaskCount      uint   `db:"task_count" json:"task_count"`
}

type TaskExecutor

type TaskExecutor string
var (
	ExecutorTaskQueue TaskExecutor = "taskqueue"
	ExecutorEndpoint  TaskExecutor = "endpoint"
	ExecutorFunction  TaskExecutor = "function"
	ExecutorContainer TaskExecutor = "container"
	ExecutorBot       TaskExecutor = "bot"
)

type TaskFilter

type TaskFilter struct {
	BaseFilter
	WorkspaceID    uint        `query:"workspace_id"`
	TaskIds        StringSlice `query:"task_ids"`
	StubIds        StringSlice `query:"stub_ids"`
	StubNames      StringSlice `query:"stub_names"`
	StubTypes      StringSlice `query:"stub_types"`
	Status         string      `query:"status"`
	ContainerIds   StringSlice `query:"container_ids"`
	CreatedAtStart string      `query:"created_at_start"`
	CreatedAtEnd   string      `query:"created_at_end"`
	MinDuration    uint        `query:"min_duration"`
	MaxDuration    uint        `query:"max_duration"`
	Interval       string      `query:"interval"`
	Cursor         string      `query:"cursor"`
	AppId          string      `query:"app_id"`
}

type TaskInterface

type TaskInterface interface {
	Execute(ctx context.Context, options ...interface{}) error
	Cancel(ctx context.Context, reason TaskCancellationReason) error
	Retry(ctx context.Context) error
	HeartBeat(ctx context.Context) (bool, error)
	Metadata() TaskMetadata
	Message() *TaskMessage
}

type TaskMessage

type TaskMessage struct {
	TaskId        string                 `json:"task_id" redis:"task_id"`
	WorkspaceName string                 `json:"workspace_name" redis:"workspace_name"`
	StubId        string                 `json:"stub_id" redis:"stub_id"`
	Executor      string                 `json:"executor" redis:"executor"`
	Args          []interface{}          `json:"args" redis:"args"`
	Kwargs        map[string]interface{} `json:"kwargs" redis:"kwargs"`
	Policy        TaskPolicy             `json:"policy" redis:"policy"`
	Retries       uint                   `json:"retries" redis:"retries"`
	// RetryPending and RetryID persist a dispatch intent across gateway restarts.
	RetryPending bool   `json:"retry_pending,omitempty" redis:"retry_pending"`
	RetryID      string `json:"retry_id,omitempty" redis:"retry_id"`
	Timestamp    int64  `json:"timestamp" redis:"timestamp"`
}

TaskMessage represents a JSON serializable message to be added to the queue

func (*TaskMessage) Decode

func (tm *TaskMessage) Decode(encodedData []byte) error

Decode initializes the TaskMessage fields from a byte array

func (*TaskMessage) Encode

func (tm *TaskMessage) Encode() ([]byte, error)

Encode returns a binary representation of the TaskMessage

func (*TaskMessage) Reset

func (tm *TaskMessage) Reset()

type TaskMetadata

type TaskMetadata struct {
	TaskId        string
	StubId        string
	WorkspaceName string
	ContainerId   string
}

type TaskMetrics

type TaskMetrics struct {
	TaskByStatusCounts map[string]int `json:"task_by_status_counts"`
}

type TaskOutput

type TaskOutput struct {
	Name      string `json:"name" serializer:"name"`
	URL       string `json:"url" serializer:"url"`
	ExpiresIn uint32 `json:"expires_in" serializer:"expires_in"`
}

type TaskParams

type TaskParams struct {
	TaskId      string
	ContainerId string
	StubId      uint
	WorkspaceId uint
}

type TaskPayload

type TaskPayload struct {
	Args   []interface{}          `json:"args"`
	Kwargs map[string]interface{} `json:"kwargs"`
}

type TaskPolicy

type TaskPolicy struct {
	MaxRetries uint      `json:"max_retries" redis:"max_retries"`
	Timeout    int       `json:"timeout" redis:"timeout"`
	Expires    time.Time `json:"expires" redis:"expires"`
	TTL        uint32    `json:"ttl" redis:"ttl"`
}

type TaskStats

type TaskStats struct {
	ActiveContainers uint32 `json:"active_containers" serializer:"active_containers"`
	QueueDepth       uint32 `json:"queue_depth" serializer:"queue_depth"`
}

type TaskStatus

type TaskStatus string
const (
	TaskStatusPending   TaskStatus = "PENDING"
	TaskStatusRunning   TaskStatus = "RUNNING"
	TaskStatusComplete  TaskStatus = "COMPLETE"
	TaskStatusError     TaskStatus = "ERROR"
	TaskStatusCancelled TaskStatus = "CANCELLED"
	TaskStatusExpired   TaskStatus = "EXPIRED"
	TaskStatusTimeout   TaskStatus = "TIMEOUT"
	TaskStatusRetry     TaskStatus = "RETRY"
)

func (TaskStatus) IsCompleted

func (ts TaskStatus) IsCompleted() bool

func (TaskStatus) IsInflight

func (ts TaskStatus) IsInflight() bool

type TaskWithRelated

type TaskWithRelated struct {
	Task
	Deployment struct {
		ExternalId *string `db:"external_id" json:"external_id" serializer:"id"`
		Name       *string `db:"name" json:"name" serializer:"name"`
		Version    *uint   `db:"version" json:"version" serializer:"version"`
	} `db:"deployment" json:"deployment" serializer:"deployment"`
	Outputs   []TaskOutput    `json:"outputs" serializer:"outputs"`
	Stats     TaskStats       `json:"stats" serializer:"stats"`
	Result    json.RawMessage `json:"result" serializer:"result"`
	Workspace Workspace       `db:"workspace" json:"workspace" serializer:"workspace"`
	Stub      Stub            `db:"stub" json:"stub" serializer:"stub"`
	App       App             `db:"app" json:"app" serializer:"app"`
}

type TelemetryConfig

type TelemetryConfig struct {
	Enabled          bool          `key:"enabled" json:"enabled"`
	Endpoint         string        `key:"endpoint" json:"endpoint"`
	MeterInterval    time.Duration `key:"meterInterval" json:"meter_interval"`
	TraceInterval    time.Duration `key:"traceInterval" json:"trace_interval"`
	TraceSampleRatio float64       `key:"traceSampleRatio" json:"trace_sample_ratio"`
}

type ThrottledByConcurrencyLimitError

type ThrottledByConcurrencyLimitError struct {
	Reason string
}

func (*ThrottledByConcurrencyLimitError) Error

type Time

type Time struct {
	time.Time
}

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

func (Time) Serialize

func (t Time) Serialize() string

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the driver.Valuer interface for SQL operations

type Token

type Token struct {
	Id                     uint       `db:"id" json:"id" serializer:"id,source:external_id"`
	ExternalId             string     `db:"external_id" json:"external_id" serializer:"external_id"`
	Key                    string     `db:"key" json:"key" serializer:"key"`
	Active                 bool       `db:"active" json:"active" serializer:"active"`
	Reusable               bool       `db:"reusable" json:"reusable" serializer:"reusable"`
	WorkspaceId            *uint      `db:"workspace_id" json:"workspace_id,omitempty"`                            // Foreign key to Workspace
	Workspace              *Workspace `db:"workspace" json:"workspace,omitempty" serializer:"workspace,omitempty"` // Pointer to associated Workspace
	TokenType              string     `db:"token_type" json:"token_type" serializer:"token_type"`
	CreatedAt              Time       `db:"created_at" json:"created_at" serializer:"created_at"`
	UpdatedAt              Time       `db:"updated_at" json:"updated_at" serializer:"updated_at"`
	DisabledByClusterAdmin bool       `db:"disabled_by_cluster_admin" json:"disabled_by_cluster_admin" serializer:"disabled_by_cluster_admin"`
	// WorkerID is the only worker a worker token may act as; empty for other token types.
	WorkerID string `db:"worker_id" json:"worker_id,omitempty"`
}

type Usage

type Usage struct {
	Work
	Cost
}

Usage is Work and Cost summed over many charges (a day, a model, a report).

func (*Usage) Add

func (u *Usage) Add(o Usage)

func (*Usage) Fields

func (u *Usage) Fields() []*int64

Fields lists every counter by its wire name, in a fixed order.

type UsageKind

type UsageKind string

UsageKind separates what a workspace spent calling apps from what it earned serving them on contributed machines.

const (
	UsageSpend  UsageKind = "spend"
	UsageEarned UsageKind = "earned"
)

type UsageReport

type UsageReport struct {
	Total    Usage            `json:"total"`
	PerModel map[string]Usage `json:"per_model"`
	PerDay   map[string]Usage `json:"per_day"`
}

type VM

type VM struct {
	ID                  string            `json:"id"`
	WorkspaceID         uint              `json:"-"`
	WorkspaceExternalID string            `json:"-"`
	TokenID             string            `json:"-"`
	Name                string            `json:"name"`
	Metadata            map[string]string `json:"metadata,omitempty"`
	CreationDigest      string            `json:"creation_digest,omitempty"`
	TrafficAccessToken  string            `json:"traffic_access_token,omitempty"`
	Handle              string            `json:"handle"`
	PublicIPv6          string            `json:"public_ipv6,omitempty"`
	Spec                VMSpec            `json:"spec"`
	StubID              string            `json:"stub_id,omitempty"`
	ContainerID         string            `json:"container_id,omitempty"`
	DesiredState        string            `json:"desired_state"`
	Status              string            `json:"status"`
	Error               string            `json:"error,omitempty"`
	StopReason          string            `json:"stop_reason,omitempty"`
	Generation          int64             `json:"generation"`
	LaunchAttempts      int               `json:"launch_attempts"`
	EverRunning         bool              `json:"ever_running"`
	RootSnapshotID      string            `json:"root_snapshot_id,omitempty"`
	StopSnapshotID      string            `json:"stop_snapshot_id,omitempty"`
	MemoryCheckpointID  string            `json:"memory_checkpoint_id,omitempty"`
	MemoryDiskSnapshots map[string]string `json:"memory_disk_snapshots,omitempty"`
	CreatedAt           time.Time         `json:"created_at"`
	UpdatedAt           time.Time         `json:"updated_at"`
	LastActiveAt        time.Time         `json:"last_active_at"`
	TerminalURL         string            `json:"terminal_url,omitempty"`
	DesktopURL          string            `json:"desktop_url,omitempty"`
	KioskURL            string            `json:"kiosk_url,omitempty"`
	MCPURL              string            `json:"mcp_url,omitempty"`
	BrowserAuth         bool              `json:"browser_auth,omitempty"`
	CPUTierEligible     *bool             `json:"cpu_tier_eligible,omitempty"` // set only in responses
	URLs                map[uint32]string `json:"urls"`
}

type VMArtifact

type VMArtifact struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	VMID           string    `json:"vm_id"`
	VMName         string    `json:"vm_name,omitempty"`
	VMDeleted      bool      `json:"vm_deleted,omitempty"`
	Kind           string    `json:"kind"`
	RootSnapshotID string    `json:"root_snapshot_id"`
	Spec           VMSpec    `json:"spec"`
	CreatedAt      time.Time `json:"created_at"`
	Description    string    `json:"description,omitempty"`
	Public         bool      `json:"public,omitempty"`
}

VMArtifact references existing immutable qcow snapshot data; it never owns the source VM's disk. Templates survive removal of the source VM.

type VMArtifactFilter

type VMArtifactFilter struct {
	Limit, Offset int
	VMID          string
}

VMArtifactFilter selects one page of artifacts, newest first.

type VMConfig

type VMConfig struct {
	// Optional pool used when a VM is created without an explicit selector.
	DefaultPool string `key:"defaultPool" json:"default_pool"`
	// Wildcard DNS/ingress pointing at the gateway; <handle>-<port>.<domain>.
	Domain  string `key:"domain" json:"domain"`
	BaseURL string `key:"baseURL" json:"base_url"`
	// Optional external browser sign-in endpoint; empty disables redirects.
	// Receives workspace, vm, port and a relative next path. The provider must
	// authorize the viewer and obtain a session through the management API.
	BrowserAuthURL string          `key:"browserAuthURL" json:"browser_auth_url"`
	Network        VMNetworkConfig `key:"network" json:"network"`
	WebRTC         VMWebRTCConfig  `key:"webrtc" json:"webrtc"`
}

type VMCreateOptions

type VMCreateOptions struct {
	Name      string
	Spec      VMSpec
	Metadata  map[string]string
	RequestID string
	Image     *pb.VerifyImageBuildRequest
	// Older immutable desktop images use the empty (VNC) transport. Forks
	// retain their image contract unless the caller explicitly changes it.
	PreserveDesktopTransport bool
}

VMCreateOptions carries parsed inputs for creation and forks.

type VMDesktopTransport

type VMDesktopTransport string

func (VMDesktopTransport) Valid

func (t VMDesktopTransport) Valid() bool

type VMFilter

type VMFilter struct {
	Limit, Offset int
	// Stored statuses; reconciliation keeps them within seconds of the runtime.
	Statuses []string
	// Case-insensitive substring of the name or ID.
	Search   string
	Metadata map[string]string
	All      bool
}

VMFilter selects one page of a workspace's VMs, newest first. A zero Limit returns only the counts.

type VMKioskMCPServer

type VMKioskMCPServer struct {
	Command string            `json:"command,omitempty"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
	Cwd     string            `json:"cwd,omitempty"`
	URL     string            `json:"url,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

VMKioskMCPServer follows the standard mcpServers launch configuration.

type VMKioskSpec

type VMKioskSpec struct {
	Transport VMKioskTransport            `json:"transport,omitempty"`
	Command   []string                    `json:"command"`
	Cwd       string                      `json:"cwd,omitempty"`
	Env       map[string]string           `json:"env,omitempty"`
	MCP       map[string]VMKioskMCPServer `json:"mcp,omitempty"`
}

VMKioskSpec launches an ordinary application on an isolated graphical session. Commands are argv, never shell source. Env values follow the VM's redaction rules.

func (*VMKioskSpec) Clone

func (k *VMKioskSpec) Clone() *VMKioskSpec

Clone isolates normalization and redaction from snapshots and their parent VM.

func (*VMKioskSpec) PrivatePorts

func (k *VMKioskSpec) PrivatePorts() []uint32

func (*VMKioskSpec) WithoutCredentials

func (k *VMKioskSpec) WithoutCredentials() *VMKioskSpec

type VMKioskTransport

type VMKioskTransport = VMDesktopTransport

Kiosk and full desktops use the same authenticated streaming protocol.

type VMNetworkConfig

type VMNetworkConfig struct {
	// Empty disables public networking. The ingress must route this prefix to
	// the gateway while preserving the original destination with PROXY protocol.
	PublicIPv6Prefix string `key:"publicIPv6Prefix" json:"public_ipv6_prefix"`
	// Additional routed pools let shared ingress capacity grow without moving
	// existing VM addresses. Keep retired pools routed until their VMs are gone.
	PublicIPv6Prefixes []string `key:"publicIPv6Prefixes" json:"public_ipv6_prefixes"`
	// All published TCP ports must reach this listener with PROXY v2 TCP6
	// metadata carrying their original destination address and port.
	IngressPort int `key:"ingressPort" json:"ingress_port"`
	// These are the actual TCP ingress peers. Disable client IP preservation
	// on this listener so advertised client addresses cannot authorize a proxy.
	TrustedProxyCIDRs []string `key:"trustedProxyCIDRs" json:"trusted_proxy_cidrs"`
	// Maximum concurrent public TCP connections per gateway. Zero uses 16384.
	MaxConnections int `key:"maxConnections" json:"max_connections"`
	// Per-VM limit per gateway across public TCP ports, including HTTP keep-alives.
	// Zero uses 256, capped at one quarter of the gateway limit (minimum one).
	MaxConnectionsPerVM int `key:"maxConnectionsPerVM" json:"max_connections_per_vm"`
}

type VMPage

type VMPage struct {
	VMs    []*VM
	Total  int
	Counts map[string]int
}

VMPage counts the VMs in scope by status, so each status can show its count before it is selected. Statuses and Search narrow only VMs and Total.

type VMSpec

type VMSpec struct {
	ImageID          string             `json:"image_id"`
	CPU              int64              `json:"cpu"`    // millicores
	Memory           int64              `json:"memory"` // MiB
	GPU              string             `json:"gpu,omitempty"`
	DiskSize         string             `json:"disk_size"`
	Pool             string             `json:"pool,omitempty"`
	CPUTier          CPUTier            `json:"cpu_tier,omitempty"`
	Env              []string           `json:"env,omitempty"`
	Secrets          []string           `json:"secrets,omitempty"`
	Ports            []uint32           `json:"ports,omitempty"`
	PrivatePorts     []uint32           `json:"private_ports,omitempty"`
	Desktop          bool               `json:"desktop"`
	DesktopTransport VMDesktopTransport `json:"desktop_transport,omitempty"`
	Kiosk            *VMKioskSpec       `json:"kiosk,omitempty"`
	DockerEnabled    bool               `json:"docker_enabled"`
	SSH              bool               `json:"ssh"`
	SSHPublicKey     string             `json:"ssh_public_key,omitempty"`
	IdleTimeout      int64              `json:"idle_timeout"`
	IdleAction       string             `json:"idle_action,omitempty"`
	AutoResume       bool               `json:"auto_resume"`
	BlockNetwork     bool               `json:"block_network"`
	AllowList        []string           `json:"allow_list,omitempty"`
	ProtectedPorts   []uint32           `json:"protected_ports,omitempty"`
	PublicPorts      []uint32           `json:"public_ports,omitempty"`
	Disks            []*pb.DurableDisk  `json:"disks,omitempty"`
	Volumes          []*pb.Volume       `json:"volumes,omitempty"`
	SourceSnapshotID string             `json:"source_snapshot_id,omitempty"`
}

VMSpec describes a persistent microVM. GPU requests assign one device.

func (VMSpec) DesktopPrivatePorts

func (s VMSpec) DesktopPrivatePorts() []uint32

func (VMSpec) DisplayTransport

func (s VMSpec) DisplayTransport() VMDesktopTransport

func (VMSpec) PublicTemplate

func (s VMSpec) PublicTemplate() VMSpec

PublicTemplate shares installed software without inheriting the publisher's workspace credentials, placement or attached storage. Root files are included; publishers must prepare a clean machine before sharing its complete root.

func (VMSpec) RuntimePorts

func (s VMSpec) RuntimePorts() []uint32

func (VMSpec) StreamingDesktop

func (s VMSpec) StreamingDesktop() bool

An empty transport identifies desktops built before the Selkies contract.

type VMWebRTCConfig

type VMWebRTCConfig struct {
	MaxConnections           int           `key:"maxConnections" json:"max_connections"`
	MaxConnectionsPerSession int           `key:"maxConnectionsPerSession" json:"max_connections_per_session"`
	RegistrationsPerMinute   int           `key:"registrationsPerMinute" json:"registrations_per_minute"`
	HandshakeTimeout         time.Duration `key:"handshakeTimeout" json:"handshake_timeout"`
	SessionTTL               time.Duration `key:"sessionTTL" json:"session_ttl"`
	LeaseTTL                 time.Duration `key:"leaseTTL" json:"lease_ttl"`
	CheckInterval            time.Duration `key:"checkInterval" json:"check_interval"`
}

VMWebRTCConfig bounds authenticated kiosk media on the shared TCP gateway. Zero values use defaults; timing values follow the normal duration config format.

func (*VMWebRTCConfig) ApplyDefaults

func (c *VMWebRTCConfig) ApplyDefaults() error

type VMWebRTCSessionDescription

type VMWebRTCSessionDescription struct {
	SDP string `json:"sdp"`
}

type VastProviderConfig

type VastProviderConfig struct {
	ApiKey  string `key:"apiKey" json:"api_key"`
	BaseURL string `key:"baseURL" json:"base_url"`
}

type VictoriaMetricsConfig

type VictoriaMetricsConfig struct {
	PushURL       string `key:"pushURL" json:"push_url"`
	AuthToken     string `key:"authToken" json:"auth_token"`
	PushSecs      int    `key:"pushSecs" json:"push_secs"`
	WriteURL      string `key:"writeURL" json:"write_url"`
	WriteUsername string `key:"writeUsername" json:"write_username"`
	WritePassword string `key:"writePassword" json:"write_password"`
}

type Volume

type Volume struct {
	Id          uint   `db:"id" json:"id"`
	ExternalId  string `db:"external_id" json:"external_id"`
	Name        string `db:"name" json:"name"`
	Size        uint64 `json:"size"`                           // Populated by volume abstraction
	WorkspaceId uint   `db:"workspace_id" json:"workspace_id"` // Foreign key to Workspace
	CreatedAt   Time   `db:"created_at" json:"created_at"`
	UpdatedAt   Time   `db:"updated_at" json:"updated_at"`
}

type VolumeWithRelated

type VolumeWithRelated struct {
	Volume
	Workspace Workspace `db:"workspace" json:"workspace"`
}

type Work

type Work struct {
	Requests         int64 `json:"requests"`
	PromptTokens     int64 `json:"prompt_tokens"`
	CompletionTokens int64 `json:"completion_tokens"`
	CachedTokens     int64 `json:"cached_tokens"` // part of PromptTokens, billed at the cache rate
}

Work is what an app reported for one completed request. It is never estimated: token-priced work without a usage object is not billed.

func (Work) Valid

func (w Work) Valid() bool

type Worker

type Worker struct {
	Id                   string       `json:"id" redis:"id"`
	Status               WorkerStatus `json:"status" redis:"status"`
	TotalCpu             int64        `json:"total_cpu" redis:"total_cpu"`
	TotalMemory          int64        `json:"total_memory" redis:"total_memory"`
	TotalGpuCount        uint32       `json:"total_gpu_count" redis:"total_gpu_count"`
	FreeCpu              int64        `json:"free_cpu" redis:"free_cpu"`
	FreeMemory           int64        `json:"free_memory" redis:"free_memory"`
	FreeGpuCount         uint32       `json:"free_gpu_count" redis:"gpu_count"`
	Gpu                  string       `json:"gpu" redis:"gpu"`
	PoolName             string       `json:"pool_name" redis:"pool_name"`
	MachineId            string       `json:"machine_id" redis:"machine_id"`
	ResourceVersion      int64        `json:"resource_version" redis:"resource_version"`
	RequiresPoolSelector bool         `json:"requires_pool_selector" redis:"requires_pool_selector"`
	Priority             int32        `json:"priority" redis:"priority"`
	Preemptable          bool         `json:"preemptable" redis:"preemptable"`
	BuildVersion         string       `json:"build_version" redis:"build_version"`
	ActiveContainers     []Container  `json:"active_containers" redis:"active_containers"`
	Runtime              string       `json:"runtime" redis:"runtime"`
	PoolSelector         string       `json:"pool_selector" redis:"pool_selector"`
	// CordonRequested records explicit operator intent. Disabled workers without
	// this flag may be recovered automatically after a transient failure.
	CordonRequested bool `json:"cordon_requested" redis:"cordon_requested"`
	// RolloutGeneration gates readiness while an agent worker is being replaced.
	RolloutGeneration   string `json:"rollout_generation" redis:"rollout_generation"`
	RolloutBuildVersion string `json:"rollout_build_version" redis:"-"`
	WorkerImageOverride string `json:"worker_image_override" redis:"worker_image_override"`
	// Evictable* is the share of used capacity held by evictable containers
	// (managed endpoint replicas). Non-evictable requests may claim it; the
	// scheduler stops the holders first.
	EvictableCpu        int64  `json:"evictable_cpu" redis:"evictable_cpu"`
	EvictableMemory     int64  `json:"evictable_memory" redis:"evictable_memory"`
	EvictableGpuCount   uint32 `json:"evictable_gpu_count" redis:"evictable_gpu_count"`
	WorkspaceId         string `json:"-" redis:"workspace_id" go2proto:"ignore"`
	ControlPlaneManaged bool   `json:"-" redis:"control_plane_managed" go2proto:"ignore"`
	// Keep internal fields after wire fields: go2proto numbers by struct position.
	RolloutPreviousStatus      WorkerStatus `json:"-" redis:"rollout_previous_status" go2proto:"ignore"`
	CheckpointCompatibilityKey string       `json:"-" redis:"checkpoint_compatibility_key" go2proto:"ignore"`
	CPUTierProtocol            uint32       `json:"-" redis:"cpu_tier_protocol" go2proto:"ignore"`
}

@go2proto

func NewWorkerFromProto

func NewWorkerFromProto(in *pb.Worker) *Worker

func (*Worker) ToProto

func (w *Worker) ToProto() *pb.Worker

type WorkerConfig

type WorkerConfig struct {
	Pools                        map[string]WorkerPoolConfig   `key:"pools" json:"pools"`
	HostNetwork                  bool                          `key:"hostNetwork" json:"host_network"`
	UseGatewayServiceHostname    bool                          `key:"useGatewayServiceHostname" json:"use_gateway_service_hostname"`
	UseHostResolvConf            bool                          `key:"useHostResolvConf" json:"use_host_resolv_conf"`
	ImageTag                     string                        `key:"imageTag" json:"image_tag"`
	ImageName                    string                        `key:"imageName" json:"image_name"`
	ImageRegistry                string                        `key:"imageRegistry" json:"image_registry"`
	ImagePullSecrets             []string                      `key:"imagePullSecrets" json:"image_pull_secrets"`
	Namespace                    string                        `key:"namespace" json:"namespace"`
	ServiceAccountName           string                        `key:"serviceAccountName" json:"service_account_name"`
	JobResourcesEnforced         bool                          `key:"jobResourcesEnforced" json:"job_resources_enforced"`
	JobResourceOverhead          JobResourceOverheadConfig     `key:"jobResourceOverhead" json:"job_resource_overhead"`
	ContainerResourceLimits      ContainerResourceLimitsConfig `key:"containerResourceLimits" json:"container_resource_limits"`
	DefaultWorkerCPURequest      int64                         `key:"defaultWorkerCPURequest" json:"default_worker_cpu_request"`
	DefaultWorkerMemoryRequest   int64                         `key:"defaultWorkerMemoryRequest" json:"default_worker_memory_request"`
	ImagePVCName                 string                        `key:"imagePVCName" json:"image_pvc_name"`
	CleanupWorkerInterval        time.Duration                 `key:"cleanupWorkerInterval" json:"cleanup_worker_interval"`
	CleanupPendingWorkerAgeLimit time.Duration                 `key:"cleanupPendingWorkerAgeLimit" json:"cleanup_pending_worker_age_limit"`
	TerminationGracePeriod       int64                         `key:"terminationGracePeriod"`
	CacheEnabled                 bool                          `key:"cacheEnabled" json:"cache_enabled"`
	CRIU                         CRIUConfig                    `key:"criu" json:"criu"`
	TmpSizeLimit                 string                        `key:"tmpSizeLimit" json:"tmp_size_limit"`
	ContainerLogLinesPerHour     int                           `key:"containerLogLinesPerHour" json:"container_log_lines_per_hour"`
	ContainerRuntime             string                        `key:"containerRuntime" json:"container_runtime"`
	// HeadroomWorkerMaxAge bounds how long pool headroom alone keeps an idle
	// worker up. Zero disables the bound.
	HeadroomWorkerMaxAge time.Duration `key:"headroomWorkerMaxAge" json:"headroom_worker_max_age"`
	// MaxAge bounds any non-persistent worker's lifetime, busy or idle: past it
	// the worker disables scheduling, lets running containers finish and exits.
	// Zero disables the bound.
	MaxAge time.Duration `key:"maxAge" json:"max_age"`

	Egress EgressConfig `key:"egress" json:"egress"`
}

type WorkerKeepAlive

type WorkerKeepAlive struct {
	MachineId                  string `json:"machine_id"`
	CheckpointCompatibilityKey string `json:"checkpoint_compatibility_key"`
	CPUTierProtocol            uint32 `json:"cpu_tier_protocol"`
	// RequestStreamOpen is set by the gateway that received the keepalive when
	// it also holds this worker's container request stream. A worker opens
	// that stream only after it has started.
	RequestStreamOpen bool `json:"request_stream_open"`
}

type WorkerPoolCacheConfig

type WorkerPoolCacheConfig struct {
	Enabled *bool                     `key:"enabled" json:"enabled"`
	Disk    WorkerPoolCacheDiskConfig `key:"disk" json:"disk"`
}

type WorkerPoolCacheDiskConfig

type WorkerPoolCacheDiskConfig struct {
	Enabled      *bool   `key:"enabled" json:"enabled"`
	HostPath     string  `key:"hostPath" json:"host_path"`
	MountPath    string  `key:"mountPath" json:"mount_path"`
	MaxUsagePct  float64 `key:"maxUsagePct" json:"max_usage_pct"`
	MinFreeBytes int64   `key:"minFreeBytes" json:"min_free_bytes"`
}

type WorkerPoolConfig

type WorkerPoolConfig struct {
	GPUType                   string                            `key:"gpuType" json:"gpu_type"`
	Runtime                   string                            `key:"runtime" json:"runtime"`                                 // Kubernetes RuntimeClass for pod (e.g., "nvidia")
	ContainerRuntime          string                            `key:"containerRuntime" json:"container_runtime"`              // Pool-specific container runtime: "runc", "gvisor", or "microvm"
	ContainerRuntimeConfig    RuntimeConfig                     `key:"containerRuntimeConfig" json:"container_runtime_config"` // Pool-specific container runtime configuration
	CPUAffinityEnforced       bool                              `key:"cpuAffinityEnforced" json:"cpu_affinity_enforced"`
	CPUShareMultiplier        CPUShareMultiplier                `key:"cpuShareMultiplier" json:"cpu_share_multiplier,omitempty"`
	GPUVirtualized            bool                              `key:"gpuVirtualized" json:"gpu_virtualized"`
	ContainerStartConcurrency int                               `key:"containerStartConcurrency" json:"container_start_concurrency"`
	NetworkPreallocation      *bool                             `key:"networkPreallocation" json:"network_preallocation"`
	NetworkSlotPoolSize       int                               `key:"networkSlotPoolSize" json:"network_slot_pool_size"`
	Mode                      PoolMode                          `key:"mode" json:"mode"`
	JobSpec                   WorkerPoolJobSpecConfig           `key:"jobSpec" json:"job_spec"`
	PoolSizing                WorkerPoolJobSpecPoolSizingConfig `key:"poolSizing" json:"pool_sizing"`
	RequiresPoolSelector      bool                              `key:"requiresPoolSelector" json:"requires_pool_selector"`
	Priority                  int32                             `key:"priority" json:"priority"`
	Preemptable               bool                              `key:"preemptable" json:"preemptable"`
	CRIUEnabled               bool                              `key:"criuEnabled" json:"criu_enabled"`
	TmpSizeLimit              string                            `key:"tmpSizeLimit" json:"tmp_size_limit"`
	ConfigGroup               string                            `key:"configGroup" json:"config_group"`
	StoragePath               string                            `key:"storagePath" json:"storage_path"` // Host root for workspace mounts, checkpoints, and durable disks.
	StorageMode               string                            `key:"storageMode" json:"storage_mode"`
	ImagesPath                string                            `key:"imagesPath" json:"images_path"`              // Host path backing the worker's /images volume; agent pools fall back to the installer state dir.
	DurableDisksPath          string                            `key:"durableDisksPath" json:"durable_disks_path"` // Host path backing durable disks; agent pools fall back to storagePath or the installer state dir.
	Cache                     WorkerPoolCacheConfig             `key:"cache" json:"cache"`
	HourlyCostCents           int64                             `key:"hourlyCostCents" json:"hourly_cost_cents"` // Cost of one machine in this pool, in cents per hour (e.g. 120 for $1.20/hr)
	// ManagedEndpoints lets platform endpoint replicas fill this pool's spare GPUs.
	ManagedEndpoints WorkerPoolManagedEndpointsConfig `key:"managedEndpoints" json:"managed_endpoints"`
	// Locality is the network domain used to scope KV caching and P/D pairing.
	// Defaults to the pool name.
	Locality string `key:"locality" json:"locality"`
}

func (WorkerPoolConfig) AgentHosted

func (c WorkerPoolConfig) AgentHosted() bool

AgentHosted reports whether this concrete pool uses the agent control path.

func (WorkerPoolConfig) CPUClass

func (p WorkerPoolConfig) CPUClass() CPUTier

CPUClass is the tier a pool sells. A hosted CPU pool that schedules more than one vCPU per physical CPU sells Shared, and any other hosted CPU pool sells Performance. GPU pools and customer machines sell none.

func (WorkerPoolConfig) HostedCPU

func (p WorkerPoolConfig) HostedCPU() bool

HostedCPU reports whether the pool is Beam-hosted CPU capacity, the only capacity CPU tiers use. Managed serverless (external) pools run on agents but are Beam capacity; private and provider pools are customer machines.

type WorkerPoolController

type WorkerPoolController string

type WorkerPoolJobSpecConfig

type WorkerPoolJobSpecConfig struct {
	NodeSelector map[string]string `key:"nodeSelector" json:"node_selector"`
	Env          []corev1.EnvVar   `key:"env" json:"env"`

	// Mimics corev1.Volume since that type doesn't currently serialize correctly
	Volumes []struct {
		Name   string `key:"name" json:"name"`
		Secret struct {
			SecretName string `key:"secretName" json:"secret_name"`
		} `key:"secret" json:"secret"`
	} `key:"volumes" json:"volumes"`

	VolumeMounts []corev1.VolumeMount `key:"volumeMounts" json:"volume_mounts"`
}

type WorkerPoolJobSpecPoolSizingConfig

type WorkerPoolJobSpecPoolSizingConfig struct {
	DefaultWorkerCPU      string `key:"defaultWorkerCPU" json:"default_worker_cpu"`
	DefaultWorkerMemory   string `key:"defaultWorkerMemory" json:"default_worker_memory"`
	DefaultWorkerGpuType  string `key:"defaultWorkerGPUType" json:"default_worker_gpu_type"`
	DefaultWorkerGpuCount string `key:"defaultWorkerGpuCount" json:"default_worker_gpu_count"`
	MinFreeCPU            string `key:"minFreeCPU" json:"min_free_cpu"`
	MinFreeMemory         string `key:"minFreeMemory" json:"min_free_memory"`
	MinFreeGPU            string `key:"minFreeGPU" json:"min_free_gpu"`
	SharedMemoryLimitPct  string `key:"sharedMemoryLimitPct" json:"shared_memory_limit_pct"`
}

type WorkerPoolManagedEndpointsConfig

type WorkerPoolManagedEndpointsConfig struct {
	Enabled bool `key:"enabled" json:"enabled"`
}

WorkerPoolManagedEndpointsConfig opts a pool into hosting endpoint replicas.

type WorkerPoolManagementSource

type WorkerPoolManagementSource string

type WorkerPoolSizingConfig

type WorkerPoolSizingConfig struct {
	MinFreeCpu            int64
	MinFreeMemory         int64
	MinFreeGpu            uint
	DefaultWorkerCpu      int64
	DefaultWorkerMemory   int64
	DefaultWorkerGpuType  string
	DefaultWorkerGpuCount uint32
}

func NewWorkerPoolSizingConfig

func NewWorkerPoolSizingConfig() *WorkerPoolSizingConfig

type WorkerPoolState

type WorkerPoolState struct {
	Status             WorkerPoolStatus `redis:"status" json:"status"`
	SchedulingLatency  int64            `redis:"scheduling_latency" json:"scheduling_latency"`
	FreeGpu            uint             `redis:"free_gpu" json:"free_gpu"`
	FreeCpu            int64            `redis:"free_cpu" json:"free_cpu"`
	FreeMemory         int64            `redis:"free_memory" json:"free_memory"`
	PendingWorkers     int64            `redis:"pending_workers" json:"pending_workers"`
	AvailableWorkers   int64            `redis:"available_workers" json:"available_workers"`
	PendingContainers  int64            `redis:"pending_containers" json:"pending_containers"`
	RunningContainers  int64            `redis:"running_containers" json:"running_containers"`
	RegisteredMachines int64            `redis:"registered_machines" json:"registered_machines"`
	PendingMachines    int64            `redis:"pending_machines" json:"pending_machines"`
	ReadyMachines      int64            `redis:"ready_machines" json:"ready_machines"`
}

@go2proto

func (*WorkerPoolState) ToProto

func (w *WorkerPoolState) ToProto() *pb.WorkerPoolState

type WorkerPoolStatus

type WorkerPoolStatus string
const (
	WorkerPoolStatusHealthy  WorkerPoolStatus = "HEALTHY"
	WorkerPoolStatusDegraded WorkerPoolStatus = "DEGRADED"
)

type WorkerStatus

type WorkerStatus string

type Workspace

type Workspace struct {
	Id                 uint              `db:"id" json:"id,omitempty" serializer:"id,source:external_id"`
	ExternalId         string            `db:"external_id" json:"external_id,omitempty" serializer:"external_id"`
	Name               string            `db:"name" json:"name" serializer:"name"`
	CreatedAt          Time              `db:"created_at" json:"created_at,omitempty" serializer:"created_at"`
	UpdatedAt          Time              `db:"updated_at" json:"updated_at,omitempty" serializer:"updated_at"`
	SigningKey         *string           `db:"signing_key" json:"signing_key" serializer:"signing_key"`
	VolumeCacheEnabled bool              `db:"volume_cache_enabled" json:"volume_cache_enabled" serializer:"volume_cache_enabled"`
	MultiGpuEnabled    bool              `db:"multi_gpu_enabled" json:"multi_gpu_enabled" serializer:"multi_gpu_enabled"`
	ConcurrencyLimitId *uint             `db:"concurrency_limit_id" json:"concurrency_limit_id,omitempty"`
	ConcurrencyLimit   *ConcurrencyLimit `db:"concurrency_limit" json:"concurrency_limit" serializer:"concurrency_limit,omitempty"`
	StorageId          *uint             `db:"storage_id" json:"storage_id,omitempty" serializer:"storage_id,from:storage.external_id,omitempty"`
	Storage            *WorkspaceStorage `db:"storage" json:"storage" serializer:"storage,omitempty"`
}

@go2proto

func NewWorkspaceFromProto

func NewWorkspaceFromProto(in *pb.Workspace) *Workspace

func (*Workspace) StorageAvailable

func (w *Workspace) StorageAvailable() bool

func (*Workspace) ToProto

func (w *Workspace) ToProto() *pb.Workspace

func (Workspace) WithoutPrivateCredentials

func (w Workspace) WithoutPrivateCredentials() Workspace

func (Workspace) WithoutSigningKey

func (w Workspace) WithoutSigningKey() Workspace

type WorkspaceStorage

type WorkspaceStorage struct {
	Id          *uint      `db:"id" json:"id"`
	ExternalId  *string    `db:"external_id" json:"external_id"`
	BucketName  *string    `db:"bucket_name" json:"bucket_name"`
	AccessKey   *string    `db:"access_key" json:"access_key" encrypt:"true"`
	SecretKey   *string    `db:"secret_key" json:"secret_key" encrypt:"true"`
	EndpointUrl *string    `db:"endpoint_url" json:"endpoint_url"`
	Region      *string    `db:"region" json:"region"`
	CreatedAt   *time.Time `db:"created_at" json:"created_at,omitempty"`
	UpdatedAt   *time.Time `db:"updated_at" json:"updated_at,omitempty"`
}

@go2proto

func NewWorkspaceStorageFromProto

func NewWorkspaceStorageFromProto(in *pb.WorkspaceStorage) *WorkspaceStorage

func (*WorkspaceStorage) ToProto

func (w *WorkspaceStorage) ToProto() *pb.WorkspaceStorage

type WorkspaceStorageConfig

type WorkspaceStorageConfig struct {
	BaseMountPath               string `key:"baseMountPath" json:"base_mount_path"`
	DefaultStorageMode          string `key:"defaultStorageMode" json:"default_storage_mode"`
	DefaultBucketPrefix         string `key:"defaultBucketPrefix" json:"default_bucket_prefix"`
	DefaultAccessKey            string `key:"defaultAccessKey" json:"default_access_key"`
	DefaultSecretKey            string `key:"defaultSecretKey" json:"default_secret_key"`
	DefaultEndpointUrl          string `key:"defaultEndpointUrl" json:"default_endpoint_url"`
	DefaultPresignedEndpointUrl string `key:"defaultPresignedEndpointUrl" json:"default_presigned_endpoint_url"`
	DefaultRegion               string `key:"defaultRegion" json:"default_region"`

	// Storage mode configs
	Geese GeeseConfig `key:"geese" json:"geese"`
}

type WorkspaceWebhook

type WorkspaceWebhook struct {
	ExternalId  string    `json:"id"`
	URL         string    `json:"url"`
	EventTypes  []string  `json:"event_types"`
	Secret      string    `json:"secret,omitempty"`
	Description string    `json:"description,omitempty"`
	Enabled     bool      `json:"enabled"`
	CreatedAt   time.Time `json:"created_at"`
}

WorkspaceWebhook receives CloudEvents JSON signed with HMAC-SHA256(Secret) in `X-Beta9-Signature`.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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