server

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 27 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server is the HTTP API that `ingestion serve` answers. Every route but the probes and the RFC 9728 metadata answers only a request carrying a bearer token the identity provider signed. A person's token reaches every route. A service's token reaches only the routes its scopes list.

Index

Constants

View Source
const (
	// ScopeDeclarationsApply admits a caller to apply a set of declarations.
	ScopeDeclarationsApply = "ingestion.declarations.apply"
	// ScopeConnectorsRead admits a caller to read each connector's state.
	ScopeConnectorsRead = "ingestion.connectors.read"
	// ScopeConnectorsRun admits a caller to run a connector now.
	ScopeConnectorsRun = "ingestion.connectors.run"
	// ScopeFirstFillsRelease admits a caller to release a connector's first
	// fill, which sends every item it held on to the model stages.
	ScopeFirstFillsRelease = "ingestion.first-fills.release"
	// ScopeItemsDrop admits a caller to drop a file into a drop connector.
	ScopeItemsDrop = "ingestion.items.drop"
)

Scopes of the connector routes.

View Source
const (
	CodeConnectorNotFound   = "connector_not_found"
	CodeConnectorMode       = "connector_mode"
	CodeInvalidDeclarations = "invalid_declarations"
	CodeDeclarationsMoved   = "declarations_moved"
	CodeDropTooLarge        = "drop_too_large"
	CodeInvalidDrop         = "invalid_drop"
)

Refusal codes of the connector routes.

View Source
const (
	DefaultItemsListed = 100
	MaxItemsListed     = 1000
)

DefaultItemsListed bounds a list whose caller names no limit, and MaxItemsListed bounds every page. A larger limit answers a page of MaxItemsListed and its next cursor, so a caller pages on without knowing it.

View Source
const (
	FoundInSource   = "source"
	FoundInSentence = "sentence"
)

Where a suggestion's finding was found.

View Source
const (
	// WaitingFirstFill is a task that a connector's first fill holds.
	WaitingFirstFill = "first-fill"
	// WaitingUnclaimed is a task that no worker heard from lately claims.
	WaitingUnclaimed = "unclaimed"
	// WaitingQueued is a task that a worker claims next.
	WaitingQueued = "queued"
	// WaitingDispatched is a run that the model port started and that has
	// not answered.
	WaitingDispatched = "dispatched"
)

Why an item waits at a model stage.

View Source
const (
	CodeIdempotencyKeyMissing = "idempotency_key_missing"
	CodeIdempotencyKeyReused  = "idempotency_key_reused"
	CodeStageNotReplayable    = "stage_not_replayable"
	CodeNoItemFromConnector   = "no_item_from_connector"
	// CodePlacedByNotReplayable is a replay over the labeled items, of a
	// stage that holds no such replay.
	CodePlacedByNotReplayable = "placed_by_not_replayable"
	// CodeModelNotReplayable is a replay that names a model, of a stage that
	// runs on the model its worker's config names.
	CodeModelNotReplayable = "model_not_replayable"
	// CodeModelMissing is a replay of a measurement arm that names no model.
	CodeModelMissing = "model_missing"
)

Refusal codes of a replay.

View Source
const (
	ScopeReviewRead  = "ingestion.review.read"
	ScopeReviewPlace = "ingestion.review.place"
)

ScopeReviewRead admits a caller to read the items that wait on a person's placement. ScopeReviewPlace admits it to place or drop an item for the person whose login its body names.

View Source
const (
	CodeDestinationNotDeclared = "destination_not_declared"
	CodeActingForAnother       = "acting_for_another"
	CodeChapterOfBook          = "chapter_of_book"
)

CodeDestinationNotDeclared refuses a placement on a destination that the set in force does not declare. CodeActingForAnother refuses a person's token whose body names another person's login. CodeChapterOfBook refuses a placement of a book's chapter, which takes its book's placement.

View Source
const (
	CodeInvalidBody   = "invalid_body"
	CodeInvalidQuery  = "invalid_query"
	CodeRouteNotFound = "route_not_found"
	CodeTaskNotFound  = "task_not_found"
	CodeItemNotFound  = "item_not_found"
	CodeParseNotFound = "parse_not_found"
	CodeStaleLease    = "stale_lease"
	CodeTaskDone      = "task_done"
	// CodeTaskSuperseded is a retry of a draft whose misses a later prompt
	// proposal holds.
	CodeTaskSuperseded = "task_superseded"
	CodeInternal       = "internal"
	CodeUnknownField   = "unknown_field"
	CodeInvalidKey     = "invalid_key"
	CodeInvalidBlob    = "invalid_blob"
	CodeBlobNotFound   = "blob_not_found"
	// CodeBlobBytesMissing is a blob whose row holds and whose bytes are gone,
	// which the unpaired report also names.
	CodeBlobBytesMissing = "blob_bytes_missing"
	CodeDigestMismatch   = "digest_mismatch"
)

Refusal codes, by the status each answers with. A client branches on the code, and the message is for a person.

View Source
const (
	OutcomeDone   = "done"
	OutcomeFailed = "failed"
	OutcomeRetry  = "retry"
)

Report outcomes.

View Source
const (
	ScopeMarksWrite   = "ingestion.marks.write"
	ScopeTrustPromote = "ingestion.trust.promote"
)

ScopeMarksWrite admits a caller to mark an item for a person, who its body may name. ScopeTrustPromote admits it to promote a gate family for the person whose login its body names.

View Source
const CodeFamilyNotFound = "family_not_found"

CodeFamilyNotFound refuses a promotion naming a family that the store holds no standing of.

View Source
const IdempotencyKey = "Idempotency-Key"

IdempotencyKey is the header that a keyed route finds an earlier request's work by, so a retry after a lost answer never starts it twice.

View Source
const MaxBlobBytes = 4 << 30

MaxBlobBytes bounds one blob that a worker writes.

View Source
const MaxDropBytes = 256 << 20

MaxDropBytes bounds one dropped file. A folder connector takes larger files, such as books, by reference.

View Source
const MaxListed = 1000

MaxListed is the most tasks one list answers.

View Source
const Product = "ingestion"

Product names the client id prefixes the API accepts: ingestion-cli- for a person's device login, ingestion-svc- for a service.

View Source
const ScopeItemsRead = "ingestion.items.read"

ScopeItemsRead admits a caller to read items and their records.

View Source
const ScopeItemsReplay = "ingestion.items.replay"

ScopeItemsReplay admits a caller to run a stage again over landed items.

View Source
const ScopeTasksClaim = "ingestion.tasks.claim"

ScopeTasksClaim admits a worker to claim tasks, extend their leases and report them.

View Source
const WorkersHeardWithin = 10 * time.Minute

