class

Feed::Backend::Executable

Inherits Feed::Backend < Reference < Object

A judge that is an executable file.

A judge may declare settings in its first lines, after any comment syntax:

# ktistec: batch-size=10
# ktistec: revision=2

And the params a feed may give it:

# ktistec: param=minimum type=integer required

A param's type is integer or string (the default).

Settings are read when the judge is created.

Constants

FRONT_MATTER = /\bktistec: ([a-z][a-z-]*)=(\S+)(.*)/
FRONT_MATTER_LINES = 10
Log = ::Log.for(self)

Constructors

new(path : String, previous : Executable | Nil = nil)

Creates the judge.

A previous judge's revision and params override the ones the judge declares.

Source

Class methods

deadline
Source
deadline=(deadline : Time::Span)
Source
grace
Source
grace=(grace : Time::Span)
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
path
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