scheduler

package
v0.0.0-...-153afd2 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Unlicense Imports: 17 Imported by: 0

README

Module: Scheduler

  • The scheduler module schedules new orders to the cheapest elevator
  • Orders are assigned by the elevator that received the order
  • Orders are assigned a deadline, and if it is expired, the order is reassigned a new elevator. This also applies to "offline" elevators
  • Worst case normal execution time
  • Can function in single elevator mode. Should then finish all orders it has been assigned in addition to own cab calls

External packages

Package Name Description Reason
context Goroutine context management (included in standard library from Golang 1.7) To stop the goroutine if the context is no longer valid
driver-go Handout from TTK4145 To control the hardware of the elevator
go-spew Pretty printer for complex data structures To dump order list to console
xid Generates globally unique IDs Used to assign unique order ids

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, waitGroup *sync.WaitGroup, conf Config)

Run is the startingpoint for the scheduler module The ctx context is used to stop the gorotine if the context expires.

Types

type Config

type Config struct {
	ElevatorID         int
	NumFloors          int
	FilePath           string
	ElevButtonPressed  <-chan elevio.ButtonEvent
	ElevCompletedOrder <-chan common.Order
	ElevExecuteOrder   chan<- common.Order
	ElevStatus         <-chan common.ElevatorStatus
	//Sets light state - assumed non-blocking
	Lights             chan<- elevatordriver.LightState
	NewOrderSend       chan<- SchedulableOrder
	NewOrderRecv       <-chan SchedulableOrder
	OrderCompletedSend chan<- SchedulableOrder
	OrderCompletedRecv <-chan SchedulableOrder
	CostsSend          chan<- common.OrderCosts
	CostsRecv          <-chan common.OrderCosts
	WorkerLost         <-chan int
}

Config contains scheduler configuration variables

type SchedulableOrder

type SchedulableOrder struct {
	common.Order `json:"order"`
	Worker       int       `json:"assignee"`
	Timestamp    time.Time `json:"timestamp"`
	OrderID      string    `json:"order_id"`
	// contains filtered or unexported fields
}

SchedulableOrder is an order with a priority and cost

Jump to

Keyboard shortcuts

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