WorkersHeardWithin is how recently a worker was heard from for the list to show it by default. Each process start is a worker of its own, so the workers that stopped outnumber the live ones within a few releases.

Variables

View Source
var (
	RouteVersion        = Route{"GET /api/v1/version", ScopeTasksClaim, RepeatRead}
	RouteTaskClaims     = Route{"POST /api/v1/tasks/claims", ScopeTasksClaim, RepeatOnce}
	RouteTaskHeartbeats = Route{"POST /api/v1/tasks/{id}/heartbeats", ScopeTasksClaim, RepeatByContent}
	RouteTaskReports    = Route{"POST /api/v1/tasks/{id}/reports", ScopeTasksClaim, RepeatByContent}
	RouteTaskParse      = Route{"GET /api/v1/tasks/{id}/parse", ScopeTasksClaim, RepeatRead}
	RouteTaskRetries    = Route{"POST /api/v1/tasks/{id}/retries", "", RepeatByContent}
	RouteTasks          = Route{"GET /api/v1/tasks", "", RepeatRead}
	RouteBlob           = Route{"GET /api/v1/blobs/{sha256}", ScopeTasksClaim, RepeatRead}
	RouteBlobWrite      = Route{"PUT /api/v1/blobs/{sha256}", ScopeTasksClaim, RepeatByContent}
	RouteBlobsUnpaired  = Route{"GET /api/v1/blobs/unpaired", "", RepeatRead}
	RouteItems          = Route{"GET /api/v1/items", ScopeItemsRead, RepeatRead}
	RouteItem           = Route{"GET /api/v1/items/{key}", ScopeItemsRead, RepeatRead}
	RouteItemParse      = Route{"GET /api/v1/items/{key}/parse", ScopeItemsRead, RepeatRead}
	RouteReplays        = Route{"POST /api/v1/replays", ScopeItemsReplay, RepeatKeyed}
	RouteDeclarations   = Route{"PUT /api/v1/declarations", ScopeDeclarationsApply, RepeatByContent}
	RouteConnectors     = Route{"GET /api/v1/connectors", ScopeConnectorsRead, RepeatRead}
	RouteConnector      = Route{"GET /api/v1/connectors/{name}", ScopeConnectorsRead, RepeatRead}
	RouteConnectorRuns  = Route{"POST /api/v1/connectors/{name}/runs", ScopeConnectorsRun, RepeatKeyed}
	RouteFirstFill      = Route{"PATCH /api/v1/connectors/{name}/first-fill", ScopeFirstFillsRelease, RepeatByContent}
	RouteConnectorDrops = Route{"POST /api/v1/connectors/{name}/drops", ScopeItemsDrop, RepeatKeyed}
	RouteReview         = Route{"GET /api/v1/review", ScopeReviewRead, RepeatRead}
	RouteReviewPlace    = Route{"POST /api/v1/review/{key}/place", ScopeReviewPlace, RepeatByContent}
	RouteReviewDrop     = Route{"POST /api/v1/review/{key}/drop", ScopeReviewPlace, RepeatByContent}
	RouteGateAgreement  = Route{"GET /api/v1/gates/agreement", ScopeItemsRead, RepeatRead}
	RouteItemMarks      = Route{"POST /api/v1/items/{key}/marks", ScopeMarksWrite, RepeatByContent}
	RouteGateTrust      = Route{"GET /api/v1/gates/trust", ScopeItemsRead, RepeatRead}
	// RouteGateTrustPromote's family is <connector>@<prompt version>@<model>@<effort>.
	RouteGateTrustPromote = Route{"POST /api/v1/gates/trust/{family}/promote", ScopeTrustPromote, RepeatByContent}
	RouteGateProposals    = Route{"GET /api/v1/gates/proposals", ScopeItemsRead, RepeatRead}
)

The route table. Each package registers its rows with Router.Handle, and a client sends through the row of the route it calls.

ReplayStages are the stages that a replay request may name, as schemas/replay.schema.json's stage enum holds them. ReplayRoutes takes the stages that the service replays.

Functions

func GateConfig

func GateConfig(issuer string) goapiauth.Config

GateConfig is the token check for issuer, accepting this product's person and service clients.

func Handler

func Handler(cfg Config, routes ...Routes) http.Handler

Handler is every route: the probes, which answer with no token so a kubelet can call them, the metadata, and each of routes behind the token check.

func JSON

func JSON(w http.ResponseWriter, status int, body any)

JSON answers status with body encoded as JSON.

func Refuse

func Refuse(w http.ResponseWriter, status int, code, format string, args ...any)

Refuse answers status with a refusal carrying code and the sentence that format and args make.

func ValidCause

func ValidCause(cause string) bool

ValidCause reports whether cause is spelled as the place and drop routes take one.

Types

type AfterStage

type AfterStage func(ctx context.Context, tx *store.Tx, task store.Task) error

AfterStage runs in the write that ends an item's task done, after the stage's outputs, such as the scan and the gates that follow an item's parse. An error rolls the whole report back, so the task stays leased.

type BlobAnswer

type BlobAnswer struct {
	SchemaVersion int    `json:"schema_version"`
	SHA256        string `json:"sha256"`
	MD5           string `json:"md5"`
	SizeBytes     int64  `json:"size_bytes"`
	MediaType     string `json:"media_type"`
	CreatedTS     string `json:"created_ts"`
}

BlobAnswer is what a blob write answers: schemas/blob.schema.json.

type ClaimAnswer

type ClaimAnswer struct {
	Tasks []LeasedTask `json:"tasks"`
}

ClaimAnswer is every task that the claim leased, and none where nothing waits.

type ClaimRequest

type ClaimRequest struct {
	WorkerID        string               `json:"worker_id"`
	Capabilities    []string             `json:"capabilities"`
	Version         string               `json:"version"`
	StartedTS       string               `json:"started_ts"`
	Max             int                  `json:"max"`
	MaxByCapability map[string]int       `json:"max_by_capability,omitempty"`
	SlotGroups      map[string]SlotGroup `json:"slot_groups,omitempty"`
	LeaseSeconds    int                  `json:"lease_seconds"`
}

ClaimRequest is a worker asking for up to Max tasks whose capability it holds, each leased for LeaseSeconds. MaxByCapability bounds how many of each capability it names the claim leases, such as a worker whose slot limit for one capability holds one of its slots free for the rest. Each of SlotGroups bounds the tasks of its capabilities together, such as two heavy parses where the worker's memory holds one. A capability sits in one group at most, and MaxByCapability names no grouped one.

type Config

