NAME

Net::Blossom::Server::Backend::SQLite::MetadataStore - SQLite Blossom metadata

DESCRIPTION

This module implements Net::Blossom::Server::MetadataStore using SQLite. It stores descriptors and owners but not blob bytes.

Use the same DBI handle for the paired Net::Blossom::Server::Backend::SQLite::BlobStore so their changes share one transaction.

lock_blob and all methods that change records require a transaction started by with_transaction.

CONSTRUCTOR

new

my $metadata = Net::Blossom::Server::Backend::SQLite::MetadataStore->new(
    dbh => $dbh,
);

Creates a metadata store using a SQLite DBI handle with AutoCommit enabled.

METHODS

dbh

Returns the SQLite DBI handle.

deploy_schema

Creates the metadata tables and owner lookup indexes.

with_transaction

Runs a callback in a SQLite transaction.

lock_blob

Provides the contract's per-blob lock point. SQLite serializes writes for the whole database, so this method is a no-op. Conflicting writers may receive a SQLite busy or locked error.

find_blob

Returns one storage-neutral blob record by SHA-256.

insert_blob

Inserts a blob record and reports whether it was created.

upsert_owner

Creates or updates one owner record.

delete_owner

Deletes one owner record and reports whether it existed.

delete_owners

Deletes every owner record for a blob.

owner_count

Returns the number of owners for a blob.

delete_blob

Deletes one blob metadata record and reports whether it existed.

list_blobs

Returns ordered storage-neutral blob records for an owner.

BUILDARGS

Validates and normalizes constructor arguments for Class::Tiny.