Help us shape the future of Go! Take the 2026 Go Developer Survey

workshop

package
v0.24.0 Latest Latest
Warning

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

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

Documentation

Overview

Package workshop provides workshop and event management functionality for Prism.

This package implements time-bounded, event-style workshop management — conferences, tutorials, and hackathons where an organizer needs bulk workspace pre-provisioning, real-time participant monitoring, and auto-termination at a fixed end time.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWorkshopNotFound    = errors.New("workshop not found")
	ErrParticipantNotFound = errors.New("participant not found")
	ErrWorkshopFull        = errors.New("workshop has reached maximum participant capacity")
	ErrWorkshopEnded       = errors.New("workshop has already ended")
	ErrConfigNotFound      = errors.New("workshop config not found")
	ErrDuplicateConfig     = errors.New("workshop config with this name already exists")
)

Error sentinels

Functions

This section is empty.

Types

type CreateWorkshopRequest

type CreateWorkshopRequest struct {
	Title                string    `json:"title"`
	Description          string    `json:"description,omitempty"`
	Owner                string    `json:"owner"`
	Template             string    `json:"template"`
	ApprovedTemplates    []string  `json:"approved_templates,omitempty"`
	MaxParticipants      int       `json:"max_participants"`
	BudgetPerParticipant float64   `json:"budget_per_participant,omitempty"`
	StartTime            time.Time `json:"start_time"`
	EndTime              time.Time `json:"end_time"`
	EarlyAccessHours     int       `json:"early_access_hours,omitempty"`
	PolicyRestrictions   []string  `json:"policy_restrictions,omitempty"`
}

CreateWorkshopRequest is the payload for creating a new workshop

func (*CreateWorkshopRequest) Validate

func (r *CreateWorkshopRequest) Validate() error

Validate validates the create workshop request

type DownloadManifest

type DownloadManifest struct {
	WorkshopID   string            `json:"workshop_id"`
	Participants []ParticipantWork `json:"participants"`
	GeneratedAt  time.Time         `json:"generated_at"`
}

