Documentation ¶
Index ¶
- type LinkStatus
- type Network
- type SimpleNetwork
- func (network SimpleNetwork) AddConnection(from, to string, speed, delay uint64)
- func (network *SimpleNetwork) Advance(time uint64) ([]TransferEvent, uint64, error)
- func (network *SimpleNetwork) StartTransfer(when, size uint64, from, to string, ...) ([]event.Event, error)
- func (network *SimpleNetwork) Status(from, to string) (LinkStatus, error)
- type TransferEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LinkStatus ¶
type LinkStatus struct { // available bandwidth Bandwidth uint64 }
type Network ¶
type Network interface { // Transfer models a transfer starting at time now of size // bytes from one location to another with a third parameter // to define what happens as a consequence of this transfer. // It returns a TransferEvent, which will execute the // consequence function at the time the transfer ends, and a // possible error if there's a problem with the transfer. StartTransfer(when, size uint64, from, to string, consequence func(time uint64) []event.Event) ([]event.Event, error) // Advances the network simulation up to time. Returns the // earliest network events that concluded before that time, // the time they happened, or an error. Advance(time uint64) ([]TransferEvent, uint64, error) // Status returns a LinkStatus struct describing the current // condition of the link identified by the from, to ids Status(from, to string) (LinkStatus, error) AddConnection(from, to string, speed, delay uint64) }
Network is meant to represent transfer of data between data centers.
type SimpleNetwork ¶
type SimpleNetwork struct {
// contains filtered or unexported fields
}
SimpleNetwork models a naive approach to simulating a network.
func NewSimpleNetwork ¶
func NewSimpleNetwork() SimpleNetwork
func (SimpleNetwork) AddConnection ¶
func (network SimpleNetwork) AddConnection(from, to string, speed, delay uint64)
func (*SimpleNetwork) Advance ¶
func (network *SimpleNetwork) Advance(time uint64) ([]TransferEvent, uint64, error)
func (*SimpleNetwork) StartTransfer ¶
func (*SimpleNetwork) Status ¶
func (network *SimpleNetwork) Status(from, to string) (LinkStatus, error)
type TransferEvent ¶
type TransferEvent struct {
// contains filtered or unexported fields
}
func (TransferEvent) Process ¶
func (te TransferEvent) Process() []event.Event
func (TransferEvent) Time ¶
func (te TransferEvent) Time() uint64
Click to show internal directories.
Click to hide internal directories.