| Home | Trees | Indices | Help |
|---|
|
|
Slot table
The slot table is one of the main data structures in Haizea (if not *the* main one). It tracks the capacity of the physical nodes on which leases can be scheduled, contains the resource reservations of all the leases, and allows efficient access to them.
However, the information in the slot table is stored in a somewhat 'raw' format (a collection of ResourceReservations) which can be hard to use directly. So, one of the responsabilities of the slot table is to efficiently generate "availability windows", which are a more convenient abstraction over available resources. See AvailabilityWindow for more details. When writing a custom mapper, most read-only interactions with the slot table should be through availability windows, which can be obtained through the get_availability_window method of SlotTable.
The slot table also depends on classes Node and KeyValueWrapper.
Since querying resource reservations is the most frequent operation in
Haizea, the slot table tries to optimize access to them as much as
possible. In particular, we will often need to quickly access
reservations starting or ending at a specific time (or in an interval of
time). The current slot table implementation stores the RRs in two
ordered lists: one by starting time and another by ending time. Access is
done by binary search in O(log n) time using the bisect
module. Insertion and removal require O(n) time, since lists are
implemented internally as arrays in CPython. We could improve these times
in the future by using a tree structure (which Python doesn't have
natively, so we'd have to include our own tree implementation), although
slot table accesses far outweight insertion and removal operations.
|
|||
|
|||
|
|||
| ResourceTuple |
|
||
| ResourceTuple |
|
||
| AvailabilityWindow |
|
||
dict
|
|
||
bool
|
|
||
bool
|
|
||
int
|
|
||
|
|||
|
|||
|
|||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of ResourceReservations
|
|
||
list of DateTimes
|
|
||
DateTime
|
|
||
DateTime
|
|
||
list of ResourceReservations
|
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
(bool,
|
|
||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
Constructor The slot table will be initially empty, without any physical nodes. These have to be added with add_node.
|
Add a new physical node to the slot table
|
Create an empty resource tuple
|
Converts a Capacity object to a ResourceTuple
|
Creates an availability window starting at a given time.
|
Computes the available resources on all nodes at a given time.
|
Determines if the slot table is empty (has no reservations)
|
Determines if a resource type is "full" at a specified time. A resource type is considered to be "full" if its available capacity is zero in all the physical nodes in the slot table.
|
Determines the aggregate capacity of a given resource type across all nodes.
|
Adds a ResourceReservation to the slot table.
|
Update a ResourceReservation to the slot table. Since the start and end time are used to index the reservations, the old times have to be provided so we can find the old reservation and make the changes.
|
Remove a ResourceReservation from the slot table.
|
Get all reservations at a specified time
|
Get all reservations starting in a specified interval. The interval is closed: it includes the starting time and the ending time.
|
Get all reservations ending in a specified interval. The interval is closed: it includes the starting time and the ending time.
|
Get all reservations starting after (but not on) a specified time
|
Get all reservations ending after (but not on) a specified time
|
Get all reservations starting on or after a specified time
|
Get all reservations ending on or after a specified time
|
Get all reservations starting at a specified time
|
Get all reservations ending at a specified time
|
Get all reservations that take place after (but not on) a specified time. i.e., all reservations starting or ending after that time.
|
Get all reservations that take place on or after a specified time. i.e., all reservations starting or ending after that time.
|
Get all the changepoints after a given time. A changepoint is any time anything is scheduled to change in the slottable (a reservation starting or ending).
|
Get the first changepoint after a given time.
|
Get the first premature end time after a given time. ONLY FOR SIMULATION. In simulation, some reservations can end prematurely, and this information is stored in the slot table (in real life, this information is not known a priori).
|
Gets all the ResourceReservations that are set to end prematurely at a given time. ONLY FOR SIMULATION
|
Remove a ResourceReservation from the slot table.
|
Computes availability at a given time, and caches it. Called when get_availability can't use availabilities in the cache.
|
Computes availability window at a given time, and caches it. Called when get_availability_window can't use the cached availability window.
|
Empties the caches. Should be called whenever the caches become dirty (e.g., when a reservation is added to the slot table). |
Find the index of a resource reservation in one of the internal reservation lists
|
Verifies the slot table is consistent. Used by unit tests.
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Dec 17 10:59:22 2009 | http://epydoc.sourceforge.net |