type Config struct {
	Store *store.Store
	Gate  TokenGate
	// Issuer is the identity provider whose tokens the API accepts.
	Issuer string
	// PublicURL is where callers reach the API. Where it is set, the
	// API serves RFC 9728 metadata there, from which `ingestion auth login`
	// learns the issuer.
	PublicURL string
	Version   string
	Log       *slog.Logger
}

Config is what the API serves from.

type ConnectorConfig

type ConnectorConfig struct {
	Store     *store.Store
	Lander    *landing.Lander
	Scheduler *connectors.Scheduler
	// Roots names each [serve.homes] root a folder connector may read.
	Roots []string
	// AfterApply runs in the write that applies a changed set.
	AfterApply connectors.AfterApply
	Log        *slog.Logger
}

ConnectorConfig is what the connector routes serve from.

type ConnectorView

type ConnectorView struct {
	Name           string     `json:"name"`
	Mode           string     `json:"mode"`
	Zone           store.Zone `json:"zone"`
	Source         string     `json:"source"`
	Tags           []string   `json:"tags"`
	AppliedCommit  string     `json:"applied_commit"`
	LastRunTS      *string    `json:"last_run_ts"`
	LastDeliveryTS *string    `json:"last_delivery_ts"`
	// LastError is why the last run failed, null since one succeeded, and
	// Failures counts the failed runs since then.
	LastError   *string `json:"last_error"`
	LastErrorTS *string `json:"last_error_ts"`
	Failures    int     `json:"failures"`
	Items       int     `json:"items"`
	Waiting     int     `json:"waiting"`
	Review      int     `json:"review"`
	Failed      int     `json:"failed"`
	Schedule    *string `json:"schedule"`
	DueInterval *string `json:"due_interval"`
	Freshness   *string `json:"freshness"`
	DueAt       string  `json:"due_at"`
	Overdue     bool    `json:"overdue"`
	// OverdueSince is when the connector went overdue, and null while it is not.
	OverdueSince *string `json:"overdue_since"`
	// FinishedTS is when a connector scheduled once ran a poll that ended
	// done, after which the scheduler never runs it, and null until then.
	FinishedTS *string `json:"finished_ts"`
	// FirstFill is answered on one connector alone.
	FirstFill *FirstFillView `json:"first_fill,omitempty"`
}

ConnectorView is one applied connector, its counts and its due time.

type ConnectorsAnswer

type ConnectorsAnswer struct {
	SchemaVersion int `json:"schema_version"`
	// AppliedCommit is the commit of the set in force, and null where no set
	// has been applied.
	AppliedCommit *string         `json:"applied_commit"`
	Connectors    []ConnectorView `json:"connectors"`
}

ConnectorsAnswer is what GET /api/v1/connectors answers: schemas/connectors-list.schema.json.

type DecisionView

type DecisionView struct {
	Gate        string   `json:"gate"`
	Verdict     string   `json:"verdict"`
	DecidedBy   string   `json:"decided_by"`
	Confidence  *float64 `json:"confidence"`
	Cause       string   `json:"cause"`
	Destination *string  `json:"destination"`
	Note        *string  `json:"note"`
	Lens        *string  `json:"lens"`
	ClientID    *string  `json:"client_id"`
	DecidedTS   string   `json:"decided_ts"`
}

DecisionView is one gate's decision.

type DeclarationsAnswer

type DeclarationsAnswer struct {
	SchemaVersion int    `json:"schema_version"`
	Commit        string `json:"commit"`
	AppliedTS     string `json:"applied_ts"`
	AppliedBy     string `json:"applied_by"`
	Unchanged     bool   `json:"unchanged"`
	Connectors    int    `json:"connectors"`
	RoutingRules  int    `json:"routing_rules"`
	Destinations  int    `json:"destinations"`
}

DeclarationsAnswer is what an apply answers: schemas/declarations-applied.schema.json.

type DeclarationsRequest

type DeclarationsRequest struct {
	Commit string `json:"commit"`
	// Replaces is the commit the caller saw in force, and null where it saw
	// none. An apply that replaces another commit is refused.
	Replaces *string `json:"replaces"`
	connectors.Set
}

DeclarationsRequest is what PUT /api/v1/declarations reads: schemas/declarations.schema.json.

type DeliveryView

type DeliveryView struct {
	Destination   string  `json:"destination"`
	DestinationID *string `json:"destination_id"`
	Outcome       string  `json:"outcome"`
	Attempts      int     `json:"attempts"`
	LastError     *string `json:"last_error"`
	// UnclaimedCapability is the capability of the delivery's queued task
	// where no worker heard from lately holds it, and null otherwise.
	UnclaimedCapability *string `json:"unclaimed_capability"`
}

DeliveryView is one delivery to one destination.

type DropRequest

type DropRequest struct {
	Cause string  `json:"cause,omitempty"`
	Note  *string `json:"note,omitempty"`
	Login string  `json:"login,omitempty"`
}

DropRequest drops an item, which keeps its row. Cause names the aspect that decided it, and a drop that names none is kept as unstated.

type FindingView

type FindingView struct {
	store.Finding
	Span *string `json:"span"`
}

FindingView is one scanner finding and the text it matched.

type FirstFillAnswer

type FirstFillAnswer struct {
	SchemaVersion int    `json:"schema_version"`
	Connector     string `json:"connector"`
	State         string `json:"state"`
	// Released counts the held queued tasks that this request returned to the
	// claims, which is 0 for a fill already released.
	Released int `json:"released"`
}

FirstFillAnswer is what the PATCH answers: schemas/first-fill.schema.json.

type FirstFillRequest

type FirstFillRequest struct {
	State string `json:"state"`
}

FirstFillRequest is what PATCH /api/v1/connectors/{name}/first-fill reads. Released is the one state a person sets.

type FirstFillView

type FirstFillView struct {
	State   string                  `json:"state"`
	ItemKey *string                 `json:"item_key"`
	Held    int                     `json:"held"`
	Tokens  map[string]store.Tokens `json:"tokens"`
}

FirstFillView is a connector's first fill: its state, the one item it ran end to end, the items held behind it, and that item's tokens by model stage.

type GateTrustAnswer added in v0.27.0

type GateTrustAnswer struct {
	SchemaVersion int               `json:"schema_version"`
	Rule          TrustRule         `json:"rule"`
	Families      []store.GateTrust `json:"families"`
}

GateTrustAnswer is what GET /api/v1/gates/trust answers: schemas/gate-trust-list.schema.json.

type HeartbeatRequest

type HeartbeatRequest struct {
	Token        int64 `json:"token"`
	LeaseSeconds int   `json:"lease_seconds"`
}

HeartbeatRequest extends a lease by LeaseSeconds from now.

type HomeView

