Documentation
¶
Overview ¶
Package workspace provides the core business logic for managing workspaces.
Index ¶
- Variables
- func GenerateID() string
- func GenerateUniqueID(existingIDs []string) string
- type AmbiguousNameError
- type Info
- type Service
- func (s *Service) Create(id string, st *state.State) error
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Find(id string) (*state.State, error)
- func (s *Service) List() ([]Info, error)
- func (s *Service) Render(ctx context.Context, id string, progress func(msg string)) error
- func (s *Service) Resolve(idOrName string) ([]Info, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrWorkspaceNotFound = errors.New("workspace not found") ErrWorkspaceExists = errors.New("workspace already exists") ErrAmbiguousName = errors.New("ambiguous workspace name") )
Sentinel errors for workspace operations.
Functions ¶
func GenerateUniqueID ¶
GenerateUniqueID returns a unique ID that doesn't collide with any existing IDs. After 10 attempts, it appends a random numeric suffix.
Types ¶
type AmbiguousNameError ¶
AmbiguousNameError is returned when a name matches multiple workspaces.
func (*AmbiguousNameError) Error ¶
func (e *AmbiguousNameError) Error() string
func (*AmbiguousNameError) Unwrap ¶
func (e *AmbiguousNameError) Unwrap() error
type Info ¶
type Info struct {
ID string // directory name (unique identifier)
Name string // metadata.name (may be empty or duplicated)
Description string
RepoCount int
Created time.Time
}
Info holds summary data for listing workspaces.
type Service ¶
Service orchestrates workspace operations.
func (*Service) Create ¶
Create initializes a new workspace directory and writes the state file. id is used as the directory name; st.Metadata.Name may differ from id or be empty.
Click to show internal directories.
Click to hide internal directories.