class BBS::Store

A small thread-safe table keyed by session id, for keeping what callers entered, in a BBS::SQLite file. The file and the table are created on first use; a column added to headers later is added to the table.

store = BBS::Store.new(path: 'data/callers.csv', headers: %w[session_id timestamp name])
store.upsert(session_id: ctx[:session_id], name: 'Ada')

A path ending in .csv names the CSV file of earlier versions: the database is the .sqlite3 file beside it, and on first use (or at boot, with open!) the rows of the CSV file (when it exists and the table is empty) are imported in one transaction and the CSV file is renamed to <name>.csv.imported. A row that is not CSV, has more fields than the header or no session_id is skipped and set aside in <name>.csv.rejected (see Store::CsvImport).

The session_id column is the key; a timestamp column, when present, is filled with the UTC time a row is created.