type HomeView struct {
	Root       string  `json:"root"`
	Path       string  `json:"path"`
	ModifiedTS *string `json:"modified_ts"`
	FoundTS    string  `json:"found_ts"`
	GoneTS     *string `json:"gone_ts"`
}

HomeView names where the item's file lives under a named root.

type ItemAnswer

type ItemAnswer struct {
	SchemaVersion int            `json:"schema_version"`
	Item          ItemView       `json:"item"`
	Homes         []HomeView     `json:"homes"`
	Sightings     []SightingView `json:"sightings"`
	Outputs       []OutputView   `json:"outputs"`
	Decisions     []DecisionView `json:"decisions"`
	Deliveries    []DeliveryView `json:"deliveries"`
	// Sections are the item's sections, each producer version's in order.
	Sections []SectionView `json:"sections"`
	// Undelivered says why an item placed on a side and read as is reaches
	// no deliverer, and is null where it does.
	Undelivered *UndeliveredView `json:"undelivered"`
	// Waiting says why the item waits at a model stage, and is null where it
	// waits at none.
	Waiting *WaitingView `json:"waiting"`
	// Suggestion is the item's latest suggestion, and null where no model
	// read holds a sentence.
	Suggestion *SuggestionView `json:"suggestion"`
	// QualityAnswer is the quality gate's newest done answer, as
	// store.NewestDone picks it and the review route serves it, and null where
	// the gate gave none.
	QualityAnswer json.RawMessage `json:"quality_answer"`
	// ModelRead is the newest done model read, as store.NewestDone picks it,
	// with the scanner's findings over its sentence, and null where none is
	// done.
	ModelRead *OutputView `json:"model_read"`
}

ItemAnswer is what GET /api/v1/items/{key} answers: schemas/item.schema.json.

type ItemListed

type ItemListed struct {
	Key        string     `json:"key"`
	Zone       store.Zone `json:"zone"`
	MediaType  string     `json:"media_type"`
	Title      *string    `json:"title"`
	URL        *string    `json:"url"`
	Connectors []string   `json:"connectors"`
	Phase      string     `json:"phase"`
	WaitingAt  *string    `json:"waiting_at"`
	Side       *string    `json:"side"`
	CreatedTS  string     `json:"created_ts"`
}

ItemListed is one item as the list shows it.

type ItemView

type ItemView struct {
	Key        string     `json:"key"`
	Zone       store.Zone `json:"zone"`
	MediaType  string     `json:"media_type"`
	Title      *string    `json:"title"`
	URL        *string    `json:"url"`
	SourceTS   *string    `json:"source_ts"`
	BlobSHA256 *string    `json:"blob_sha256"`
	SizeBytes  *int64     `json:"size_bytes"`
	MD5        *string    `json:"md5"`
	ParentKey  *string    `json:"parent_key"`
	FlowID     string     `json:"flow_id"`
	Phase      string     `json:"phase"`
	WaitingAt  *string    `json:"waiting_at"`
	CreatedTS  string     `json:"created_ts"`
}

ItemView is the item, with its bytes' size and MD5 and its derived phase.

type ItemsAnswer

type ItemsAnswer struct {
	SchemaVersion int          `json:"schema_version"`
	Items         []ItemListed `json:"items"`
	Next          *string      `json:"next"`
}

ItemsAnswer is what GET /api/v1/items answers: schemas/items-list.schema.json. Next is the cursor of the next page, and null where none is left.

type LeasedProposal added in v0.28.0

type LeasedProposal struct {
	Prompt        string `json:"prompt"`
	PromptVersion string `json:"prompt_version"`
	// PromptText is the template of the prompt at PromptVersion, which the
	// draft's edits apply to.
	PromptText     string          `json:"prompt_text"`
	LabeledAfter   *string         `json:"labeled_after"`
	LabeledThrough string          `json:"labeled_through"`
	MissCount      int             `json:"miss_count"`
	Misses         json.RawMessage `json:"misses"`
}

LeasedProposal is the prompt proposal that a prompt-proposal task drafts: the prompt it changes, at the version it changes, and the misses labeled after LabeledAfter, through LabeledThrough, as one JSON array.

type LeasedSighting added in v0.24.0

type LeasedSighting struct {
	Connector   string            `json:"connector"`
	ExternalKey string            `json:"external_key"`
	Fields      map[string]string `json:"fields"`
}

LeasedSighting is one connector's sighting of a delete task's item, which the task removes from that connector's source: the source's own key for the item, and the fields read from its payload, such as a playlist item's id.

type LeasedTask

type LeasedTask struct {
	ID             string  `json:"id"`
	ItemKey        *string `json:"item_key"`
	Connector      *string `json:"connector"`
	Stage          string  `json:"stage"`
	Capability     string  `json:"capability"`
	Attempts       int     `json:"attempts"`
	LeaseToken     int64   `json:"lease_token"`
	LeaseExpiresTS string  `json:"lease_expires_ts"`
	// WaitedSeconds is how long before this claim a report first said the
	// task waits, and 0 where none has.
	WaitedSeconds int64 `json:"waited_seconds,omitempty"`
	// MediaType and BlobSHA256 are the item's, so a worker reads its bytes
	// holding no scope to read items. A poll carries neither, and BlobSHA256
	// is null where the item holds no bytes.
	MediaType  string  `json:"media_type"`
	BlobSHA256 *string `json:"blob_sha256"`
	// Zone, Title, URL and LandedTS are the item's too, so a deliverer writes
	// it holding no scope to read items. A deliver task's Title, URL and
	// SourceTS are its delivery's, as they were when it was first queued, so
	// a retry sends what the first attempt sent. SourceTS is when the item
	// was made at its source, and null where its source gave no time. Path
	// is a deliver task's file below its deliverer's root, kept the same way,
	// and absent for a deliverer that writes no file. A poll carries none of
	// them.
	Zone     store.Zone `json:"zone,omitempty"`
	Title    *string    `json:"title"`
	URL      *string    `json:"url"`
	LandedTS string     `json:"landed_ts,omitempty"`
	SourceTS *string    `json:"source_ts,omitempty"`
	Path     *string    `json:"path,omitempty"`
	// Chapter is a deliver task's of a book's chapter, kept the same way:
	// the destination's id for its book's record, and where the chapter
	// sits in the book. Every other task carries none.
	Chapter *store.ChapterInBook `json:"chapter,omitempty"`
	// Destination names where a deliver task writes its item, and is null
	// for every other task.
	Destination *string `json:"destination"`
	// StageOutputs are the item's outputs at a model stage's task's stage,
	// so a task whose run is already dispatched follows that run rather than
	// starting another. Every other task carries none.
	StageOutputs []StageOutput `json:"stage_outputs,omitempty"`
	// Lens and Note are a model read's task's: the lens of the item's newest
	// read decision, and the note that a person wrote, which the read
	// answers. Every other task carries neither.
	Lens *string `json:"lens,omitempty"`
	Note *string `json:"note,omitempty"`
	// Model is a measurement arm's task's. The task asks its run for this
	// model in place of the worker's configured one. Every other task
	// carries none.
	Model *string `json:"model,omitempty"`
	// Cursor and Declaration are a poll's: its connector's position, where an
	// earlier poll moved it, and the connector's declaration as the set in
	// force holds it, so the source's handler reads what its connector names.
	// Declaration is absent where the connector is missing from the set in
	// force. Every other task carries neither.
	Cursor      *string         `json:"cursor,omitempty"`
	Declaration json.RawMessage `json:"declaration,omitempty"`
	// Sighting is a delete task's: the sighting whose source the task removes
	// the item from. Every other task carries none.
	Sighting *LeasedSighting `json:"sighting,omitempty"`
	// ProposalID and Proposal are a prompt-proposal task's: the prompt proposal that
	// it drafts, and the misses that the draft reads. Its StageOutputs hold
	// the proposal's run, once one was sent. Every other task carries
	// neither.
	ProposalID *string         `json:"proposal_id,omitempty"`
	Proposal   *LeasedProposal `json:"proposal,omitempty"`
}

