class

Feed::Backend

Inherits Reference < Object

Base class for feed judges.

The interface between a feed and whatever decides membership: a backend is given a feed's config and a batch of posts and returns a per-post verdict -- {included, reason} or {failure, reason} -- with order and identity preserved.

Constructors

register(name : String, backend : Backend) : Backend

Registers a backend.

Source

Class methods

find?(name : String) : Backend | Nil

Returns the registered backend for a name, or nil.

Source
names

Returns the names of the registered backends.

Source
unregister(name : String) : Nil

Unregisters a backend.

Source

Instance methods

cost(params : Hash(String, JSON::Any)) : Cost

Declares the judge's cost given a feed's params.

Source
declared_params

Returns the params a feed may give the judge.

Source
judge(feed : Feed, objects : Array(ActivityPub::Object)) : Array(Judgment | Failure)

Judges a batch of objects for a feed.

Returns one Judgment or Failure per object, in the same order.

Raises if the judge can't answer for the entire batch.

Source
judging_params(params : Hash(String, JSON::Any)) : Hash(String, JSON::Any)

Returns a feed's params reduced to what decides membership.

In canonical form.

Source
revision(params : Hash(String, JSON::Any)) : String

Reports the judge's revision given a feed's params.

Changes when a change to the judge would change its answers.

Source
validate_params(params : Hash(String, JSON::Any)) : Array(String)

Validates a feed's backend-owned params.

Returns error messages -- empty if the params are valid. Each message should be a complete sentence and is rendered verbatim.

Source

Nested types