pub enum NetAction {
RunStep,
CreatePacket(Option<EpochID>),
ConsumePacket(PacketID),
DestroyPacket(PacketID),
StartEpoch(EpochID),
FinishEpoch(EpochID),
CancelEpoch(EpochID),
CreateEpoch(NodeName, Salvo),
LoadPacketIntoOutputPort(PacketID, PortName),
SendOutputSalvo(EpochID, SalvoConditionName),
TransportPacketToLocation(PacketID, PacketLocation),
}Expand description
An action that can be performed on the network.
All mutations to NetSim state must go through these actions via NetSim::do_action.
This ensures all operations are tracked and produce appropriate events.
Variants§
RunStep
Execute one step of automatic packet flow.
A single step performs one full iteration of the flow loop:
- Move all movable packets from edges to input ports
- Trigger all satisfied input salvo conditions
Returns StepResult { made_progress } indicating whether any progress was made.
If no progress was made, the network is “blocked”.
CreatePacket(Option<EpochID>)
Create a new packet, optionally inside an epoch.
If None, packet is created outside the network.
ConsumePacket(PacketID)
Consume a packet (normal removal from the network).
DestroyPacket(PacketID)
Destroy a packet (abnormal removal, e.g., due to error or cancellation).
StartEpoch(EpochID)
Transition a startable epoch to running state.
FinishEpoch(EpochID)
Complete a running epoch. Fails if epoch still contains packets.
CancelEpoch(EpochID)
Cancel an epoch and destroy all packets inside it.
CreateEpoch(NodeName, Salvo)
Manually create an epoch with specified packets. Bypasses the normal salvo condition triggering mechanism. The epoch is created in Startable state - call StartEpoch to begin execution.
LoadPacketIntoOutputPort(PacketID, PortName)
Move a packet from inside an epoch to one of its output ports.
SendOutputSalvo(EpochID, SalvoConditionName)
Send packets from output ports onto edges according to a salvo condition.
TransportPacketToLocation(PacketID, PacketLocation)
Transport a packet to a new location. Restrictions:
- Cannot move packets into or out of Running epochs (only Startable allowed)
- Input ports are checked for capacity