LeasedTask is one leased task, with the token for every heartbeat and report on it. A stage's task names its item. A poll names its connector, and its capability is poll:<source>, so each source's handler claims its own.

type MarkAnswer added in v0.27.0

type MarkAnswer struct {
	SchemaVersion int               `json:"schema_version"`
	Mark          store.Mark        `json:"mark"`
	Families      []store.GateTrust `json:"families"`
}

MarkAnswer is what a mark answers: schemas/item-mark.schema.json. Families is each family's standing after the mark moved it, and empty where the mark moved none.

type MarkRequest added in v0.27.0

type MarkRequest struct {
	Mark  string `json:"mark"`
	Login string `json:"login,omitempty"`
}

MarkRequest marks an item low-quality or read. A service marking for a person may name the person's Login, since its token carries none. Without one, the mark is the service's, which relays a person's word under its scope.

type OutputView

type OutputView struct {
	Stage           string          `json:"stage"`
	Producer        string          `json:"producer"`
	ProducerVersion string          `json:"producer_version"`
	Lens            *string         `json:"lens"`
	LensVersion     *string         `json:"lens_version"`
	NoteDigest      *string         `json:"note_digest"`
	State           string          `json:"state"`
	Units           *int            `json:"units"`
	Findings        []FindingView   `json:"findings"`
	RulesVersion    *string         `json:"rules_version"`
	Answer          json.RawMessage `json:"answer"`
	RunID           *string         `json:"run_id"`
	DispatchID      *string         `json:"dispatch_id"`
	Model           *string         `json:"model"`
	Effort          *string         `json:"effort"`
	AnsweredModel   *string         `json:"answered_model"`
	Tokens          *store.Tokens   `json:"tokens"`
	Error           *string         `json:"error"`
}

OutputView is one stage's output, with a parse's units counted and each finding beside its span.

type ParseAnswer

type ParseAnswer struct {
	SchemaVersion    int            `json:"schema_version"`
	Key              string         `json:"key"`
	Zone             store.Zone     `json:"zone"`
	Title            *string        `json:"title"`
	URL              *string        `json:"url"`
	MediaType        string         `json:"media_type"`
	Extractor        string         `json:"extractor"`
	ExtractorVersion string         `json:"extractor_version"`
	Text             string         `json:"text"`
	Units            []store.Unit   `json:"units"`
	RulesVersion     *string        `json:"rules_version"`
	Findings         []ParseFinding `json:"findings"`
}

ParseAnswer is what GET /api/v1/items/{key}/parse answers: schemas/item-parse.schema.json. Text is the units' text in order, joined by a blank line.

type ParseFinding

type ParseFinding struct {
	store.Finding
	Span string `json:"span"`
}

ParseFinding is one finding of the newest scan of the parse, with the text it matched. Its offset counts bytes from its unit's start.

type PlaceRequest

type PlaceRequest struct {
	Destination string  `json:"destination"`
	Cause       string  `json:"cause,omitempty"`
	Note        *string `json:"note,omitempty"`
	Login       string  `json:"login,omitempty"`
}

PlaceRequest places an item on Destination, one the set in force declares. Cause names the aspect that decided it, such as subreddit, channel, theme or title, and Note the questions and why the item was saved. A service placing for a person names the person's Login, since its token carries none.

type PlacementAnswer

type PlacementAnswer struct {
	SchemaVersion int            `json:"schema_version"`
	Key           string         `json:"key"`
	Decisions     []DecisionView `json:"decisions"`
}

PlacementAnswer is what a placement or a drop answers: schemas/review-placement.schema.json. Decisions are the side decision and, where it places the item on a side, the read decision after it.

type PromoteRequest added in v0.27.0

type PromoteRequest struct {
	Login string `json:"login,omitempty"`
}

PromoteRequest promotes a gate family. A service promoting for a person names the person's Login, since its token carries none.

type PromotionAnswer added in v0.27.0

type PromotionAnswer struct {
	SchemaVersion int             `json:"schema_version"`
	Family        store.GateTrust `json:"family"`
}

PromotionAnswer is what a promotion answers: schemas/gate-trust-promotion.schema.json.

type PushAnswer

type PushAnswer struct {
	SchemaVersion int          `json:"schema_version"`
	Items         []PushedItem `json:"items"`
}

PushAnswer is what a push or a drop answers: schemas/push.schema.json.

type PushedItem

type PushedItem struct {
	Key  string     `json:"key"`
	Zone store.Zone `json:"zone"`
	// Created is false where the item was already landed, and this was one
	// more sighting of it.
	Created bool `json:"created"`
}

PushedItem is one item a push or a drop landed.

type Repeat

type Repeat string

Repeat says what a second copy of a route's request does, so a client's retry and a handler's dedupe read one answer.

const (
	// RepeatRead reads, so a second copy changes nothing.
	RepeatRead Repeat = "read"
	// RepeatKeyed writes once per Idempotency-Key. The client sets one key
	// per call and sends it on every retry of that call, and the router
	// refuses a request that carries none.
	RepeatKeyed Repeat = "keyed"
	// RepeatByContent writes what its body names, so a second copy of one
	// body leaves the state as the first copy left it.
	RepeatByContent Repeat = "byContent"
	// RepeatOnce may do its work twice when sent twice, so a client sends it
	// again only where the first copy never reached the server.
	RepeatOnce Repeat = "once"
)

