lightspeed/agent/typestate
Typestate lifecycle for Lightspeed session agents.
Types
Agent
opaqueA session agent parameterized by lifecycle state.
pub opaque type Agent(state)
Marker type for a disconnected agent.
pub type Disconnected {
Disconnected
}
Constructors
-
Disconnected
Marker type for an agent draining before shutdown.
pub type Draining {
Draining
}
Constructors
-
Draining
Marker type for an agent performing protocol handshake.
pub type Handshaking {
Handshaking
}
Constructors
-
Handshaking
Lifecycle labels useful for logs and protocol diagnostics.
pub type Lifecycle {
DisconnectedLabel
HandshakingLabel
MountedLabel
LiveLabel
DrainingLabel
TerminatedLabel
}
Constructors
-
DisconnectedLabel -
HandshakingLabel -
MountedLabel -
LiveLabel -
DrainingLabel -
TerminatedLabel
Marker type for an active live agent.
pub type Live {
Live
}
Constructors
-
Live
Marker type for an agent whose component has mounted.
pub type Mounted {
Mounted
}
Constructors
-
Mounted
Marker type for a terminated agent.
pub type Terminated {
Terminated
}
Constructors
-
Terminated
Values
pub fn handshake(
agent: Agent(Disconnected),
) -> Agent(Handshaking)
Transition from disconnected to handshaking.
pub fn lifecycle_to_string(lifecycle: Lifecycle) -> String
Convert a lifecycle label to a stable string.
pub fn mount(agent: Agent(Handshaking)) -> Agent(Mounted)
Transition from handshaking to mounted.
pub fn terminate(agent: Agent(Draining)) -> Agent(Terminated)
Transition from draining to terminated.