Documentation ¶
Index ¶
- func NewTaskHeap() taskHeap
- type Container
- type Data
- type DataCenter
- type Database
- type FifoDataCenter
- func (dc *FifoDataCenter) AddContainer(container Container)
- func (dc FifoDataCenter) Container() Container
- func (dc *FifoDataCenter) Dequeue(now uint64, calling *Node) []event.Event
- func (dc *FifoDataCenter) Enqueue(rt RunningTask)
- func (dc FifoDataCenter) Equal(otherDc DataCenter) bool
- func (dc FifoDataCenter) ExpectedEndings() []uint64
- func (dc FifoDataCenter) Get(n int) *Node
- func (dc *FifoDataCenter) Host(task RunningTask) (*Node, bool)
- func (dc FifoDataCenter) Id() string
- func (dc FifoDataCenter) JobAvailability(cost int) (free int)
- func (dc FifoDataCenter) JobCapacity(cost int) int
- func (dc *FifoDataCenter) Nodes() []*Node
- func (dc *FifoDataCenter) NumNodes() int
- type Node
- type RunningTask
- type Topology
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTaskHeap ¶
func NewTaskHeap() taskHeap
Types ¶
type Container ¶
type Container interface { Add(id string, data Data) Has(id string) bool Find(id string) Data Pop(id string) Data Transfer(when uint64, id string, data Data, consequence func(time uint64) []event.Event) []event.Event SetNetwork(network network.Network) SetDatabase(db Database) }
Container is an interface to model storage for data
type DataCenter ¶
type DataCenter interface { Enqueue(rt RunningTask) Dequeue(now uint64, calling *Node) []event.Event JobCapacity(cost int) int JobAvailability(cost int) int ExpectedEndings() []uint64 Host(task RunningTask) (*Node, bool) Equal(otherDc DataCenter) bool Container() Container AddContainer(container Container) NumNodes() int Nodes() []*Node Id() string // this function meant for testing Get(n int) *Node }
type Database ¶
type Database interface { // Location should return a list of location ids for a file with given id Location(fileId string) []string // Record will update the database to store that the file with given id can be found at the given location Record(fileId, locationId string) }
Database is an interface to model information about file storage
type FifoDataCenter ¶
type FifoDataCenter struct {
// contains filtered or unexported fields
}
func (*FifoDataCenter) AddContainer ¶
func (dc *FifoDataCenter) AddContainer(container Container)
func (FifoDataCenter) Container ¶
func (dc FifoDataCenter) Container() Container
func (*FifoDataCenter) Dequeue ¶
func (dc *FifoDataCenter) Dequeue(now uint64, calling *Node) []event.Event
func (*FifoDataCenter) Enqueue ¶
func (dc *FifoDataCenter) Enqueue(rt RunningTask)
func (FifoDataCenter) Equal ¶
func (dc FifoDataCenter) Equal(otherDc DataCenter) bool
Compares two DataCenters. They are equal if they have the same amount of nodes and all nodes have the same free capacity.
func (FifoDataCenter) ExpectedEndings ¶
func (dc FifoDataCenter) ExpectedEndings() []uint64
Returns the expected ending times for all tasks currently hosted in dc.
func (FifoDataCenter) Get ¶
func (dc FifoDataCenter) Get(n int) *Node
Returns a pointer to the corresponding node. This is meant only to be used in tests.
func (*FifoDataCenter) Host ¶
func (dc *FifoDataCenter) Host(task RunningTask) (*Node, bool)
func (FifoDataCenter) Id ¶
func (dc FifoDataCenter) Id() string
func (FifoDataCenter) JobAvailability ¶
func (dc FifoDataCenter) JobAvailability(cost int) (free int)
Returns how many jobs requiring *cost* CPU slots a data center can currently host given available free space.
func (FifoDataCenter) JobCapacity ¶
func (dc FifoDataCenter) JobCapacity(cost int) int
Returns how many jobs requiring *cost* CPU slots a data center can host at most.
func (*FifoDataCenter) Nodes ¶
func (dc *FifoDataCenter) Nodes() []*Node
func (*FifoDataCenter) NumNodes ¶
func (dc *FifoDataCenter) NumNodes() int
type Node ¶
type Node struct { Location int // contains filtered or unexported fields }
func (*Node) Host ¶
func (n *Node) Host(task RunningTask) bool
type RunningTask ¶
type Topology ¶
type Topology struct { DataCenters []DataCenter Speeds [][]uint64 }
Click to show internal directories.
Click to hide internal directories.