type ReplayAnswer

type ReplayAnswer struct {
	SchemaVersion int           `json:"schema_version"`
	Stage         string        `json:"stage"`
	Connector     *string       `json:"connector"`
	Key           *string       `json:"key"`
	PlacedBy      *string       `json:"placed_by"`
	Model         *string       `json:"model"`
	Items         int           `json:"items"`
	Queued        bool          `json:"queued"`
	Estimate      *store.Tokens `json:"estimate"`
}

ReplayAnswer is what POST /api/v1/replays answers: schemas/replay.schema.json.

type ReplayRequest

type ReplayRequest struct {
	Stage     string  `json:"stage"`
	Connector *string `json:"connector"`
	Key       *string `json:"key"`
	PlacedBy  *string `json:"placed_by,omitempty"`
	Model     *string `json:"model,omitempty"`
	Confirm   bool    `json:"confirm"`
}

ReplayRequest asks to run Stage again over the items that Connector and Key select, each absent selecting every item. PlacedBy store.PlacedByPerson narrows them to the labeled items. Model names the model that a measurement arm asks. Confirm runs a model stage once a person has read its estimate.

type Replayable

type Replayable struct {
	// Capability is the capability of the stage's task on item, and false
	// where the stage does not run on item. A replay queues one task of that
	// capability for each item it covers.
	Capability func(item store.Item) (string, bool)
	// Queue, where it is set, queues the stage's tasks for one item instead,
	// and answers whether it queued any. A stage whose task names more than
	// its item, such as a delivery's destination, sets it.
	Queue store.ReplayQueue
	// Estimate is how many of items a model stage would run on, and its
	// tokens by kind over them. Where it is set, a replay answers the
	// estimate and queues nothing until a request confirms it. A model-free
	// stage leaves it nil, and queues at once.
	// Its tokens are nil where it holds no stored run to estimate from.
	Estimate func(ctx context.Context, items []store.Item) (int, *store.Tokens, error)
	// PlacedByPerson, where it is set, is the stage run only over the
	// labeled items, as a measurement of the stage against each placement. A
	// request asks for it with placed_by person.
	PlacedByPerson *Replayable
	// OnModel, where it is set, is a measurement arm: the stage asked of the
	// model that a request names. A request to such a stage names its model,
	// and one to any other stage names none.
	OnModel func(model string) Replayable
}

Replayable is one stage that a replay runs again.

type ReportArrival added in v0.24.0

type ReportArrival struct {
	Key       string `json:"key,omitempty"`
	URL       string `json:"url,omitempty"`
	MediaType string `json:"media_type"`
	Title     string `json:"title,omitempty"`
	// ExternalKey is the source's own key for the item, such as a playlist
	// item's id, which a deleter removes.
	ExternalKey string            `json:"external_key,omitempty"`
	Fields      map[string]string `json:"fields,omitempty"`
	Metrics     map[string]int64  `json:"metrics,omitempty"`
	SourceTS    *string           `json:"source_ts,omitempty"`
}

ReportArrival is one item that a poll found at its source. serve lands it under the poll's connector, with the zone and tags that the set in force declares for it. Key or URL names the item, and landing refuses a key that the URL does not derive. Title, ExternalKey and Fields are outsider text where the connector's zone is outside. Metrics are the source's counts by name, which ship on the record channel. SourceTS is when the item was made at its source, in RFC 3339.

type ReportDelivery

type ReportDelivery struct {
	Outcome       string  `json:"outcome"`
	DestinationID *string `json:"destination_id,omitempty"`
	Error         *string `json:"error,omitempty"`
}

ReportDelivery is how one write of a deliver task's item ended: its outcome, the destination's id for the record that holds the item, and the destination's answer where the delivery is pending or refused.

type ReportOutput

type ReportOutput struct {
	Producer        string  `json:"producer"`
	ProducerVersion string  `json:"producer_version"`
	Lens            *string `json:"lens,omitempty"`
	LensVersion     *string `json:"lens_version,omitempty"`
	// NoteDigest is store.NoteDigest of the note that a model read answered.
	NoteDigest    *string       `json:"note_digest,omitempty"`
	State         string        `json:"state"`
	BlobSHA256    *string       `json:"blob_sha256,omitempty"`
	DispatchID    *string       `json:"dispatch_id,omitempty"`
	RunID         *string       `json:"run_id,omitempty"`
	Model         *string       `json:"model,omitempty"`
	Effort        *string       `json:"effort,omitempty"`
	AnsweredModel *string       `json:"answered_model,omitempty"`
	Tokens        *store.Tokens `json:"tokens,omitempty"`
	// InputProducer and InputVersion name the parse that a later stage read.
	InputProducer *string `json:"input_producer,omitempty"`
	InputVersion  *string `json:"input_version,omitempty"`
	// Findings and Spans are a scan's, and a model read's over its
	// suggestion sentence. A scan that found nothing sends an empty list,
	// which reads apart from a stage that sends none. RulesVersion is the
	// version of the rules that made them.
	Findings       []store.Finding `json:"findings"`
	RulesVersion   *string         `json:"rules_version,omitempty"`
	Quality        *int            `json:"quality,omitempty"`
	SideGuess      *string         `json:"side_guess,omitempty"`
	SideConfidence *float64        `json:"side_confidence,omitempty"`
	// Units are a parse's, numbered from 1 in order, which the service writes
	// as rows of parse_units under the producer and its version.
	Units  []store.Unit    `json:"units,omitempty"`
	Spans  []store.Span    `json:"spans"`
	Answer json.RawMessage `json:"answer,omitempty"`
	Error  *string         `json:"error,omitempty"`
}

ReportOutput is one output a worker reports: each field of an outputs row that the stage's work decides, and a parse's units. The service takes the item and stage from the task and stamps the row, so a column the store adds for itself never changes what a worker sends.

type ReportRequest

type ReportRequest struct {
	Token             int64   `json:"token"`
	Outcome           string  `json:"outcome"`
	Error             *string `json:"error,omitempty"`
	RetryAfterSeconds int     `json:"retry_after_seconds,omitempty"`
	// Wait marks a retry that its far end asked for, or that a stopping
	// worker hands back, so the claim spends none of the task's attempts.
	Wait     bool            `json:"wait,omitempty"`
	Outputs  []ReportOutput  `json:"outputs,omitempty"`
	Delivery *ReportDelivery `json:"delivery,omitempty"`
	Arrivals []ReportArrival `json:"arrivals,omitempty"`
	Cursor   *string         `json:"cursor,omitempty"`
}

