capacity

package
v0.0.0-...-6d29b5c Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MaxConnections int = 100

Variables

This section is empty.

Functions

func NewPerfectLink(from, to NodeCapacity) Link

Types

type CapacityConnector

type CapacityConnector interface {
	interfaces.DataTransport
}

Allow connecting between two nodes via scheduler

func NewCapacityConnector

func NewCapacityConnector(
	up, down int,
	capacityMap CapacityMap,
) CapacityConnector

type CapacityMap

type CapacityMap interface {
	AddConnector(id string, connector CapacityConnector)
	Connector(id string) CapacityConnector

	RegisterLink(link interfaces.Link)
	Start(simulation *underlay.NetworkSimulation)

	// A simulation Receiver associated with the CapacityMap. Allows
	// registering observers that follow the map.
	Receiver() events.Receiver
}

Allow access the CapacityConnector

func NewScheduledCapacityMap

func NewScheduledCapacityMap(scheduleInterval int) CapacityMap

type PerfectCapacityConnector

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

func (*PerfectCapacityConnector) Connect

func (*PerfectCapacityConnector) Down

func (c *PerfectCapacityConnector) Down() int

func (*PerfectCapacityConnector) Up

func (c *PerfectCapacityConnector) Up() int
type PerfectLink struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

Assumptions:

  • equal link share & max capacity
  • no latency effects
  • end-capacity is the bottleneck

func (*PerfectLink) Clear

func (p *PerfectLink) Clear()

func (*PerfectLink) Download

func (p *PerfectLink) Download() <-chan Data

func (*PerfectLink) From

func (p *PerfectLink) From() NodeCapacity

func (*PerfectLink) To

func (p *PerfectLink) To() NodeCapacity

func (*PerfectLink) Upload

func (p *PerfectLink) Upload(data Data)

type ScheduledCapacityMap

type ScheduledCapacityMap struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

A capacity map that uses a capacity scheduler for allowing data transfer between nodes. Note the capacity scheduler is already thread-safe.

func (*ScheduledCapacityMap) AddConnector

func (c *ScheduledCapacityMap) AddConnector(
	id string,
	capacityConnector CapacityConnector,
)

func (*ScheduledCapacityMap) Connector

func (*ScheduledCapacityMap) Receiver

func (c *ScheduledCapacityMap) Receiver() events.Receiver
func (c *ScheduledCapacityMap) RegisterLink(link interfaces.Link)

func (*ScheduledCapacityMap) Start

type Scheduler

type Scheduler interface {
	Receiver

	RegisterLink(Link)
	Schedule()
}

The simulator is based on a scheduler which computes the transfer speed associated with each link in the topology. The scheduler runs periodically at an established period, by implementing the Receiver interface and stopping the simulation to recalculate the transfer rates. The main assumption under which the simulator calculates the transfer rates are the equal share and maximum capacity utilization.

func NewScheduler

func NewScheduler(interval int) Scheduler

Jump to

Keyboard shortcuts

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