switches

package
v0.0.0-...-8f60dbe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Match

type Match map[int]int

Match represents input to output port matching when there is no match for a port use -1.

func (Match) String

func (m Match) String() string

type Packet

type Packet struct {
	InputPort  int
	OutputPort int
	Delay      int
	// contains filtered or unexported fields
}

Packet contains information about network packet that comes into switch

func (*Packet) String

func (p *Packet) String() string

type Port

type Port struct {
	// contains filtered or unexported fields
}

Port represents input port of switch

func (*Port) VOQ

func (p *Port) VOQ(n int) int

VOQ returns length of n th VOQ

type Switch

type Switch struct {
	Ports []*Port
	N     int
	// contains filtered or unexported fields
}

Switch represents switching fabric that can work with each algorithm

func New

func New(n int) *Switch

New creates new switch with n in/out ports

func NewWithFractionalSpeedup

func NewWithFractionalSpeedup(n int, s int, f int) *Switch

NewWithFractionalSpeedup creates new switch with n in/out port and speedup s - f/n

func NewWithSpeedup

func NewWithSpeedup(n int, s int) *Switch

NewWithSpeedup creates new switch with n in/out port and speedup s

func (*Switch) Arrive

func (sw *Switch) Arrive(i int, o int)

Arrive new packet into switch

func (*Switch) ArriveMany

func (sw *Switch) ArriveMany(n int, i int, o int)

ArriveMany packets into switch

func (*Switch) MarshalJSON

func (sw *Switch) MarshalJSON() ([]byte, error)

MarshalJSON marshals switch into valid json

func (*Switch) Process

func (sw *Switch) Process(m Match) []*Packet

Process takes switch into next timeslot based on given match

func (*Switch) String

func (sw *Switch) String() string

func (*Switch) T

func (sw *Switch) T() int

T returns timestamps of switches

func (*Switch) UnmarshalJSON

func (sw *Switch) UnmarshalJSON(bytes []byte) error

UnmarshalJSON unmarshal switch from valid json packet arrival timestamps are invalid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL