Skip to content

Database

The PostgreSQL database schema for Labox contains two types of records:

  • Manifest Records: Contains metadata about a stored object and its associated content.
  • Content Records: Pointers to the actual content of the stored object.

Each manifest record corresponds to a single Storable object while each content record related to a manifest corresponds to the content deconstructed by an unpacker.

Manifest Records

The labox_manifests table contains metadata about stored objects.

Column Name Type Description
id UUID Unique identifier for the manifest record.
created_at TIMESTAMP Timestamp when the manifest was created.
class_id UUID See Class IDs for more information.
unpacker_name TEXT See Unpacker Names for more information.
tags JSONB Tags associated with the stored object, stored as a JSONB object.

A single manifest record is saved in the labox_manifests table whenever you save a Storable object. When you do, you have the option of providing tags which will end up added to the tags column. In addition the object's class ID and the name of the unpacker used to deconstructed will be stored under the class_id and unpacker_name columns, respectively.

Content Records

The labox_contents table contains pointers to the actual content of stored objects.

Column Name Type Description
id UUID Unique identifier for the content record.
created_at TIMESTAMP Timestamp when the content record was created.
manifest_id UUID Unique identifier for the related manifest record representing the stored object.
content_key TEXT Unique amongst all content records for a given manifest. Given by the unpacker of the content.
content_type TEXT The MIME type of the content.
content_encoding TEXT The encoding of the content, if applicable (e.g., gzip, deflate).
content_size BIGINT The size of the content in bytes.
content_hash TEXT A hash of the content.
content_hash_algorithm TEXT The algorithm used to compute the content hash (e.g., sha256).
serializer_config JSONB See Serializer Config for more information.
serializer_name TEXT See Serializer Names for more information.
serializer_type ENUM Indicates whether the serializer is a stream or a value.
storage_name TEXT See Storage Names for more information.
storage_config JSONB See Storage Config for more information.

A content record is saved in the labox_contents table for each unpacked value or unpacked stream returned by an unpacker when deconstructing a Storable object. The content_key of each record comes from the keys in the mapping returned by the unpack_object method.