service

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound indicates the requested resource was not found.

Functions

This section is empty.

Types

type ConflictError

type ConflictError struct {
	Message string
}

ConflictError represents a conflict condition (HTTP 409).

func (*ConflictError) Error

func (e *ConflictError) Error() string

type CreateRequest

type CreateRequest struct {
	Name           string
	PackageManager string
	PixiToml       string
	Source         string
	Path           string
}

CreateRequest holds parameters for creating a workspace.

type PushRequest

type PushRequest struct {
	Tag      string
	PixiToml string
	PixiLock string
	Force    bool
}

PushRequest holds parameters for pushing a new version.

type PushResult

type PushResult struct {
	VersionNumber int
	Tags          []string
	ContentHash   string
	Deduplicated  bool
	Tag           string // kept for backwards compatibility
}

PushResult is returned after a successful push.

type ValidationError

type ValidationError struct {
	Message string
}

ValidationError represents a bad-request condition (HTTP 400).

func (*ValidationError) Error

func (e *ValidationError) Error() string

type WorkspaceService

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

WorkspaceService contains the business logic for workspace operations.

func New

func New(db *gorm.DB, q queue.Queue, exec executor.Executor, isLocal bool) *WorkspaceService

New creates a new WorkspaceService.

func (*WorkspaceService) Create

func (s *WorkspaceService) Create(ctx context.Context, req CreateRequest, userID uuid.UUID) (*models.Workspace, error)

Create validates and creates a new workspace, queues the creation job, grants RBAC owner access, and writes an audit log entry.

func (*WorkspaceService) Delete

func (s *WorkspaceService) Delete(ctx context.Context, wsID string, userID uuid.UUID) error

Delete queues a deletion job for the workspace and writes an audit log.

func (*WorkspaceService) Get

func (s *WorkspaceService) Get(id string) (*models.Workspace, error)

Get returns a single workspace by ID.

func (*WorkspaceService) GetPixiToml

func (s *WorkspaceService) GetPixiToml(wsID string) (string, error)

GetPixiToml reads the pixi.toml content from the workspace's filesystem.

func (*WorkspaceService) GetVersion

func (s *WorkspaceService) GetVersion(wsID string, versionNum string) (*models.WorkspaceVersion, error)

GetVersion returns a specific version by workspace ID and version number.

func (*WorkspaceService) GetVersionFile

func (s *WorkspaceService) GetVersionFile(wsID string, versionNum string, field string) (string, error)

GetVersionFile returns the content of a specific file field from a version. field must be "lock" or "manifest".

func (*WorkspaceService) List

func (s *WorkspaceService) List(userID uuid.UUID) ([]models.Workspace, error)

List returns workspaces visible to the given user. In local mode all workspaces are returned (no ownership filtering).

func (*WorkspaceService) ListTags

func (s *WorkspaceService) ListTags(wsID string) ([]models.WorkspaceTag, error)

ListTags returns tags for a workspace, ordered by creation time descending.

func (*WorkspaceService) ListVersions

func (s *WorkspaceService) ListVersions(wsID string) ([]models.WorkspaceVersion, error)

ListVersions returns versions for a workspace (excluding large file contents).

func (*WorkspaceService) PushVersion

func (s *WorkspaceService) PushVersion(ctx context.Context, wsID string, req PushRequest, userID uuid.UUID) (*PushResult, error)

PushVersion creates a new workspace version (or deduplicates), writes files, handles tags (content hash, latest, optional user tag), and records audit logs.

func (*WorkspaceService) SavePixiToml

func (s *WorkspaceService) SavePixiToml(wsID string, content string) error

SavePixiToml writes pixi.toml content to the workspace's filesystem.

Jump to

Keyboard shortcuts

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