DownloadManifest is returned by GetDownloadManifest (#180)

type EndResult

type EndResult struct {
	WorkshopID string   `json:"workshop_id"`
	Stopped    int      `json:"stopped"`
	Errors     []string `json:"errors,omitempty"`
}

EndResult is returned by EndWorkshop

type Manager

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

Manager handles workshop lifecycle, participant management, and config templates.

func NewManager

func NewManager() (*Manager, error)

NewManager creates a new workshop manager.

func (*Manager) AddParticipant

func (m *Manager) AddParticipant(ctx context.Context, workshopID string, p WorkshopParticipant) (*WorkshopEvent, error)

AddParticipant adds a participant who has redeemed the join token.

func (*Manager) CreateFromConfig

func (m *Manager) CreateFromConfig(ctx context.Context, configName string, req *CreateWorkshopRequest) (*WorkshopEvent, error)

CreateFromConfig creates a new workshop pre-populated from a saved config.

func (*Manager) CreateWorkshop

func (m *Manager) CreateWorkshop(ctx context.Context, req *CreateWorkshopRequest) (*WorkshopEvent, error)

CreateWorkshop creates a new workshop and generates its join token.

func (*Manager) DeleteWorkshop

func (m *Manager) DeleteWorkshop(ctx context.Context, workshopID string) error

DeleteWorkshop removes a workshop permanently.

func (*Manager) EndWorkshop

func (m *Manager) EndWorkshop(ctx context.Context, workshopID string) (*EndResult, []WorkshopParticipant, error)

EndWorkshop transitions the workshop to ended status and returns participants with instances (#135).

func (*Manager) GetConfig

func (m *Manager) GetConfig(ctx context.Context, name string) (*WorkshopConfig, error)

GetConfig retrieves a single config by name.

func (*Manager) GetDashboard

func (m *Manager) GetDashboard(ctx context.Context, workshopID string) (*WorkshopDashboard, error)

GetDashboard builds the live dashboard view for a workshop (#179).

func (*Manager) GetDownloadManifest

func (m *Manager) GetDownloadManifest(ctx context.Context, workshopID string) (*DownloadManifest, error)

GetDownloadManifest returns a manifest of participant work for bulk download (#180).

func (*Manager) GetWorkshop

func (m *Manager) GetWorkshop(ctx context.Context, workshopID string) (*WorkshopEvent, error)

GetWorkshop retrieves a workshop by ID.

func (*Manager) ListConfigs

func (m *Manager) ListConfigs(ctx context.Context) ([]*WorkshopConfig, error)

ListConfigs returns all saved workshop config templates.

func (*Manager) ListWorkshops

func (m *Manager) ListWorkshops(ctx context.Context, filter *WorkshopFilter) ([]*WorkshopEvent, error)

ListWorkshops returns all workshops matching the optional filter.

func (*Manager) ProvisionWorkshop

func (m *Manager) ProvisionWorkshop(ctx context.Context, workshopID string) (*ProvisionResult, []*WorkshopParticipant, error)

ProvisionWorkshop marks all pending participants as provisioned and returns a summary. Actual instance launch is handled by the daemon handler (which calls the AWS manager). This method updates participant statuses and returns the list needing provisioning.

func (*Manager) RemoveParticipant

func (m *Manager) RemoveParticipant(ctx context.Context, workshopID, userID string) error

RemoveParticipant removes a participant from the workshop.

func (*Manager) SaveConfig

func (m *Manager) SaveConfig(ctx context.Context, workshopID, configName string) (*WorkshopConfig, error)

SaveConfig saves the current workshop settings as a reusable config template.

func (*Manager) UpdateParticipantInstance

func (m *Manager) UpdateParticipantInstance(ctx context.Context, workshopID, userID, instanceID, instanceName string, status string) error

UpdateParticipantInstance sets the instance details for a provisioned participant.

func (*Manager) UpdateWorkshop

func (m *Manager) UpdateWorkshop(ctx context.Context, workshopID string, req *UpdateWorkshopRequest) (*WorkshopEvent, error)

UpdateWorkshop applies a partial update to an existing workshop.

type ParticipantWork

type ParticipantWork struct {
	UserID       string `json:"user_id"`
	Email        string `json:"email,omitempty"`
	DisplayName  string `json:"display_name,omitempty"`
	InstanceName string `json:"instance_name,omitempty"`
	DownloadNote string `json:"download_note"`
}

ParticipantWork represents one participant's downloadable work

type ProvisionResult

type ProvisionResult struct {
	WorkshopID  string   `json:"workshop_id"`
	Provisioned int      `json:"provisioned"`
	Skipped     int      `json:"skipped"`
	Errors      []string `json:"errors,omitempty"`
}

ProvisionResult is returned by ProvisionWorkshop

type UpdateWorkshopRequest

type UpdateWorkshopRequest struct {
	Title                *string    `json:"title,omitempty"`
	Description          *string    `json:"description,omitempty"`
	Template             *string    `json:"template,omitempty"`
	ApprovedTemplates    []string   `json:"approved_templates,omitempty"`
	MaxParticipants      *int       `json:"max_participants,omitempty"`
	BudgetPerParticipant *float64   `json:"budget_per_participant,omitempty"`
	EndTime              *time.Time `json:"end_time,omitempty"`
	EarlyAccessHours     *int       `json:"early_access_hours,omitempty"`
	PolicyRestrictions   []string   `json:"policy_restrictions,omitempty"`
}

UpdateWorkshopRequest is the payload for updating an existing workshop

type WorkshopConfig

type WorkshopConfig struct {
	// Name is the unique config identifier
	Name string `json:"name"`

	// Template is the workspace template slug
	Template string `json:"template"`

	// MaxParticipants is the default capacity
	MaxParticipants int `json:"max_participants"`

	// BudgetPerParticipant is the default per-participant budget
	BudgetPerParticipant float64 `json:"budget_per_participant,omitempty"`

	// DurationHours is the default workshop length in hours
	DurationHours int `json:"duration_hours"`

	// EarlyAccessHours is the default early-access window
	EarlyAccessHours int `json:"early_access_hours,omitempty"`

	// Description is an optional description of this config
	Description string `json:"description,omitempty"`

	// CreatedAt is when the config was saved
	CreatedAt time.Time `json:"created_at"`
}

WorkshopConfig is a reusable workshop configuration template (#183)

type WorkshopDashboard

type WorkshopDashboard struct {
	WorkshopID        string                `json:"workshop_id"`
	Title             string                `json:"title"`
	TotalParticipants int                   `json:"total_participants"`
	ActiveInstances   int                   `json:"active_instances"`
	StoppedInstances  int                   `json:"stopped_instances"`
	PendingInstances  int                   `json:"pending_instances"`
	TotalSpent        float64               `json:"total_spent"`
	TimeRemaining     string                `json:"time_remaining"`
	Status            WorkshopStatus        `json:"status"`
	Participants      []WorkshopParticipant `json:"participants"`
}

WorkshopDashboard is the live status view for the workshop organizer (#179)

type WorkshopEvent

type WorkshopEvent struct {
	// ID is the unique workshop identifier
	ID string `json:"id"`

	// Title is the human-readable workshop name
	Title string `json:"title"`

	// Description is an optional longer description
	Description string `json:"description,omitempty"`

	// Owner is the organizer's user ID
	Owner string `json:"owner"`

	// Template is the default workspace template slug for participants
	Template string `json:"template"`

	// ApprovedTemplates is an optional whitelist of allowed templates (#176).
	// When empty, only Template is allowed. When non-empty, participants may choose
	// any listed template (and Template must be in the list).
	ApprovedTemplates []string `json:"approved_templates,omitempty"`

	// MaxParticipants caps the number of participants who can join (0 = unlimited)
	MaxParticipants int `json:"max_participants"`

	// BudgetPerParticipant is the per-participant cost allocation in USD (0 = unlimited)
	BudgetPerParticipant float64 `json:"budget_per_participant,omitempty"`

	// StartTime is when the workshop begins
	StartTime time.Time `json:"start_time"`

	// EndTime is when the workshop ends (all instances auto-stopped at this time)
	EndTime time.Time `json:"end_time"`

	// EarlyAccessHours is how many hours before StartTime participants can join (#181).
	// 0 means no early access (join only after StartTime).
	EarlyAccessHours int `json:"early_access_hours,omitempty"`

	// Status is the current workshop lifecycle state
	Status WorkshopStatus `json:"status"`

	// JoinToken is the shared token code participants use to join.
	// Auto-generated on creation. Redeeming the token adds the participant.
	JoinToken string `json:"join_token,omitempty"`

	// Participants lists all joined participants
	Participants []WorkshopParticipant `json:"participants,omitempty"`

	// PolicyRestrictions defines launch policy constraints for this workshop (#177).
	// When set, all participant workspace launches must satisfy these policies.
	PolicyRestrictions []string `json:"policy_restrictions,omitempty"`

	// CreatedAt is when the workshop was created
	CreatedAt time.Time `json:"created_at"`

	// UpdatedAt is when the workshop was last modified
	UpdatedAt time.Time `json:"updated_at"`
}

WorkshopEvent represents a time-bounded event workspace session. Unlike a Course (semester-length, email-enrollment), a WorkshopEvent is short-lived, joined via a shared token, and supports bulk provisioning.

type WorkshopFilter

type WorkshopFilter struct {
	Owner  string          `json:"owner,omitempty"`
	Status *WorkshopStatus `json:"status,omitempty"`
}

WorkshopFilter defines criteria for filtering workshop lists

func (*WorkshopFilter) Matches

func (f *WorkshopFilter) Matches(w *WorkshopEvent) bool

Matches returns true if the workshop satisfies all filter criteria

type WorkshopParticipant

type WorkshopParticipant struct {
	// UserID is the participant's user identifier
	UserID string `json:"user_id"`

	// Email is the participant's email address
	Email string `json:"email,omitempty"`

	// DisplayName is the participant's human-readable name
	DisplayName string `json:"display_name,omitempty"`

	// JoinedAt is when the participant redeemed the join token
	JoinedAt time.Time `json:"joined_at"`

	// InstanceID is the AWS instance ID of the provisioned workspace (empty until provisioned)
	InstanceID string `json:"instance_id,omitempty"`

	// InstanceName is the logical name of the provisioned workspace
	InstanceName string `json:"instance_name,omitempty"`

	// Status is the participant's workspace state: pending|provisioned|running|stopped
	Status string `json:"status"`

	// Progress is 0-100 progress value for tracking workshop exercises (#184)
	Progress int `json:"progress,omitempty"`
}

WorkshopParticipant represents a single joined participant

type WorkshopStatus

type WorkshopStatus string

WorkshopStatus indicates the lifecycle state of a workshop

const (
	WorkshopStatusDraft    WorkshopStatus = "draft"
	WorkshopStatusActive   WorkshopStatus = "active"
	WorkshopStatusEnded    WorkshopStatus = "ended"
	WorkshopStatusArchived WorkshopStatus = "archived"
)

Jump to

Keyboard shortcuts

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