module

Feed::Backend::Executable::Exchange

Defines what an executable judge reads its questions from and writes its answers to.

Constants

SCHEMA = ["CREATE TABLE feed (name TEXT, description TEXT, params TEXT)", "CREATE TABLE stats (posting_rate_q1 REAL, posting_rate_median REAL, posting_rate_q3 REAL)", "CREATE TABLE authors (\n iri TEXT PRIMARY KEY,\n type TEXT,\n handle TEXT,\n followers TEXT,\n deleted INTEGER,\n blocked INTEGER,\n followed INTEGER,\n rate_7 REAL,\n rate_30 REAL,\n rate_90 REAL\n)", "CREATE TABLE posts (#{POST_COLUMNS})", "CREATE TABLE referenced (#{POST_COLUMNS})", "CREATE TABLE answers (\n iri TEXT PRIMARY KEY REFERENCES posts(iri),\n included INTEGER,\n failure TEXT CHECK (failure IN ('transient', 'permanent')),\n reason TEXT,\n keep INTEGER,\n CHECK ((included IS NULL) <> (failure IS NULL))\n)", "CREATE TABLE unavailable (\n reason TEXT,\n retry_after TEXT\n)"]
VERSION = 1

The exchange's version.

Changes only when a change would break a judge that names its columns (a column removed, renamed, or given a new meaning). Judges must name columns.

Written as the file's user_version.

Instance methods

read(path : String) : Hash(String, Judgment | Failure)

Reads the answers, by IRI.

Source
unavailable(path : String) : Unavailable | Nil

Reads whether the judge reported that it is unavailable.

Source
write(path : String, feed : Feed, objects : Array(ActivityPub::Object), now : Time = Time.utc) : Nil

Writes the questions about objects for feed.

Stats are computed over windows ending at now.

Source

Nested types