barrel_server_dbs (barrel_server v1.0.1)

View Source

Server-side database access: a thin, stateless shim over Barrel's database lifecycle manager (barrel_dbs), which owns the open handles, touches them on use, closes idle ones, and bounds the open set. This module adds only the HTTP concerns: name validation and the server-wide open options from the app env.

Summary

Functions

Fork Parent into BranchName. Opts: at => now | HlcT.

Close and forget the database Name. Idempotent.

Destroy the database Name: close it and delete its files.

Return the (possibly newly opened) handle for Name.

Names of the currently open databases.

Functions

branch(Parent, BranchName, Opts)

-spec branch(binary(), binary(), map()) -> {ok, barrel:db()} | {error, term()}.

Fork Parent into BranchName. Opts: at => now | HlcT.

close(Name)

-spec close(binary()) -> ok.

Close and forget the database Name. Idempotent.

destroy(Name)

-spec destroy(binary()) -> ok | {error, term()}.

Destroy the database Name: close it and delete its files.

ensure(Name)

-spec ensure(binary()) -> {ok, barrel:db()} | {error, term()}.

Return the (possibly newly opened) handle for Name.

list()

-spec list() -> [binary()].

Names of the currently open databases.