ibid.core – Ibid Core

This module contains Ibid’s startup code, plugin, source, config, and DB loading as well as the Event dispatcher.

Dispatcher

ibid.core.process(event, log)

This function takes event and passes it to the process() function in each processor, in order of increasing priority. Messages are logged on the logger log.

After each Processor, any unclean SQLAlchemy sessions are committed and exceptions logged.

class ibid.core.Dispatcher

The Ibid Event dispatcher.

call_later(delay, callable, oldevent, *args, **kwargs)

Run callable after delay seconds, passing it oldevent and *args and *kwargs.

Returns a twisted.internet.base.DelayedCall.

Can be used in plugins instead of blocking in sleep.

Internal Functions

ibid.core._process(event)

The core of the dispatcher, must be called from a worker thread.

This function takes event and passes it to the process() function. Any responses attached to event are then dispatched to their destination sources.

ibid.core.send(response)

Dispatches response to the appropriate source.

ibid.core.dispatch(event)

Called by sources to dispatch event. Calls _process(), deferred to a thread, and returns the twisted.internet.defer.Deferred.

ibid.core.delayed_call(callable, event, *args, **kwargs)

The method called by call_later(), in a thread, to call callable, then _process() on event.

ibid.core.delayed_response(event)

Dispatches responses from delayed_call().

Reloader

class ibid.core.Reloader

The center of Ibid’s bootstrap process, the reloader loads plugins and processors. They can be reloaded at any time.

run()

Boostrap Ibid and run the reactor.

reload_dispatcher()

Reload the Ibid dispatcher.

load_source(name[, service])

Load source of name name, setting the service parent to service.

load_sources([service])

Load all enabled sources, setting the service parents to service.

Sources can be disabled by setting the configuration key service.``disabled = True``.

unload_source(name)

Unload source of name name.

reload_source(name)

Re-load source of name name.

load_processors([load, noload, autoload])

Load all enabled processors, according to the rules in load_processor().

load specifies the plugins to force loading, noload plugins to skip loading, and autoload whether to load everything by default. If these parameters are not supplied or are None, they will be looked up as configuration keys in the plugins block.

load_processor(name, [noload, load, load_all=False,
noload_all=False])

Load the plugin of name name. Individual Processors can be disabled by listing them in noload. If they are marked with autoload = False, then they are skipped unless listed in load or load_all is True.

unload_processor(name).

Unload plugin of name name.

reload_databases()

Reload the Databases.

reload_auth()

Reload the ibid.auth.

reload_config()

Notify all processors of a configuration reload, by calling setup().

Databases

ibid.core.regexp(pattern, item)

Regular Expression function for SQLite.

ibid.core.sqlite_creator(database)

Connect to a SQLite database, with regular expression support, thanks to regexp().

class ibid.core.DatabaseManager(check_schema_versions=True)

The DatabaseManager is responsible for loading databases (usually only one, 'ibid'), and is a dict of database to sqlalchemy.orm.scoping.ScopedSessions.

load(name)

Load the database of name name.

Echoing is configured by debugging.sqlalchemy_echo.

Databases are configured as sanely as possible:

  • All databases are brought up in a UTF-8 mode, with UTC timezone.
  • MySQL has the default engine set to InnoDB and ANSI mode enabled.