Comments on the DB layer

clawrenc at clawrenc at
Mon May 5 17:37:59 New Zealand Standard Time 1997

In wrapping up the base design and most of the coding for moving my DB
to a fully transactional DB, an interesting little fillip poked its
head up.

Currently my ObjectID is a single 64bit value comprised of a 32bit
Record# and a 32bit time_t.  This is great for uniquely identifying a
given object while allowing database record # recycling.  The interest
arises in adding transactions and then allowing objects to be "rolled
back" thru time to a previous state.

How should such an object state (ie the object as of a particular
instant in time) be identified?  Should this identification be
different from the normal ObjectId?

My current approach is to change my definition of an ObjectID to a
128bit value as follows:


  32bit record#
  32bit time_t    // Time that object was initiallty created


  32bit record#
  32bit time_t    // Time that object was initiallty created
  32bit time_t    // Time of last transaction on object
  32bit ms        // Millisecond subdivision for last transaction time

A normal ObjectID would continue to be the same 64 bit value.  The
last 64bits specifiying the last transaction time would auto-default
to the very latest transaction on that object (ie the current object). 
This allows compleatly transparent handling of objects without having
to address the transactions or rollback support.

When needed however, say for audits or other game or server analysis,
a full 128bit Object ID could be used.  This would specify the version
of the object which existed at that time.  Note that if there was no
transaction for the object as of that specified time, object state for
the transaction _immediately_ preceding that time would be returned. 
(ie transparent)  This should allow for easy analysis of the database
as of any instant in time.

Now to go argue with myself and see if I really want some form of
query support for the DB.  The appeal of having an admin able to do
something like:

  Show me all the users who killed mobile XXX in the last week, 
  cross referenced with a list of all the weapons and spells 
  they used in their successful attacks.

is undeniable.

J C Lawrence                           Internet: claw at
(Contractor)                           Internet: coder at
---------------(*)               Internet: clawrenc at
...Honorary Member Clan McFUD -- Teamer's Avenging Monolith...

More information about the MUD-Dev mailing list