Events storage procedure

Added the necessary database code to convert the contents of event
queues into actual event records. The changes include:
 * a new table, events.pending_events, which is automatically filled by
a trigger when events are inserted into queue tables,
 * the game.events.batchSize constant which defines the maximal amount
of events to process in a single transaction,
 * the events.eq_process() stored procedure, which processes the events.
In addition, the "hstore" extension was added as it is the easiest way
to convert events from the queues' table model to the store's
meta-model.
This commit is contained in:
Emmanuel BENOîT 2012-07-01 14:12:22 +02:00
parent dc9ef2292d
commit 3a0f5bbb78
5 changed files with 248 additions and 4 deletions
legacyworlds-server-data/db-structure/parts/030-data

View file

@ -239,6 +239,28 @@ CREATE SEQUENCE events.event_id_sequence;
GRANT SELECT,UPDATE ON events.event_id_sequence TO :dbuser;
/*
* Pending events
* --------------
*
* This table is updated when events are inserted into queues and when they
* are converted. It tracks events that need to be converted.
*
* Note: the table does not have a primary key or foreign keys; it is simply
* a cache which must not get in the way of inserts into queues.
*
* Warning: a record in this table may be orphaned, i.e. there could be no
* corresponding entry in the queue table.
*/
DROP TABLE IF EXISTS events.pending_events CASCADE;
CREATE TABLE events.pending_events(
/* Event identifier */
event_id BIGINT NOT NULL ,
/* Event type */
evdef_id VARCHAR(48) NOT NULL
);
/*
* Event storage table
* -------------------