ReportRequest ends a lease. Outputs are the stage's records for the task's item, and Delivery is how a deliver task's write ended. Arrivals are what a poll that ends done found at its source, in source order, and Cursor the connector's next position, where the poll moves it. Each is written in the same transaction that ends the lease. A poll that ends done has reported every item its source holds past its cursor, so a connector scheduled once never polls after it.

type ReviewAnswer

type ReviewAnswer struct {
	SchemaVersion int                 `json:"schema_version"`
	Items         []ReviewItem        `json:"items"`
	Destinations  []ReviewDestination `json:"destinations"`
}

ReviewAnswer is what GET /api/v1/review answers: schemas/review-list.schema.json. Destinations are those a placement takes, in the order the set in force declares them, and nil where the set in force could not be read.

type ReviewDestination

type ReviewDestination struct {
	Name string  `json:"name"`
	Side *string `json:"side"`
}

ReviewDestination is a declared destination and the side it gives an item. Side is null where the destination drops what it takes.

type ReviewGuess

type ReviewGuess struct {
	Side       string  `json:"side"`
	Confidence float64 `json:"confidence"`
}

ReviewGuess is the quality gate's side guess on an item.

type ReviewItem

type ReviewItem struct {
	Key   string     `json:"key"`
	Zone  store.Zone `json:"zone"`
	Title *string    `json:"title"`
	URL   *string    `json:"url"`
	// Reason is why the item waits, as schemas/review-list.schema.json
	// enumerates it.
	Reason string       `json:"reason"`
	Guess  *ReviewGuess `json:"guess"`
	// QualityAnswer is the quality gate's newest done answer as the store
	// keeps it, and null where the gate gave none.
	QualityAnswer  json.RawMessage  `json:"quality_answer"`
	Connectors     []string         `json:"connectors"`
	Sightings      []ReviewSighting `json:"sightings"`
	WaitingSinceTS string           `json:"waiting_since_ts"`
}

ReviewItem is one item that waits on a person's placement, and why.

type ReviewSighting

type ReviewSighting struct {
	Connector string            `json:"connector"`
	Tags      []string          `json:"tags"`
	Fields    map[string]string `json:"fields"`
	Metrics   map[string]int64  `json:"metrics"`
}

ReviewSighting is one connector's arrival of a waiting item: the tags the side gate read and the source's fields, such as a Reddit save's subreddit.

type Route

type Route struct {
	Pattern string
	Scope   string
	Repeat  Repeat
}

Route is one row of the API's route table: its pattern as ServeMux reads it ("POST /api/v1/x"), the scope a service's token needs, and what a repeat does. An empty scope admits a person's token alone.

func (Route) Method

func (r Route) Method() string

Method is the route's HTTP method.

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router is where a package registers a handler for each of its rows in the route table.

func (*Router) Handle

func (r *Router) Handle(route Route, h http.HandlerFunc)

Handle serves route with h. A service reaches it only while its token carries the route's scope. A keyed route refuses a request with no Idempotency-Key before h runs, and h reads the key with requestKey.

type Routes

type Routes func(*Router)

Routes registers one package's routes.

func BlobRoutes

func BlobRoutes(l *landing.Lander, log *slog.Logger) Routes

BlobRoutes are the routes for a worker to read and write bytes through, and the report for a person of where the volume and the blob rows disagree.

func ConnectorRoutes

func ConnectorRoutes(cfg ConnectorConfig) Routes

ConnectorRoutes are the routes for a person to apply the declarations, read and run each connector, release a first fill, and drop a file.

func ItemRoutes

func ItemRoutes(st *store.Store, log *slog.Logger) Routes

ItemRoutes are the routes for a person or a service holding ingestion.items.read to read items. A key in the path is one escaped segment, such as reddit%2Ft3_aq7ggd, and a URL there resolves to its key. The parse route answers the item's newest done parse, or the newest of the extractor and at the version that its query names.

func ReplayRoutes

func ReplayRoutes(st *store.Store, stages map[string]Replayable, log *slog.Logger) Routes

ReplayRoutes is the route for a person to run one of stages again over landed items. It is keyed: a request carries an Idempotency-Key, and a repeat under the same key answers the replay that the first one queued.

func ReviewRoutes

func ReviewRoutes(st *store.Store, log *slog.Logger) Routes

ReviewRoutes are the routes for a person, or a service acting for one, to read the review queue and place or drop an item. A placement or a drop sent again with the same body appends nothing.

func TaskRoutes

func TaskRoutes(st *store.Store, lander *landing.Lander, log *slog.Logger, after AfterStage) Routes

TaskRoutes are the routes for a worker to lease tasks through and read a task's input, and the list for a person to read. lander lands what each poll found, in the write that ends the poll's lease. after runs in the write that ends each item's task done, and nil runs nothing.

func TrustRoutes added in v0.27.0

func TrustRoutes(st *store.Store, log *slog.Logger) Routes

TrustRoutes are the routes for a person, or a service acting for one, to mark an item, read each gate family's standing, and promote a family. A mark or a promotion sent again with the same body changes nothing.

type RunAnswer

type RunAnswer struct {
	SchemaVersion int     `json:"schema_version"`
	Connector     string  `json:"connector"`
	Mode          string  `json:"mode"`
	TaskID        *string `json:"task_id"`
	DueAt         string  `json:"due_at"`
}

RunAnswer is what POST /api/v1/connectors/{name}/runs answers: schemas/connector-run.schema.json. A poll answers its task, and a folder the due time that the scheduler scans it at.

type SectionView added in v0.20.0

type SectionView struct {
	Producer         string  `json:"producer"`
	ProducerVersion  string  `json:"producer_version"`
	N                int     `json:"n"`
	ParentN          *int    `json:"parent_n"`
	Level            int     `json:"level"`
	Kind             string  `json:"kind"`
	Title            *string `json:"title"`
	PDFPageStart     int     `json:"pdf_page_start"`
	PDFPageEnd       int     `json:"pdf_page_end"`
	PrintedPageStart *string `json:"printed_page_start"`
	PrintedPageEnd   *string `json:"printed_page_end"`
	StartPlacedBy    string  `json:"start_placed_by"`
	ChildKey         *string `json:"child_key"`
}

SectionView is one entry of an item's sections, as the sections table holds it.

type SightingView

type SightingView struct {
	Connector      string            `json:"connector"`
	ExternalKey    string            `json:"external_key"`
	Tags           []string          `json:"tags"`
	Fields         map[string]string `json:"fields"`
	Metrics        map[string]int64  `json:"metrics"`
	Zone           store.Zone        `json:"zone"`
	CursorPosition *string           `json:"cursor_position"`
	FirstSeenTS    string            `json:"first_seen_ts"`
	LastSeenTS     string            `json:"last_seen_ts"`
}

SightingView is one connector's arrival of the item.

