Documentation
¶
Index ¶
- Constants
- Variables
- func DeliverWebhook(ctx context.Context, webhook types.WorkspaceWebhook, event cloudevents.Event) error
- func GenerateDSN(config types.PostgresConfig) string
- func GenerateSubdomain(deploymentName, stubType string, workspaceId uint) string
- func NewCacheRedisRepository(rdb *common.RedisClient) cache.CoordinatorRepository
- func NewRedisClientForTest() (*common.RedisClient, error)
- type AuthInfo
- type BackendRepository
- type CacheRedisRepository
- func (r *CacheRedisRepository) CountCacheRegistrations(ctx context.Context, logicalHostID string) (int64, error)
- func (r *CacheRedisRepository) GetActiveCacheRegistration(ctx context.Context, logicalHostID string) (string, bool, error)
- func (r *CacheRedisRepository) GetCacheLogicalHost(ctx context.Context, logicalHostID string) (cache.CoordinatorHost, bool, error)
- func (r *CacheRedisRepository) GetCacheRegistration(ctx context.Context, logicalHostID, registrationID string) (cache.CoordinatorHost, bool, error)
- func (r *CacheRedisRepository) ListCacheLogicalHosts(ctx context.Context, poolName, locality string) ([]string, error)
- func (r *CacheRedisRepository) ListCacheRegistrations(ctx context.Context, logicalHostID string) ([]string, error)
- func (r *CacheRedisRepository) RemoveCacheLogicalHost(ctx context.Context, poolName, locality, logicalHostID string) error
- func (r *CacheRedisRepository) RemoveCacheLogicalHostFromPool(ctx context.Context, poolName, locality, logicalHostID string) error
- func (r *CacheRedisRepository) RemoveCacheRegistration(ctx context.Context, logicalHostID, registrationID string) error
- func (r *CacheRedisRepository) SetActiveCacheRegistration(ctx context.Context, logicalHostID, registrationID string, ttl time.Duration) error
- func (r *CacheRedisRepository) SetCacheRegistration(ctx context.Context, host cache.CoordinatorHost, ttl time.Duration) error
- type ComputeRedisRepository
- func (r *ComputeRedisRepository) DeleteAgentMachineState(ctx context.Context, workspaceID, poolName, machineID string) error
- func (r *ComputeRedisRepository) DeleteAgentWorkerSlotState(ctx context.Context, workspaceID, poolName, machineID, workerID string) error
- func (r *ComputeRedisRepository) DeleteFailoverDemand(ctx context.Context, gpu string) error
- func (r *ComputeRedisRepository) DeleteMachineSSHState(ctx context.Context, workspaceID, poolName, machineID string) error
- func (r *ComputeRedisRepository) DeletePoolState(ctx context.Context, workspaceID, name string) error
- func (r *ComputeRedisRepository) GetAgentMachineState(ctx context.Context, workspaceID, poolName, machineID string) (*compute.AgentTokenState, error)
- func (r *ComputeRedisRepository) GetAgentMachineStateForWorkspace(ctx context.Context, workspaceID, machineID string) (*compute.AgentTokenState, error)
- func (r *ComputeRedisRepository) GetAgentTokenState(ctx context.Context, tokenHash string) (*compute.AgentTokenState, error)
- func (r *ComputeRedisRepository) GetJoinTokenState(ctx context.Context, tokenHash string) (*compute.JoinTokenState, error)
- func (r *ComputeRedisRepository) GetMachineSSHState(ctx context.Context, workspaceID, poolName, machineID string) (*compute.MachineSSHState, error)
- func (r *ComputeRedisRepository) GetPoolState(ctx context.Context, workspaceID, name string) (*compute.PoolState, error)
- func (r *ComputeRedisRepository) ListAgentTokenStates(ctx context.Context, workspaceID, poolName string) ([]*compute.AgentTokenState, error)
- func (r *ComputeRedisRepository) ListAgentWorkerSlotStates(ctx context.Context, workspaceID, poolName, machineID string) ([]*compute.AgentWorkerSlotState, error)
- func (r *ComputeRedisRepository) ListAllPoolStates(ctx context.Context, limit int) ([]*compute.PoolState, error)
- func (r *ComputeRedisRepository) ListFailoverDemand(ctx context.Context) ([]*compute.FailoverDemand, error)
- func (r *ComputeRedisRepository) ListPoolStates(ctx context.Context, workspaceID string, limit int) ([]*compute.PoolState, error)
- func (r *ComputeRedisRepository) OnDemandSpendCents(ctx context.Context, window time.Duration) (float64, error)
- func (r *ComputeRedisRepository) PruneAgentMachineIndex(ctx context.Context, workspaceID, poolName string) error
- func (r *ComputeRedisRepository) PushFailoverDemand(ctx context.Context, demand *compute.FailoverDemand, ttl time.Duration) error
- func (r *ComputeRedisRepository) RecordOnDemandSpend(ctx context.Context, at time.Time, cents float64) error
- func (r *ComputeRedisRepository) SaveAgentTokenState(ctx context.Context, state *compute.AgentTokenState, ttl time.Duration) error
- func (r *ComputeRedisRepository) SaveAgentWorkerSlotState(ctx context.Context, state *compute.AgentWorkerSlotState) error
- func (r *ComputeRedisRepository) SaveJoinTokenState(ctx context.Context, state *compute.JoinTokenState, ttl time.Duration) error
- func (r *ComputeRedisRepository) SaveMachineSSHState(ctx context.Context, state *compute.MachineSSHState) error
- func (r *ComputeRedisRepository) SavePoolState(ctx context.Context, workspaceID string, state *compute.PoolState) error
- func (r *ComputeRedisRepository) WithMachineSSHStateLock(ctx context.Context, workspaceID, poolName, machineID string, ...) error
- func (r *ComputeRedisRepository) WithPoolStateLock(ctx context.Context, workspaceID, name string, fn func(context.Context) error) error
- type ComputeRepository
- type ContainerRedisRepository
- func (c *ContainerRedisRepository) AcquireEndpointRequestToken(ctx context.Context, workspaceName, stubId, containerId string, maxTokens int, ...) (bool, error)
- func (c *ContainerRedisRepository) CheckContainerConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
- func (c *ContainerRedisRepository) CreateContainerStateWithConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
- func (cr *ContainerRedisRepository) DeleteBackendRoutesByContainerID(ctx context.Context, containerID string) error
- func (cr *ContainerRedisRepository) DeleteBackendRoutesByMachine(ctx context.Context, workspaceID, poolName, machineID string) error
- func (cr *ContainerRedisRepository) DeleteContainerState(containerId string) error
- func (cr *ContainerRedisRepository) DeleteStubState(stubId string) error
- func (c *ContainerRedisRepository) EndpointRequestHeartbeatExists(ctx context.Context, workspaceName, stubId, taskId, containerId string) (bool, error)
- func (cr *ContainerRedisRepository) GetActiveContainersByStubId(stubId string) ([]types.ContainerState, error)
- func (cr *ContainerRedisRepository) GetActiveContainersByWorkerId(workerId string) ([]types.ContainerState, error)
- func (cr *ContainerRedisRepository) GetActiveContainersByWorkspaceId(workspaceId string) ([]types.ContainerState, error)
- func (cr *ContainerRedisRepository) GetBackendRoute(ctx context.Context, routeID string) (*types.BackendRoute, error)
- func (cr *ContainerRedisRepository) GetContainerAddress(containerId string) (string, error)
- func (cr *ContainerRedisRepository) GetContainerAddressMap(containerId string) (map[int32]string, error)
- func (cr *ContainerRedisRepository) GetContainerExitCode(containerId string) (int, error)
- func (cr *ContainerRedisRepository) GetContainerRequestStatus(containerId string) (types.ContainerRequestStatus, error)
- func (cr *ContainerRedisRepository) GetContainerState(containerId string) (*types.ContainerState, error)
- func (cr *ContainerRedisRepository) GetContainerStatuses(containerIds []string) (map[string]types.ContainerStatus, error)
- func (c *ContainerRedisRepository) GetEndpointRequestTokens(ctx context.Context, workspaceName, stubId, containerId string, maxTokens int, ...) (int, error)
- func (cr *ContainerRedisRepository) GetFailedContainersByStubId(stubId string) ([]string, error)
- func (cr *ContainerRedisRepository) GetSandboxActivity(workspaceId string, appIds []string, since time.Time) (map[string][]types.AppActivityBucket, error)
- func (cr *ContainerRedisRepository) GetStubState(stubId string) (string, error)
- func (cr *ContainerRedisRepository) GetWorkerAddress(ctx context.Context, containerId string) (string, error)
- func (cr *ContainerRedisRepository) ListBackendRoutesByMachine(ctx context.Context, workspaceID, poolName, machineID string) ([]types.BackendRoute, error)
- func (cr *ContainerRedisRepository) ListBackendRoutesByMachineID(ctx context.Context, machineID string) ([]types.BackendRoute, error)
- func (cr *ContainerRedisRepository) MarkPendingContainerStoppingIfUnassigned(containerId string, expirySeconds int64) (bool, error)
- func (c *ContainerRedisRepository) PodKeepWarmLockExists(ctx context.Context, workspaceName, stubId, containerId string) (bool, error)
- func (cr *ContainerRedisRepository) RecordSandboxCreated(workspaceId, appId string, at time.Time) error
- func (cr *ContainerRedisRepository) RefreshBuildContainerTTL(containerId string, ttl time.Duration) (bool, error)
- func (c *ContainerRedisRepository) RefreshEndpointRequestTokenTTL(ctx context.Context, workspaceName, stubId, containerId string, ...) error
- func (c *ContainerRedisRepository) ReleaseEndpointRequestToken(ctx context.Context, workspaceName, stubId, containerId, taskId string, ...) error
- func (c *ContainerRedisRepository) ReserveContainerConcurrencyForPending(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
- func (cr *ContainerRedisRepository) SetBackendRoute(ctx context.Context, route types.BackendRoute) error
- func (cr *ContainerRedisRepository) SetBackendRoutes(ctx context.Context, routes []types.BackendRoute) error
- func (cr *ContainerRedisRepository) SetBuildContainerTTL(containerId string, ttl time.Duration) error
- func (cr *ContainerRedisRepository) SetContainerAddress(containerId string, addr string) error
- func (cr *ContainerRedisRepository) SetContainerAddressMap(containerId string, addressMap map[int32]string) error
- func (cr *ContainerRedisRepository) SetContainerExitCode(containerId string, exitCode int) error
- func (cr *ContainerRedisRepository) SetContainerFailureCooldown(containerIds []string) error
- func (cr *ContainerRedisRepository) SetContainerRequestStatus(containerId string, status types.ContainerRequestStatus) error
- func (cr *ContainerRedisRepository) SetContainerState(containerId string, state *types.ContainerState) error
- func (c *ContainerRedisRepository) SetEndpointRequestHeartbeat(ctx context.Context, workspaceName, stubId, taskId, containerId string, ...) error
- func (c *ContainerRedisRepository) SetPodKeepWarmLock(ctx context.Context, workspaceName, stubId, containerId string, ...) error
- func (cr *ContainerRedisRepository) SetStubState(stubId, state string) error
- func (cr *ContainerRedisRepository) SetWorkerAddress(containerId string, addr string) error
- func (cr *ContainerRedisRepository) UpdateContainerStatus(containerId string, requestedStatus types.ContainerStatus, expirySeconds int64) error
- type ContainerRepository
- type EventClientOption
- type EventClientRepo
- func (r *EventClientRepo) GetContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (*types.ContainerEventsResponse, error)
- func (r *EventClientRepo) GetEventHistory(ctx context.Context, query types.EventQuery) (*types.EventHistoryResponse, error)
- func (r *EventClientRepo) GetLogs(ctx context.Context, query types.LogQuery) (*types.LogsResponse, error)
- func (r *EventClientRepo) GetPoolMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, ...) (*types.PoolMetricsTimeseriesResponse, error)
- func (r *EventClientRepo) GetStubMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, ...) (*types.MetricsTimeseriesResponse, error)
- func (r *EventClientRepo) GetWorkspaceMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, ...) (*types.MetricsTimeseriesResponse, error)
- func (r *EventClientRepo) PushCloneStubEvent(workspaceId string, stub *types.Stub, parentStub *types.Stub, ...)
- func (r *EventClientRepo) PushComputeEvent(eventType string, event types.EventComputeSchema)
- func (r *EventClientRepo) PushContainerEvent(event types.EventContainerEventSchema)
- func (r *EventClientRepo) PushContainerFunctionTaskEvent(workspaceID string, task types.TaskInterface, eventID types.ContainerEventID, ...)
- func (r *EventClientRepo) PushContainerFunctionTaskLifecycle(workspaceID string, task types.TaskInterface, ...)
- func (r *EventClientRepo) PushContainerLifecycleEvent(lifecycle types.EventContainerLifecycleSchema)
- func (r *EventClientRepo) PushContainerLogDropped(workerID string, request *types.ContainerRequest, message types.EventMessage, ...)
- func (r *EventClientRepo) PushContainerLogEvent(entry types.EventContainerLogSchema)
- func (r *EventClientRepo) PushContainerLogEventQueued(entry types.EventContainerLogSchema) error
- func (r *EventClientRepo) PushContainerLogFirstByte(workerID string, request *types.ContainerRequest, taskID string)
- func (r *EventClientRepo) PushContainerLogFlushCompleted(workerID string, request *types.ContainerRequest)
- func (r *EventClientRepo) PushContainerLogLastByte(workerID string, request *types.ContainerRequest)
- func (r *EventClientRepo) PushContainerRequestEvent(workerID string, request *types.ContainerRequest, ...)
- func (r *EventClientRepo) PushContainerRequestLifecycle(workerID string, request *types.ContainerRequest, ...)
- func (r *EventClientRepo) PushContainerRequestLogLine(workerID string, request *types.ContainerRequest, taskID string, stream string, ...)
- func (r *EventClientRepo) PushContainerResourceMetricsEvent(workerID string, request *types.ContainerRequest, ...)
- func (r *EventClientRepo) PushContainerRunnerEvent(workerID string, request *types.ContainerRequest, ...)
- func (r *EventClientRepo) PushContainerRunningToStartTask(task *types.TaskWithRelated, runningAt time.Time, startedAt time.Time, ...)
- func (r *EventClientRepo) PushContainerTaskEvent(task *types.TaskWithRelated, eventID types.ContainerEventID, ...)
- func (r *EventClientRepo) PushContainerTaskLifecycle(task *types.TaskWithRelated, lifecycleID types.ContainerLifecycleID, ...)
- func (r *EventClientRepo) PushContainerTaskLifecycleSince(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, ...)
- func (r *EventClientRepo) PushDeployStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
- func (r *EventClientRepo) PushEndpointEvent(eventType string, event types.EventEndpointSchema)
- func (r *EventClientRepo) PushEndpointRequestStatsEvent(schema types.EventEndpointRequestStatsSchema)
- func (r *EventClientRepo) PushEndpointRouteEvent(event types.EventEndpointRouteSchema)
- func (r *EventClientRepo) PushFunctionGetArgs(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, ...)
- func (r *EventClientRepo) PushFunctionResultDelivery(workspaceID string, task types.TaskInterface, startedAt time.Time, ...)
- func (r *EventClientRepo) PushFunctionResultLoaded(workspaceID string, task types.TaskInterface, exitCode int32, byteCount int)
- func (r *EventClientRepo) PushFunctionResultSent(workspaceID string, task types.TaskInterface, exitCode int32, byteCount int)
- func (r *EventClientRepo) PushFunctionSetResult(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, ...)
- func (r *EventClientRepo) PushFunctionStreamCancelApplied(workspaceID string, task types.TaskInterface)
- func (r *EventClientRepo) PushFunctionStreamCancelRequested(workspaceID string, task types.TaskInterface)
- func (r *EventClientRepo) PushGatewayEndpointCalledEvent(method, path, workspaceID string, statusCode int, ...)
- func (r *EventClientRepo) PushPlatformCacheEvent(schema types.EventPlatformCacheSchema)
- func (r *EventClientRepo) PushPlatformLogEvent(entry types.EventPlatformLogSchema)
- func (r *EventClientRepo) PushRunStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
- func (r *EventClientRepo) PushServeStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
- func (r *EventClientRepo) PushStubCacheRequiredContent(schema types.EventStubCacheRequiredContentSchema) error
- func (r *EventClientRepo) PushStubStateUnhealthy(workspaceId string, stubId string, currentState string, previousState string, ...)
- func (r *EventClientRepo) PushTaskCancelApplied(task *types.TaskWithRelated, source types.EventSource, ...)
- func (r *EventClientRepo) PushTaskCancelRequested(task *types.TaskWithRelated, source types.EventSource, ...)
- func (r *EventClientRepo) PushTaskCreatedEvent(task *types.TaskWithRelated)
- func (r *EventClientRepo) PushTaskEndEvents(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, ...)
- func (r *EventClientRepo) PushTaskEndPersisted(task *types.TaskWithRelated)
- func (r *EventClientRepo) PushTaskStartEvents(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, ...)
- func (r *EventClientRepo) PushTaskUpdatedEvent(task *types.TaskWithRelated)
- func (r *EventClientRepo) PushWorkerDeletedEvent(workerID, machineID, poolName string, reason types.DeletedWorkerReason)
- func (r *EventClientRepo) PushWorkerStartedEvent(workerID string)
- func (r *EventClientRepo) PushWorkerStoppedEvent(workerID string)
- func (r *EventClientRepo) ReadStubCacheRequiredContent(ctx context.Context, workspaceID, stubID string) ([]types.CacheRequiredContentItem, error)
- func (r *EventClientRepo) StreamAppNamespaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- func (r *EventClientRepo) StreamContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (EventStream, error)
- func (r *EventClientRepo) StreamLogs(ctx context.Context, query types.LogQuery) (EventStream, error)
- func (r *EventClientRepo) StreamStubEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- func (r *EventClientRepo) StreamTaskEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- func (r *EventClientRepo) StreamWorkspaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- type EventRepository
- type EventStream
- type GooseLogger
- type ManagedEndpointRedisRepository
- func (r *ManagedEndpointRedisRepository) CompleteAccounting(ctx context.Context, id string, ttl time.Duration) error
- func (r *ManagedEndpointRedisRepository) DeleteReplica(ctx context.Context, replicaID string) error
- func (r *ManagedEndpointRedisRepository) DrainRequested(ctx context.Context, replicaID string) (bool, uint32, error)
- func (r *ManagedEndpointRedisRepository) GetCharge(ctx context.Context, id string) (*types.Charge, error)
- func (r *ManagedEndpointRedisRepository) GetEndpoint(ctx context.Context, id string) (*types.ManagedEndpoint, error)
- func (r *ManagedEndpointRedisRepository) GetFleet(ctx context.Context) (*types.Fleet, error)
- func (r *ManagedEndpointRedisRepository) GetGitOpsState(ctx context.Context) (*types.GitOpsState, error)
- func (r *ManagedEndpointRedisRepository) GetReplica(ctx context.Context, replicaID string) (*types.EndpointReplica, error)
- func (r *ManagedEndpointRedisRepository) GetReplicaByContainer(ctx context.Context, containerID string) (*types.EndpointReplica, error)
- func (r *ManagedEndpointRedisRepository) GetRouteMetrics(ctx context.Context, endpointID, gpu, replicaID string, configRevision uint64, ...) (*types.RouteMetrics, error)
- func (r *ManagedEndpointRedisRepository) InScheduleBackoff(ctx context.Context, endpointID, gpu string) (bool, error)
- func (r *ManagedEndpointRedisRepository) ListAllReplicas(ctx context.Context) ([]*types.EndpointReplica, error)
- func (r *ManagedEndpointRedisRepository) ListEndpoints(ctx context.Context) ([]*types.ManagedEndpoint, error)
- func (r *ManagedEndpointRedisRepository) ListPendingCharges(ctx context.Context, now time.Time, limit int64) ([]*types.Charge, error)
- func (r *ManagedEndpointRedisRepository) ListReplicas(ctx context.Context, endpointID string) ([]*types.EndpointReplica, error)
- func (r *ManagedEndpointRedisRepository) NotifyReplicaConfig(ctx context.Context, replicaID string, revision uint64) error
- func (r *ManagedEndpointRedisRepository) RecordRouteSample(ctx context.Context, c *types.Charge) error
- func (r *ManagedEndpointRedisRepository) RequestDrain(ctx context.Context, replicaID string, drainSeconds uint32) error
- func (r *ManagedEndpointRedisRepository) SaveCharge(ctx context.Context, c *types.Charge) (bool, error)
- func (r *ManagedEndpointRedisRepository) SaveEndpoint(ctx context.Context, app *types.ManagedEndpoint) error
- func (r *ManagedEndpointRedisRepository) SaveFleet(ctx context.Context, fleet *types.Fleet) error
- func (r *ManagedEndpointRedisRepository) SaveGitOpsState(ctx context.Context, state *types.GitOpsState) error
- func (r *ManagedEndpointRedisRepository) SaveReplica(ctx context.Context, replica *types.EndpointReplica) error
- func (r *ManagedEndpointRedisRepository) SetReplicaProtection(ctx context.Context, replicaID string, protected bool) (*types.EndpointReplica, error)
- func (r *ManagedEndpointRedisRepository) SetScheduleBackoff(ctx context.Context, endpointID, gpu string, ttl time.Duration) error
- func (r *ManagedEndpointRedisRepository) SubscribeReplicaConfig(ctx context.Context, replicaID string) (<-chan uint64, error)
- func (r *ManagedEndpointRedisRepository) WithReplicaLock(ctx context.Context, replicaID string, fn func(context.Context) error) error
- type ManagedEndpointRepository
- type ManagedPoolRedisRepository
- func (r *ManagedPoolRedisRepository) DeleteManagedPoolState(ctx context.Context, workspaceID, name string) error
- func (r *ManagedPoolRedisRepository) GetManagedPoolState(ctx context.Context, workspaceID, name string) (*compute.PoolState, error)
- func (r *ManagedPoolRedisRepository) ListManagedPoolStates(ctx context.Context, workspaceID string, limit int) ([]*compute.PoolState, error)
- func (r *ManagedPoolRedisRepository) SaveManagedPoolState(ctx context.Context, workspaceID string, state *compute.PoolState) error
- func (r *ManagedPoolRedisRepository) WithManagedPoolStateLock(ctx context.Context, workspaceID, name string, fn func(context.Context) error) error
- type ManagedPoolRepository
- type PostgresBackendRepository
- func (c *PostgresBackendRepository) AggregateTaskActivityByApp(ctx context.Context, workspaceID uint, appExternalIDs []string, ...) (map[string][]types.AppActivityBucket, error)
- func (c *PostgresBackendRepository) AggregateTasksByTimeWindow(ctx context.Context, filters types.TaskFilter) ([]types.TaskCountByTime, error)
- func (r *PostgresBackendRepository) AuthorizeToken(ctx context.Context, tokenKey string) (*types.Token, *types.Workspace, error)
- func (c *PostgresBackendRepository) CountActiveDeploymentsByApp(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]int, error)
- func (r *PostgresBackendRepository) CountApps(ctx context.Context, workspaceId uint) (int, error)
- func (r *PostgresBackendRepository) CreateCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (*types.Checkpoint, error)
- func (r *PostgresBackendRepository) CreateConcurrencyLimit(ctx context.Context, workspaceId uint, gpuLimit uint32, ...) (*types.ConcurrencyLimit, error)
- func (c *PostgresBackendRepository) CreateDeployment(ctx context.Context, workspaceId uint, name string, version uint, stubId uint, ...) (*types.Deployment, error)
- func (r *PostgresBackendRepository) CreateDiskSnapshot(ctx context.Context, snapshot *types.DiskSnapshot) (*types.DiskSnapshot, error)
- func (r *PostgresBackendRepository) CreateImage(ctx context.Context, imageId string, clipVersion uint32) (uint32, error)
- func (r *PostgresBackendRepository) CreateObject(ctx context.Context, hash string, size int64, workspaceId uint) (*types.Object, error)
- func (r *PostgresBackendRepository) CreateScheduledJob(ctx context.Context, scheduledJob *types.ScheduledJob) (*types.ScheduledJob, error)
- func (r *PostgresBackendRepository) CreateSecret(ctx context.Context, workspace *types.Workspace, tokenId uint, name string, ...) (*types.Secret, error)
- func (r *PostgresBackendRepository) CreateStack(ctx context.Context, workspaceId uint, name string, spec json.RawMessage) (*types.Stack, error)
- func (r *PostgresBackendRepository) CreateTask(ctx context.Context, params *types.TaskParams) (*types.Task, error)
- func (r *PostgresBackendRepository) CreateToken(ctx context.Context, workspaceId uint, tokenType string, reusable bool) (types.Token, error)
- func (r *PostgresBackendRepository) CreateWorkspace(ctx context.Context) (types.Workspace, error)
- func (r *PostgresBackendRepository) CreateWorkspaceStorage(ctx context.Context, workspaceId uint, storage types.WorkspaceStorage) (*types.WorkspaceStorage, error)
- func (r *PostgresBackendRepository) DeleteApp(ctx context.Context, appId string) error
- func (r *PostgresBackendRepository) DeleteConcurrencyLimit(ctx context.Context, workspaceId types.Workspace) error
- func (r *PostgresBackendRepository) DeleteDeployment(ctx context.Context, deployment types.Deployment) error
- func (r *PostgresBackendRepository) DeleteDisk(ctx context.Context, workspaceId uint, name string) error
- func (r *PostgresBackendRepository) DeleteObjectByExternalId(ctx context.Context, externalId string) error
- func (r *PostgresBackendRepository) DeletePreviousScheduledJob(ctx context.Context, deployment *types.Deployment) error
- func (r *PostgresBackendRepository) DeleteScheduledJob(ctx context.Context, scheduledJob *types.ScheduledJob) error
- func (r *PostgresBackendRepository) DeleteSecret(ctx context.Context, workspace *types.Workspace, name string) error
- func (r *PostgresBackendRepository) DeleteStack(ctx context.Context, workspaceId uint, externalId string) error
- func (r *PostgresBackendRepository) DeleteTask(ctx context.Context, externalId string) error
- func (r *PostgresBackendRepository) DeleteToken(ctx context.Context, workspaceId uint, extTokenId string) error
- func (c *PostgresBackendRepository) DeleteVolume(ctx context.Context, workspaceId uint, name string) error
- func (r *PostgresBackendRepository) GetAdminWorkspace(ctx context.Context) (*types.Workspace, error)
- func (c *PostgresBackendRepository) GetAnyDeploymentByExternalId(ctx context.Context, deploymentExternalId string) (*types.DeploymentWithRelated, error)
- func (r *PostgresBackendRepository) GetCheckpointById(ctx context.Context, checkpointId string) (*types.Checkpoint, error)
- func (r *PostgresBackendRepository) GetConcurrencyLimit(ctx context.Context, concurrencyLimitId uint) (*types.ConcurrencyLimit, error)
- func (r *PostgresBackendRepository) GetConcurrencyLimitByWorkspaceId(ctx context.Context, workspaceId string) (*types.ConcurrencyLimit, error)
- func (c *PostgresBackendRepository) GetDeploymentByExternalId(ctx context.Context, workspaceId uint, deploymentExternalId string) (*types.DeploymentWithRelated, error)
- func (c *PostgresBackendRepository) GetDeploymentByNameAndVersion(ctx context.Context, workspaceId uint, name string, version uint, ...) (*types.DeploymentWithRelated, error)
- func (c *PostgresBackendRepository) GetDeploymentByStubExternalId(ctx context.Context, workspaceId uint, stubExternalId string) (*types.DeploymentWithRelated, error)
- func (c *PostgresBackendRepository) GetDeploymentBySubdomain(ctx context.Context, subdomain string, version uint) (*types.DeploymentWithRelated, error)
- func (r *PostgresBackendRepository) GetDisk(ctx context.Context, workspaceId uint, name string) (*types.Disk, error)
- func (r *PostgresBackendRepository) GetDiskSnapshot(ctx context.Context, workspaceId uint, snapshotId string) (*types.DiskSnapshot, error)
- func (r *PostgresBackendRepository) GetImageClipVersion(ctx context.Context, imageId string) (uint32, error)
- func (r *PostgresBackendRepository) GetImageCredentials(ctx context.Context, workspace *types.Workspace, imageId string) (string, error)
- func (r *PostgresBackendRepository) GetLatestCheckpointByStubId(ctx context.Context, stubExternalId string) (*types.Checkpoint, error)
- func (c *PostgresBackendRepository) GetLatestDeploymentByName(ctx context.Context, workspaceId uint, name string, stubType string, ...) (*types.DeploymentWithRelated, error)
- func (r *PostgresBackendRepository) GetLatestDiskSnapshot(ctx context.Context, workspaceId uint, diskName string) (*types.DiskSnapshot, error)
- func (r *PostgresBackendRepository) GetObjectByExternalId(ctx context.Context, externalId string, workspaceId uint) (types.Object, error)
- func (r *PostgresBackendRepository) GetObjectByExternalStubId(ctx context.Context, stubId string, workspaceId uint) (types.Object, error)
- func (r *PostgresBackendRepository) GetObjectByHash(ctx context.Context, hash string, workspaceId uint) (*types.Object, error)
- func (r *PostgresBackendRepository) GetOrCreateApp(ctx context.Context, workspaceId uint, appName string) (*types.App, error)
- func (r *PostgresBackendRepository) GetOrCreateDisk(ctx context.Context, workspaceId uint, disk *types.Disk) (*types.Disk, error)
- func (r *PostgresBackendRepository) GetOrCreateStub(ctx context.Context, name, stubType string, config types.StubConfigV1, ...) (types.Stub, error)
- func (c *PostgresBackendRepository) GetOrCreateVolume(ctx context.Context, workspaceId uint, name string) (*types.Volume, error)
- func (r *PostgresBackendRepository) GetScheduledJob(ctx context.Context, deploymentId uint) (*types.ScheduledJob, error)
- func (r *PostgresBackendRepository) GetSecretByName(ctx context.Context, workspace *types.Workspace, name string) (*types.Secret, error)
- func (r *PostgresBackendRepository) GetSecretByNameDecrypted(ctx context.Context, workspace *types.Workspace, name string) (*types.Secret, error)
- func (r *PostgresBackendRepository) GetSecretsByName(ctx context.Context, workspace *types.Workspace, names []string) ([]types.Secret, error)
- func (r *PostgresBackendRepository) GetSecretsByNameDecrypted(ctx context.Context, workspace *types.Workspace, names []string) ([]types.Secret, error)
- func (r *PostgresBackendRepository) GetStubByExternalId(ctx context.Context, externalId string, queryFilters ...types.QueryFilter) (*types.StubWithRelated, error)
- func (r *PostgresBackendRepository) GetStubById(ctx context.Context, stubId uint, queryFilters ...types.QueryFilter) (*types.StubWithRelated, error)
- func (r *PostgresBackendRepository) GetTask(ctx context.Context, externalId string) (*types.Task, error)
- func (r *PostgresBackendRepository) GetTaskByWorkspace(ctx context.Context, externalId string, workspace *types.Workspace) (*types.TaskWithRelated, error)
- func (c *PostgresBackendRepository) GetTaskCountPerDeployment(ctx context.Context, filters types.TaskFilter) ([]types.TaskCountPerDeployment, error)
- func (r *PostgresBackendRepository) GetTaskMetrics(ctx context.Context, periodStart, periodEnd time.Time) (types.TaskMetrics, error)
- func (r *PostgresBackendRepository) GetTaskStatus(ctx context.Context, externalId string) (types.TaskStatus, error)
- func (r *PostgresBackendRepository) GetTaskWithRelated(ctx context.Context, externalId string) (*types.TaskWithRelated, error)
- func (r *PostgresBackendRepository) GetTokenByExternalId(ctx context.Context, workspaceId uint, extTokenId string) (*types.Token, error)
- func (c *PostgresBackendRepository) GetVolume(ctx context.Context, workspaceId uint, name string) (*types.Volume, error)
- func (c *PostgresBackendRepository) GetVolumeByExternalId(ctx context.Context, workspaceId uint, externalId string) (*types.Volume, error)
- func (r *PostgresBackendRepository) GetWorkspace(ctx context.Context, workspaceId uint) (*types.Workspace, error)
- func (r *PostgresBackendRepository) GetWorkspaceByExternalId(ctx context.Context, externalId string) (types.Workspace, error)
- func (r *PostgresBackendRepository) GetWorkspaceByExternalIdWithSigningKey(ctx context.Context, externalId string) (types.Workspace, error)
- func (r *PostgresBackendRepository) GetWorkspaceStorage(ctx context.Context, storageId uint) (*types.WorkspaceStorage, error)
- func (c *PostgresBackendRepository) ListAppIDsByStubExternalIDs(ctx context.Context, workspaceID string, stubExternalIDs []string) (map[string]string, error)
- func (r *PostgresBackendRepository) ListApps(ctx context.Context, workspaceId uint) ([]types.App, error)
- func (r *PostgresBackendRepository) ListAppsPaginated(ctx context.Context, workspaceId uint, filters types.AppFilter) (common.CursorPaginationInfo[types.App], error)
- func (r *PostgresBackendRepository) ListCheckpoints(ctx context.Context, workspaceExternalId string) ([]types.Checkpoint, error)
- func (r *PostgresBackendRepository) ListConcurrencyLimitsByWorkspaceId(ctx context.Context, workspaceId string) ([]types.ConcurrencyLimit, error)
- func (c *PostgresBackendRepository) ListDeploymentsPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
- func (c *PostgresBackendRepository) ListDeploymentsWithRelated(ctx context.Context, filters types.DeploymentFilter) ([]types.DeploymentWithRelated, error)
- func (r *PostgresBackendRepository) ListDiskSnapshots(ctx context.Context, filter types.DiskSnapshotFilter) ([]types.DiskSnapshot, error)
- func (r *PostgresBackendRepository) ListDisksWithRelated(ctx context.Context, workspaceId uint) ([]types.DiskWithRelated, error)
- func (c *PostgresBackendRepository) ListLatestDeploymentsByAppIDs(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]types.DeploymentWithRelated, error)
- func (c *PostgresBackendRepository) ListLatestDeploymentsWithRelatedPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
- func (c *PostgresBackendRepository) ListLatestStubsByAppIDs(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]types.StubWithRelated, error)
- func (r *PostgresBackendRepository) ListSecrets(ctx context.Context, workspace *types.Workspace) ([]types.Secret, error)
- func (r *PostgresBackendRepository) ListStacks(ctx context.Context, workspaceId uint) ([]types.Stack, error)
- func (r *PostgresBackendRepository) ListStaleCheckpoints(ctx context.Context, activeRecentStubKeys []string, ...) ([]types.Checkpoint, error)
- func (c *PostgresBackendRepository) ListStubs(ctx context.Context, filters types.StubFilter) ([]types.StubWithRelated, error)
- func (c *PostgresBackendRepository) ListStubsPaginated(ctx context.Context, filters types.StubFilter) (common.CursorPaginationInfo[types.StubWithRelated], error)
- func (r *PostgresBackendRepository) ListTasks(ctx context.Context) ([]types.Task, error)
- func (c *PostgresBackendRepository) ListTasksWithRelated(ctx context.Context, filters types.TaskFilter) ([]types.TaskWithRelated, error)
- func (c *PostgresBackendRepository) ListTasksWithRelatedPaginated(ctx context.Context, filters types.TaskFilter) (common.CursorPaginationInfo[types.TaskWithRelated], error)
- func (r *PostgresBackendRepository) ListTokens(ctx context.Context, workspaceId uint) ([]types.Token, error)
- func (c *PostgresBackendRepository) ListVolumesWithRelated(ctx context.Context, workspaceId uint) ([]types.VolumeWithRelated, error)
- func (r *PostgresBackendRepository) ListWorkspaces(ctx context.Context) ([]types.Workspace, error)
- func (r *PostgresBackendRepository) ListenToChannel(ctx context.Context, channel string) (<-chan string, error)
- func (r *PostgresBackendRepository) Migrate() error
- func (r *PostgresBackendRepository) MigrateContext(ctx context.Context) error
- func (r *PostgresBackendRepository) Ping() error
- func (r *PostgresBackendRepository) PruneCheckpoints(ctx context.Context, checkpointIds []string) ([]types.Checkpoint, error)
- func (r *PostgresBackendRepository) RetrieveActiveToken(ctx context.Context, workspaceId uint) (*types.Token, error)
- func (r *PostgresBackendRepository) RetrieveApp(ctx context.Context, workspaceId uint, appId string) (*types.App, error)
- func (r *PostgresBackendRepository) RetrieveAppByStubExternalId(ctx context.Context, stubExternalId string) (*types.App, error)
- func (r *PostgresBackendRepository) RevertToConcurrencyLimit(ctx context.Context, workspaceId string, concurrencyLimitId string) (*types.ConcurrencyLimit, error)
- func (r *PostgresBackendRepository) RevokeTokenByExternalId(ctx context.Context, externalId string) error
- func (r *PostgresBackendRepository) SetImageCredentialSecretNames(ctx context.Context, imageId string, names []string) error
- func (r *PostgresBackendRepository) ToggleToken(ctx context.Context, workspaceId uint, extTokenId string) (types.Token, error)
- func (r *PostgresBackendRepository) UpdateCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (*types.Checkpoint, error)
- func (r *PostgresBackendRepository) UpdateConcurrencyLimit(ctx context.Context, concurrencyLimitId uint, gpuLimit uint32, ...) (*types.ConcurrencyLimit, error)
- func (r *PostgresBackendRepository) UpdateDeployment(ctx context.Context, deployment types.Deployment) (*types.Deployment, error)
- func (r *PostgresBackendRepository) UpdateDiskSnapshot(ctx context.Context, snapshot *types.DiskSnapshot) (*types.DiskSnapshot, error)
- func (r *PostgresBackendRepository) UpdateObjectSizeByExternalId(ctx context.Context, externalId string, size int) error
- func (r *PostgresBackendRepository) UpdateSecret(ctx context.Context, workspace *types.Workspace, tokenId uint, ...) (*types.Secret, error)
- func (r *PostgresBackendRepository) UpdateStack(ctx context.Context, workspaceId uint, externalId, name string, ...) (*types.Stack, error)
- func (r *PostgresBackendRepository) UpdateStubConfig(ctx context.Context, stubId uint, config *types.StubConfigV1) error
- func (r *PostgresBackendRepository) UpdateTask(ctx context.Context, externalId string, updatedTask types.Task) (*types.Task, error)
- func (r *PostgresBackendRepository) UpdateTokenAsClusterAdmin(ctx context.Context, tokenId string, disabled bool) error
- type ProviderRedisRepository
- func (r *ProviderRedisRepository) AddMachine(providerName, poolName, machineId string, ...) error
- func (r *ProviderRedisRepository) GetGPUAvailability(pools map[string]types.WorkerPoolConfig) (map[string]bool, error)
- func (r *ProviderRedisRepository) GetGPUCounts(pools map[string]types.WorkerPoolConfig) (map[string]int, error)
- func (r *ProviderRedisRepository) GetMachine(providerName, poolName, machineId string) (*types.ProviderMachine, error)
- func (r *ProviderRedisRepository) ListAllMachines(providerName, poolName string, useLock bool) ([]*types.ProviderMachine, error)
- func (r *ProviderRedisRepository) RegisterMachine(providerName, poolName, machineId string, ...) error
- func (r *ProviderRedisRepository) RemoveMachine(providerName, poolName, machineId string) error
- func (r *ProviderRedisRepository) RemoveMachineLock(providerName, poolName, machineId string) error
- func (r *ProviderRedisRepository) SetLastWorkerSeen(providerName, poolName, machineId string) error
- func (r *ProviderRedisRepository) SetMachineKeepAlive(providerName, poolName, machineId, agentVersion string, ...) error
- func (r *ProviderRedisRepository) SetMachineLock(providerName, poolName, machineId string) error
- func (r *ProviderRedisRepository) WaitForMachineRegistration(providerName, poolName, machineId string) (*types.ProviderMachineState, error)
- type ProviderRepository
- type S2EventRepository
- func (r *S2EventRepository) GetContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (*types.ContainerEventsResponse, error)
- func (r *S2EventRepository) GetEventHistory(ctx context.Context, query types.EventQuery) (*types.EventHistoryResponse, error)
- func (r *S2EventRepository) GetLogs(ctx context.Context, query types.LogQuery) (*types.LogsResponse, error)
- func (r *S2EventRepository) GetPoolMetricsTimeseries(ctx context.Context, query types.EventQuery, start, end time.Time, ...) (*types.PoolMetricsTimeseriesResponse, error)
- func (r *S2EventRepository) GetStubMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, ...) (*types.MetricsTimeseriesResponse, error)
- func (r *S2EventRepository) GetWorkspaceMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, ...) (*types.MetricsTimeseriesResponse, error)
- func (r *S2EventRepository) PushEvent(event cloudevents.Event) error
- func (r *S2EventRepository) PushEventSync(event cloudevents.Event) error
- func (r *S2EventRepository) ReadStubCacheRequiredContent(ctx context.Context, workspaceID, stubID string) ([]types.CacheRequiredContentItem, error)
- func (r *S2EventRepository) StreamAppNamespaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- func (r *S2EventRepository) StreamContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (EventStream, error)
- func (r *S2EventRepository) StreamLogs(ctx context.Context, query types.LogQuery) (EventStream, error)
- func (r *S2EventRepository) StreamStubEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- func (r *S2EventRepository) StreamTaskEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- func (r *S2EventRepository) StreamWorkspaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
- type SchedulerRepository
- type ScopedS2EventRepository
- type TailscaleRedisRepository
- type TailscaleRepository
- type TaskRedisRepository
- func (r *TaskRedisRepository) ClaimTask(ctx context.Context, workspaceName, stubId, taskId, containerId string) error
- func (r *TaskRedisRepository) DeleteTaskState(ctx context.Context, workspaceName, stubId, taskId string) error
- func (r *TaskRedisRepository) GetTaskState(ctx context.Context, workspaceName, stubId, taskId string) (*types.TaskMessage, error)
- func (r *TaskRedisRepository) GetTasksInFlight(ctx context.Context) ([]*types.TaskMessage, error)
- func (r *TaskRedisRepository) IsClaimed(ctx context.Context, workspaceName, stubId, taskId string) (bool, error)
- func (r *TaskRedisRepository) RemoveTaskClaim(ctx context.Context, workspaceName, stubId, taskId string) error
- func (r *TaskRedisRepository) RemoveTaskRetryLock(ctx context.Context, workspaceName, stubId, taskId string) error
- func (r *TaskRedisRepository) SetTaskRetryLock(ctx context.Context, workspaceName, stubId, taskId string) error
- func (r *TaskRedisRepository) SetTaskState(ctx context.Context, workspaceName, stubId, taskId string, msg []byte) error
- func (r *TaskRedisRepository) TasksClaimed(ctx context.Context, workspaceName, stubId string) (int, error)
- func (r *TaskRedisRepository) TasksInFlight(ctx context.Context, workspaceName, stubId string) (int, error)
- func (r *TaskRedisRepository) WithTaskMonitorLease(ctx context.Context, fn func(context.Context) error) error
- type TaskRepository
- type ThunderClientEnrollmentState
- type ThunderNodeEnrollmentState
- type ThunderRedisRepository
- func (r *ThunderRedisRepository) DeleteClientEnrollment(ctx context.Context, containerID string) error
- func (r *ThunderRedisRepository) DeleteNodeEnrollment(ctx context.Context, workspaceID, poolName, machineID string) error
- func (r *ThunderRedisRepository) DeleteZone(ctx context.Context, workspaceID, poolName string) error
- func (r *ThunderRedisRepository) GetClientEnrollment(ctx context.Context, containerID string) (*ThunderClientEnrollmentState, bool, error)
- func (r *ThunderRedisRepository) GetNodeEnrollment(ctx context.Context, workspaceID, poolName, machineID string) (*ThunderNodeEnrollmentState, bool, error)
- func (r *ThunderRedisRepository) GetZone(ctx context.Context, workspaceID, poolName string) (*ThunderZoneState, bool, error)
- func (r *ThunderRedisRepository) ListClientEnrollments(ctx context.Context) ([]*ThunderClientEnrollmentState, error)
- func (r *ThunderRedisRepository) ListNodeEnrollments(ctx context.Context, workspaceID, poolName string) ([]*ThunderNodeEnrollmentState, error)
- func (r *ThunderRedisRepository) ListZones(ctx context.Context, workspaceID string) ([]*ThunderZoneState, error)
- func (r *ThunderRedisRepository) SaveClientEnrollment(ctx context.Context, state *ThunderClientEnrollmentState) error
- func (r *ThunderRedisRepository) SaveNodeEnrollment(ctx context.Context, state *ThunderNodeEnrollmentState) error
- func (r *ThunderRedisRepository) SaveZone(ctx context.Context, state *ThunderZoneState) error
- func (r *ThunderRedisRepository) WithPoolLock(ctx context.Context, workspaceID, poolName string, ...) error
- type ThunderRepository
- type ThunderZoneState
- type UsageMeterReader
- type UsageMetricsRepository
- type WebhookSource
- type WorkerPoolRedisRepository
- func (r *WorkerPoolRedisRepository) DeleteWorkerPoolState(ctx context.Context, poolName string) error
- func (r *WorkerPoolRedisRepository) GetWorkerPoolState(ctx context.Context, poolName string) (*types.WorkerPoolState, error)
- func (r *WorkerPoolRedisRepository) RemoveWorkerCleanerLock(poolName string) error
- func (r *WorkerPoolRedisRepository) RemoveWorkerPoolSizerLock(poolName string) error
- func (r *WorkerPoolRedisRepository) RemoveWorkerPoolStateLock(poolName string) error
- func (r *WorkerPoolRedisRepository) SetWorkerCleanerLock(poolName string) error
- func (r *WorkerPoolRedisRepository) SetWorkerPoolSizerLock(poolName string) error
- func (r *WorkerPoolRedisRepository) SetWorkerPoolState(ctx context.Context, poolName string, state *types.WorkerPoolState) error
- func (r *WorkerPoolRedisRepository) SetWorkerPoolStateLock(poolName string) error
- type WorkerPoolRepository
- type WorkerRedisRepository
- func (r *WorkerRedisRepository) AddContainerToWorker(workerId, containerId, deliveryToken string) error
- func (r *WorkerRedisRepository) AddWorker(worker *types.Worker) error
- func (r *WorkerRedisRepository) CancelWorkerRollout(workerId, generation string) error
- func (r *WorkerRedisRepository) GetAllWorkers() ([]*types.Worker, error)
- func (r *WorkerRedisRepository) GetAllWorkersInPool(poolName string) ([]*types.Worker, error)
- func (r *WorkerRedisRepository) GetAllWorkersOnMachine(machineId string) ([]*types.Worker, error)
- func (r *WorkerRedisRepository) GetContainerIp(networkPrefix string, containerId string) (string, error)
- func (r *WorkerRedisRepository) GetContainerIpAssignments(networkPrefix string) ([]types.ContainerIpAssignment, error)
- func (r *WorkerRedisRepository) GetContainerIps(networkPrefix string) ([]string, error)
- func (r *WorkerRedisRepository) GetFreeGpuCounts() (map[string]int, error)
- func (r *WorkerRedisRepository) GetGpuAvailability() (map[string]bool, error)
- func (r *WorkerRedisRepository) GetGpuCounts() (map[string]int, error)
- func (r *WorkerRedisRepository) GetId() string
- func (r *WorkerRedisRepository) GetNextContainerRequest(workerId string) (*types.ContainerRequest, error)
- func (r *WorkerRedisRepository) GetNextContainerRequests(workerId string, limit int) ([]*types.ContainerRequest, error)
- func (r *WorkerRedisRepository) GetPreemptibleGpus() []string
- func (r *WorkerRedisRepository) GetWorkerById(workerId string) (*types.Worker, error)
- func (r *WorkerRedisRepository) MoveContainerIp(networkPrefix, fromContainerId, toContainerId, containerIp string) error
- func (r *WorkerRedisRepository) PrepareWorkerRollout(workerId, generation string) (bool, error)
- func (r *WorkerRedisRepository) RecoverPendingContainerRequests(workerId string) error
- func (r *WorkerRedisRepository) RemoveContainerFromWorker(workerId string, containerId string) error
- func (r *WorkerRedisRepository) RemoveContainerIp(networkPrefix string, containerId string) error
- func (r *WorkerRedisRepository) RemoveImagePullLock(workerId, imageId, token string) error
- func (r *WorkerRedisRepository) RemoveNetworkLock(networkPrefix string, token string) error
- func (r *WorkerRedisRepository) RemoveWorker(workerId string) error
- func (r *WorkerRedisRepository) RemoveWorkerNetworkState(ctx context.Context, networkPrefix string) error
- func (r *WorkerRedisRepository) RequeueContainerRequests(workerId string, requests []*types.ContainerRequest) error
- func (r *WorkerRedisRepository) ScheduleContainerRequest(worker *types.Worker, request *types.ContainerRequest) error
- func (r *WorkerRedisRepository) ScheduleContainerRequests(worker *types.Worker, requests []*types.ContainerRequest) error
- func (r *WorkerRedisRepository) SetContainerIp(networkPrefix string, containerId, containerIp string) error
- func (r *WorkerRedisRepository) SetContainerResourceValues(workerId string, containerId string, usage types.ContainerResourceUsage) error
- func (r *WorkerRedisRepository) SetImagePullLock(workerId, imageId string) (string, error)
- func (r *WorkerRedisRepository) SetNetworkLock(networkPrefix string, ttl, retries int) (string, error)
- func (r *WorkerRedisRepository) SetWorkerCordon(workerId string, cordoned bool) error
- func (r *WorkerRedisRepository) SetWorkerKeepAlive(workerId string, keepAlive types.WorkerKeepAlive) error
- func (r *WorkerRedisRepository) ToggleWorkerAvailable(workerId, generation string) error
- func (r *WorkerRedisRepository) UpdateWorkerCapacity(worker *types.Worker, request *types.ContainerRequest, ...) error
- func (r *WorkerRedisRepository) UpdateWorkerStatus(workerId string, status types.WorkerStatus) error
- type WorkerRepository
- type WorkspaceRedisRepository
- func (wr *WorkspaceRedisRepository) AuthorizeToken(token string) (*types.Token, *types.Workspace, error)
- func (wr *WorkspaceRedisRepository) DeleteWebhook(ctx context.Context, workspaceId, webhookId string) error
- func (wr *WorkspaceRedisRepository) GetConcurrencyLimitByWorkspaceId(workspaceId string) (*types.ConcurrencyLimit, error)
- func (wr *WorkspaceRedisRepository) ListWebhooks(ctx context.Context, workspaceId string) ([]types.WorkspaceWebhook, error)
- func (wr *WorkspaceRedisRepository) RevokeToken(tokenKey string) error
- func (wr *WorkspaceRedisRepository) SetAuthorizationToken(token *types.Token, workspace *types.Workspace) error
- func (wr *WorkspaceRedisRepository) SetConcurrencyLimitByWorkspaceId(workspaceId string, limit *types.ConcurrencyLimit) error
- func (wr *WorkspaceRedisRepository) SetWebhook(ctx context.Context, workspaceId string, webhook types.WorkspaceWebhook) error
- type WorkspaceRepository
Constants ¶
const (
ScheduledJobsChannel = "jobs"
)
Variables ¶
var ( ErrEventReadUnsupported = errors.New("event read unsupported") ErrEventWriteUnsupported = errors.New("event write unsupported") )
var ErrEvictionVictimsChanged = errors.New("eviction victims changed before placement committed")
ErrEvictionVictimsChanged means the chosen victims changed before the placement committed.
var ErrInsufficientEvictableCapacity = errors.New("unable to schedule container, worker out of free and evictable capacity")
var ErrReplicaProtectionChanged = errors.New("replica protection assignment changed; retry reconciliation")
ErrReplicaProtectionChanged is retryable after the controller refreshes its replica snapshot. A stopping, evicted, or unassigned container cannot be promoted.
var ErrWorkerCapacityChanged = errors.New("worker capacity changed after selection")
ErrWorkerCapacityChanged means the scheduler selected the worker from a stale snapshot.
var PostgresDataError = pq.ErrorClass("22")
Functions ¶
func DeliverWebhook ¶
func DeliverWebhook(ctx context.Context, webhook types.WorkspaceWebhook, event cloudevents.Event) error
DeliverWebhook posts one signed CloudEvent; non-2xx is an error.
func GenerateDSN ¶
func GenerateDSN(config types.PostgresConfig) string
func GenerateSubdomain ¶
GenerateSubdomain is deterministic, so a deployment's host URL is known before it exists.
func NewCacheRedisRepository ¶
func NewCacheRedisRepository(rdb *common.RedisClient) cache.CoordinatorRepository
func NewRedisClientForTest ¶
func NewRedisClientForTest() (*common.RedisClient, error)
Types ¶
type BackendRepository ¶
type BackendRepository interface {
ListWorkspaces(ctx context.Context) ([]types.Workspace, error)
CreateWorkspace(ctx context.Context) (types.Workspace, error)
GetWorkspaceByExternalId(ctx context.Context, externalId string) (types.Workspace, error)
GetWorkspaceByExternalIdWithSigningKey(ctx context.Context, externalId string) (types.Workspace, error)
GetWorkspace(ctx context.Context, workspaceId uint) (*types.Workspace, error)
GetWorkspaceStorage(ctx context.Context, storageId uint) (*types.WorkspaceStorage, error)
CreateWorkspaceStorage(ctx context.Context, workspaceId uint, storage types.WorkspaceStorage) (*types.WorkspaceStorage, error)
GetAdminWorkspace(ctx context.Context) (*types.Workspace, error)
CreateObject(ctx context.Context, hash string, size int64, workspaceId uint) (*types.Object, error)
GetObjectByHash(ctx context.Context, hash string, workspaceId uint) (*types.Object, error)
GetObjectByExternalId(ctx context.Context, externalId string, workspaceId uint) (types.Object, error)
GetObjectByExternalStubId(ctx context.Context, stubId string, workspaceId uint) (types.Object, error)
UpdateObjectSizeByExternalId(ctx context.Context, externalId string, size int) error
DeleteObjectByExternalId(ctx context.Context, externalId string) error
CreateToken(ctx context.Context, workspaceId uint, tokenType string, reusable bool) (types.Token, error)
AuthorizeToken(ctx context.Context, tokenKey string) (*types.Token, *types.Workspace, error)
RetrieveActiveToken(ctx context.Context, workspaceId uint) (*types.Token, error)
GetTokenByExternalId(ctx context.Context, workspaceId uint, extTokenId string) (*types.Token, error)
ListTokens(ctx context.Context, workspaceId uint) ([]types.Token, error)
UpdateTokenAsClusterAdmin(ctx context.Context, tokenId string, disabled bool) error
ToggleToken(ctx context.Context, workspaceId uint, extTokenId string) (types.Token, error)
DeleteToken(ctx context.Context, workspaceId uint, extTokenId string) error
GetTask(ctx context.Context, externalId string) (*types.Task, error)
GetTaskStatus(ctx context.Context, externalId string) (types.TaskStatus, error)
GetTaskWithRelated(ctx context.Context, externalId string) (*types.TaskWithRelated, error)
GetTaskByWorkspace(ctx context.Context, externalId string, workspace *types.Workspace) (*types.TaskWithRelated, error)
CreateTask(ctx context.Context, params *types.TaskParams) (*types.Task, error)
UpdateTask(ctx context.Context, externalId string, updatedTask types.Task) (*types.Task, error)
DeleteTask(ctx context.Context, externalId string) error
ListTasks(ctx context.Context) ([]types.Task, error)
ListTasksWithRelated(ctx context.Context, filters types.TaskFilter) ([]types.TaskWithRelated, error)
ListTasksWithRelatedPaginated(ctx context.Context, filters types.TaskFilter) (common.CursorPaginationInfo[types.TaskWithRelated], error)
AggregateTasksByTimeWindow(ctx context.Context, filters types.TaskFilter) ([]types.TaskCountByTime, error)
GetTaskCountPerDeployment(ctx context.Context, filters types.TaskFilter) ([]types.TaskCountPerDeployment, error)
GetOrCreateStub(ctx context.Context, name, stubType string, config types.StubConfigV1, objectId, workspaceId uint, forceCreate bool, appId uint) (types.Stub, error)
UpdateStubConfig(ctx context.Context, stubId uint, config *types.StubConfigV1) error
GetStubByExternalId(ctx context.Context, externalId string, queryFilters ...types.QueryFilter) (*types.StubWithRelated, error)
GetStubById(ctx context.Context, stubId uint, queryFilters ...types.QueryFilter) (*types.StubWithRelated, error)
GetDeploymentBySubdomain(ctx context.Context, subdomain string, version uint) (*types.DeploymentWithRelated, error)
GetVolume(ctx context.Context, workspaceId uint, name string) (*types.Volume, error)
GetVolumeByExternalId(ctx context.Context, workspaceId uint, externalId string) (*types.Volume, error)
GetOrCreateVolume(ctx context.Context, workspaceId uint, name string) (*types.Volume, error)
DeleteVolume(ctx context.Context, workspaceId uint, name string) error
ListVolumesWithRelated(ctx context.Context, workspaceId uint) ([]types.VolumeWithRelated, error)
ListDeploymentsWithRelated(ctx context.Context, filters types.DeploymentFilter) ([]types.DeploymentWithRelated, error)
ListLatestDeploymentsByAppIDs(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]types.DeploymentWithRelated, error)
CountActiveDeploymentsByApp(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]int, error)
AggregateTaskActivityByApp(ctx context.Context, workspaceID uint, appExternalIDs []string, since time.Time) (map[string][]types.AppActivityBucket, error)
ListLatestDeploymentsWithRelatedPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
ListDeploymentsPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
GetLatestDeploymentByName(ctx context.Context, workspaceId uint, name string, stubType string, filterDeleted bool) (*types.DeploymentWithRelated, error)
GetDeploymentByExternalId(ctx context.Context, workspaceId uint, deploymentExternalId string) (*types.DeploymentWithRelated, error)
GetAnyDeploymentByExternalId(ctx context.Context, deploymentExternalId string) (*types.DeploymentWithRelated, error)
GetDeploymentByStubExternalId(ctx context.Context, workspaceId uint, stubExternalId string) (*types.DeploymentWithRelated, error)
GetDeploymentByNameAndVersion(ctx context.Context, workspaceId uint, name string, version uint, stubType string) (*types.DeploymentWithRelated, error)
CreateDeployment(ctx context.Context, workspaceId uint, name string, version uint, stubId uint, stubType string, appId uint) (*types.Deployment, error)
UpdateDeployment(ctx context.Context, deployment types.Deployment) (*types.Deployment, error)
DeleteDeployment(ctx context.Context, deployment types.Deployment) error
ListStubs(ctx context.Context, filters types.StubFilter) ([]types.StubWithRelated, error)
ListLatestStubsByAppIDs(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]types.StubWithRelated, error)
ListAppIDsByStubExternalIDs(ctx context.Context, workspaceID string, stubExternalIDs []string) (map[string]string, error)
ListStubsPaginated(ctx context.Context, filters types.StubFilter) (common.CursorPaginationInfo[types.StubWithRelated], error)
GetConcurrencyLimit(ctx context.Context, concurrenyLimitId uint) (*types.ConcurrencyLimit, error)
GetConcurrencyLimitByWorkspaceId(ctx context.Context, workspaceId string) (*types.ConcurrencyLimit, error)
DeleteConcurrencyLimit(ctx context.Context, workspaceId types.Workspace) error
CreateConcurrencyLimit(ctx context.Context, workspaceId uint, gpuLimit uint32, cpuMillicoreLimit uint32) (*types.ConcurrencyLimit, error)
UpdateConcurrencyLimit(ctx context.Context, concurrencyLimitId uint, gpuLimit uint32, cpuMillicoreLimit uint32) (*types.ConcurrencyLimit, error)
ListConcurrencyLimitsByWorkspaceId(ctx context.Context, workspaceId string) ([]types.ConcurrencyLimit, error)
RevertToConcurrencyLimit(ctx context.Context, workspaceId string, concurrencyLimitId string) (*types.ConcurrencyLimit, error)
CreateSecret(ctx context.Context, workspace *types.Workspace, tokenId uint, name string, value string, validateName bool) (*types.Secret, error)
GetSecretByName(ctx context.Context, workspace *types.Workspace, name string) (*types.Secret, error)
GetSecretsByName(ctx context.Context, workspace *types.Workspace, names []string) ([]types.Secret, error)
GetSecretByNameDecrypted(ctx context.Context, workspace *types.Workspace, name string) (*types.Secret, error)
GetSecretsByNameDecrypted(ctx context.Context, workspace *types.Workspace, names []string) ([]types.Secret, error)
ListSecrets(ctx context.Context, workspace *types.Workspace) ([]types.Secret, error)
UpdateSecret(ctx context.Context, workspace *types.Workspace, tokenId uint, secretName string, value string) (*types.Secret, error)
DeleteSecret(ctx context.Context, workspace *types.Workspace, secretName string) error
ListStacks(ctx context.Context, workspaceId uint) ([]types.Stack, error)
CreateStack(ctx context.Context, workspaceId uint, name string, spec json.RawMessage) (*types.Stack, error)
UpdateStack(ctx context.Context, workspaceId uint, externalId, name string, spec json.RawMessage) (*types.Stack, error)
DeleteStack(ctx context.Context, workspaceId uint, externalId string) error
CreateScheduledJob(ctx context.Context, scheduledJob *types.ScheduledJob) (*types.ScheduledJob, error)
DeleteScheduledJob(ctx context.Context, scheduledJob *types.ScheduledJob) error
DeletePreviousScheduledJob(ctx context.Context, deployment *types.Deployment) error
GetScheduledJob(ctx context.Context, deploymentId uint) (*types.ScheduledJob, error)
ListenToChannel(ctx context.Context, channel string) (<-chan string, error)
Ping() error
GetTaskMetrics(ctx context.Context, periodStart time.Time, periodEnd time.Time) (types.TaskMetrics, error)
GetOrCreateApp(ctx context.Context, workspaceId uint, appName string) (*types.App, error)
RetrieveApp(ctx context.Context, workspaceId uint, appId string) (*types.App, error)
RetrieveAppByStubExternalId(ctx context.Context, stubExternalId string) (*types.App, error)
ListApps(ctx context.Context, workspaceId uint) ([]types.App, error)
ListAppsPaginated(ctx context.Context, workspaceId uint, filters types.AppFilter) (common.CursorPaginationInfo[types.App], error)
CountApps(ctx context.Context, workspaceId uint) (int, error)
DeleteApp(ctx context.Context, appId string) error
GetImageClipVersion(ctx context.Context, imageId string) (uint32, error)
CreateImage(ctx context.Context, imageId string, clipVersion uint32) (uint32, error)
SetImageCredentialSecretNames(ctx context.Context, imageId string, names []string) error
GetImageCredentials(ctx context.Context, workspace *types.Workspace, imageId string) (string, error)
CreateCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (*types.Checkpoint, error)
UpdateCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (*types.Checkpoint, error)
ListCheckpoints(ctx context.Context, workspaceExternalId string) ([]types.Checkpoint, error)
GetCheckpointById(ctx context.Context, checkpointId string) (*types.Checkpoint, error)
GetLatestCheckpointByStubId(ctx context.Context, stubExternalId string) (*types.Checkpoint, error)
ListStaleCheckpoints(ctx context.Context, activeRecentStubKeys []string, stubLastUsedBefore time.Time) ([]types.Checkpoint, error)
PruneCheckpoints(ctx context.Context, checkpointIds []string) ([]types.Checkpoint, error)
CreateDiskSnapshot(ctx context.Context, snapshot *types.DiskSnapshot) (*types.DiskSnapshot, error)
UpdateDiskSnapshot(ctx context.Context, snapshot *types.DiskSnapshot) (*types.DiskSnapshot, error)
GetDiskSnapshot(ctx context.Context, workspaceId uint, snapshotId string) (*types.DiskSnapshot, error)
GetLatestDiskSnapshot(ctx context.Context, workspaceId uint, diskName string) (*types.DiskSnapshot, error)
ListDiskSnapshots(ctx context.Context, filter types.DiskSnapshotFilter) ([]types.DiskSnapshot, error)
GetDisk(ctx context.Context, workspaceId uint, name string) (*types.Disk, error)
GetOrCreateDisk(ctx context.Context, workspaceId uint, disk *types.Disk) (*types.Disk, error)
// DeleteDisk unregisters the mutable disk resource. Immutable snapshots and
// their backing payload are retained because snapshot IDs can outlive a disk
// record (for example, when pinned by a template or published for a fork).
DeleteDisk(ctx context.Context, workspaceId uint, name string) error
ListDisksWithRelated(ctx context.Context, workspaceId uint) ([]types.DiskWithRelated, error)
}
func NewBackendPostgresRepositoryForTest ¶
func NewBackendPostgresRepositoryForTest() (BackendRepository, sqlmock.Sqlmock)
type CacheRedisRepository ¶
type CacheRedisRepository struct {
// contains filtered or unexported fields
}
func (*CacheRedisRepository) CountCacheRegistrations ¶
func (*CacheRedisRepository) GetActiveCacheRegistration ¶
func (*CacheRedisRepository) GetCacheLogicalHost ¶
func (r *CacheRedisRepository) GetCacheLogicalHost(ctx context.Context, logicalHostID string) (cache.CoordinatorHost, bool, error)
func (*CacheRedisRepository) GetCacheRegistration ¶
func (r *CacheRedisRepository) GetCacheRegistration(ctx context.Context, logicalHostID, registrationID string) (cache.CoordinatorHost, bool, error)
func (*CacheRedisRepository) ListCacheLogicalHosts ¶
func (*CacheRedisRepository) ListCacheRegistrations ¶
func (*CacheRedisRepository) RemoveCacheLogicalHost ¶
func (r *CacheRedisRepository) RemoveCacheLogicalHost(ctx context.Context, poolName, locality, logicalHostID string) error
func (*CacheRedisRepository) RemoveCacheLogicalHostFromPool ¶
func (r *CacheRedisRepository) RemoveCacheLogicalHostFromPool(ctx context.Context, poolName, locality, logicalHostID string) error
func (*CacheRedisRepository) RemoveCacheRegistration ¶
func (r *CacheRedisRepository) RemoveCacheRegistration(ctx context.Context, logicalHostID, registrationID string) error
func (*CacheRedisRepository) SetActiveCacheRegistration ¶
func (*CacheRedisRepository) SetCacheRegistration ¶
func (r *CacheRedisRepository) SetCacheRegistration(ctx context.Context, host cache.CoordinatorHost, ttl time.Duration) error
type ComputeRedisRepository ¶
type ComputeRedisRepository struct {
// contains filtered or unexported fields
}
func (*ComputeRedisRepository) DeleteAgentMachineState ¶
func (r *ComputeRedisRepository) DeleteAgentMachineState(ctx context.Context, workspaceID, poolName, machineID string) error
func (*ComputeRedisRepository) DeleteAgentWorkerSlotState ¶
func (r *ComputeRedisRepository) DeleteAgentWorkerSlotState(ctx context.Context, workspaceID, poolName, machineID, workerID string) error
func (*ComputeRedisRepository) DeleteFailoverDemand ¶
func (r *ComputeRedisRepository) DeleteFailoverDemand(ctx context.Context, gpu string) error
func (*ComputeRedisRepository) DeleteMachineSSHState ¶
func (r *ComputeRedisRepository) DeleteMachineSSHState(ctx context.Context, workspaceID, poolName, machineID string) error
func (*ComputeRedisRepository) DeletePoolState ¶
func (r *ComputeRedisRepository) DeletePoolState(ctx context.Context, workspaceID, name string) error
func (*ComputeRedisRepository) GetAgentMachineState ¶
func (r *ComputeRedisRepository) GetAgentMachineState(ctx context.Context, workspaceID, poolName, machineID string) (*compute.AgentTokenState, error)
func (*ComputeRedisRepository) GetAgentMachineStateForWorkspace ¶
func (r *ComputeRedisRepository) GetAgentMachineStateForWorkspace(ctx context.Context, workspaceID, machineID string) (*compute.AgentTokenState, error)
func (*ComputeRedisRepository) GetAgentTokenState ¶
func (r *ComputeRedisRepository) GetAgentTokenState(ctx context.Context, tokenHash string) (*compute.AgentTokenState, error)
func (*ComputeRedisRepository) GetJoinTokenState ¶
func (r *ComputeRedisRepository) GetJoinTokenState(ctx context.Context, tokenHash string) (*compute.JoinTokenState, error)
func (*ComputeRedisRepository) GetMachineSSHState ¶
func (r *ComputeRedisRepository) GetMachineSSHState(ctx context.Context, workspaceID, poolName, machineID string) (*compute.MachineSSHState, error)
func (*ComputeRedisRepository) GetPoolState ¶
func (*ComputeRedisRepository) ListAgentTokenStates ¶
func (r *ComputeRedisRepository) ListAgentTokenStates(ctx context.Context, workspaceID, poolName string) ([]*compute.AgentTokenState, error)
func (*ComputeRedisRepository) ListAgentWorkerSlotStates ¶
func (r *ComputeRedisRepository) ListAgentWorkerSlotStates(ctx context.Context, workspaceID, poolName, machineID string) ([]*compute.AgentWorkerSlotState, error)
func (*ComputeRedisRepository) ListAllPoolStates ¶
func (*ComputeRedisRepository) ListFailoverDemand ¶
func (r *ComputeRedisRepository) ListFailoverDemand(ctx context.Context) ([]*compute.FailoverDemand, error)
ListFailoverDemand returns the unexpired demand records and prunes index entries whose records have already expired.
func (*ComputeRedisRepository) ListPoolStates ¶
func (*ComputeRedisRepository) OnDemandSpendCents ¶
func (r *ComputeRedisRepository) OnDemandSpendCents(ctx context.Context, window time.Duration) (float64, error)
OnDemandSpendCents sums the hourly buckets covering the trailing window.
func (*ComputeRedisRepository) PruneAgentMachineIndex ¶
func (r *ComputeRedisRepository) PruneAgentMachineIndex(ctx context.Context, workspaceID, poolName string) error
PruneAgentMachineIndex removes index entries whose machine state key no longer exists.
func (*ComputeRedisRepository) PushFailoverDemand ¶
func (r *ComputeRedisRepository) PushFailoverDemand(ctx context.Context, demand *compute.FailoverDemand, ttl time.Duration) error
func (*ComputeRedisRepository) RecordOnDemandSpend ¶
func (*ComputeRedisRepository) SaveAgentTokenState ¶
func (r *ComputeRedisRepository) SaveAgentTokenState(ctx context.Context, state *compute.AgentTokenState, ttl time.Duration) error
func (*ComputeRedisRepository) SaveAgentWorkerSlotState ¶
func (r *ComputeRedisRepository) SaveAgentWorkerSlotState(ctx context.Context, state *compute.AgentWorkerSlotState) error
func (*ComputeRedisRepository) SaveJoinTokenState ¶
func (r *ComputeRedisRepository) SaveJoinTokenState(ctx context.Context, state *compute.JoinTokenState, ttl time.Duration) error
func (*ComputeRedisRepository) SaveMachineSSHState ¶
func (r *ComputeRedisRepository) SaveMachineSSHState(ctx context.Context, state *compute.MachineSSHState) error
func (*ComputeRedisRepository) SavePoolState ¶
func (*ComputeRedisRepository) WithMachineSSHStateLock ¶
func (*ComputeRedisRepository) WithPoolStateLock ¶
type ComputeRepository ¶
type ComputeRepository interface {
WithPoolStateLock(ctx context.Context, workspaceID, name string, fn func(context.Context) error) error
SavePoolState(ctx context.Context, workspaceID string, state *compute.PoolState) error
GetPoolState(ctx context.Context, workspaceID, name string) (*compute.PoolState, error)
ListPoolStates(ctx context.Context, workspaceID string, limit int) ([]*compute.PoolState, error)
ListAllPoolStates(ctx context.Context, limit int) ([]*compute.PoolState, error)
DeletePoolState(ctx context.Context, workspaceID, name string) error
SaveJoinTokenState(ctx context.Context, state *compute.JoinTokenState, ttl time.Duration) error
GetJoinTokenState(ctx context.Context, tokenHash string) (*compute.JoinTokenState, error)
SaveAgentTokenState(ctx context.Context, state *compute.AgentTokenState, ttl time.Duration) error
GetAgentTokenState(ctx context.Context, tokenHash string) (*compute.AgentTokenState, error)
GetAgentMachineState(ctx context.Context, workspaceID, poolName, machineID string) (*compute.AgentTokenState, error)
GetAgentMachineStateForWorkspace(ctx context.Context, workspaceID, machineID string) (*compute.AgentTokenState, error)
ListAgentTokenStates(ctx context.Context, workspaceID, poolName string) ([]*compute.AgentTokenState, error)
DeleteAgentMachineState(ctx context.Context, workspaceID, poolName, machineID string) error
PruneAgentMachineIndex(ctx context.Context, workspaceID, poolName string) error
WithMachineSSHStateLock(ctx context.Context, workspaceID, poolName, machineID string, fn func(context.Context) error) error
SaveMachineSSHState(ctx context.Context, state *compute.MachineSSHState) error
GetMachineSSHState(ctx context.Context, workspaceID, poolName, machineID string) (*compute.MachineSSHState, error)
DeleteMachineSSHState(ctx context.Context, workspaceID, poolName, machineID string) error
SaveAgentWorkerSlotState(ctx context.Context, state *compute.AgentWorkerSlotState) error
ListAgentWorkerSlotStates(ctx context.Context, workspaceID, poolName, machineID string) ([]*compute.AgentWorkerSlotState, error)
DeleteAgentWorkerSlotState(ctx context.Context, workspaceID, poolName, machineID, workerID string) error
PushFailoverDemand(ctx context.Context, demand *compute.FailoverDemand, ttl time.Duration) error
ListFailoverDemand(ctx context.Context) ([]*compute.FailoverDemand, error)
DeleteFailoverDemand(ctx context.Context, gpu string) error
RecordOnDemandSpend(ctx context.Context, at time.Time, cents float64) error
OnDemandSpendCents(ctx context.Context, window time.Duration) (float64, error)
}
func NewComputeRedisRepository ¶
func NewComputeRedisRepository(rdb *common.RedisClient) ComputeRepository
type ContainerRedisRepository ¶
type ContainerRedisRepository struct {
// contains filtered or unexported fields
}
func (*ContainerRedisRepository) AcquireEndpointRequestToken ¶
func (*ContainerRedisRepository) CheckContainerConcurrencyLimit ¶
func (c *ContainerRedisRepository) CheckContainerConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
func (*ContainerRedisRepository) CreateContainerStateWithConcurrencyLimit ¶
func (c *ContainerRedisRepository) CreateContainerStateWithConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
func (*ContainerRedisRepository) DeleteBackendRoutesByContainerID ¶
func (cr *ContainerRedisRepository) DeleteBackendRoutesByContainerID(ctx context.Context, containerID string) error
func (*ContainerRedisRepository) DeleteBackendRoutesByMachine ¶
func (cr *ContainerRedisRepository) DeleteBackendRoutesByMachine(ctx context.Context, workspaceID, poolName, machineID string) error
DeleteBackendRoutesByMachine removes all backend routes and index entries for a machine when it is released.
func (*ContainerRedisRepository) DeleteContainerState ¶
func (cr *ContainerRedisRepository) DeleteContainerState(containerId string) error
func (*ContainerRedisRepository) DeleteStubState ¶
func (cr *ContainerRedisRepository) DeleteStubState(stubId string) error
func (*ContainerRedisRepository) EndpointRequestHeartbeatExists ¶
func (*ContainerRedisRepository) GetActiveContainersByStubId ¶
func (cr *ContainerRedisRepository) GetActiveContainersByStubId(stubId string) ([]types.ContainerState, error)
func (*ContainerRedisRepository) GetActiveContainersByWorkerId ¶
func (cr *ContainerRedisRepository) GetActiveContainersByWorkerId(workerId string) ([]types.ContainerState, error)
func (*ContainerRedisRepository) GetActiveContainersByWorkspaceId ¶
func (cr *ContainerRedisRepository) GetActiveContainersByWorkspaceId(workspaceId string) ([]types.ContainerState, error)
func (*ContainerRedisRepository) GetBackendRoute ¶
func (cr *ContainerRedisRepository) GetBackendRoute(ctx context.Context, routeID string) (*types.BackendRoute, error)
func (*ContainerRedisRepository) GetContainerAddress ¶
func (cr *ContainerRedisRepository) GetContainerAddress(containerId string) (string, error)
func (*ContainerRedisRepository) GetContainerAddressMap ¶
func (cr *ContainerRedisRepository) GetContainerAddressMap(containerId string) (map[int32]string, error)
func (*ContainerRedisRepository) GetContainerExitCode ¶
func (cr *ContainerRedisRepository) GetContainerExitCode(containerId string) (int, error)
func (*ContainerRedisRepository) GetContainerRequestStatus ¶
func (cr *ContainerRedisRepository) GetContainerRequestStatus(containerId string) (types.ContainerRequestStatus, error)
func (*ContainerRedisRepository) GetContainerState ¶
func (cr *ContainerRedisRepository) GetContainerState(containerId string) (*types.ContainerState, error)
func (*ContainerRedisRepository) GetContainerStatuses ¶
func (cr *ContainerRedisRepository) GetContainerStatuses(containerIds []string) (map[string]types.ContainerStatus, error)
func (*ContainerRedisRepository) GetEndpointRequestTokens ¶
func (*ContainerRedisRepository) GetFailedContainersByStubId ¶
func (cr *ContainerRedisRepository) GetFailedContainersByStubId(stubId string) ([]string, error)
func (*ContainerRedisRepository) GetSandboxActivity ¶
func (cr *ContainerRedisRepository) GetSandboxActivity(workspaceId string, appIds []string, since time.Time) (map[string][]types.AppActivityBucket, error)
func (*ContainerRedisRepository) GetStubState ¶
func (cr *ContainerRedisRepository) GetStubState(stubId string) (string, error)
func (*ContainerRedisRepository) GetWorkerAddress ¶
func (*ContainerRedisRepository) ListBackendRoutesByMachine ¶
func (cr *ContainerRedisRepository) ListBackendRoutesByMachine(ctx context.Context, workspaceID, poolName, machineID string) ([]types.BackendRoute, error)
func (*ContainerRedisRepository) ListBackendRoutesByMachineID ¶
func (cr *ContainerRedisRepository) ListBackendRoutesByMachineID(ctx context.Context, machineID string) ([]types.BackendRoute, error)
func (*ContainerRedisRepository) MarkPendingContainerStoppingIfUnassigned ¶
func (cr *ContainerRedisRepository) MarkPendingContainerStoppingIfUnassigned(containerId string, expirySeconds int64) (bool, error)
func (*ContainerRedisRepository) PodKeepWarmLockExists ¶
func (*ContainerRedisRepository) RecordSandboxCreated ¶
func (cr *ContainerRedisRepository) RecordSandboxCreated(workspaceId, appId string, at time.Time) error
func (*ContainerRedisRepository) RefreshBuildContainerTTL ¶
func (*ContainerRedisRepository) RefreshEndpointRequestTokenTTL ¶
func (*ContainerRedisRepository) ReleaseEndpointRequestToken ¶
func (*ContainerRedisRepository) ReserveContainerConcurrencyForPending ¶
func (c *ContainerRedisRepository) ReserveContainerConcurrencyForPending(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
ReserveContainerConcurrencyForPending applies workspace quota accounting to an already-created PENDING container without changing its state or TTL. Initial admissions, including serverless, use CreateContainerStateWithConcurrencyLimit; this transition is for a quota-exempt request rerouted to accounted capacity.
func (*ContainerRedisRepository) SetBackendRoute ¶
func (cr *ContainerRedisRepository) SetBackendRoute(ctx context.Context, route types.BackendRoute) error
func (*ContainerRedisRepository) SetBackendRoutes ¶
func (cr *ContainerRedisRepository) SetBackendRoutes(ctx context.Context, routes []types.BackendRoute) error
func (*ContainerRedisRepository) SetBuildContainerTTL ¶
func (cr *ContainerRedisRepository) SetBuildContainerTTL(containerId string, ttl time.Duration) error
func (*ContainerRedisRepository) SetContainerAddress ¶
func (cr *ContainerRedisRepository) SetContainerAddress(containerId string, addr string) error
func (*ContainerRedisRepository) SetContainerAddressMap ¶
func (cr *ContainerRedisRepository) SetContainerAddressMap(containerId string, addressMap map[int32]string) error
func (*ContainerRedisRepository) SetContainerExitCode ¶
func (cr *ContainerRedisRepository) SetContainerExitCode(containerId string, exitCode int) error
func (*ContainerRedisRepository) SetContainerFailureCooldown ¶
func (cr *ContainerRedisRepository) SetContainerFailureCooldown(containerIds []string) error
func (*ContainerRedisRepository) SetContainerRequestStatus ¶
func (cr *ContainerRedisRepository) SetContainerRequestStatus(containerId string, status types.ContainerRequestStatus) error
func (*ContainerRedisRepository) SetContainerState ¶
func (cr *ContainerRedisRepository) SetContainerState(containerId string, state *types.ContainerState) error
func (*ContainerRedisRepository) SetEndpointRequestHeartbeat ¶
func (*ContainerRedisRepository) SetPodKeepWarmLock ¶
func (*ContainerRedisRepository) SetStubState ¶
func (cr *ContainerRedisRepository) SetStubState(stubId, state string) error
func (*ContainerRedisRepository) SetWorkerAddress ¶
func (cr *ContainerRedisRepository) SetWorkerAddress(containerId string, addr string) error
func (*ContainerRedisRepository) UpdateContainerStatus ¶
func (cr *ContainerRedisRepository) UpdateContainerStatus(containerId string, requestedStatus types.ContainerStatus, expirySeconds int64) error
type ContainerRepository ¶
type ContainerRepository interface {
GetContainerState(string) (*types.ContainerState, error)
SetContainerState(string, *types.ContainerState) error
SetContainerExitCode(string, int) error
SetContainerFailureCooldown([]string) error
GetContainerExitCode(string) (int, error)
SetContainerAddress(containerId string, addr string) error
GetContainerAddress(containerId string) (string, error)
SetBackendRoute(ctx context.Context, route types.BackendRoute) error
SetBackendRoutes(ctx context.Context, routes []types.BackendRoute) error
GetBackendRoute(ctx context.Context, routeID string) (*types.BackendRoute, error)
ListBackendRoutesByMachine(ctx context.Context, workspaceID, poolName, machineID string) ([]types.BackendRoute, error)
ListBackendRoutesByMachineID(ctx context.Context, machineID string) ([]types.BackendRoute, error)
DeleteBackendRoutesByContainerID(ctx context.Context, containerID string) error
DeleteBackendRoutesByMachine(ctx context.Context, workspaceID, poolName, machineID string) error
UpdateContainerStatus(string, types.ContainerStatus, int64) error
MarkPendingContainerStoppingIfUnassigned(containerId string, expirySeconds int64) (bool, error)
DeleteContainerState(containerId string) error
SetContainerRequestStatus(containerId string, status types.ContainerRequestStatus) error
GetContainerRequestStatus(containerId string) (types.ContainerRequestStatus, error)
SetWorkerAddress(containerId string, addr string) error
GetWorkerAddress(ctx context.Context, containerId string) (string, error)
SetContainerAddressMap(containerId string, addressMap map[int32]string) error
GetContainerAddressMap(containerId string) (map[int32]string, error)
CheckContainerConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
CreateContainerStateWithConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
ReserveContainerConcurrencyForPending(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
GetActiveContainersByStubId(stubId string) ([]types.ContainerState, error)
GetActiveContainersByWorkspaceId(workspaceId string) ([]types.ContainerState, error)
RecordSandboxCreated(workspaceId, appId string, at time.Time) error
GetSandboxActivity(workspaceId string, appIds []string, since time.Time) (map[string][]types.AppActivityBucket, error)
GetActiveContainersByWorkerId(workerId string) ([]types.ContainerState, error)
GetFailedContainersByStubId(stubId string) ([]string, error)
GetStubState(stubId string) (string, error)
SetStubState(stubId, state string) error
DeleteStubState(stubId string) error
SetBuildContainerTTL(containerId string, ttl time.Duration) error
RefreshBuildContainerTTL(containerId string, ttl time.Duration) (bool, error)
GetEndpointRequestTokens(ctx context.Context, workspaceName, stubId, containerId string, maxTokens int, ttl time.Duration) (int, error)
AcquireEndpointRequestToken(ctx context.Context, workspaceName, stubId, containerId string, maxTokens int, ttl time.Duration) (bool, error)
ReleaseEndpointRequestToken(ctx context.Context, workspaceName, stubId, containerId, taskId string, maxTokens int, ttl time.Duration) error
RefreshEndpointRequestTokenTTL(ctx context.Context, workspaceName, stubId, containerId string, ttl time.Duration) error
SetEndpointRequestHeartbeat(ctx context.Context, workspaceName, stubId, taskId, containerId string, ttl time.Duration) error
EndpointRequestHeartbeatExists(ctx context.Context, workspaceName, stubId, taskId, containerId string) (bool, error)
SetPodKeepWarmLock(ctx context.Context, workspaceName, stubId, containerId string, keepWarmSeconds int) error
PodKeepWarmLockExists(ctx context.Context, workspaceName, stubId, containerId string) (bool, error)
}
func NewContainerRedisRepository ¶
func NewContainerRedisRepository(r *common.RedisClient) ContainerRepository
func NewContainerRedisRepositoryForTest ¶
func NewContainerRedisRepositoryForTest(rdb *common.RedisClient) ContainerRepository
type EventClientOption ¶
type EventClientOption func(*EventClientRepo)
EventClientOption adds sinks beyond the configured ones.
func WithWorkspaceWebhooks ¶
func WithWorkspaceWebhooks(source WebhookSource) EventClientOption
WithWorkspaceWebhooks fans events out to workspace webhooks. Gateway only.
type EventClientRepo ¶
type EventClientRepo struct {
// contains filtered or unexported fields
}
func (*EventClientRepo) GetContainerEvents ¶
func (r *EventClientRepo) GetContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (*types.ContainerEventsResponse, error)
func (*EventClientRepo) GetEventHistory ¶
func (r *EventClientRepo) GetEventHistory(ctx context.Context, query types.EventQuery) (*types.EventHistoryResponse, error)
func (*EventClientRepo) GetLogs ¶
func (r *EventClientRepo) GetLogs(ctx context.Context, query types.LogQuery) (*types.LogsResponse, error)
func (*EventClientRepo) GetPoolMetricsTimeseries ¶
func (r *EventClientRepo) GetPoolMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.PoolMetricsTimeseriesResponse, error)
func (*EventClientRepo) GetStubMetricsTimeseries ¶
func (r *EventClientRepo) GetStubMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.MetricsTimeseriesResponse, error)
func (*EventClientRepo) GetWorkspaceMetricsTimeseries ¶
func (r *EventClientRepo) GetWorkspaceMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.MetricsTimeseriesResponse, error)
func (*EventClientRepo) PushCloneStubEvent ¶
func (r *EventClientRepo) PushCloneStubEvent(workspaceId string, stub *types.Stub, parentStub *types.Stub, actor types.EventActor)
func (*EventClientRepo) PushComputeEvent ¶
func (r *EventClientRepo) PushComputeEvent(eventType string, event types.EventComputeSchema)
func (*EventClientRepo) PushContainerEvent ¶
func (r *EventClientRepo) PushContainerEvent(event types.EventContainerEventSchema)
func (*EventClientRepo) PushContainerFunctionTaskEvent ¶
func (r *EventClientRepo) PushContainerFunctionTaskEvent(workspaceID string, task types.TaskInterface, eventID types.ContainerEventID, opts types.ContainerEventOptions)
func (*EventClientRepo) PushContainerFunctionTaskLifecycle ¶
func (r *EventClientRepo) PushContainerFunctionTaskLifecycle(workspaceID string, task types.TaskInterface, lifecycleID types.ContainerLifecycleID, start time.Time, end time.Time, success bool, opts types.ContainerLifecycleOptions)
func (*EventClientRepo) PushContainerLifecycleEvent ¶
func (r *EventClientRepo) PushContainerLifecycleEvent(lifecycle types.EventContainerLifecycleSchema)
func (*EventClientRepo) PushContainerLogDropped ¶
func (r *EventClientRepo) PushContainerLogDropped(workerID string, request *types.ContainerRequest, message types.EventMessage, taskID string)
func (*EventClientRepo) PushContainerLogEvent ¶
func (r *EventClientRepo) PushContainerLogEvent(entry types.EventContainerLogSchema)
func (*EventClientRepo) PushContainerLogEventQueued ¶
func (r *EventClientRepo) PushContainerLogEventQueued(entry types.EventContainerLogSchema) error
func (*EventClientRepo) PushContainerLogFirstByte ¶
func (r *EventClientRepo) PushContainerLogFirstByte(workerID string, request *types.ContainerRequest, taskID string)
func (*EventClientRepo) PushContainerLogFlushCompleted ¶
func (r *EventClientRepo) PushContainerLogFlushCompleted(workerID string, request *types.ContainerRequest)
func (*EventClientRepo) PushContainerLogLastByte ¶
func (r *EventClientRepo) PushContainerLogLastByte(workerID string, request *types.ContainerRequest)
func (*EventClientRepo) PushContainerRequestEvent ¶
func (r *EventClientRepo) PushContainerRequestEvent(workerID string, request *types.ContainerRequest, eventID types.ContainerEventID, opts types.ContainerEventOptions)
func (*EventClientRepo) PushContainerRequestLifecycle ¶
func (r *EventClientRepo) PushContainerRequestLifecycle(workerID string, request *types.ContainerRequest, lifecycleID types.ContainerLifecycleID, startedAt time.Time, duration time.Duration, success bool, opts types.ContainerLifecycleOptions)
func (*EventClientRepo) PushContainerRequestLogLine ¶
func (r *EventClientRepo) PushContainerRequestLogLine(workerID string, request *types.ContainerRequest, taskID string, stream string, line string)
func (*EventClientRepo) PushContainerResourceMetricsEvent ¶
func (r *EventClientRepo) PushContainerResourceMetricsEvent(workerID string, request *types.ContainerRequest, metrics types.EventContainerMetricsData)
func (*EventClientRepo) PushContainerRunnerEvent ¶
func (r *EventClientRepo) PushContainerRunnerEvent(workerID string, request *types.ContainerRequest, event *types.ContainerRunnerEvent)
func (*EventClientRepo) PushContainerRunningToStartTask ¶
func (r *EventClientRepo) PushContainerRunningToStartTask(task *types.TaskWithRelated, runningAt time.Time, startedAt time.Time, status types.ContainerStatus)
func (*EventClientRepo) PushContainerTaskEvent ¶
func (r *EventClientRepo) PushContainerTaskEvent(task *types.TaskWithRelated, eventID types.ContainerEventID, opts types.ContainerEventOptions)
func (*EventClientRepo) PushContainerTaskLifecycle ¶
func (r *EventClientRepo) PushContainerTaskLifecycle(task *types.TaskWithRelated, lifecycleID types.ContainerLifecycleID, start time.Time, end time.Time, success bool, opts types.ContainerLifecycleOptions)
func (*EventClientRepo) PushContainerTaskLifecycleSince ¶
func (r *EventClientRepo) PushContainerTaskLifecycleSince(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, lifecycleID types.ContainerLifecycleID, sincePhase string, end time.Time, success bool, opts types.ContainerLifecycleOptions)
func (*EventClientRepo) PushDeployStubEvent ¶
func (r *EventClientRepo) PushDeployStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
func (*EventClientRepo) PushEndpointEvent ¶
func (r *EventClientRepo) PushEndpointEvent(eventType string, event types.EventEndpointSchema)
func (*EventClientRepo) PushEndpointRequestStatsEvent ¶
func (r *EventClientRepo) PushEndpointRequestStatsEvent(schema types.EventEndpointRequestStatsSchema)
func (*EventClientRepo) PushEndpointRouteEvent ¶
func (r *EventClientRepo) PushEndpointRouteEvent(event types.EventEndpointRouteSchema)
func (*EventClientRepo) PushFunctionGetArgs ¶
func (r *EventClientRepo) PushFunctionGetArgs(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, at time.Time, byteCount int)
func (*EventClientRepo) PushFunctionResultDelivery ¶
func (r *EventClientRepo) PushFunctionResultDelivery(workspaceID string, task types.TaskInterface, startedAt time.Time, exitCode int32, byteCount int)
func (*EventClientRepo) PushFunctionResultLoaded ¶
func (r *EventClientRepo) PushFunctionResultLoaded(workspaceID string, task types.TaskInterface, exitCode int32, byteCount int)
func (*EventClientRepo) PushFunctionResultSent ¶
func (r *EventClientRepo) PushFunctionResultSent(workspaceID string, task types.TaskInterface, exitCode int32, byteCount int)
func (*EventClientRepo) PushFunctionSetResult ¶
func (r *EventClientRepo) PushFunctionSetResult(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, at time.Time, byteCount int)
func (*EventClientRepo) PushFunctionStreamCancelApplied ¶
func (r *EventClientRepo) PushFunctionStreamCancelApplied(workspaceID string, task types.TaskInterface)
func (*EventClientRepo) PushFunctionStreamCancelRequested ¶
func (r *EventClientRepo) PushFunctionStreamCancelRequested(workspaceID string, task types.TaskInterface)
func (*EventClientRepo) PushGatewayEndpointCalledEvent ¶
func (r *EventClientRepo) PushGatewayEndpointCalledEvent(method, path, workspaceID string, statusCode int, userAgent, remoteIP, requestID, contentType, accept, errorMessage string)
func (*EventClientRepo) PushPlatformCacheEvent ¶
func (r *EventClientRepo) PushPlatformCacheEvent(schema types.EventPlatformCacheSchema)
func (*EventClientRepo) PushPlatformLogEvent ¶
func (r *EventClientRepo) PushPlatformLogEvent(entry types.EventPlatformLogSchema)
func (*EventClientRepo) PushRunStubEvent ¶
func (r *EventClientRepo) PushRunStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
func (*EventClientRepo) PushServeStubEvent ¶
func (r *EventClientRepo) PushServeStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
func (*EventClientRepo) PushStubCacheRequiredContent ¶
func (r *EventClientRepo) PushStubCacheRequiredContent(schema types.EventStubCacheRequiredContentSchema) error
func (*EventClientRepo) PushStubStateUnhealthy ¶
func (*EventClientRepo) PushTaskCancelApplied ¶
func (r *EventClientRepo) PushTaskCancelApplied(task *types.TaskWithRelated, source types.EventSource, message types.EventMessage)
func (*EventClientRepo) PushTaskCancelRequested ¶
func (r *EventClientRepo) PushTaskCancelRequested(task *types.TaskWithRelated, source types.EventSource, message types.EventMessage)
func (*EventClientRepo) PushTaskCreatedEvent ¶
func (r *EventClientRepo) PushTaskCreatedEvent(task *types.TaskWithRelated)
func (*EventClientRepo) PushTaskEndEvents ¶
func (r *EventClientRepo) PushTaskEndEvents(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, endedAt time.Time)
func (*EventClientRepo) PushTaskEndPersisted ¶
func (r *EventClientRepo) PushTaskEndPersisted(task *types.TaskWithRelated)
func (*EventClientRepo) PushTaskStartEvents ¶
func (r *EventClientRepo) PushTaskStartEvents(ctx context.Context, rdb *common.RedisClient, task *types.TaskWithRelated, containerID string, startedAt time.Time)
func (*EventClientRepo) PushTaskUpdatedEvent ¶
func (r *EventClientRepo) PushTaskUpdatedEvent(task *types.TaskWithRelated)
func (*EventClientRepo) PushWorkerDeletedEvent ¶
func (r *EventClientRepo) PushWorkerDeletedEvent(workerID, machineID, poolName string, reason types.DeletedWorkerReason)
func (*EventClientRepo) PushWorkerStartedEvent ¶
func (r *EventClientRepo) PushWorkerStartedEvent(workerID string)
func (*EventClientRepo) PushWorkerStoppedEvent ¶
func (r *EventClientRepo) PushWorkerStoppedEvent(workerID string)
func (*EventClientRepo) ReadStubCacheRequiredContent ¶
func (r *EventClientRepo) ReadStubCacheRequiredContent(ctx context.Context, workspaceID, stubID string) ([]types.CacheRequiredContentItem, error)
func (*EventClientRepo) StreamAppNamespaceEvents ¶
func (r *EventClientRepo) StreamAppNamespaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
func (*EventClientRepo) StreamContainerEvents ¶
func (r *EventClientRepo) StreamContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (EventStream, error)
func (*EventClientRepo) StreamLogs ¶
func (r *EventClientRepo) StreamLogs(ctx context.Context, query types.LogQuery) (EventStream, error)
func (*EventClientRepo) StreamStubEvents ¶
func (r *EventClientRepo) StreamStubEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
func (*EventClientRepo) StreamTaskEvents ¶
func (r *EventClientRepo) StreamTaskEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
func (*EventClientRepo) StreamWorkspaceEvents ¶
func (r *EventClientRepo) StreamWorkspaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
type EventRepository ¶
type EventRepository interface {
GetContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (*types.ContainerEventsResponse, error)
GetEventHistory(ctx context.Context, query types.EventQuery) (*types.EventHistoryResponse, error)
GetLogs(ctx context.Context, query types.LogQuery) (*types.LogsResponse, error)
GetStubMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.MetricsTimeseriesResponse, error)
GetWorkspaceMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.MetricsTimeseriesResponse, error)
GetPoolMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.PoolMetricsTimeseriesResponse, error)
StreamContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (EventStream, error)
StreamStubEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
StreamTaskEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
StreamWorkspaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
StreamAppNamespaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
StreamLogs(ctx context.Context, query types.LogQuery) (EventStream, error)
PushContainerResourceMetricsEvent(workerID string, request *types.ContainerRequest, metrics types.EventContainerMetricsData)
PushContainerLifecycleEvent(lifecycle types.EventContainerLifecycleSchema)
PushContainerEvent(event types.EventContainerEventSchema)
PushContainerLogEvent(entry types.EventContainerLogSchema)
PushContainerLogEventQueued(entry types.EventContainerLogSchema) error
PushPlatformLogEvent(entry types.EventPlatformLogSchema)
PushContainerRequestEvent(workerID string, request *types.ContainerRequest, eventID types.ContainerEventID, opts types.ContainerEventOptions)
PushContainerRequestLifecycle(workerID string, request *types.ContainerRequest, lifecycleID types.ContainerLifecycleID, startedAt time.Time, duration time.Duration, success bool, opts types.ContainerLifecycleOptions)
PushContainerTaskEvent(task *types.TaskWithRelated, eventID types.ContainerEventID, opts types.ContainerEventOptions)
PushContainerFunctionTaskEvent(workspaceID string, task types.TaskInterface, eventID types.ContainerEventID, opts types.ContainerEventOptions)
PushContainerTaskLifecycle(task *types.TaskWithRelated, lifecycleID types.ContainerLifecycleID, start time.Time, end time.Time, success bool, opts types.ContainerLifecycleOptions)
PushContainerFunctionTaskLifecycle(workspaceID string, task types.TaskInterface, lifecycleID types.ContainerLifecycleID, start time.Time, end time.Time, success bool, opts types.ContainerLifecycleOptions)
PushContainerTaskLifecycleSince(ctx context.Context, rdb *pkgcommon.RedisClient, task *types.TaskWithRelated, lifecycleID types.ContainerLifecycleID, sincePhase string, end time.Time, success bool, opts types.ContainerLifecycleOptions)
PushContainerRequestLogLine(workerID string, request *types.ContainerRequest, taskID string, stream string, line string)
PushContainerRunnerEvent(workerID string, request *types.ContainerRequest, event *types.ContainerRunnerEvent)
PushFunctionResultLoaded(workspaceID string, task types.TaskInterface, exitCode int32, byteCount int)
PushFunctionResultSent(workspaceID string, task types.TaskInterface, exitCode int32, byteCount int)
PushFunctionResultDelivery(workspaceID string, task types.TaskInterface, startedAt time.Time, exitCode int32, byteCount int)
PushFunctionStreamCancelRequested(workspaceID string, task types.TaskInterface)
PushFunctionStreamCancelApplied(workspaceID string, task types.TaskInterface)
PushFunctionGetArgs(ctx context.Context, rdb *pkgcommon.RedisClient, task *types.TaskWithRelated, at time.Time, byteCount int)
PushFunctionSetResult(ctx context.Context, rdb *pkgcommon.RedisClient, task *types.TaskWithRelated, at time.Time, byteCount int)
PushTaskStartEvents(ctx context.Context, rdb *pkgcommon.RedisClient, task *types.TaskWithRelated, containerID string, startedAt time.Time)
PushTaskEndEvents(ctx context.Context, rdb *pkgcommon.RedisClient, task *types.TaskWithRelated, endedAt time.Time)
PushTaskEndPersisted(task *types.TaskWithRelated)
PushContainerRunningToStartTask(task *types.TaskWithRelated, runningAt time.Time, startedAt time.Time, status types.ContainerStatus)
PushTaskCancelRequested(task *types.TaskWithRelated, source types.EventSource, message types.EventMessage)
PushTaskCancelApplied(task *types.TaskWithRelated, source types.EventSource, message types.EventMessage)
PushContainerLogFlushCompleted(workerID string, request *types.ContainerRequest)
PushContainerLogDropped(workerID string, request *types.ContainerRequest, message types.EventMessage, taskID string)
PushContainerLogFirstByte(workerID string, request *types.ContainerRequest, taskID string)
PushContainerLogLastByte(workerID string, request *types.ContainerRequest)
PushWorkerStartedEvent(workerID string)
PushWorkerStoppedEvent(workerID string)
PushWorkerDeletedEvent(workerID, machineID, poolName string, reason types.DeletedWorkerReason)
PushComputeEvent(eventType string, event types.EventComputeSchema)
PushEndpointEvent(eventType string, event types.EventEndpointSchema)
PushEndpointRouteEvent(event types.EventEndpointRouteSchema)
PushDeployStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
PushServeStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
PushRunStubEvent(workspaceId string, stub *types.Stub, actor types.EventActor)
PushCloneStubEvent(workspaceId string, stub *types.Stub, parentStub *types.Stub, actor types.EventActor)
PushTaskUpdatedEvent(task *types.TaskWithRelated)
PushTaskCreatedEvent(task *types.TaskWithRelated)
PushStubStateUnhealthy(workspaceId string, stubId string, currentState, previousState string, reason string, failedContainers []string)
PushGatewayEndpointCalledEvent(method, path, workspaceID string, statusCode int, userAgent, remoteIP, requestID, contentType, accept, errorMessage string)
PushEndpointRequestStatsEvent(schema types.EventEndpointRequestStatsSchema)
PushStubCacheRequiredContent(schema types.EventStubCacheRequiredContentSchema) error
PushPlatformCacheEvent(schema types.EventPlatformCacheSchema)
ReadStubCacheRequiredContent(ctx context.Context, workspaceID, stubID string) ([]types.CacheRequiredContentItem, error)
}
func NewEventClientRepo ¶
func NewEventClientRepo(config types.AppConfig, opts ...EventClientOption) EventRepository
func NewWorkerEventClientRepo ¶
func NewWorkerEventClientRepo(config types.AppConfig, client pb.WorkerRepositoryServiceClient, workerID string) EventRepository
type EventStream ¶
type EventStream interface {
Next() bool
Record() types.ContainerEventRecord
Err() error
Close() error
}
type GooseLogger ¶
func (*GooseLogger) Fatalf ¶
func (l *GooseLogger) Fatalf(format string, v ...any)
type ManagedEndpointRedisRepository ¶
type ManagedEndpointRedisRepository struct {
// contains filtered or unexported fields
}
ManagedEndpointRedisRepository implements ManagedEndpointRepository on Redis. Keys (under managed_endpoint:):
app:<id>, replica:<rid> JSON, indexed by the sets apps, replicas, replicas:<id> replica_container:<cid> -> rid; replica_lock:<rid>, drain:<rid>, backoff:<id>:<gpu> fleet, gitops JSON generation:<charge_id> JSON charge; accounting:pending ZSET of ids not yet metered config_events:<rid> pub/sub, replica config revision numbers metrics:<id>:<gpu>:<replica[@revision]>:<minute> HASH counters
func (*ManagedEndpointRedisRepository) CompleteAccounting ¶
func (r *ManagedEndpointRedisRepository) CompleteAccounting(ctx context.Context, id string, ttl time.Duration) error
CompleteAccounting takes a charge out of the pending index and lets its journal entry expire.
func (*ManagedEndpointRedisRepository) DeleteReplica ¶
func (r *ManagedEndpointRedisRepository) DeleteReplica(ctx context.Context, replicaID string) error
func (*ManagedEndpointRedisRepository) DrainRequested ¶
func (*ManagedEndpointRedisRepository) GetCharge ¶
func (r *ManagedEndpointRedisRepository) GetCharge(ctx context.Context, id string) (*types.Charge, error)
GetCharge returns nil for an id with no charge, including a record written before charges existed.
func (*ManagedEndpointRedisRepository) GetEndpoint ¶
func (r *ManagedEndpointRedisRepository) GetEndpoint(ctx context.Context, id string) (*types.ManagedEndpoint, error)
func (*ManagedEndpointRedisRepository) GetFleet ¶
GetFleet returns the stored fleet, or an empty one when none was applied yet.
func (*ManagedEndpointRedisRepository) GetGitOpsState ¶
func (r *ManagedEndpointRedisRepository) GetGitOpsState(ctx context.Context) (*types.GitOpsState, error)
func (*ManagedEndpointRedisRepository) GetReplica ¶
func (r *ManagedEndpointRedisRepository) GetReplica(ctx context.Context, replicaID string) (*types.EndpointReplica, error)
func (*ManagedEndpointRedisRepository) GetReplicaByContainer ¶
func (r *ManagedEndpointRedisRepository) GetReplicaByContainer(ctx context.Context, containerID string) (*types.EndpointReplica, error)
func (*ManagedEndpointRedisRepository) GetRouteMetrics ¶
func (r *ManagedEndpointRedisRepository) GetRouteMetrics(ctx context.Context, endpointID, gpu, replicaID string, configRevision uint64, window time.Duration) (*types.RouteMetrics, error)
GetRouteMetrics sums the window for the app, one GPU type, one replica or one replica under one config revision.
func (*ManagedEndpointRedisRepository) InScheduleBackoff ¶
func (*ManagedEndpointRedisRepository) ListAllReplicas ¶
func (r *ManagedEndpointRedisRepository) ListAllReplicas(ctx context.Context) ([]*types.EndpointReplica, error)
func (*ManagedEndpointRedisRepository) ListEndpoints ¶
func (r *ManagedEndpointRedisRepository) ListEndpoints(ctx context.Context) ([]*types.ManagedEndpoint, error)
func (*ManagedEndpointRedisRepository) ListPendingCharges ¶
func (r *ManagedEndpointRedisRepository) ListPendingCharges(ctx context.Context, now time.Time, limit int64) ([]*types.Charge, error)
ListPendingCharges returns the charges due for accounting by now, oldest first. An index entry with no charge behind it is dropped with a warning rather than blocking every charge behind it.
func (*ManagedEndpointRedisRepository) ListReplicas ¶
func (r *ManagedEndpointRedisRepository) ListReplicas(ctx context.Context, endpointID string) ([]*types.EndpointReplica, error)
func (*ManagedEndpointRedisRepository) NotifyReplicaConfig ¶
func (*ManagedEndpointRedisRepository) RecordRouteSample ¶
func (r *ManagedEndpointRedisRepository) RecordRouteSample(ctx context.Context, c *types.Charge) error
RecordRouteSample folds one finished charge into the minute buckets for the app, its GPU type, the replica and the replica's config revision.
func (*ManagedEndpointRedisRepository) RequestDrain ¶
func (*ManagedEndpointRedisRepository) SaveCharge ¶
func (r *ManagedEndpointRedisRepository) SaveCharge(ctx context.Context, c *types.Charge) (bool, error)
SaveCharge journals a charge and reports whether it was written. A charge is final once journaled, so a duplicate completion writes nothing. Written charges stay in the pending index until CompleteAccounting.
func (*ManagedEndpointRedisRepository) SaveEndpoint ¶
func (r *ManagedEndpointRedisRepository) SaveEndpoint(ctx context.Context, app *types.ManagedEndpoint) error
func (*ManagedEndpointRedisRepository) SaveGitOpsState ¶
func (r *ManagedEndpointRedisRepository) SaveGitOpsState(ctx context.Context, state *types.GitOpsState) error
func (*ManagedEndpointRedisRepository) SaveReplica ¶
func (r *ManagedEndpointRedisRepository) SaveReplica(ctx context.Context, replica *types.EndpointReplica) error
func (*ManagedEndpointRedisRepository) SetReplicaProtection ¶
func (r *ManagedEndpointRedisRepository) SetReplicaProtection(ctx context.Context, replicaID string, protected bool) (*types.EndpointReplica, error)
SetReplicaProtection changes an assigned replica without replacing its process. Scheduling already takes this worker lease and checks each victim's live flag; protection adds no work to the ordinary serverless scheduling path.
func (*ManagedEndpointRedisRepository) SetScheduleBackoff ¶
func (*ManagedEndpointRedisRepository) SubscribeReplicaConfig ¶
func (*ManagedEndpointRedisRepository) WithReplicaLock ¶
type ManagedEndpointRepository ¶
type ManagedEndpointRepository interface {
// Registry: the deployed endpoints and the fleet (placement) from the repo
SaveEndpoint(ctx context.Context, endpoint *types.ManagedEndpoint) error
GetEndpoint(ctx context.Context, endpointID string) (*types.ManagedEndpoint, error)
ListEndpoints(ctx context.Context) ([]*types.ManagedEndpoint, error)
SaveFleet(ctx context.Context, fleet *types.Fleet) error
GetFleet(ctx context.Context) (*types.Fleet, error)
// Replicas
SaveReplica(ctx context.Context, replica *types.EndpointReplica) error
GetReplica(ctx context.Context, replicaID string) (*types.EndpointReplica, error)
GetReplicaByContainer(ctx context.Context, containerID string) (*types.EndpointReplica, error)
ListReplicas(ctx context.Context, endpointID string) ([]*types.EndpointReplica, error)
ListAllReplicas(ctx context.Context) ([]*types.EndpointReplica, error)
DeleteReplica(ctx context.Context, replicaID string) error
WithReplicaLock(ctx context.Context, replicaID string, fn func(context.Context) error) error
SetReplicaProtection(ctx context.Context, replicaID string, protected bool) (*types.EndpointReplica, error)
RequestDrain(ctx context.Context, replicaID string, drainSeconds uint32) error
DrainRequested(ctx context.Context, replicaID string) (bool, uint32, error)
SetScheduleBackoff(ctx context.Context, endpointID, gpu string, ttl time.Duration) error
InScheduleBackoff(ctx context.Context, endpointID, gpu string) (bool, error)
// Live config: the replica record holds the config; these wake WatchConfig streams.
NotifyReplicaConfig(ctx context.Context, replicaID string, revision uint64) error
SubscribeReplicaConfig(ctx context.Context, replicaID string) (<-chan uint64, error)
// GitOps
SaveGitOpsState(ctx context.Context, state *types.GitOpsState) error
GetGitOpsState(ctx context.Context) (*types.GitOpsState, error)
// Route metrics (minute buckets, bounded retention), derived from settled charges
RecordRouteSample(ctx context.Context, charge *types.Charge) error
GetRouteMetrics(ctx context.Context, endpointID, gpu, replicaID string, configRevision uint64, window time.Duration) (*types.RouteMetrics, error)
// Charge journal: the durable accounting outbox
SaveCharge(ctx context.Context, charge *types.Charge) (written bool, err error)
GetCharge(ctx context.Context, id string) (*types.Charge, error)
ListPendingCharges(ctx context.Context, now time.Time, limit int64) ([]*types.Charge, error)
CompleteAccounting(ctx context.Context, id string, ttl time.Duration) error
}
ManagedEndpointRepository stores the fast-changing state of the managed endpoints platform: the registry of deployed endpoint/service versions, live replicas, harness config revisions and acks, tuning experiments, rollout and GitOps state, and rolled-up route metrics. The durable stub itself lives in Postgres; everything here can be rebuilt from stubs + heartbeats.
func NewManagedEndpointRedisRepository ¶
func NewManagedEndpointRedisRepository(rdb *common.RedisClient) ManagedEndpointRepository
type ManagedPoolRedisRepository ¶
type ManagedPoolRedisRepository struct {
// contains filtered or unexported fields
}
func (*ManagedPoolRedisRepository) DeleteManagedPoolState ¶
func (r *ManagedPoolRedisRepository) DeleteManagedPoolState(ctx context.Context, workspaceID, name string) error
func (*ManagedPoolRedisRepository) GetManagedPoolState ¶
func (*ManagedPoolRedisRepository) ListManagedPoolStates ¶
func (*ManagedPoolRedisRepository) SaveManagedPoolState ¶
func (*ManagedPoolRedisRepository) WithManagedPoolStateLock ¶
type ManagedPoolRepository ¶
type ManagedPoolRepository interface {
WithManagedPoolStateLock(ctx context.Context, workspaceID, name string, fn func(context.Context) error) error
SaveManagedPoolState(ctx context.Context, workspaceID string, state *compute.PoolState) error
GetManagedPoolState(ctx context.Context, workspaceID, name string) (*compute.PoolState, error)
ListManagedPoolStates(ctx context.Context, workspaceID string, limit int) ([]*compute.PoolState, error)
DeleteManagedPoolState(ctx context.Context, workspaceID, name string) error
}
ManagedPoolRepository keeps managed pool definitions separate from tenant/private compute state. That boundary lets mixed gateway versions roll safely: replicas that predate managed pools cannot enumerate or rewrite these records through ComputeRepository.
func NewManagedPoolRedisRepository ¶
func NewManagedPoolRedisRepository(rdb *common.RedisClient) ManagedPoolRepository
type PostgresBackendRepository ¶
type PostgresBackendRepository struct {
// contains filtered or unexported fields
}
func NewBackendPostgresRepository ¶
func NewBackendPostgresRepository(config types.PostgresConfig, eventRepo EventRepository) (*PostgresBackendRepository, error)
func (*PostgresBackendRepository) AggregateTaskActivityByApp ¶
func (c *PostgresBackendRepository) AggregateTaskActivityByApp(ctx context.Context, workspaceID uint, appExternalIDs []string, since time.Time) (map[string][]types.AppActivityBucket, error)
AggregateTaskActivityByApp buckets tasks created since `since` by app and hour, for a set of apps, in one query. Backs the dashboard's per-card activity strips, replacing one aggregate request per card.
func (*PostgresBackendRepository) AggregateTasksByTimeWindow ¶
func (c *PostgresBackendRepository) AggregateTasksByTimeWindow(ctx context.Context, filters types.TaskFilter) ([]types.TaskCountByTime, error)
func (*PostgresBackendRepository) AuthorizeToken ¶
func (*PostgresBackendRepository) CountActiveDeploymentsByApp ¶
func (c *PostgresBackendRepository) CountActiveDeploymentsByApp(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]int, error)
CountActiveDeploymentsByApp returns, per app, how many of its deployments are currently active. Unlike ListLatestDeploymentsByAppIDs this considers every deployment in the app, so an app whose newest deployment was stopped while an older function is still deployed reports as idle rather than stopped. A nil appExternalIDs covers every app in the workspace, which is what the dashboard needs to compute workspace-wide state counts; apps with no active deployment are simply absent from the result.
func (*PostgresBackendRepository) CountApps ¶
CountApps returns the number of live (non-deleted) apps in a workspace.
func (*PostgresBackendRepository) CreateCheckpoint ¶
func (r *PostgresBackendRepository) CreateCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (*types.Checkpoint, error)
func (*PostgresBackendRepository) CreateConcurrencyLimit ¶
func (r *PostgresBackendRepository) CreateConcurrencyLimit(ctx context.Context, workspaceId uint, gpuLimit uint32, cpuMillicoreLimit uint32) (*types.ConcurrencyLimit, error)
func (*PostgresBackendRepository) CreateDeployment ¶
func (*PostgresBackendRepository) CreateDiskSnapshot ¶
func (r *PostgresBackendRepository) CreateDiskSnapshot(ctx context.Context, snapshot *types.DiskSnapshot) (*types.DiskSnapshot, error)
func (*PostgresBackendRepository) CreateImage ¶
func (*PostgresBackendRepository) CreateObject ¶
func (*PostgresBackendRepository) CreateScheduledJob ¶
func (r *PostgresBackendRepository) CreateScheduledJob(ctx context.Context, scheduledJob *types.ScheduledJob) (*types.ScheduledJob, error)
func (*PostgresBackendRepository) CreateSecret ¶
func (*PostgresBackendRepository) CreateStack ¶
func (r *PostgresBackendRepository) CreateStack(ctx context.Context, workspaceId uint, name string, spec json.RawMessage) (*types.Stack, error)
func (*PostgresBackendRepository) CreateTask ¶
func (r *PostgresBackendRepository) CreateTask(ctx context.Context, params *types.TaskParams) (*types.Task, error)
func (*PostgresBackendRepository) CreateToken ¶
func (*PostgresBackendRepository) CreateWorkspace ¶
func (*PostgresBackendRepository) CreateWorkspaceStorage ¶
func (r *PostgresBackendRepository) CreateWorkspaceStorage(ctx context.Context, workspaceId uint, storage types.WorkspaceStorage) (*types.WorkspaceStorage, error)
func (*PostgresBackendRepository) DeleteApp ¶
func (r *PostgresBackendRepository) DeleteApp(ctx context.Context, appId string) error
func (*PostgresBackendRepository) DeleteConcurrencyLimit ¶
func (*PostgresBackendRepository) DeleteDeployment ¶
func (r *PostgresBackendRepository) DeleteDeployment(ctx context.Context, deployment types.Deployment) error
func (*PostgresBackendRepository) DeleteDisk ¶
func (*PostgresBackendRepository) DeleteObjectByExternalId ¶
func (r *PostgresBackendRepository) DeleteObjectByExternalId(ctx context.Context, externalId string) error
func (*PostgresBackendRepository) DeletePreviousScheduledJob ¶
func (r *PostgresBackendRepository) DeletePreviousScheduledJob(ctx context.Context, deployment *types.Deployment) error
func (*PostgresBackendRepository) DeleteScheduledJob ¶
func (r *PostgresBackendRepository) DeleteScheduledJob(ctx context.Context, scheduledJob *types.ScheduledJob) error
func (*PostgresBackendRepository) DeleteSecret ¶
func (*PostgresBackendRepository) DeleteStack ¶
func (*PostgresBackendRepository) DeleteTask ¶
func (r *PostgresBackendRepository) DeleteTask(ctx context.Context, externalId string) error
func (*PostgresBackendRepository) DeleteToken ¶
func (*PostgresBackendRepository) DeleteVolume ¶
func (*PostgresBackendRepository) GetAdminWorkspace ¶
func (*PostgresBackendRepository) GetAnyDeploymentByExternalId ¶
func (c *PostgresBackendRepository) GetAnyDeploymentByExternalId(ctx context.Context, deploymentExternalId string) (*types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) GetCheckpointById ¶
func (r *PostgresBackendRepository) GetCheckpointById(ctx context.Context, checkpointId string) (*types.Checkpoint, error)
func (*PostgresBackendRepository) GetConcurrencyLimit ¶
func (r *PostgresBackendRepository) GetConcurrencyLimit(ctx context.Context, concurrencyLimitId uint) (*types.ConcurrencyLimit, error)
func (*PostgresBackendRepository) GetConcurrencyLimitByWorkspaceId ¶
func (r *PostgresBackendRepository) GetConcurrencyLimitByWorkspaceId(ctx context.Context, workspaceId string) (*types.ConcurrencyLimit, error)
func (*PostgresBackendRepository) GetDeploymentByExternalId ¶
func (c *PostgresBackendRepository) GetDeploymentByExternalId(ctx context.Context, workspaceId uint, deploymentExternalId string) (*types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) GetDeploymentByNameAndVersion ¶
func (c *PostgresBackendRepository) GetDeploymentByNameAndVersion(ctx context.Context, workspaceId uint, name string, version uint, stubType string) (*types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) GetDeploymentByStubExternalId ¶
func (c *PostgresBackendRepository) GetDeploymentByStubExternalId(ctx context.Context, workspaceId uint, stubExternalId string) (*types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) GetDeploymentBySubdomain ¶
func (c *PostgresBackendRepository) GetDeploymentBySubdomain(ctx context.Context, subdomain string, version uint) (*types.DeploymentWithRelated, error)
GetDeploymentBySubdomain retrieves the deployment by name, version, and stub group If version is 0, it will return the latest version
func (*PostgresBackendRepository) GetDiskSnapshot ¶
func (r *PostgresBackendRepository) GetDiskSnapshot(ctx context.Context, workspaceId uint, snapshotId string) (*types.DiskSnapshot, error)
func (*PostgresBackendRepository) GetImageClipVersion ¶
func (*PostgresBackendRepository) GetImageCredentials ¶
func (r *PostgresBackendRepository) GetImageCredentials(ctx context.Context, workspace *types.Workspace, imageId string) (string, error)
GetImageCredentials returns the registry credentials for an image, read from the workspace secrets it names, in the form the worker parses. Empty when the image names none.
func (*PostgresBackendRepository) GetLatestCheckpointByStubId ¶
func (r *PostgresBackendRepository) GetLatestCheckpointByStubId(ctx context.Context, stubExternalId string) (*types.Checkpoint, error)
func (*PostgresBackendRepository) GetLatestDeploymentByName ¶
func (c *PostgresBackendRepository) GetLatestDeploymentByName(ctx context.Context, workspaceId uint, name string, stubType string, filterDeleted bool) (*types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) GetLatestDiskSnapshot ¶
func (r *PostgresBackendRepository) GetLatestDiskSnapshot(ctx context.Context, workspaceId uint, diskName string) (*types.DiskSnapshot, error)
func (*PostgresBackendRepository) GetObjectByExternalId ¶
func (*PostgresBackendRepository) GetObjectByExternalStubId ¶
func (*PostgresBackendRepository) GetObjectByHash ¶
func (*PostgresBackendRepository) GetOrCreateApp ¶
func (*PostgresBackendRepository) GetOrCreateDisk ¶
func (*PostgresBackendRepository) GetOrCreateStub ¶
func (*PostgresBackendRepository) GetOrCreateVolume ¶
func (*PostgresBackendRepository) GetScheduledJob ¶
func (r *PostgresBackendRepository) GetScheduledJob(ctx context.Context, deploymentId uint) (*types.ScheduledJob, error)
func (*PostgresBackendRepository) GetSecretByName ¶
func (*PostgresBackendRepository) GetSecretByNameDecrypted ¶
func (*PostgresBackendRepository) GetSecretsByName ¶
func (*PostgresBackendRepository) GetSecretsByNameDecrypted ¶
func (*PostgresBackendRepository) GetStubByExternalId ¶
func (r *PostgresBackendRepository) GetStubByExternalId(ctx context.Context, externalId string, queryFilters ...types.QueryFilter) (*types.StubWithRelated, error)
func (*PostgresBackendRepository) GetStubById ¶
func (r *PostgresBackendRepository) GetStubById(ctx context.Context, stubId uint, queryFilters ...types.QueryFilter) (*types.StubWithRelated, error)
func (*PostgresBackendRepository) GetTaskByWorkspace ¶
func (r *PostgresBackendRepository) GetTaskByWorkspace(ctx context.Context, externalId string, workspace *types.Workspace) (*types.TaskWithRelated, error)
func (*PostgresBackendRepository) GetTaskCountPerDeployment ¶
func (c *PostgresBackendRepository) GetTaskCountPerDeployment(ctx context.Context, filters types.TaskFilter) ([]types.TaskCountPerDeployment, error)
func (*PostgresBackendRepository) GetTaskMetrics ¶
func (r *PostgresBackendRepository) GetTaskMetrics(ctx context.Context, periodStart, periodEnd time.Time) (types.TaskMetrics, error)
func (*PostgresBackendRepository) GetTaskStatus ¶
func (r *PostgresBackendRepository) GetTaskStatus(ctx context.Context, externalId string) (types.TaskStatus, error)
func (*PostgresBackendRepository) GetTaskWithRelated ¶
func (r *PostgresBackendRepository) GetTaskWithRelated(ctx context.Context, externalId string) (*types.TaskWithRelated, error)
func (*PostgresBackendRepository) GetTokenByExternalId ¶
func (*PostgresBackendRepository) GetVolume ¶
func (c *PostgresBackendRepository) GetVolume(ctx context.Context, workspaceId uint, name string) (*types.Volume, error)
Volume
func (*PostgresBackendRepository) GetVolumeByExternalId ¶
func (*PostgresBackendRepository) GetWorkspace ¶
func (*PostgresBackendRepository) GetWorkspaceByExternalId ¶
func (*PostgresBackendRepository) GetWorkspaceByExternalIdWithSigningKey ¶
func (*PostgresBackendRepository) GetWorkspaceStorage ¶
func (r *PostgresBackendRepository) GetWorkspaceStorage(ctx context.Context, storageId uint) (*types.WorkspaceStorage, error)
func (*PostgresBackendRepository) ListAppIDsByStubExternalIDs ¶
func (*PostgresBackendRepository) ListAppsPaginated ¶
func (*PostgresBackendRepository) ListCheckpoints ¶
func (r *PostgresBackendRepository) ListCheckpoints(ctx context.Context, workspaceExternalId string) ([]types.Checkpoint, error)
func (*PostgresBackendRepository) ListConcurrencyLimitsByWorkspaceId ¶
func (r *PostgresBackendRepository) ListConcurrencyLimitsByWorkspaceId(ctx context.Context, workspaceId string) ([]types.ConcurrencyLimit, error)
func (*PostgresBackendRepository) ListDeploymentsPaginated ¶
func (c *PostgresBackendRepository) ListDeploymentsPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
func (*PostgresBackendRepository) ListDeploymentsWithRelated ¶
func (c *PostgresBackendRepository) ListDeploymentsWithRelated(ctx context.Context, filters types.DeploymentFilter) ([]types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) ListDiskSnapshots ¶
func (r *PostgresBackendRepository) ListDiskSnapshots(ctx context.Context, filter types.DiskSnapshotFilter) ([]types.DiskSnapshot, error)
func (*PostgresBackendRepository) ListDisksWithRelated ¶
func (r *PostgresBackendRepository) ListDisksWithRelated(ctx context.Context, workspaceId uint) ([]types.DiskWithRelated, error)
func (*PostgresBackendRepository) ListLatestDeploymentsByAppIDs ¶
func (c *PostgresBackendRepository) ListLatestDeploymentsByAppIDs(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) ListLatestDeploymentsWithRelatedPaginated ¶
func (c *PostgresBackendRepository) ListLatestDeploymentsWithRelatedPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
func (*PostgresBackendRepository) ListLatestStubsByAppIDs ¶
func (c *PostgresBackendRepository) ListLatestStubsByAppIDs(ctx context.Context, workspaceID uint, appExternalIDs []string) (map[string]types.StubWithRelated, error)
func (*PostgresBackendRepository) ListSecrets ¶
func (*PostgresBackendRepository) ListStacks ¶
func (*PostgresBackendRepository) ListStaleCheckpoints ¶
func (r *PostgresBackendRepository) ListStaleCheckpoints(ctx context.Context, activeRecentStubKeys []string, stubLastUsedBefore time.Time) ([]types.Checkpoint, error)
func (*PostgresBackendRepository) ListStubs ¶
func (c *PostgresBackendRepository) ListStubs(ctx context.Context, filters types.StubFilter) ([]types.StubWithRelated, error)
func (*PostgresBackendRepository) ListStubsPaginated ¶
func (c *PostgresBackendRepository) ListStubsPaginated(ctx context.Context, filters types.StubFilter) (common.CursorPaginationInfo[types.StubWithRelated], error)
func (*PostgresBackendRepository) ListTasksWithRelated ¶
func (c *PostgresBackendRepository) ListTasksWithRelated(ctx context.Context, filters types.TaskFilter) ([]types.TaskWithRelated, error)
func (*PostgresBackendRepository) ListTasksWithRelatedPaginated ¶
func (c *PostgresBackendRepository) ListTasksWithRelatedPaginated(ctx context.Context, filters types.TaskFilter) (common.CursorPaginationInfo[types.TaskWithRelated], error)
func (*PostgresBackendRepository) ListTokens ¶
func (*PostgresBackendRepository) ListVolumesWithRelated ¶
func (c *PostgresBackendRepository) ListVolumesWithRelated(ctx context.Context, workspaceId uint) ([]types.VolumeWithRelated, error)
func (*PostgresBackendRepository) ListWorkspaces ¶
func (*PostgresBackendRepository) ListenToChannel ¶
func (*PostgresBackendRepository) Migrate ¶
func (r *PostgresBackendRepository) Migrate() error
func (*PostgresBackendRepository) MigrateContext ¶
func (r *PostgresBackendRepository) MigrateContext(ctx context.Context) error
func (*PostgresBackendRepository) Ping ¶
func (r *PostgresBackendRepository) Ping() error
func (*PostgresBackendRepository) PruneCheckpoints ¶
func (r *PostgresBackendRepository) PruneCheckpoints(ctx context.Context, checkpointIds []string) ([]types.Checkpoint, error)
func (*PostgresBackendRepository) RetrieveActiveToken ¶
func (*PostgresBackendRepository) RetrieveApp ¶
func (*PostgresBackendRepository) RetrieveAppByStubExternalId ¶
func (*PostgresBackendRepository) RevertToConcurrencyLimit ¶
func (r *PostgresBackendRepository) RevertToConcurrencyLimit(ctx context.Context, workspaceId string, concurrencyLimitId string) (*types.ConcurrencyLimit, error)
func (*PostgresBackendRepository) RevokeTokenByExternalId ¶
func (r *PostgresBackendRepository) RevokeTokenByExternalId(ctx context.Context, externalId string) error
func (*PostgresBackendRepository) SetImageCredentialSecretNames ¶
func (*PostgresBackendRepository) ToggleToken ¶
func (*PostgresBackendRepository) UpdateCheckpoint ¶
func (r *PostgresBackendRepository) UpdateCheckpoint(ctx context.Context, checkpoint *types.Checkpoint) (*types.Checkpoint, error)
func (*PostgresBackendRepository) UpdateConcurrencyLimit ¶
func (r *PostgresBackendRepository) UpdateConcurrencyLimit(ctx context.Context, concurrencyLimitId uint, gpuLimit uint32, cpuMillicoreLimit uint32) (*types.ConcurrencyLimit, error)
func (*PostgresBackendRepository) UpdateDeployment ¶
func (r *PostgresBackendRepository) UpdateDeployment(ctx context.Context, deployment types.Deployment) (*types.Deployment, error)
func (*PostgresBackendRepository) UpdateDiskSnapshot ¶
func (r *PostgresBackendRepository) UpdateDiskSnapshot(ctx context.Context, snapshot *types.DiskSnapshot) (*types.DiskSnapshot, error)
func (*PostgresBackendRepository) UpdateObjectSizeByExternalId ¶
func (*PostgresBackendRepository) UpdateSecret ¶
func (*PostgresBackendRepository) UpdateStack ¶
func (r *PostgresBackendRepository) UpdateStack(ctx context.Context, workspaceId uint, externalId, name string, spec json.RawMessage) (*types.Stack, error)
func (*PostgresBackendRepository) UpdateStubConfig ¶
func (r *PostgresBackendRepository) UpdateStubConfig(ctx context.Context, stubId uint, config *types.StubConfigV1) error
func (*PostgresBackendRepository) UpdateTask ¶
func (*PostgresBackendRepository) UpdateTokenAsClusterAdmin ¶
type ProviderRedisRepository ¶
type ProviderRedisRepository struct {
// contains filtered or unexported fields
}
func (*ProviderRedisRepository) AddMachine ¶
func (r *ProviderRedisRepository) AddMachine(providerName, poolName, machineId string, machineInfo *types.ProviderMachineState) error
func (*ProviderRedisRepository) GetGPUAvailability ¶
func (r *ProviderRedisRepository) GetGPUAvailability(pools map[string]types.WorkerPoolConfig) (map[string]bool, error)
func (*ProviderRedisRepository) GetGPUCounts ¶
func (r *ProviderRedisRepository) GetGPUCounts(pools map[string]types.WorkerPoolConfig) (map[string]int, error)
func (*ProviderRedisRepository) GetMachine ¶
func (r *ProviderRedisRepository) GetMachine(providerName, poolName, machineId string) (*types.ProviderMachine, error)
func (*ProviderRedisRepository) ListAllMachines ¶
func (r *ProviderRedisRepository) ListAllMachines(providerName, poolName string, useLock bool) ([]*types.ProviderMachine, error)
func (*ProviderRedisRepository) RegisterMachine ¶
func (r *ProviderRedisRepository) RegisterMachine(providerName, poolName, machineId string, newMachineInfo *types.ProviderMachineState, poolConfig *types.WorkerPoolConfig) error
func (*ProviderRedisRepository) RemoveMachine ¶
func (r *ProviderRedisRepository) RemoveMachine(providerName, poolName, machineId string) error
func (*ProviderRedisRepository) RemoveMachineLock ¶
func (r *ProviderRedisRepository) RemoveMachineLock(providerName, poolName, machineId string) error
func (*ProviderRedisRepository) SetLastWorkerSeen ¶
func (r *ProviderRedisRepository) SetLastWorkerSeen(providerName, poolName, machineId string) error
func (*ProviderRedisRepository) SetMachineKeepAlive ¶
func (r *ProviderRedisRepository) SetMachineKeepAlive(providerName, poolName, machineId, agentVersion string, metrics *types.ProviderMachineMetrics) error
func (*ProviderRedisRepository) SetMachineLock ¶
func (r *ProviderRedisRepository) SetMachineLock(providerName, poolName, machineId string) error
func (*ProviderRedisRepository) WaitForMachineRegistration ¶
func (r *ProviderRedisRepository) WaitForMachineRegistration(providerName, poolName, machineId string) (*types.ProviderMachineState, error)
type ProviderRepository ¶
type ProviderRepository interface {
GetMachine(providerName, poolName, machineId string) (*types.ProviderMachine, error)
AddMachine(providerName, poolName, machineId string, machineInfo *types.ProviderMachineState) error
RemoveMachine(providerName, poolName, machineId string) error
SetMachineKeepAlive(providerName, poolName, machineId, agentVersion string, metrics *types.ProviderMachineMetrics) error
SetLastWorkerSeen(providerName, poolName, machineId string) error
RegisterMachine(providerName, poolName, machineId string, newMachineInfo *types.ProviderMachineState, poolConfig *types.WorkerPoolConfig) error
WaitForMachineRegistration(providerName, poolName, machineId string) (*types.ProviderMachineState, error)
ListAllMachines(providerName, poolName string, useLock bool) ([]*types.ProviderMachine, error)
SetMachineLock(providerName, poolName, machineId string) error
RemoveMachineLock(providerName, poolName, machineId string) error
GetGPUAvailability(pools map[string]types.WorkerPoolConfig) (map[string]bool, error)
GetGPUCounts(pools map[string]types.WorkerPoolConfig) (map[string]int, error)
}
func NewProviderRedisRepository ¶
func NewProviderRedisRepository(rdb *common.RedisClient) ProviderRepository
func NewProviderRedisRepositoryForTest ¶
func NewProviderRedisRepositoryForTest(rdb *common.RedisClient) ProviderRepository
type S2EventRepository ¶
type S2EventRepository struct {
// contains filtered or unexported fields
}
func NewS2EventRepository ¶
func NewS2EventRepository(config types.S2Config) (*S2EventRepository, error)
func (*S2EventRepository) GetContainerEvents ¶
func (r *S2EventRepository) GetContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (*types.ContainerEventsResponse, error)
func (*S2EventRepository) GetEventHistory ¶
func (r *S2EventRepository) GetEventHistory(ctx context.Context, query types.EventQuery) (*types.EventHistoryResponse, error)
func (*S2EventRepository) GetLogs ¶
func (r *S2EventRepository) GetLogs(ctx context.Context, query types.LogQuery) (*types.LogsResponse, error)
func (*S2EventRepository) GetPoolMetricsTimeseries ¶
func (r *S2EventRepository) GetPoolMetricsTimeseries(ctx context.Context, query types.EventQuery, start, end time.Time, interval string) (*types.PoolMetricsTimeseriesResponse, error)
func (*S2EventRepository) GetStubMetricsTimeseries ¶
func (r *S2EventRepository) GetStubMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.MetricsTimeseriesResponse, error)
func (*S2EventRepository) GetWorkspaceMetricsTimeseries ¶
func (r *S2EventRepository) GetWorkspaceMetricsTimeseries(ctx context.Context, query types.EventQuery, start time.Time, end time.Time, interval string) (*types.MetricsTimeseriesResponse, error)
func (*S2EventRepository) PushEvent ¶
func (r *S2EventRepository) PushEvent(event cloudevents.Event) error
func (*S2EventRepository) PushEventSync ¶
func (r *S2EventRepository) PushEventSync(event cloudevents.Event) error
func (*S2EventRepository) ReadStubCacheRequiredContent ¶
func (r *S2EventRepository) ReadStubCacheRequiredContent(ctx context.Context, workspaceID, stubID string) ([]types.CacheRequiredContentItem, error)
ReadStubCacheRequiredContent reads the coalesced required-content set for a stub from the dedicated S2 cache stream. Items are merged by (hash, routing_key) keeping the most recent report for each.
func (*S2EventRepository) StreamAppNamespaceEvents ¶
func (r *S2EventRepository) StreamAppNamespaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
func (*S2EventRepository) StreamContainerEvents ¶
func (r *S2EventRepository) StreamContainerEvents(ctx context.Context, containerID string, query types.EventQuery) (EventStream, error)
func (*S2EventRepository) StreamLogs ¶
func (r *S2EventRepository) StreamLogs(ctx context.Context, query types.LogQuery) (EventStream, error)
func (*S2EventRepository) StreamStubEvents ¶
func (r *S2EventRepository) StreamStubEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
func (*S2EventRepository) StreamTaskEvents ¶
func (r *S2EventRepository) StreamTaskEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
func (*S2EventRepository) StreamWorkspaceEvents ¶
func (r *S2EventRepository) StreamWorkspaceEvents(ctx context.Context, query types.EventQuery) (EventStream, error)
type SchedulerRepository ¶
type SchedulerRepository interface{}
type ScopedS2EventRepository ¶
type ScopedS2EventRepository struct {
// contains filtered or unexported fields
}
func NewScopedS2EventRepository ¶
func NewScopedS2EventRepository(config types.S2Config) (*ScopedS2EventRepository, error)
func (*ScopedS2EventRepository) PushEvent ¶
func (r *ScopedS2EventRepository) PushEvent(event cloudevents.Event) error
func (*ScopedS2EventRepository) PushEventSync ¶
func (r *ScopedS2EventRepository) PushEventSync(event cloudevents.Event) error
type TailscaleRedisRepository ¶
type TailscaleRedisRepository struct {
// contains filtered or unexported fields
}
func (*TailscaleRedisRepository) GetHostnamesForService ¶
func (ts *TailscaleRedisRepository) GetHostnamesForService(serviceName string) ([]string, error)
func (*TailscaleRedisRepository) SetHostname ¶
func (ts *TailscaleRedisRepository) SetHostname(serviceName, serviceId string, hostName string) error
type TailscaleRepository ¶
type TailscaleRepository interface {
GetHostnamesForService(serviceName string) ([]string, error)
SetHostname(serviceName, serviceId, hostName string) error
}
func NewTailscaleRedisRepository ¶
func NewTailscaleRedisRepository(r *common.RedisClient, config types.AppConfig) TailscaleRepository
type TaskRedisRepository ¶
type TaskRedisRepository struct {
// contains filtered or unexported fields
}
func (*TaskRedisRepository) ClaimTask ¶
func (r *TaskRedisRepository) ClaimTask(ctx context.Context, workspaceName, stubId, taskId, containerId string) error
func (*TaskRedisRepository) DeleteTaskState ¶
func (r *TaskRedisRepository) DeleteTaskState(ctx context.Context, workspaceName, stubId, taskId string) error
func (*TaskRedisRepository) GetTaskState ¶
func (r *TaskRedisRepository) GetTaskState(ctx context.Context, workspaceName, stubId, taskId string) (*types.TaskMessage, error)
func (*TaskRedisRepository) GetTasksInFlight ¶
func (r *TaskRedisRepository) GetTasksInFlight(ctx context.Context) ([]*types.TaskMessage, error)
func (*TaskRedisRepository) RemoveTaskClaim ¶
func (r *TaskRedisRepository) RemoveTaskClaim(ctx context.Context, workspaceName, stubId, taskId string) error
func (*TaskRedisRepository) RemoveTaskRetryLock ¶
func (r *TaskRedisRepository) RemoveTaskRetryLock(ctx context.Context, workspaceName, stubId, taskId string) error
func (*TaskRedisRepository) SetTaskRetryLock ¶
func (r *TaskRedisRepository) SetTaskRetryLock(ctx context.Context, workspaceName, stubId, taskId string) error
func (*TaskRedisRepository) SetTaskState ¶
func (*TaskRedisRepository) TasksClaimed ¶
func (*TaskRedisRepository) TasksInFlight ¶
func (*TaskRedisRepository) WithTaskMonitorLease ¶
type TaskRepository ¶
type TaskRepository interface {
WithTaskMonitorLease(ctx context.Context, fn func(context.Context) error) error
GetTaskState(ctx context.Context, workspaceName, stubId, taskId string) (*types.TaskMessage, error)
SetTaskState(ctx context.Context, workspaceName, stubId, taskId string, msg []byte) error
DeleteTaskState(ctx context.Context, workspaceName, stubId, taskId string) error
GetTasksInFlight(ctx context.Context) ([]*types.TaskMessage, error)
ClaimTask(ctx context.Context, workspaceName, stubId, taskId, containerId string) error
RemoveTaskClaim(ctx context.Context, workspaceName, stubId, taskId string) error
IsClaimed(ctx context.Context, workspaceName, stubId, taskId string) (bool, error)
TasksClaimed(ctx context.Context, workspaceName, stubId string) (int, error)
TasksInFlight(ctx context.Context, workspaceName, stubId string) (int, error)
SetTaskRetryLock(ctx context.Context, workspaceName, stubId, taskId string) error
RemoveTaskRetryLock(ctx context.Context, workspaceName, stubId, taskId string) error
}
func NewTaskRedisRepository ¶
func NewTaskRedisRepository(r *common.RedisClient) TaskRepository
type ThunderRedisRepository ¶
type ThunderRedisRepository struct {
// contains filtered or unexported fields
}
func NewThunderRedisRepository ¶
func NewThunderRedisRepository(rdb *common.RedisClient) *ThunderRedisRepository
func (*ThunderRedisRepository) DeleteClientEnrollment ¶
func (r *ThunderRedisRepository) DeleteClientEnrollment(ctx context.Context, containerID string) error
func (*ThunderRedisRepository) DeleteNodeEnrollment ¶
func (r *ThunderRedisRepository) DeleteNodeEnrollment(ctx context.Context, workspaceID, poolName, machineID string) error
func (*ThunderRedisRepository) DeleteZone ¶
func (r *ThunderRedisRepository) DeleteZone(ctx context.Context, workspaceID, poolName string) error
func (*ThunderRedisRepository) GetClientEnrollment ¶
func (r *ThunderRedisRepository) GetClientEnrollment(ctx context.Context, containerID string) (*ThunderClientEnrollmentState, bool, error)
func (*ThunderRedisRepository) GetNodeEnrollment ¶
func (r *ThunderRedisRepository) GetNodeEnrollment(ctx context.Context, workspaceID, poolName, machineID string) (*ThunderNodeEnrollmentState, bool, error)
func (*ThunderRedisRepository) GetZone ¶
func (r *ThunderRedisRepository) GetZone(ctx context.Context, workspaceID, poolName string) (*ThunderZoneState, bool, error)
func (*ThunderRedisRepository) ListClientEnrollments ¶
func (r *ThunderRedisRepository) ListClientEnrollments(ctx context.Context) ([]*ThunderClientEnrollmentState, error)
func (*ThunderRedisRepository) ListNodeEnrollments ¶
func (r *ThunderRedisRepository) ListNodeEnrollments(ctx context.Context, workspaceID, poolName string) ([]*ThunderNodeEnrollmentState, error)
func (*ThunderRedisRepository) ListZones ¶
func (r *ThunderRedisRepository) ListZones(ctx context.Context, workspaceID string) ([]*ThunderZoneState, error)
func (*ThunderRedisRepository) SaveClientEnrollment ¶
func (r *ThunderRedisRepository) SaveClientEnrollment(ctx context.Context, state *ThunderClientEnrollmentState) error
func (*ThunderRedisRepository) SaveNodeEnrollment ¶
func (r *ThunderRedisRepository) SaveNodeEnrollment(ctx context.Context, state *ThunderNodeEnrollmentState) error
func (*ThunderRedisRepository) SaveZone ¶
func (r *ThunderRedisRepository) SaveZone(ctx context.Context, state *ThunderZoneState) error
func (*ThunderRedisRepository) WithPoolLock ¶
type ThunderRepository ¶
type ThunderRepository interface {
WithPoolLock(ctx context.Context, workspaceID, poolName string, fn func(context.Context) error) error
GetClientEnrollment(ctx context.Context, containerID string) (*ThunderClientEnrollmentState, bool, error)
SaveClientEnrollment(ctx context.Context, state *ThunderClientEnrollmentState) error
DeleteClientEnrollment(ctx context.Context, containerID string) error
ListClientEnrollments(ctx context.Context) ([]*ThunderClientEnrollmentState, error)
GetNodeEnrollment(ctx context.Context, workspaceID, poolName, machineID string) (*ThunderNodeEnrollmentState, bool, error)
SaveNodeEnrollment(ctx context.Context, state *ThunderNodeEnrollmentState) error
DeleteNodeEnrollment(ctx context.Context, workspaceID, poolName, machineID string) error
ListNodeEnrollments(ctx context.Context, workspaceID, poolName string) ([]*ThunderNodeEnrollmentState, error)
GetZone(ctx context.Context, workspaceID, poolName string) (*ThunderZoneState, bool, error)
SaveZone(ctx context.Context, state *ThunderZoneState) error
DeleteZone(ctx context.Context, workspaceID, poolName string) error
ListZones(ctx context.Context, workspaceID string) ([]*ThunderZoneState, error)
}
type ThunderZoneState ¶
type UsageMeterReader ¶
type UsageMeterReader interface {
QueryMeter(ctx context.Context, meter, subject string, from, to time.Time, groupBy []string) ([]types.MeterRow, error)
}
UsageMeterReader is the query side of a usage collector that keeps meters: one aggregate per UTC day for a subject, split by the group-by dimensions. A collector that only exports counters does not implement it.
type UsageMetricsRepository ¶
type WebhookSource ¶
type WebhookSource interface {
ListWebhooks(ctx context.Context, workspaceId string) ([]types.WorkspaceWebhook, error)
}
WebhookSource lists a workspace's webhooks; the sink caches results briefly.
type WorkerPoolRedisRepository ¶
type WorkerPoolRedisRepository struct {
// contains filtered or unexported fields
}
func (*WorkerPoolRedisRepository) DeleteWorkerPoolState ¶
func (r *WorkerPoolRedisRepository) DeleteWorkerPoolState(ctx context.Context, poolName string) error
DeleteWorkerPoolState removes the cached health snapshot for a pool. Pool configuration lives elsewhere, so this is safe to call while deleting a API-managed pool and prevents a later same-name pool from inheriting stale health or capacity data.
func (*WorkerPoolRedisRepository) GetWorkerPoolState ¶
func (r *WorkerPoolRedisRepository) GetWorkerPoolState(ctx context.Context, poolName string) (*types.WorkerPoolState, error)
GetWorkerPoolState retrieves a collection of health metrics for a worker pool
func (*WorkerPoolRedisRepository) RemoveWorkerCleanerLock ¶
func (r *WorkerPoolRedisRepository) RemoveWorkerCleanerLock(poolName string) error
func (*WorkerPoolRedisRepository) RemoveWorkerPoolSizerLock ¶
func (r *WorkerPoolRedisRepository) RemoveWorkerPoolSizerLock(poolName string) error
func (*WorkerPoolRedisRepository) RemoveWorkerPoolStateLock ¶
func (r *WorkerPoolRedisRepository) RemoveWorkerPoolStateLock(poolName string) error
func (*WorkerPoolRedisRepository) SetWorkerCleanerLock ¶
func (r *WorkerPoolRedisRepository) SetWorkerCleanerLock(poolName string) error
func (*WorkerPoolRedisRepository) SetWorkerPoolSizerLock ¶
func (r *WorkerPoolRedisRepository) SetWorkerPoolSizerLock(poolName string) error
func (*WorkerPoolRedisRepository) SetWorkerPoolState ¶
func (r *WorkerPoolRedisRepository) SetWorkerPoolState(ctx context.Context, poolName string, state *types.WorkerPoolState) error
SetWorkerPoolState updates the worker pool state with some recent health metrics
func (*WorkerPoolRedisRepository) SetWorkerPoolStateLock ¶
func (r *WorkerPoolRedisRepository) SetWorkerPoolStateLock(poolName string) error
type WorkerPoolRepository ¶
type WorkerPoolRepository interface {
SetWorkerPoolState(ctx context.Context, poolName string, state *types.WorkerPoolState) error
GetWorkerPoolState(ctx context.Context, poolName string) (*types.WorkerPoolState, error)
DeleteWorkerPoolState(ctx context.Context, poolName string) error
SetWorkerPoolStateLock(poolName string) error
RemoveWorkerPoolStateLock(poolName string) error
SetWorkerPoolSizerLock(poolName string) error
RemoveWorkerPoolSizerLock(poolName string) error
SetWorkerCleanerLock(poolName string) error
RemoveWorkerCleanerLock(poolName string) error
}
func NewWorkerPoolRedisRepository ¶
func NewWorkerPoolRedisRepository(rdb *common.RedisClient) WorkerPoolRepository
func NewWorkerPoolRedisRepositoryForTest ¶
func NewWorkerPoolRedisRepositoryForTest(rdb *common.RedisClient) WorkerPoolRepository
type WorkerRedisRepository ¶
type WorkerRedisRepository struct {
// contains filtered or unexported fields
}
func (*WorkerRedisRepository) AddContainerToWorker ¶
func (r *WorkerRedisRepository) AddContainerToWorker(workerId, containerId, deliveryToken string) error
func (*WorkerRedisRepository) AddWorker ¶
func (r *WorkerRedisRepository) AddWorker(worker *types.Worker) error
AddWorker adds or updates a worker
func (*WorkerRedisRepository) CancelWorkerRollout ¶
func (r *WorkerRedisRepository) CancelWorkerRollout(workerId, generation string) error
CancelWorkerRollout restores an unpublished rollout's original readiness. The caller holds the agent slot lock and has verified that the published slot still matches the desired generation. Compare the pending target under the scheduling lock so a stale snapshot cannot cancel another transition.
func (*WorkerRedisRepository) GetAllWorkers ¶
func (r *WorkerRedisRepository) GetAllWorkers() ([]*types.Worker, error)
func (*WorkerRedisRepository) GetAllWorkersInPool ¶
func (r *WorkerRedisRepository) GetAllWorkersInPool(poolName string) ([]*types.Worker, error)
func (*WorkerRedisRepository) GetAllWorkersOnMachine ¶
func (r *WorkerRedisRepository) GetAllWorkersOnMachine(machineId string) ([]*types.Worker, error)
func (*WorkerRedisRepository) GetContainerIp ¶
func (r *WorkerRedisRepository) GetContainerIp(networkPrefix string, containerId string) (string, error)
func (*WorkerRedisRepository) GetContainerIpAssignments ¶
func (r *WorkerRedisRepository) GetContainerIpAssignments(networkPrefix string) ([]types.ContainerIpAssignment, error)
func (*WorkerRedisRepository) GetContainerIps ¶
func (r *WorkerRedisRepository) GetContainerIps(networkPrefix string) ([]string, error)
func (*WorkerRedisRepository) GetFreeGpuCounts ¶
func (r *WorkerRedisRepository) GetFreeGpuCounts() (map[string]int, error)
func (*WorkerRedisRepository) GetGpuAvailability ¶
func (r *WorkerRedisRepository) GetGpuAvailability() (map[string]bool, error)
func (*WorkerRedisRepository) GetGpuCounts ¶
func (r *WorkerRedisRepository) GetGpuCounts() (map[string]int, error)
func (*WorkerRedisRepository) GetId ¶
func (r *WorkerRedisRepository) GetId() string
func (*WorkerRedisRepository) GetNextContainerRequest ¶
func (r *WorkerRedisRepository) GetNextContainerRequest(workerId string) (*types.ContainerRequest, error)
func (*WorkerRedisRepository) GetNextContainerRequests ¶
func (r *WorkerRedisRepository) GetNextContainerRequests(workerId string, limit int) ([]*types.ContainerRequest, error)
func (*WorkerRedisRepository) GetPreemptibleGpus ¶
func (r *WorkerRedisRepository) GetPreemptibleGpus() []string
func (*WorkerRedisRepository) GetWorkerById ¶
func (r *WorkerRedisRepository) GetWorkerById(workerId string) (*types.Worker, error)
func (*WorkerRedisRepository) MoveContainerIp ¶
func (r *WorkerRedisRepository) MoveContainerIp(networkPrefix, fromContainerId, toContainerId, containerIp string) error
func (*WorkerRedisRepository) PrepareWorkerRollout ¶
func (r *WorkerRedisRepository) PrepareWorkerRollout(workerId, generation string) (bool, error)
PrepareWorkerRollout disables an agent worker immediately, then waits until queued, delivered, and active container work is gone before allowing the agent slot to change. The worker lock is shared with scheduling, so no new assignment can race the transition.
func (*WorkerRedisRepository) RecoverPendingContainerRequests ¶
func (r *WorkerRedisRepository) RecoverPendingContainerRequests(workerId string) error
func (*WorkerRedisRepository) RemoveContainerFromWorker ¶
func (r *WorkerRedisRepository) RemoveContainerFromWorker(workerId string, containerId string) error
func (*WorkerRedisRepository) RemoveContainerIp ¶
func (r *WorkerRedisRepository) RemoveContainerIp(networkPrefix string, containerId string) error
func (*WorkerRedisRepository) RemoveImagePullLock ¶
func (r *WorkerRedisRepository) RemoveImagePullLock(workerId, imageId, token string) error
func (*WorkerRedisRepository) RemoveNetworkLock ¶
func (r *WorkerRedisRepository) RemoveNetworkLock(networkPrefix string, token string) error
func (*WorkerRedisRepository) RemoveWorker ¶
func (r *WorkerRedisRepository) RemoveWorker(workerId string) error
func (*WorkerRedisRepository) RemoveWorkerNetworkState ¶
func (r *WorkerRedisRepository) RemoveWorkerNetworkState(ctx context.Context, networkPrefix string) error
func (*WorkerRedisRepository) RequeueContainerRequests ¶
func (r *WorkerRedisRepository) RequeueContainerRequests(workerId string, requests []*types.ContainerRequest) error
func (*WorkerRedisRepository) ScheduleContainerRequest ¶
func (r *WorkerRedisRepository) ScheduleContainerRequest(worker *types.Worker, request *types.ContainerRequest) error
func (*WorkerRedisRepository) ScheduleContainerRequests ¶
func (r *WorkerRedisRepository) ScheduleContainerRequests(worker *types.Worker, requests []*types.ContainerRequest) error
func (*WorkerRedisRepository) SetContainerIp ¶
func (r *WorkerRedisRepository) SetContainerIp(networkPrefix string, containerId, containerIp string) error
func (*WorkerRedisRepository) SetContainerResourceValues ¶
func (r *WorkerRedisRepository) SetContainerResourceValues(workerId string, containerId string, usage types.ContainerResourceUsage) error
func (*WorkerRedisRepository) SetImagePullLock ¶
func (r *WorkerRedisRepository) SetImagePullLock(workerId, imageId string) (string, error)
func (*WorkerRedisRepository) SetNetworkLock ¶
func (r *WorkerRedisRepository) SetNetworkLock(networkPrefix string, ttl, retries int) (string, error)
func (*WorkerRedisRepository) SetWorkerCordon ¶
func (r *WorkerRedisRepository) SetWorkerCordon(workerId string, cordoned bool) error
func (*WorkerRedisRepository) SetWorkerKeepAlive ¶
func (r *WorkerRedisRepository) SetWorkerKeepAlive(workerId string, keepAlive types.WorkerKeepAlive) error
func (*WorkerRedisRepository) ToggleWorkerAvailable ¶
func (r *WorkerRedisRepository) ToggleWorkerAvailable(workerId, generation string) error
func (*WorkerRedisRepository) UpdateWorkerCapacity ¶
func (r *WorkerRedisRepository) UpdateWorkerCapacity(worker *types.Worker, request *types.ContainerRequest, capacityUpdateType types.CapacityUpdateType) error
func (*WorkerRedisRepository) UpdateWorkerStatus ¶
func (r *WorkerRedisRepository) UpdateWorkerStatus(workerId string, status types.WorkerStatus) error
type WorkerRepository ¶
type WorkerRepository interface {
GetId() string
GetWorkerById(workerId string) (*types.Worker, error)
GetAllWorkers() ([]*types.Worker, error)
GetAllWorkersInPool(poolName string) ([]*types.Worker, error)
GetAllWorkersOnMachine(machineId string) ([]*types.Worker, error)
AddWorker(w *types.Worker) error
ToggleWorkerAvailable(workerId, generation string) error
SetWorkerCordon(workerId string, cordoned bool) error
PrepareWorkerRollout(workerId, generation string) (bool, error)
CancelWorkerRollout(workerId, generation string) error
UpdateWorkerStatus(workerId string, status types.WorkerStatus) error
RemoveWorker(workerId string) error
SetWorkerKeepAlive(workerId string, keepAlive types.WorkerKeepAlive) error
UpdateWorkerCapacity(w *types.Worker, cr *types.ContainerRequest, ut types.CapacityUpdateType) error
ScheduleContainerRequest(worker *types.Worker, request *types.ContainerRequest) error
ScheduleContainerRequests(worker *types.Worker, requests []*types.ContainerRequest) error
GetNextContainerRequest(workerId string) (*types.ContainerRequest, error)
GetNextContainerRequests(workerId string, limit int) ([]*types.ContainerRequest, error)
RecoverPendingContainerRequests(workerId string) error
RequeueContainerRequests(workerId string, requests []*types.ContainerRequest) error
AddContainerToWorker(workerId, containerId, deliveryToken string) error
RemoveContainerFromWorker(workerId string, containerId string) error
SetContainerResourceValues(workerId string, containerId string, usage types.ContainerResourceUsage) error
SetImagePullLock(workerId, imageId string) (string, error)
RemoveImagePullLock(workerId, imageId, token string) error
GetContainerIp(networkPrefix string, containerId string) (string, error)
SetContainerIp(networkPrefix string, containerId, containerIp string) error
MoveContainerIp(networkPrefix, fromContainerId, toContainerId, containerIp string) error
RemoveContainerIp(networkPrefix string, containerId string) error
GetContainerIps(networkPrefix string) ([]string, error)
GetContainerIpAssignments(networkPrefix string) ([]types.ContainerIpAssignment, error)
RemoveWorkerNetworkState(ctx context.Context, networkPrefix string) error
SetNetworkLock(networkPrefix string, ttl, retries int) (string, error)
RemoveNetworkLock(networkPrefix string, token string) error
GetGpuCounts() (map[string]int, error)
GetGpuAvailability() (map[string]bool, error)
GetFreeGpuCounts() (map[string]int, error)
GetPreemptibleGpus() []string
}
func NewWorkerRedisRepository ¶
func NewWorkerRedisRepository(r *common.RedisClient, config types.WorkerConfig) WorkerRepository
func NewWorkerRedisRepositoryForTest ¶
func NewWorkerRedisRepositoryForTest(rdb *common.RedisClient) WorkerRepository
type WorkspaceRedisRepository ¶
type WorkspaceRedisRepository struct {
// contains filtered or unexported fields
}
func (*WorkspaceRedisRepository) AuthorizeToken ¶
func (*WorkspaceRedisRepository) DeleteWebhook ¶
func (wr *WorkspaceRedisRepository) DeleteWebhook(ctx context.Context, workspaceId, webhookId string) error
func (*WorkspaceRedisRepository) GetConcurrencyLimitByWorkspaceId ¶
func (wr *WorkspaceRedisRepository) GetConcurrencyLimitByWorkspaceId(workspaceId string) (*types.ConcurrencyLimit, error)
func (*WorkspaceRedisRepository) ListWebhooks ¶
func (wr *WorkspaceRedisRepository) ListWebhooks(ctx context.Context, workspaceId string) ([]types.WorkspaceWebhook, error)
Webhooks live in one hash per workspace: field = webhook id, value = JSON.
func (*WorkspaceRedisRepository) RevokeToken ¶
func (wr *WorkspaceRedisRepository) RevokeToken(tokenKey string) error
func (*WorkspaceRedisRepository) SetAuthorizationToken ¶
func (*WorkspaceRedisRepository) SetConcurrencyLimitByWorkspaceId ¶
func (wr *WorkspaceRedisRepository) SetConcurrencyLimitByWorkspaceId(workspaceId string, limit *types.ConcurrencyLimit) error
func (*WorkspaceRedisRepository) SetWebhook ¶
func (wr *WorkspaceRedisRepository) SetWebhook(ctx context.Context, workspaceId string, webhook types.WorkspaceWebhook) error
type WorkspaceRepository ¶
type WorkspaceRepository interface {
GetConcurrencyLimitByWorkspaceId(workspaceId string) (*types.ConcurrencyLimit, error)
SetConcurrencyLimitByWorkspaceId(workspaceId string, limit *types.ConcurrencyLimit) error
ListWebhooks(ctx context.Context, workspaceId string) ([]types.WorkspaceWebhook, error)
SetWebhook(ctx context.Context, workspaceId string, webhook types.WorkspaceWebhook) error
DeleteWebhook(ctx context.Context, workspaceId, webhookId string) error
AuthorizeToken(string) (*types.Token, *types.Workspace, error)
RevokeToken(tokenKey string) error
SetAuthorizationToken(*types.Token, *types.Workspace) error
}
func NewWorkspaceRedisRepository ¶
func NewWorkspaceRedisRepository(r *common.RedisClient) WorkspaceRepository
func NewWorkspaceRedisRepositoryForTest ¶
func NewWorkspaceRedisRepositoryForTest(rdb *common.RedisClient) WorkspaceRepository
Source Files
¶
- backend_postgres.go
- backend_utils.go
- base.go
- cache_redis.go
- compute_redis.go
- container_endpoint_tokens.go
- container_redis.go
- disk_postgres.go
- events.go
- events_http_sink.go
- events_s2.go
- events_s2_realtime.go
- events_webhook_sink.go
- events_worker.go
- managed_endpoint_protection.go
- managed_endpoint_redis.go
- managed_pool_redis.go
- provider_redis.go
- tailscale_redis.go
- task_redis.go
- testutils.go
- thunder_redis.go
- worker_pool_redis.go
- worker_redis.go
- worker_redis_evict.go
- workspace_redis.go