X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=schema.sql;fp=schema.sql;h=d225ec1f1c0cc0be002fc31ca9a74bf8b6c1c9a2;hb=6a181a1eb21ac5f9f4f742281b6de841dac9a3c8;hp=096069b5662dc051b4b1c2e3ce69ab365382bda5;hpb=7deb2384709f61697b430e9756cae4fd6e011f03;p=cumulus.git diff --git a/schema.sql b/schema.sql index 096069b..d225ec1 100644 --- a/schema.sql +++ b/schema.sql @@ -3,20 +3,36 @@ -- -- The index is stored in an SQLite3 database. This is its schema. +-- List of snapshots which have been created. +create table snapshots ( + snapshotid integer primary key, + name text not null, + timestamp real +); + +-- List of segments which have been created. +create table segments ( + segmentid integer primary key, + segment text unique not null +); + -- Index of all blocks which have been stored in a snapshot, by checksum. create table block_index ( blockid integer primary key, - segment text, - object text, + segmentid integer not null, + object text not null, checksum text, size integer, - timestamp real + timestamp real, + expired integer ); create index block_content_index on block_index(checksum); -create index block_name_index on block_index(segment, object); +create unique index block_name_index on block_index(segmentid, object); -- Index tracking which blocks are used by which snapshots. create table snapshot_contents ( blockid integer, - snapshot text + snapshotid integer ); +create unique index snapshot_contents_unique + on snapshot_contents(blockid, snapshotid);