paradrop.backend.fc package

Submodules

paradrop.backend.fc.chutestorage module

class ChuteStorage(filename=None, reactor=None)[source]

Bases: paradrop.lib.utils.storage.PDStorage

ChuteStorage class.

This class holds onto the list of Chutes on this AP.

It implements the PDStorage class which allows us to save the chuteList to disk transparently

attrSaveable()[source]

Returns True if we should save the ChuteList, otherwise False.

chuteList = {}
clearChuteStorage()[source]
deleteChute(ch)[source]

Deletes a chute from the chute storage. Can be sent the chute object, or the chute name.

getAttr()[source]

Get our attr (as class variable for all to see)

getChute(name)[source]

Returns a reference to a chute we have in our cache, or None.

getChuteList()[source]

Return a list of the GUIDs of the chutes we know of.

saveChute(ch)[source]

Saves the chute provided in our internal chuteList. Also since we just received a new chute to hold onto we should save our ChuteList to disk.

setAttr(attr)[source]

Save our attr however we want (as class variable for all to see)

paradrop.backend.fc.configurer module

class PDConfigurer(storage, lclReactor)[source]

ParaDropConfigurer class. This class is in charge of making the configuration changes required on the chutes. It utilizes the ChuteStorage class to hold onto the chute data.

Use @updateChutes to make the configuration changes on the AP.
This function is thread-safe, this class will only call one update set at a time. All others are held in a queue until the last update is complete.
clearUpdateList()[source]

MUTEX: updateLock Clears all updates from list (new array).

getNextUpdate()[source]

MUTEX: updateLock Returns the size of the local update queue.

performUpdates()[source]

This is the main working function of the PDConfigurer class. It should be executed as a separate thread, it does the following:

checks for any updates to perform does them responds to the server removes the update checks for more updates

if more exist it calls itself again more quickly else it puts itself to sleep for a little while
updateList(**updateObj)[source]

MUTEX: updateLock Take the list of Chutes and push the list into a queue object, this object will then call the real update function in another thread so the function that called us is not blocked.

We take a callable responseFunction to call, when we are done with this update we should call it.

paradrop.backend.fc.updateObject module

updateObject module.

This holds onto the UpdateObject class. It allows us to easily abstract away different update types and provide a uniform way to interpret the results through a set of basic actionable functions.

class UpdateChute(obj)[source]

Bases: paradrop.backend.fc.updateObject.UpdateObject

Updates specifically tailored to chute actions like create, delete, etc...

saveState()[source]

For chutes specifically we need to change the chuteStor object to reflect the new state of the system after a chute update. Perform that update here.

updateModuleList = [<module 'paradrop.backend.exc.name' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/v0.1/paradrop/paradrop/backend/exc/name.py'>, <module 'paradrop.backend.exc.state' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/v0.1/paradrop/paradrop/backend/exc/state.py'>, <module 'paradrop.backend.exc.struct' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/v0.1/paradrop/paradrop/backend/exc/struct.py'>, <module 'paradrop.backend.exc.resource' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/v0.1/paradrop/paradrop/backend/exc/resource.py'>, <module 'paradrop.backend.exc.traffic' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/v0.1/paradrop/paradrop/backend/exc/traffic.py'>, <module 'paradrop.backend.exc.runtime' from '/home/docs/checkouts/readthedocs.org/user_builds/paradrop/checkouts/v0.1/paradrop/paradrop/backend/exc/runtime.py'>]
class UpdateObject(obj)[source]

Bases: object

The base UpdateObject class, covers a few basic methods but otherwise all the intelligence exists in the inherited classes.

All update information passed by the API server is contained as variables of this class such as update.updateType, update.updateClass, etc...

By default, the following variables should be utilized:

responses : an array of messages any module can choose to append warnings or errors to

failure : the module that chose to fail this update can set a string message to return
: to the user in the failure variable. It should be very clear as to why the : failure occurred, but if the user wants more information they may find it : in the responses variable which may contain debug information, etc...
complete(**kwargs)[source]

Signal to the API server that any action we need to perform is complete and the API server can finish its connection with the client that initiated the API request.

execute()[source]

The function that actually walks through the main process required to create the chute. It follows the executeplan module through the paces of:

  1. Generate the plans for each exc module
  2. Prioritize the plans
  3. Execute the plans

If at any point we fail then this function will directly take care of completing the update process with an error state and will close the API connection.

saveState()[source]

Function should be overwritten for each UpdateObject subtype

updateModuleList = []
parse(obj)[source]

Determines the update type and returns the proper class.

Module contents