type SlotGroup added in v0.29.0

type SlotGroup struct {
	Capabilities []string `json:"capabilities"`
	Max          int      `json:"max"`
}

SlotGroup is the capabilities of one slot group in a claim, and the most of them together that the claim leases.

type StageOutput

type StageOutput struct {
	Producer        string  `json:"producer"`
	ProducerVersion string  `json:"producer_version"`
	NoteDigest      *string `json:"note_digest"`
	State           string  `json:"state"`
	DispatchID      *string `json:"dispatch_id"`
	Model           *string `json:"model"`
	Effort          *string `json:"effort"`
	Error           *string `json:"error"`
}

StageOutput is one output that a model stage's task carries: which prompt wrote it, how far it got, and the dispatch it waits on. Error is why a waiting one has not started, or why a failed one failed.

type SuggestionFindingView

type SuggestionFindingView struct {
	Rule     string  `json:"rule"`
	Severity string  `json:"severity"`
	In       string  `json:"in"`
	Span     *string `json:"span"`
}

SuggestionFindingView is one scanner finding beside a suggestion, in its source or in its sentence.

type SuggestionView

type SuggestionView struct {
	SchemaVersion int                     `json:"schema_version"`
	ItemKey       string                  `json:"item_key"`
	Sentence      string                  `json:"sentence"`
	Title         *string                 `json:"title"`
	URL           *string                 `json:"url"`
	Zone          store.Zone              `json:"zone"`
	Findings      []SuggestionFindingView `json:"findings"`
	PromptVersion string                  `json:"prompt_version"`
	// Lens names the read's lens and its version, as "fleet 1-9dcd3940".
	Lens        *string `json:"lens"`
	SuggestedTS string  `json:"suggested_ts"`
}

SuggestionView is an item's latest suggestion, as schemas/suggestion.schema.json publishes it: its newest done model read whose answer holds a sentence, with the scanner's findings first.

type TaskParseAnswer

type TaskParseAnswer struct {
	SchemaVersion    int          `json:"schema_version"`
	Key              string       `json:"key"`
	Extractor        string       `json:"extractor"`
	ExtractorVersion string       `json:"extractor_version"`
	Units            []store.Unit `json:"units"`
}

TaskParseAnswer is what GET /api/v1/tasks/{id}/parse answers: schemas/task-parse.schema.json. It carries the units alone, because the parse's whole text is the units joined.

type TaskRetryAnswer

type TaskRetryAnswer struct {
	SchemaVersion int      `json:"schema_version"`
	Task          TaskView `json:"task"`
}

TaskRetryAnswer is what POST /api/v1/tasks/{id}/retries answers: schemas/task-retry.schema.json.

type TaskView

type TaskView struct {
	ID      string  `json:"id"`
	ItemKey *string `json:"item_key"`
	// Connector names a poll's connector, and the connector whose sighting a
	// delete removes from its source.
	Connector   *string `json:"connector"`
	Destination *string `json:"destination"`
	Model       *string `json:"model"`
	// ProposalID names the prompt proposal that a prompt-proposal task drafts.
	ProposalID     *string `json:"proposal_id"`
	Stage          string  `json:"stage"`
	Capability     string  `json:"capability"`
	State          string  `json:"state"`
	HeldBy         *string `json:"held_by"`
	Lapsed         bool    `json:"lapsed"`
	LeaseHolder    *string `json:"lease_holder"`
	LeaseExpiresTS *string `json:"lease_expires_ts"`
	Attempts       int     `json:"attempts"`
	HasError       bool    `json:"has_error"`
	NotBeforeTS    *string `json:"not_before_ts"`
	WaitingSinceTS *string `json:"waiting_since_ts"`
	CreatedTS      string  `json:"created_ts"`
	UpdatedTS      string  `json:"updated_ts"`
}

TaskView is one task as the list shows it. It leaves out the lease token and the task's error, which can quote outsider text, and says in has_error whether one is kept.

type TasksAnswer

type TasksAnswer struct {
	Tasks   []TaskView     `json:"tasks"`
	Workers []store.Worker `json:"workers"`
	// WorkersHidden counts the workers not heard from within
	// WorkersHeardWithin, which the list leaves out unless asked for all.
	WorkersHidden int `json:"workers_hidden"`
}

TasksAnswer is what GET /api/v1/tasks answers: schemas/tasks-list.schema.json.

type TokenGate

type TokenGate interface {
	goapiauth.TokenVerifier
	Ready() error
}

TokenGate verifies a bearer token, and says why it cannot yet.

type TrustRule added in v0.27.0

type TrustRule struct {
	// Run is the straight run of a person's agreeing marks that earns asking,
	// and climbs each rung above 1.
	Run   int     `json:"run"`
	First float64 `json:"first"`
	Lower float64 `json:"lower"`
	Floor float64 `json:"floor"`
	// Shares is the share of drops shown on each rung from 1 up.
	Shares []float64 `json:"shares"`
}

TrustRule is the ladder that every family climbs, as a reader shows it.

type UndeliveredView

type UndeliveredView struct {
	Reason      string  `json:"reason"`
	Side        string  `json:"side"`
	Destination *string `json:"destination"`
	Message     string  `json:"message"`
}

UndeliveredView is why an item reaches no deliverer, in the words of connectors.Undelivered.

type UnpairedAnswer

type UnpairedAnswer struct {
	SchemaVersion int            `json:"schema_version"`
	Files         int            `json:"files"`
	Rows          int            `json:"rows"`
	Unrowed       []UnpairedFile `json:"unrowed"`
	Missing       []BlobAnswer   `json:"missing"`
	Leftovers     []UnpairedFile `json:"leftovers"`
}

UnpairedAnswer is what GET /api/v1/blobs/unpaired answers: schemas/blobs-unpaired.schema.json.

type UnpairedFile

type UnpairedFile struct {
	SHA256     *string `json:"sha256"`
	Path       *string `json:"path"`
	SizeBytes  int64   `json:"size_bytes"`
	ModifiedTS string  `json:"modified_ts"`
}

UnpairedFile is one file in the volume that no row pairs with.

type WaitingView

type WaitingView struct {
	Stage      string `json:"stage"`
	Reason     string `json:"reason"`
	Capability string `json:"capability"`
	// HeldBy is the connector whose first fill holds the task.
	HeldBy *string `json:"held_by"`
	// DispatchID is the run's dispatch, where the port started one.
	DispatchID *string `json:"dispatch_id"`
	// LastError is why the task's last try did not go through, such as a
	// dispatch service that did not answer, where it ended so.
	LastError *string `json:"last_error"`
	Message   string  `json:"message"`
}

WaitingView is why an item waits at a model stage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL