jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: NGP: Value records
Date Wed, 06 Jun 2007 09:32:26 GMT

On 6/6/07, Stefan Guggisberg <stefan.guggisberg@gmail.com> wrote:
> something that just crossed my mind: i know a number of people
> want to store everything (config, meta data, binaries and content)
> in the same db in order to allow easy backup/restore of an entire
> repository. currently they can do so by using DatabaseFileSystem
> and the externalBLOBs=false option of DatabasePersistenceManager.
> do you plan to support db persistence for the binary store as well?

Yes. The DataStore interface should be very database friendly so there
shouldn't be any issues in implementing DB persistence for binaries. A
schema like this should do the trick:

    CREATE TABLE datastore ( id SERIAL, sha1 CHAR(40), data BLOB );

The getRecord() method would essentially be:

    SELECT data FROM datastore WHERE sha1=?

The addRecord() method would essentially be:

    INSERT INTO datastore (data) VALUES (?) -- calculate sh1 while inserting
    IF (SELECT 1 FROM datastore WHERE sha1=?) THEN
        DELETE FROM datastore WHERE id=?
        UPDATE datastore SET sha1=? WHERE id=?
    END IF
    RETURN sha1


Jukka Zitting

View raw message