SQLite for ERIS block storage

SQLite is a popular embedded database. This document specifies a portable schema for storing blocks of ERIS encoded content into an SQLite database. This allows SQLite datbases to be used as portable, cross-platform and cross-implementation formats for storing and exchanging ERIS encoded content (see also SQLite As An Application File Format).

An SQLite database is well-suited for transferring ERIS encoded content over USB sticks or other portable media. Unlike the CBOR serialization an SQLite database allows efficient random-access without additional indexing or decoding.

Schema

Blocks of ERIS encoded content should be stored in a table eris_blocks that has 2 columns:

An SQL statement that creates the table and an index for accessing blocks by their reference:

CREATE TABLE IF NOT EXISTS eris_blocks (
              ref BLOB PRIMARY KEY,
              block BLOB
);

Extensibility

Applications and implementations may define other tables in the SQLite database. For example tables may be used for application specific configuration or block management.

When referencing blocks in the eris_blocks table, the automatically created rowid columns should be used as foreign key (see the SQLite documentation on ROWID). This is much more efficient than using the ref column.

Implementations

The Oebstly block storage tool implements the SQLite schema as described above.