Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateDSN(config types.PostgresConfig) string
- func NewRedisClientForTest() (*common.RedisClient, error)
- type AuthInfo
- type BackendRepository
- type ContainerRedisRepository
- func (cr *ContainerRedisRepository) DeleteContainerState(containerId string) error
- func (cr *ContainerRedisRepository) DeleteStubState(stubId string) 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) GetCheckpointState(workspaceName, checkpointId string) (*types.CheckpointState, error)
- func (cr *ContainerRedisRepository) GetContainerAddress(containerId string) (string, error)
- func (cr *ContainerRedisRepository) GetContainerExitCode(containerId string) (int, error)
- func (cr *ContainerRedisRepository) GetContainerState(containerId string) (*types.ContainerState, error)
- func (cr *ContainerRedisRepository) GetFailedContainersByStubId(stubId string) ([]string, error)
- func (cr *ContainerRedisRepository) GetStubState(stubId string) (string, error)
- func (cr *ContainerRedisRepository) GetWorkerAddress(ctx context.Context, containerId string) (string, error)
- func (cr *ContainerRedisRepository) SetContainerAddress(containerId string, addr string) error
- func (cr *ContainerRedisRepository) SetContainerExitCode(containerId string, exitCode int) error
- func (cr *ContainerRedisRepository) SetContainerState(containerId string, info *types.ContainerState) error
- func (c *ContainerRedisRepository) SetContainerStateWithConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
- func (cr *ContainerRedisRepository) SetStubState(stubId, state string) error
- func (cr *ContainerRedisRepository) SetWorkerAddress(containerId string, addr string) error
- func (cr *ContainerRedisRepository) UpdateAssignedContainerGPU(containerId string, gpuType string) error
- func (cr *ContainerRedisRepository) UpdateCheckpointState(workspaceName, checkpointId string, checkpointState *types.CheckpointState) error
- func (cr *ContainerRedisRepository) UpdateContainerStatus(containerId string, status types.ContainerStatus, expiry time.Duration) error
- type ContainerRepository
- type EventRepository
- type GooseLogger
- type MetricsRepository
- type PostgresBackendRepository
- 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 (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) 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) 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) DeleteConcurrencyLimit(ctx context.Context, workspaceId types.Workspace) error
- func (r *PostgresBackendRepository) DeleteDeployment(ctx context.Context, deployment types.Deployment) 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) 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) 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) GetDeploymentBySubdomain(ctx context.Context, subdomain string, version uint) (*types.DeploymentWithRelated, error)
- func (c *PostgresBackendRepository) GetLatestDeploymentByName(ctx context.Context, workspaceId uint, name string, stubType string, ...) (*types.DeploymentWithRelated, 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) 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) 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) GetTaskWithRelated(ctx context.Context, externalId string) (*types.TaskWithRelated, error)
- func (c *PostgresBackendRepository) GetVolume(ctx context.Context, workspaceId uint, name string) (*types.Volume, 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 (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 (c *PostgresBackendRepository) ListLatestDeploymentsWithRelatedPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
- func (r *PostgresBackendRepository) ListSecrets(ctx context.Context, workspace *types.Workspace) ([]types.Secret, 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) Ping() error
- func (r *PostgresBackendRepository) RetrieveActiveToken(ctx context.Context, workspaceId uint) (*types.Token, error)
- func (r *PostgresBackendRepository) RevokeTokenByExternalId(ctx context.Context, externalId string) error
- func (r *PostgresBackendRepository) ToggleToken(ctx context.Context, workspaceId uint, extTokenId string) (types.Token, 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) UpdateObjectSizeByExternalId(ctx context.Context, externalId string, size int) error
- func (r *PostgresBackendRepository) UpdateSecret(ctx context.Context, workspace *types.Workspace, tokenId uint, secretId string, ...) (*types.Secret, 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 SchedulerRepository
- type TCPEventClientRepo
- func (t *TCPEventClientRepo) PushContainerRequestedEvent(request *types.ContainerRequest)
- func (t *TCPEventClientRepo) PushContainerResourceMetricsEvent(workerID string, request *types.ContainerRequest, ...)
- func (t *TCPEventClientRepo) PushContainerScheduledEvent(containerID string, workerID string, request *types.ContainerRequest)
- func (t *TCPEventClientRepo) PushContainerStartedEvent(containerID string, workerID string, request *types.ContainerRequest)
- func (t *TCPEventClientRepo) PushContainerStoppedEvent(containerID string, workerID string, request *types.ContainerRequest)
- func (t *TCPEventClientRepo) PushDeployStubEvent(workspaceId string, stub *types.Stub)
- func (t *TCPEventClientRepo) PushRunStubEvent(workspaceId string, stub *types.Stub)
- func (t *TCPEventClientRepo) PushServeStubEvent(workspaceId string, stub *types.Stub)
- func (t *TCPEventClientRepo) PushStubStateUnhealthy(workspaceId string, stubId string, currentState string, previousState string, ...)
- func (t *TCPEventClientRepo) PushTaskCreatedEvent(task *types.TaskWithRelated)
- func (t *TCPEventClientRepo) PushTaskUpdatedEvent(task *types.TaskWithRelated)
- func (t *TCPEventClientRepo) PushWorkerStartedEvent(workerID string)
- func (t *TCPEventClientRepo) PushWorkerStoppedEvent(workerID string)
- 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)
- type TaskRepository
- type WorkerRedisRepository
- func (r *WorkerRedisRepository) AddContainerToWorker(workerId string, containerId string) error
- func (r *WorkerRedisRepository) AddWorker(worker *types.Worker) 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) GetContainerIps(networkPrefix string) ([]string, error)
- func (r *WorkerRedisRepository) GetId() string
- func (r *WorkerRedisRepository) GetNextContainerRequest(workerId string) (*types.ContainerRequest, error)
- func (r *WorkerRedisRepository) GetWorkerById(workerId string) (*types.Worker, 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 string) error
- func (r *WorkerRedisRepository) RemoveNetworkLock(networkPrefix string) error
- func (r *WorkerRedisRepository) RemoveWorker(worker *types.Worker) error
- func (r *WorkerRedisRepository) RemoveWorkerPoolSizerLock(poolName string) error
- func (r *WorkerRedisRepository) ScheduleContainerRequest(worker *types.Worker, request *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) error
- func (r *WorkerRedisRepository) SetNetworkLock(networkPrefix string, ttl, retries int) error
- func (r *WorkerRedisRepository) SetWorkerKeepAlive(workerId string) error
- func (r *WorkerRedisRepository) SetWorkerPoolSizerLock(poolName string) error
- func (r *WorkerRedisRepository) ToggleWorkerAvailable(workerId 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) GetConcurrencyLimitByWorkspaceId(workspaceId string) (*types.ConcurrencyLimit, error)
- func (wr *WorkspaceRedisRepository) SetAuthorizationToken(token *types.Token, workspace *types.Workspace) error
- func (wr *WorkspaceRedisRepository) SetConcurrencyLimitByWorkspaceId(workspaceId string, limit *types.ConcurrencyLimit) error
- type WorkspaceRepository
Constants ¶
View Source
const (
ScheduledJobsChannel = "jobs"
)
Variables ¶
View Source
var PostgresDataError = pq.ErrorClass("22")
Functions ¶
func GenerateDSN ¶
func GenerateDSN(config types.PostgresConfig) string
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) 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) 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) 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) (types.Stub, error) GetStubByExternalId(ctx context.Context, externalId string, 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) 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) 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) 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) (*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) 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) CreateSecret(ctx context.Context, workspace *types.Workspace, tokenId uint, name string, value string) (*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, secretId string, value string) (*types.Secret, error) DeleteSecret(ctx context.Context, workspace *types.Workspace, secretName 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 }
func NewBackendPostgresRepositoryForTest ¶
func NewBackendPostgresRepositoryForTest() (BackendRepository, sqlmock.Sqlmock)
type ContainerRedisRepository ¶
type ContainerRedisRepository struct {
// contains filtered or unexported fields
}
func (*ContainerRedisRepository) DeleteContainerState ¶
func (cr *ContainerRedisRepository) DeleteContainerState(containerId string) error
func (*ContainerRedisRepository) DeleteStubState ¶
func (cr *ContainerRedisRepository) DeleteStubState(stubId string) error
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) GetCheckpointState ¶
func (cr *ContainerRedisRepository) GetCheckpointState(workspaceName, checkpointId string) (*types.CheckpointState, error)
func (*ContainerRedisRepository) GetContainerAddress ¶
func (cr *ContainerRedisRepository) GetContainerAddress(containerId string) (string, error)
func (*ContainerRedisRepository) GetContainerExitCode ¶
func (cr *ContainerRedisRepository) GetContainerExitCode(containerId string) (int, error)
func (*ContainerRedisRepository) GetContainerState ¶
func (cr *ContainerRedisRepository) GetContainerState(containerId string) (*types.ContainerState, error)
func (*ContainerRedisRepository) GetFailedContainersByStubId ¶
func (cr *ContainerRedisRepository) GetFailedContainersByStubId(stubId string) ([]string, error)
func (*ContainerRedisRepository) GetStubState ¶
func (cr *ContainerRedisRepository) GetStubState(stubId string) (string, error)
func (*ContainerRedisRepository) GetWorkerAddress ¶
func (*ContainerRedisRepository) SetContainerAddress ¶
func (cr *ContainerRedisRepository) SetContainerAddress(containerId string, addr string) error
func (*ContainerRedisRepository) SetContainerExitCode ¶
func (cr *ContainerRedisRepository) SetContainerExitCode(containerId string, exitCode int) error
func (*ContainerRedisRepository) SetContainerState ¶
func (cr *ContainerRedisRepository) SetContainerState(containerId string, info *types.ContainerState) error
func (*ContainerRedisRepository) SetContainerStateWithConcurrencyLimit ¶
func (c *ContainerRedisRepository) SetContainerStateWithConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error
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) UpdateAssignedContainerGPU ¶
func (cr *ContainerRedisRepository) UpdateAssignedContainerGPU(containerId string, gpuType string) error
func (*ContainerRedisRepository) UpdateCheckpointState ¶
func (cr *ContainerRedisRepository) UpdateCheckpointState(workspaceName, checkpointId string, checkpointState *types.CheckpointState) error
func (*ContainerRedisRepository) UpdateContainerStatus ¶
func (cr *ContainerRedisRepository) UpdateContainerStatus(containerId string, status types.ContainerStatus, expiry time.Duration) error
type ContainerRepository ¶
type ContainerRepository interface { GetContainerState(string) (*types.ContainerState, error) SetContainerState(string, *types.ContainerState) error SetContainerExitCode(string, int) error GetContainerExitCode(string) (int, error) SetContainerAddress(containerId string, addr string) error GetContainerAddress(containerId string) (string, error) UpdateContainerStatus(string, types.ContainerStatus, time.Duration) error UpdateAssignedContainerGPU(string, string) error DeleteContainerState(containerId string) error SetWorkerAddress(containerId string, addr string) error SetContainerStateWithConcurrencyLimit(quota *types.ConcurrencyLimit, request *types.ContainerRequest) error GetWorkerAddress(ctx context.Context, containerId string) (string, error) GetActiveContainersByStubId(stubId string) ([]types.ContainerState, error) GetActiveContainersByWorkspaceId(workspaceId string) ([]types.ContainerState, error) GetActiveContainersByWorkerId(workerId string) ([]types.ContainerState, error) GetFailedContainersByStubId(stubId string) ([]string, error) UpdateCheckpointState(workspaceName, checkpointId string, checkpointState *types.CheckpointState) error GetCheckpointState(workspaceName, checkpointId string) (*types.CheckpointState, error) GetStubState(stubId string) (string, error) SetStubState(stubId, state string) error DeleteStubState(stubId string) error }
func NewContainerRedisRepository ¶
func NewContainerRedisRepository(r *common.RedisClient) ContainerRepository
func NewContainerRedisRepositoryForTest ¶
func NewContainerRedisRepositoryForTest(rdb *common.RedisClient) ContainerRepository
type EventRepository ¶
type EventRepository interface { PushContainerRequestedEvent(request *types.ContainerRequest) PushContainerScheduledEvent(containerID string, workerID string, request *types.ContainerRequest) PushContainerStartedEvent(containerID string, workerID string, request *types.ContainerRequest) PushContainerStoppedEvent(containerID string, workerID string, request *types.ContainerRequest) PushContainerResourceMetricsEvent(workerID string, request *types.ContainerRequest, metrics types.EventContainerMetricsData) PushWorkerStartedEvent(workerID string) PushWorkerStoppedEvent(workerID string) PushDeployStubEvent(workspaceId string, stub *types.Stub) PushServeStubEvent(workspaceId string, stub *types.Stub) PushRunStubEvent(workspaceId string, stub *types.Stub) PushTaskUpdatedEvent(task *types.TaskWithRelated) PushTaskCreatedEvent(task *types.TaskWithRelated) PushStubStateUnhealthy(workspaceId string, stubId string, currentState, previousState string, reason string, failedContainers []string) }
func NewTCPEventClientRepo ¶
func NewTCPEventClientRepo(config types.FluentBitEventConfig) EventRepository
type GooseLogger ¶
func (*GooseLogger) Fatalf ¶
func (l *GooseLogger) Fatalf(format string, v ...any)
type MetricsRepository ¶
type PostgresBackendRepository ¶
type PostgresBackendRepository struct {
// contains filtered or unexported fields
}
func NewBackendPostgresRepository ¶
func NewBackendPostgresRepository(config types.PostgresConfig, eventRepo EventRepository) (*PostgresBackendRepository, error)
func (*PostgresBackendRepository) AggregateTasksByTimeWindow ¶
func (c *PostgresBackendRepository) AggregateTasksByTimeWindow(ctx context.Context, filters types.TaskFilter) ([]types.TaskCountByTime, error)
func (*PostgresBackendRepository) AuthorizeToken ¶
func (*PostgresBackendRepository) CreateConcurrencyLimit ¶
func (r *PostgresBackendRepository) CreateConcurrencyLimit(ctx context.Context, workspaceId uint, gpuLimit uint32, cpuMillicoreLimit uint32) (*types.ConcurrencyLimit, error)
func (*PostgresBackendRepository) CreateDeployment ¶
func (*PostgresBackendRepository) CreateObject ¶
func (*PostgresBackendRepository) CreateScheduledJob ¶
func (r *PostgresBackendRepository) CreateScheduledJob(ctx context.Context, scheduledJob *types.ScheduledJob) (*types.ScheduledJob, error)
func (*PostgresBackendRepository) CreateSecret ¶
func (*PostgresBackendRepository) CreateTask ¶
func (r *PostgresBackendRepository) CreateTask(ctx context.Context, params *types.TaskParams) (*types.Task, error)
func (*PostgresBackendRepository) CreateToken ¶
func (*PostgresBackendRepository) CreateWorkspace ¶
func (*PostgresBackendRepository) DeleteConcurrencyLimit ¶
func (*PostgresBackendRepository) DeleteDeployment ¶
func (r *PostgresBackendRepository) DeleteDeployment(ctx context.Context, deployment types.Deployment) error
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) DeleteTask ¶
func (r *PostgresBackendRepository) DeleteTask(ctx context.Context, externalId string) error
func (*PostgresBackendRepository) DeleteToken ¶
func (*PostgresBackendRepository) DeleteVolume ¶
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) 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) GetLatestDeploymentByName ¶
func (c *PostgresBackendRepository) GetLatestDeploymentByName(ctx context.Context, workspaceId uint, name string, stubType string, filterDeleted bool) (*types.DeploymentWithRelated, error)
func (*PostgresBackendRepository) GetObjectByExternalId ¶
func (*PostgresBackendRepository) GetObjectByExternalStubId ¶
func (*PostgresBackendRepository) GetObjectByHash ¶
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) 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) GetTaskWithRelated ¶
func (r *PostgresBackendRepository) GetTaskWithRelated(ctx context.Context, externalId string) (*types.TaskWithRelated, error)
func (*PostgresBackendRepository) GetWorkspaceByExternalId ¶
func (*PostgresBackendRepository) GetWorkspaceByExternalIdWithSigningKey ¶
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) ListLatestDeploymentsWithRelatedPaginated ¶
func (c *PostgresBackendRepository) ListLatestDeploymentsWithRelatedPaginated(ctx context.Context, filters types.DeploymentFilter) (common.CursorPaginationInfo[types.DeploymentWithRelated], error)
func (*PostgresBackendRepository) ListSecrets ¶
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) Ping ¶
func (r *PostgresBackendRepository) Ping() error
func (*PostgresBackendRepository) RetrieveActiveToken ¶
func (*PostgresBackendRepository) RevokeTokenByExternalId ¶
func (r *PostgresBackendRepository) RevokeTokenByExternalId(ctx context.Context, externalId string) error
func (*PostgresBackendRepository) ToggleToken ¶
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) UpdateObjectSizeByExternalId ¶
func (*PostgresBackendRepository) UpdateSecret ¶
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) 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) 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 SchedulerRepository ¶
type SchedulerRepository interface{}
type TCPEventClientRepo ¶
type TCPEventClientRepo struct {
// contains filtered or unexported fields
}
func (*TCPEventClientRepo) PushContainerRequestedEvent ¶
func (t *TCPEventClientRepo) PushContainerRequestedEvent(request *types.ContainerRequest)
func (*TCPEventClientRepo) PushContainerResourceMetricsEvent ¶
func (t *TCPEventClientRepo) PushContainerResourceMetricsEvent(workerID string, request *types.ContainerRequest, metrics types.EventContainerMetricsData)
func (*TCPEventClientRepo) PushContainerScheduledEvent ¶
func (t *TCPEventClientRepo) PushContainerScheduledEvent(containerID string, workerID string, request *types.ContainerRequest)
func (*TCPEventClientRepo) PushContainerStartedEvent ¶
func (t *TCPEventClientRepo) PushContainerStartedEvent(containerID string, workerID string, request *types.ContainerRequest)
func (*TCPEventClientRepo) PushContainerStoppedEvent ¶
func (t *TCPEventClientRepo) PushContainerStoppedEvent(containerID string, workerID string, request *types.ContainerRequest)
func (*TCPEventClientRepo) PushDeployStubEvent ¶
func (t *TCPEventClientRepo) PushDeployStubEvent(workspaceId string, stub *types.Stub)
func (*TCPEventClientRepo) PushRunStubEvent ¶
func (t *TCPEventClientRepo) PushRunStubEvent(workspaceId string, stub *types.Stub)
func (*TCPEventClientRepo) PushServeStubEvent ¶
func (t *TCPEventClientRepo) PushServeStubEvent(workspaceId string, stub *types.Stub)
func (*TCPEventClientRepo) PushStubStateUnhealthy ¶
func (*TCPEventClientRepo) PushTaskCreatedEvent ¶
func (t *TCPEventClientRepo) PushTaskCreatedEvent(task *types.TaskWithRelated)
func (*TCPEventClientRepo) PushTaskUpdatedEvent ¶
func (t *TCPEventClientRepo) PushTaskUpdatedEvent(task *types.TaskWithRelated)
func (*TCPEventClientRepo) PushWorkerStartedEvent ¶
func (t *TCPEventClientRepo) PushWorkerStartedEvent(workerID string)
func (*TCPEventClientRepo) PushWorkerStoppedEvent ¶
func (t *TCPEventClientRepo) PushWorkerStoppedEvent(workerID string)
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 ¶
type TaskRepository ¶
type TaskRepository interface { 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 WorkerRedisRepository ¶
type WorkerRedisRepository struct {
// contains filtered or unexported fields
}
func (*WorkerRedisRepository) AddContainerToWorker ¶
func (r *WorkerRedisRepository) AddContainerToWorker(workerId string, containerId string) error
func (*WorkerRedisRepository) AddWorker ¶
func (r *WorkerRedisRepository) AddWorker(worker *types.Worker) error
AddWorker adds or updates a worker
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) GetContainerIps ¶
func (r *WorkerRedisRepository) GetContainerIps(networkPrefix string) ([]string, error)
func (*WorkerRedisRepository) GetId ¶
func (r *WorkerRedisRepository) GetId() string
func (*WorkerRedisRepository) GetNextContainerRequest ¶
func (r *WorkerRedisRepository) GetNextContainerRequest(workerId string) (*types.ContainerRequest, error)
func (*WorkerRedisRepository) GetWorkerById ¶
func (r *WorkerRedisRepository) GetWorkerById(workerId string) (*types.Worker, 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 string) error
func (*WorkerRedisRepository) RemoveNetworkLock ¶
func (r *WorkerRedisRepository) RemoveNetworkLock(networkPrefix string) error
func (*WorkerRedisRepository) RemoveWorker ¶
func (r *WorkerRedisRepository) RemoveWorker(worker *types.Worker) error
func (*WorkerRedisRepository) RemoveWorkerPoolSizerLock ¶
func (r *WorkerRedisRepository) RemoveWorkerPoolSizerLock(poolName string) error
func (*WorkerRedisRepository) ScheduleContainerRequest ¶
func (r *WorkerRedisRepository) ScheduleContainerRequest(worker *types.Worker, request *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) error
func (*WorkerRedisRepository) SetNetworkLock ¶
func (r *WorkerRedisRepository) SetNetworkLock(networkPrefix string, ttl, retries int) error
func (*WorkerRedisRepository) SetWorkerKeepAlive ¶
func (r *WorkerRedisRepository) SetWorkerKeepAlive(workerId string) error
func (*WorkerRedisRepository) SetWorkerPoolSizerLock ¶
func (r *WorkerRedisRepository) SetWorkerPoolSizerLock(poolName string) error
func (*WorkerRedisRepository) ToggleWorkerAvailable ¶
func (r *WorkerRedisRepository) ToggleWorkerAvailable(workerId 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 string) error UpdateWorkerStatus(workerId string, status types.WorkerStatus) error RemoveWorker(w *types.Worker) error SetWorkerKeepAlive(workerId string) error UpdateWorkerCapacity(w *types.Worker, cr *types.ContainerRequest, ut types.CapacityUpdateType) error ScheduleContainerRequest(worker *types.Worker, request *types.ContainerRequest) error GetNextContainerRequest(workerId string) (*types.ContainerRequest, error) AddContainerToWorker(workerId string, containerId string) error RemoveContainerFromWorker(workerId string, containerId string) error SetContainerResourceValues(workerId string, containerId string, usage types.ContainerResourceUsage) error SetImagePullLock(workerId, imageId string) error RemoveImagePullLock(workerId, imageId string) error GetContainerIp(networkPrefix string, containerId string) (string, error) SetContainerIp(networkPrefix string, containerId, containerIp string) error RemoveContainerIp(networkPrefix string, containerId string) error GetContainerIps(networkPrefix string) ([]string, error) SetNetworkLock(networkPrefix string, ttl, retries int) error RemoveNetworkLock(networkPrefix string) error SetWorkerPoolSizerLock(controllerName string) error RemoveWorkerPoolSizerLock(controllerName string) error }
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) GetConcurrencyLimitByWorkspaceId ¶
func (wr *WorkspaceRedisRepository) GetConcurrencyLimitByWorkspaceId(workspaceId string) (*types.ConcurrencyLimit, error)
func (*WorkspaceRedisRepository) SetAuthorizationToken ¶
func (*WorkspaceRedisRepository) SetConcurrencyLimitByWorkspaceId ¶
func (wr *WorkspaceRedisRepository) SetConcurrencyLimitByWorkspaceId(workspaceId string, limit *types.ConcurrencyLimit) error
type WorkspaceRepository ¶
type WorkspaceRepository interface { GetConcurrencyLimitByWorkspaceId(workspaceId string) (*types.ConcurrencyLimit, error) SetConcurrencyLimitByWorkspaceId(workspaceId string, limit *types.ConcurrencyLimit) error AuthorizeToken(string) (*types.Token, *types.Workspace, 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 ¶
Click to show internal directories.
Click to hide internal directories.