-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch.go
37 lines (29 loc) · 962 Bytes
/
switch.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package sim
import (
"github.com/h8liu/reactsim/react/sim/blocks"
. "github.com/h8liu/reactsim/react/sim/structs"
)
type Switch interface {
// Tells if the switch is a TDMA switch.
Tdma() bool
/*
A switch is a sender where other parts can
queue some packet onto the switch.
Nics queues are also part of the switch.
*/
blocks.Sender
/*
Moves packet inside the switch to the sink.
If the switch is a TDMA switch (a circuit switch or a
hybrid switches), it uses the estimator to estimate
the demand in the near future. Returns the schedule for
current tick, and the schedule events that happens at
the end of the tick.
If the switch is not a TDMA switch (a packet switch),
then it just moves packets, and always returns (nil, 0)
*/
Tick(sink blocks.Block, estimator Estimator) (Matrix, Events)
// Sets the switch to use a particular scheduler
Bind(s Scheduler, logger *SchedRecorder)
Served() (circ Matrix, pack Matrix)
}