Documentation
¶
Index ¶
- Constants
- func AbsolutizeFactoryDirectory(dir string) (string, error)
- func ExpandFolderHome(path string) (string, error)
- func FactoryName(rootDir string, runtimeCfg *factoryconfig.LoadedFactoryConfig) factoryapi.FactoryName
- func ListSummaries(registry *Registry) []factoryapi.FactorySessionSummary
- func NewSessionID() string
- func NewValidationError(reason string, field string, err error) error
- func ResolveSessionFolder(folderPath string) (string, error)
- func SameFactoryDir(left, right string) bool
- func SessionFactoryRootDir(serviceRootDir string, session *LiveSession) string
- func SummaryResponse(session *LiveSession) factoryapi.FactorySessionSummary
- func TargetDisplayName(ref TargetRef) string
- func TargetResponse(target Target) factoryapi.FactorySessionTarget
- func TargetsResponse(targets []Target) []factoryapi.FactorySessionTarget
- func ValidationReasonFromError(err error) (reason string, field string, ok bool)
- type LiveSession
- type OpenResult
- type Registry
- func (m *Registry) Count() int
- func (m *Registry) Current() *LiveSession
- func (m *Registry) Get(id string) *LiveSession
- func (m *Registry) IDs() []string
- func (m *Registry) Remove(id string)
- func (m *Registry) Select(id string) bool
- func (m *Registry) Upsert(session *LiveSession, selectSession bool)
- type Target
- type TargetKind
- type TargetProbe
- type TargetRef
Constants ¶
const DefaultSessionID = "~default"
DefaultSessionID is the stable alias for the primary live factory session.
const ValidationReasonMissing = validationReasonMissing
ValidationReasonMissing reports that the session folder path does not exist.
const ValidationReasonNotDirectory = validationReasonNotDirectory
ValidationReasonNotDirectory reports that the session folder path is not a directory.
const ValidationReasonNotRunnable = validationReasonNotRunnable
ValidationReasonNotRunnable reports that the folder exposes no runnable factory targets.
const ValidationReasonRequired = validationReasonRequired
ValidationReasonRequired reports that a required session field was empty.
const ValidationReasonTargetNotFound = validationReasonTargetNotFound
ValidationReasonTargetNotFound reports that the requested target was not discovered.
const ValidationReasonUnreadable = validationReasonUnreadable
ValidationReasonUnreadable reports that the session folder could not be read.
const ValidationTargetKind = validationTargetKind
ValidationTargetKind is the API error-target kind for factory-session validation failures.
Variables ¶
This section is empty.
Functions ¶
func AbsolutizeFactoryDirectory ¶
AbsolutizeFactoryDirectory resolves and cleans a factory directory path.
func ExpandFolderHome ¶
ExpandFolderHome expands a leading tilde in folder paths.
func FactoryName ¶
func FactoryName(rootDir string, runtimeCfg *factoryconfig.LoadedFactoryConfig) factoryapi.FactoryName
FactoryName derives the API factory name for a session runtime config.
func ListSummaries ¶
func ListSummaries(registry *Registry) []factoryapi.FactorySessionSummary
ListSummaries builds API session summaries from registered live sessions.
func NewSessionID ¶
func NewSessionID() string
NewSessionID allocates a unique live session identifier.
func NewValidationError ¶
NewValidationError builds a structured factory-session validation error.
func ResolveSessionFolder ¶
ResolveSessionFolder validates and resolves a factory session folder path.
func SameFactoryDir ¶
SameFactoryDir reports whether two factory directory paths refer to the same location.
func SessionFactoryRootDir ¶
func SessionFactoryRootDir(serviceRootDir string, session *LiveSession) string
SessionFactoryRootDir resolves the editable-definition root for a live session.
func SummaryResponse ¶
func SummaryResponse(session *LiveSession) factoryapi.FactorySessionSummary
SummaryResponse maps a live session to the API summary shape.
func TargetDisplayName ¶
TargetDisplayName formats a target ref for operator-facing errors.
func TargetResponse ¶
func TargetResponse(target Target) factoryapi.FactorySessionTarget
TargetResponse maps a discovered target to the API target shape.
func TargetsResponse ¶
func TargetsResponse(targets []Target) []factoryapi.FactorySessionTarget
TargetsResponse maps discovered targets to API targets.
Types ¶
type LiveSession ¶
type LiveSession struct {
ID string
FactoryDir string
FolderPath string
Handle any
IsDefault bool
Project string
Target TargetRef
}
LiveSession tracks one live factory session and its runtime handle. Handle is typed by the composition root (for example *service.liveRuntimeHandle).
func NewLiveSession ¶
func NewLiveSession( sessionID string, factoryDir string, folderPath string, target TargetRef, handle any, isDefault bool, project string, ) *LiveSession
NewLiveSession constructs a registry entry for a started session.
type OpenResult ¶
OpenResult is the internal outcome of opening or validating a session folder.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks live factory sessions and the selected session id.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry constructs an empty live session registry.
func (*Registry) Current ¶
func (m *Registry) Current() *LiveSession
Current returns the selected live session when present.
func (*Registry) Get ¶
func (m *Registry) Get(id string) *LiveSession
Get returns the live session for id when registered.
func (*Registry) Upsert ¶
func (m *Registry) Upsert(session *LiveSession, selectSession bool)
Upsert registers or replaces a live session. When selectSession is true, or no session is currently selected, the session becomes selected.
type Target ¶
type Target struct {
Ref TargetRef
Label string
FolderPath string
FactoryDir string
Project string
}
Target describes a runnable factory directory discovered under a session folder.
func BuildTargetFromConfig ¶
func BuildTargetFromConfig( folderPath string, factoryDir string, ref TargetRef, projectName string, ) Target
BuildTargetFromConfig projects loaded factory config into a session target.
func CloneTargets ¶
CloneTargets returns a defensive copy of discovered targets.
func DiscoverTargets ¶
func DiscoverTargets(folderPath string, probe TargetProbe) ([]Target, error)
DiscoverTargets lists runnable factory targets under folderPath.
type TargetKind ¶
type TargetKind string
TargetKind identifies whether a session target is the default factory or a named layout.
const ( TargetKindDefault TargetKind = "default" TargetKindNamed TargetKind = "named" )
type TargetProbe ¶
TargetProbe loads metadata for one discovered factory session target.
type TargetRef ¶
type TargetRef struct {
Kind TargetKind
Name string
}
TargetRef selects a discovered factory session target.