Model-controller interface

From Web Computing Documentation
Jump to: navigation, search

The Model-controller interface describes the functions and classes that you can use to interact with the GridBee Framework. Using this interface you can create custom graphical user interfaces that handle user input, connect to boinc servers, and display data relevant to work execution.

When accessing the framework from the outside (ie. when creating a gui) you should only use the model interface functions listed on this page, and refrain from using further functions otherwise accessible from JavaScript.


Client model interface

Public functions

The Client object offers the following interface functions to interact with.

setThreadNumber (n : Int) : Void

n The number of threads to enable.

Sets the number of enabled threads. If more threads are in progress, excess threads will be paused.

getThreadNumber () : Int

Returns the number of threads the framework attempts to start.

start () : Void

Enables work execution.

stop () : Void

Disables work execution.

addWorksource (worksource : WorkSource) : Void

worksource The worksource to be added to the pool.

Adds a new WorkSource to the WorkSourcePool.

removeWorksource (worksource : WorkSource) : Void

worksource The worksource to be removed.

Removes a WorkSource from the WorkSourcePool.

getWorksources () : Array<WorkSource>

Returns an array of the current worksources in the WorkSourcePool.

Public variables

onLog : Event<LogEntry>

WorkSource model interface

Public functions

getWorkunits () : Array<WorkUnit>

Returns an array containing the WorkUnits in the WorkUnitPool.

Public variables

onAddWorkunit : Event<WorkUnit>

An Event object that triggers its subscribed functions when a new WorkUnit is added. Use the subscribe member function to add callback functions accepting a single WorkUnit object as argument.

onRemoveWorkunit : Event<WorkUnit>

An Event object that triggers its subscribed functions when a WorkUnit is removed. Passes the removed WorkUnit to its subscribed functions as an argument.

BoincWorkSource model interface

Public functions

BoincWorkSource (scheduler : String, authkey : String)

scheduler The address of the scheduler script.
authkey The authkey identifying the user.

Constructor, that creates a new BoincWorkSource using the address of the BOINC scheduler and the authkey of the user.

var bws = new BoincWorkSource("", "2962b0b8974c4ca693d253da648724cd");

getSchedulerUrl () : String

Returns the Scheduler's URL.

getAuthkey () : String

Return the user's authkey.

Public variables

These variables are persisted. Your GUI can use them to store and restore them when the framework is closed and reopened.

projecturl  : String

The URL of the BOINC project.

projectname : String

The name of the project.

username : String

The BOINC username.

WorkUnit model interface

Public functions

getProgress () : Float

Returns the last reported progress of the workunit represented by a float between 0 and 1.0.

getStatusString () : String

Returns a String describing the status of the WorkUnit ie. 'Active' or 'Passive'.

Public variables

onProgressChange  : Event<Void>;

Calls its subscribed functions when a WorkUnit reports progress change. Use the subscribe() member function to specify callbacks.

onStatusChange  : Event<Void>;

Calls its subscribed functions when a WorkUnit's status changes.

onLog  : Event<LogEntry>;

Calls its subscribed functions when a WorkUnit creates sends a logmessage.

Personal tools