Documentation
¶
Overview ¶
Package workspace - client for cairn's workspace API
rest-pty is a mount-only cairn client. It resolves the workspace a session was assigned, reads the persistent volume name cairn holds for it, and mounts that volume into the session container. It never touches cairn's object store, its credentials, or the volume's lifecycle - cairn owns all three (cairn's DESIGN §4.4).
Index ¶
Constants ¶
const MountPath = "/mnt/cairn/ws"
MountPath the path a workspace's persistent volume is mounted at inside a session container.
Mirrors cairn's models.WorkspaceMountPath (its DESIGN §4.4). It is duplicated rather than imported on purpose: cairn's models package pulls gorm, its datatypes, and the rest of cairn's dependency set along with it, which is a large amount of module graph to take on for one string. cairn is the source of truth - if it ever makes the path configurable, this constant is the thing that has to follow.
The value is fixed service-wide precisely so paths round-trip: the session container that writes a file and cairn's own transfer sidecars that read it back must see it at the same path.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CairnClient ¶
type CairnClient interface {
/*
FetchWorkspace fetch one workspace by name.
@param ctxt context.Context - the operational context
@param name string - the workspace name
@returns the workspace, or a not-found error when cairn knows no workspace by
that name
*/
FetchWorkspace(ctxt context.Context, name string) (Workspace, error)
}
CairnClient client for cairn's workspace API
func NewCairnClient ¶
func NewCairnClient( parentCtxt context.Context, cfg models.CairnConfig, ) (CairnClient, error)
NewCairnClient define a new cairn API client
@param parentCtxt context.Context - parent context, owned by the OAuth token manager when
one is configured
@param cfg models.CairnConfig - cairn integration config
@returns new client
type VolumeStateENUM ¶
type VolumeStateENUM string
VolumeStateENUM a workspace's persistent volume state, mirroring cairn's WorkspaceVolumeStateENUM.
const ( // VolumeStateNone no persistent volume has been provisioned for the workspace. Only an // operator can provision one; rest-pty can not. VolumeStateNone VolumeStateENUM = "NONE" // VolumeStateReady the persistent volume exists and can be mounted VolumeStateReady VolumeStateENUM = "READY" )
type Workspace ¶
type Workspace struct {
// ID the workspace ID
ID string `json:"id"`
// Name the workspace name; what the session was assigned
Name string `json:"name"`
// VolumeName the persistent volume backing the workspace. Derived by cairn from the
// immutable workspace ID and persisted, so it is stable across a rename - rest-pty reads
// it and never re-derives it.
VolumeName string `json:"volume_name"`
// VolumeState whether the persistent volume exists and can be mounted
VolumeState VolumeStateENUM `json:"volume_state"`
}
Workspace the subset of cairn's workspace record rest-pty consumes.
Only the fields a mount needs are declared; encoding/json drops the rest of what cairn returns (description, volume metadata, timestamps), so cairn can grow its record without this decode caring.
func (Workspace) IsVolumeReady ¶
IsVolumeReady whether the workspace's persistent volume can be mounted