Documentation
¶
Index ¶
- Constants
- Variables
- func BaseConfigDir(dagsDir string) string
- func BaseConfigPath(dagsDir, name string) string
- func BaseConfigStem() string
- func ValidateName(name string) error
- func WorkspaceNameFromLabels(labels Labels) (string, bool)
- type Labels
- type Store
- type Workspace
- type WorkspaceFilter
- type WorkspaceForStorage
- type WorkspaceLabelState
Constants ¶
const ( // BaseConfigDirName is the directory below DAGsDir that stores workspace-scoped config. BaseConfigDirName = "workspaces" // BaseConfigFileName is the file name for a workspace-scoped base config. BaseConfigFileName = "base.yaml" )
Variables ¶
var ( ErrWorkspaceNotFound = errors.New("workspace not found") ErrWorkspaceAlreadyExists = errors.New("workspace with this name already exists") ErrInvalidWorkspaceName = errors.New("invalid workspace name") ErrInvalidWorkspaceID = errors.New("invalid workspace ID") )
Common errors for workspace store operations.
Functions ¶
func BaseConfigDir ¶
BaseConfigDir returns the root directory for workspace-scoped base configs.
func BaseConfigPath ¶
BaseConfigPath returns the workspace-scoped base config path for name.
func BaseConfigStem ¶
func BaseConfigStem() string
BaseConfigStem returns the base configuration file name without its extension.
func ValidateName ¶
ValidateName checks whether a workspace name can be safely reused as a label value and filesystem path segment.
func WorkspaceNameFromLabels ¶ added in v2.13.0
WorkspaceNameFromLabels returns the valid workspace label, if one is present.
Types ¶
type Store ¶
type Store interface {
// Create stores a new workspace.
// Returns ErrWorkspaceAlreadyExists if a workspace with the same name exists.
Create(ctx context.Context, ws *Workspace) error
// GetByID retrieves a workspace by its unique ID.
// Returns ErrWorkspaceNotFound if the workspace does not exist.
GetByID(ctx context.Context, id string) (*Workspace, error)
// GetByName retrieves a workspace by its name.
// Returns ErrWorkspaceNotFound if the workspace does not exist.
GetByName(ctx context.Context, name string) (*Workspace, error)
// List returns all workspaces in the store.
List(ctx context.Context) ([]*Workspace, error)
// Update modifies an existing workspace.
// Returns ErrWorkspaceNotFound if the workspace does not exist.
Update(ctx context.Context, ws *Workspace) error
// Delete removes a workspace by its ID.
// Returns ErrWorkspaceNotFound if the workspace does not exist.
Delete(ctx context.Context, id string) error
}
Store defines the interface for workspace persistence operations. Implementations must be safe for concurrent use.
type Workspace ¶
type Workspace struct {
ID string
Name string
Description string
CreatedAt time.Time
UpdatedAt time.Time
}
Workspace is the domain model for a cockpit workspace.
func NewWorkspace ¶
NewWorkspace creates a Workspace with a new UUID and current timestamps.
func (*Workspace) ToStorage ¶
func (w *Workspace) ToStorage() *WorkspaceForStorage
ToStorage converts a Workspace to WorkspaceForStorage.
type WorkspaceFilter ¶ added in v2.13.0
WorkspaceFilter restricts list and search results to allowed workspaces.
func (*WorkspaceFilter) MatchesLabels ¶ added in v2.13.0
func (f *WorkspaceFilter) MatchesLabels(labels Labels) bool
MatchesLabels reports whether labels are visible under the filter.
type WorkspaceForStorage ¶
type WorkspaceForStorage struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
WorkspaceForStorage is used for JSON serialization to persistent storage.
func (*WorkspaceForStorage) ToWorkspace ¶
func (s *WorkspaceForStorage) ToWorkspace() *Workspace
ToWorkspace converts WorkspaceForStorage back to Workspace.
type WorkspaceLabelState ¶ added in v2.13.0
type WorkspaceLabelState int
WorkspaceLabelState describes whether labels contain a usable workspace.
const ( // WorkspaceLabelMissing means no workspace label is present. WorkspaceLabelMissing WorkspaceLabelState = iota // WorkspaceLabelValid means exactly one valid workspace label value is present. WorkspaceLabelValid // WorkspaceLabelInvalid means a workspace label is present but malformed or ambiguous. WorkspaceLabelInvalid )
func WorkspaceLabelFromLabels ¶ added in v2.13.0
func WorkspaceLabelFromLabels(labels Labels) (string, WorkspaceLabelState)
WorkspaceLabelFromLabels returns the workspace label and its validity state.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package deprecation finds the workspace settings in use that stop applying when workspaces are removed in v3.0.
|
Package deprecation finds the workspace settings in use that stop applying when workspaces are removed in v3.0. |