[okfn-help] vdm: pending state

Rufus Pollock rufus.pollock at okfn.org
Mon Oct 4 17:25:31 BST 2010


Apologies for the delay Martijn!

On 22 September 2010 20:51, Martijn Faassen <faassen at startifact.com> wrote:
> Hi there,
>
> I'm trying to work out how to implement a 'pending' story for vdm.
>
> My use case is something as follows:
>
> * there's an application that edits the data: the "editable" data or "pending"
>
> * there's also the "published" version of the data.
>
> * certain can publish changes (add/update/removals made)

I assume you mean 'certain people'

> I understand vdm maintains the database in the normal tables, which
> you'd access as if the content wasn't
> revisioned. It then retains information about this and other revisions
> in the revision tables.

Right, but also adds a 'state' field and revision_id field to the
'normal' table.

> In the pending use case, should the normal tables contain the pending
> information or the published information?

This is an interesting question. Suggestion:

1. Case where object is entirely new. Write it in normal way (to both
normal table with copy to revision table) and set state to 'pending'

2. When writing a 'pending' change to an already 'active' object. In
this case, I suggest we just write a new revision to the 'revision'
table with state set to pending and make no change to the 'normal'
table. Then when the change is approved we will write that change to
the active table (and, I guess, update the revision table to set the
state on that revision to active -- to avoid issues if we revert).
This will require a bit of a change to vdm to support this
functionality:

  * Change the Revisioner MapperExtension so that it checks the state
field when making the write (before_update method i imagine) and does
not write to continuity object fields if state is 'pending'.
  * Have some support for marking 'pending' revisions as approved
which triggers write to continuity object (normal table)

> Both kinds of information needs to be easily accessible - one by the edit
> application and the published data by applications that handle this.
>
> It was suggested to me in the past to add information with the state
> set to PENDING, but how would one transition away from that state?
>
> Any design suggestions?

Excellent questions Martijn. what do you think of the suggestions above?

Rufus



More information about the okfn-help mailing list