Mike Eldridge > Hopkins-0.9.2 > Hopkins::Store::Backend

Download:
Hopkins-0.9.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

Hopkins::Store::Backend - synchronous database services

DESCRIPTION ^

Hopkins::Store::Backend encapsulates database functionality in a simple event loop. no POE services are utilized in the event processing -- the loop is spawned off in a separate process via POE::Child::Run in order to provide asynchronous operation. hence, database queries may block in the backend without affecting the rest of hopkins.

Store::Backend communicates with the store session in the parent process via message passing on stdin/stdout. these messages are YAML encoded via POE::Filter::Reference.

METHODS ^

new

create a new Hopkins::Store::Backend object for processing requests received on STDIN. under normal operations, this constructor will return. it will, however, return if there are any errors processing events.

connect

connects the schema's storage backend to the data source described by the config object passed to the constructor. this method returns the resulting schema object or undef if there was an error.

connected

checks to make sure that the schema's storage backend is connected to the data source. returns a truth value indicating whether or not the schema is connected.

loop

main event processing loop. reads lines from STDIN and passes them to POE::Filter for decoding. each decoded item is passed to the process method individually for further processing.

under normal operating conditions, this method will never return. however, if processing of an individual item fails, this method will return to its caller, resulting in the destruction of the Store::Backend object.

process

process an action or event received from STDIN by the loop method. process will return a boolean value indicating the success or failure of the processing.

process_event

process an event received from STDIN. this method will dispatch the event to an appropriate method as indicated by the event name. if Store::Backend does not have an appropriate method to handle the event, it will be ignored. if the event is successfully processed, the Store session will be notified by sending a message on STDOUT.

process_event_task_enqueued

a task was enqueued: record it in the database

process_event_task_started

a task was started: record it in the database

process_event_task_completed

a task was completed: record it in the database

process_event_task_orphaned

a task was lost: record it in the database

AUTHOR ^

Mike Eldridge <diz@cpan.org>

LICENSE ^

syntax highlighting: