Geoffrey Server
Server
-
class geoffrey.server.Server(config='/home/docs/.geoffrey/geoffrey.conf')[source]
The Geoffrey server.
-
create_project(project_name)[source]
Create a new project.
-
delete_project(project_name)[source]
Delete a project.
-
handle_ctrl_c()[source]
Control Ctrl-C to the server.
-
projects_root[source]
Returns the projects directory.
-
static read_main_config(filename='/home/docs/.geoffrey/geoffrey.conf')[source]
Read server configuration.
-
run()[source]
Run the server.
Event HUB
The EventHUB and related functions..
-
class geoffrey.hub.EventHUB[source]
The main data exchanger.
-
add_subscriptions(subscriptions)[source]
Extend the subscription list with the given subscriptions.
-
get_one_state(key_criteria)[source]
Like get_states but return the first matching state or None.
-
get_states(key_criteria)[source]
Generator with the matching states of the key_criteria.
-
put(data, force_change=False)[source]
Put a state or event in the hub.
This method is a coroutine, use:
-
put_nowait(data, force_change=False)[source]
Put a state or event in the hub.
This method is NOT a coroutine, use:
-
restore_states(filename)[source]
Load the state table from disk.
-
run()[source]
Infite loop that send events to the subscribers.
-
save_states(filename)[source]
Save the state table to disk.
Web Server
Geoffrey embedded web server.
-
class geoffrey.webserver.WebServer(server)[source]
The Webserver of Geoffrey.
Support the API and web resources.
At this time this does not handle the websocket; is handled by the
Websocket class.
-
consumer(consumer_id=None)[source]
Register a consumer.
-
get_api()[source]
Get web API definitions.
-
get_plugins(project_id)[source]
Return the active plugins of project_id.
-
get_projects()[source]
Return the current projects.
-
get_states()[source]
Return a view of the requested states.
-
index()[source]
Serve index.html redered with jinja2.
-
plugin_source(project_id, plugin_id, language)[source]
Return the main plugin source of this plugin for the given
language.
-
plugin_state(project_id, plugin_id)[source]
Return the list of states of this plugin.
-
project(project_id)[source]
Serve project.html redered with jinja2.
-
server_plugin_static(filepath)[source]
Serve static files under pluginname/assets.
-
server_static(filepath)[source]
Serve static files under web/assets at /assets.
-
start()[source]
Run the internal webserver.
-
subscribe(consumer_id)[source]
Change the subscription criteria of this consumer.
Web Socket
-
class geoffrey.websocket.WebsocketServer(consumers)[source]
-
handshake(websocket)[source]
Do the handshake with the websocket. Return the consumer.
Project
-
class geoffrey.project.Project(name, config)[source]
Geoffrey project.
-
remove()[source]
Remove this project from disk.
-
url[source]
Returns the web-ui url for this project.
Plugin
-
class geoffrey.plugin.GeoffreyPlugin(config, project=None)[source]
Base Geoffrey plugin.
Uses introspection as a tool to define the desired behavior.
The methods annotated with result geoffrey.plugin.Task will be
runned as tasks when the plugin is loaded.
The methods decored with @geoffrey.subscription can be used as an
annotation of the Task’s parameters as an incomming queue.
Example:
@asyncio.coroutine
def example(self, events: in_data) -> plugin.Task:
event = yield from in_data.get()
# ... some stuff generating states or events ...
yield from self.hub.put(mystate) # Put this on the hub
-
assets[source]
Root directory of asset files.
-
client_plugin_source(language)[source]
Return the filename of the source code for the client side of this
plugin in the given language.
-
configure_app()[source]
Override this method to add custom API endpoints.
-
get_api()[source]
Get web API definitions.
-
static get_subscriptions(task)[source]
The subscriptions defined as annotations in the tasks methods.
-
classmethod get_tasks()[source]
Return the members of this instance annotated with return Task.
-
new_event(key, **kwargs)[source]
Handy method that for creates a new event prefilled with the
information of this plugin.
-
new_state(key, content_type='data', **kwargs)[source]
Handy method that for creates a new state prefilled with the
information of this plugin.
-
start()[source]
Start the tasks of this plugin and add its subscriptions to
the hub.
-
static[source]
Root directory of static files.
Where the client sources and the assets directory lives.