Browse Source

Add loadbalancer to translation logic and GetQueue to the simulation node interface

pull/1/head
Stephanie Gredell 7 months ago
parent
commit
7a3dc29a37
  1. 11
      internal/simulation/engine.go

11
internal/simulation/engine.go

@ -23,6 +23,7 @@ type SimulationNode interface { @@ -23,6 +23,7 @@ type SimulationNode interface {
Emit() []*Request
IsAlive() bool
GetTargets() []string
GetQueue() []*Request
}
type Engine struct {
@ -57,6 +58,16 @@ func NewEngineFromDesign(design design.Design, duration int, tickMs int) *Engine @@ -57,6 +58,16 @@ func NewEngineFromDesign(design design.Design, duration int, tickMs int) *Engine
Alive: true,
Queue: []*Request{},
}
case "loadBalancer":
props := n.Props
simNode = &LoadBalancerNode{
ID: n.ID,
Label: asString(props["label"]),
Algorithm: asString(props["algorithm"]),
Queue: []*Request{},
Alive: true,
Targets: []string{},
}
case "cache":
simNode = &CacheNode{
ID: n.ID,

Loading…
Cancel
Save