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
- Variables
- func Claimed(ctx context.Context, st *store.Store) (map[string]bool, error)
- func GateConfig(issuer string) goapiauth.Config
- func Handler(cfg Config, routes ...Routes) http.Handler
- func JSON(w http.ResponseWriter, status int, body any)
- func Refuse(w http.ResponseWriter, status int, code, format string, args ...any)
- func SniffMemo(head []byte) (string, bool)
- func ValidCause(cause string) bool
- type AfterStage
- type ArchiveRequest
- type BlobAnswer
- type ClaimAnswer
- type ClaimRequest
- type CommentsState
- type Config
- type ConnectorConfig
- type ConnectorView
- type ConnectorsAnswer
- type DecidedView
- type DecisionView
- type DeclarationsAnswer
- type DeclarationsRequest
- type DeliveryView
- type DropRequest
- type FindingView
- type FirstFillView
- type GateTrustAnswer
- type HeartbeatRequest
- type HoldAnswer
- type HomeView
- type ItemAnswer
- type ItemCommentsAnswer
- type ItemListed
- type ItemResource
- type ItemResourceIdentifiers
- type ItemResourceMetadata
- type ItemResourceSpec
- type ItemResourceStatus
- type ItemView
- type ItemsAnswer
- type ItemsQuery
- type LeasedProposal
- type LeasedSighting
- type LeasedTask
- type LinkExtractors
- type LinkLanding
- type MarkAnswer
- type MarkRequest
- type MemoQuery
- type OutputView
- type ParseAnswer
- type ParseFinding
- type ParsePickQuery
- type PlaceRequest
- type PlacementAnswer
- type PromoteRequest
- type PromotionAnswer
- type PushAnswer
- type PushRequest
- type PushedItem
- type Refusal
- type ReleaseAnswer
- type Repeat
- type ReplayAnswer
- type ReplayRequest
- type Replayable
- type ReportArrival
- type ReportDelivery
- type ReportMetrics
- type ReportOutput
- type ReportPage
- type ReportRequest
- type RetireRuleRequest
- type ReviewAnswer
- type ReviewChoice
- type ReviewComments
- type ReviewDestination
- type ReviewGuess
- type ReviewItem
- type ReviewRule
- type ReviewSighting
- type Route
- type RouteTypes
- type Router
- type Routes
- func BlobRoutes(l *landing.Lander, log *slog.Logger) Routes
- func ConnectorRoutes(cfg ConnectorConfig) Routes
- func ItemRoutes(st *store.Store, log *slog.Logger) Routes
- func ReplayRoutes(st *store.Store, stages map[string]Replayable, log *slog.Logger) Routes
- func ReviewRoutes(st *store.Store, comments CommentsState, watchDefault string, log *slog.Logger) Routes
- func RoutingRuleRoutes(st *store.Store, log *slog.Logger) Routes
- func TaskRoutes(st *store.Store, lander *landing.Lander, log *slog.Logger, after AfterStage) Routes
- func TrustRoutes(st *store.Store, log *slog.Logger) Routes
- type RoutingRuleAnswer
- type RoutingRuleRequest
- type RoutingRuleView
- type RoutingRulesAnswer
- type RunAnswer
- type SectionView
- type SightingView
- type SlotGroup
- type StageOutput
- type SuggestionFindingView
- type SuggestionView
- type TaskParseAnswer
- type TaskParseQuery
- type TaskResult
- type TaskRetryAnswer
- type TaskView
- type TasksAnswer
- type TasksQuery
- type TokenGate
- type TrustRule
- type UndeliveredView
- type UnpairedAnswer
- type UnpairedFile
- type VersionAnswer
- type WaitingView
Constants ¶
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" // ScopeConnectorsHold admits a caller to hold a connector, which keeps // its polls and every queued task of its items from the claims. ScopeConnectorsHold = "ingestion.connectors.hold" // ScopeConnectorsRelease admits a caller to release a connector's hold // and its first fill. That sends every task they held to the claims, and // spends the model stages on every item the fill held. ScopeConnectorsRelease = "ingestion.connectors.release" // ScopeItemsDrop admits a caller to drop a file into a drop connector. ScopeItemsDrop = "ingestion.items.drop" )
Scopes of the connector routes.
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.
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.
const ( FoundInSource = "source" FoundInSentence = "sentence" )
Where a suggestion's finding was found.
const ( // WaitingFirstFill is a task that a connector's first fill holds. WaitingFirstFill = "first-fill" // WaitingHeld is a task of a connector that a person holds. WaitingHeld = "held" // 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.
const ( // CodeInvalidLink is a url that is not an http or https URL naming a // host, or one that names its artifact only through a redirect, such as a // Reddit share link. CodeInvalidLink = "invalid_link" // CodeLinkNotRead is a link of a kind that no extractor of this build // reads at its source, or a page that no extractor fetches, so the push // stores nothing. CodeLinkNotRead = "link_not_read" // CodeMediaNotRead is a body that is neither a JSON link nor the audio of // a memo in a container that store.MemoMediaTypes names. CodeMediaNotRead = "media_not_read" // CodeMemoTooLarge is a memo past MaxMemoBytes. CodeMemoTooLarge = "memo_too_large" )
Refusal codes of the push route.
const ( // LinkReadAtSource is a link that an extractor reads at its source, such // as a video's, so its item holds no bytes. LinkReadAtSource = "read-at-source" // LinkPage is a link to a web page, whose item's bytes are the page that a // GET of it answers. LinkPage = "page" )
How a link lands.
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.
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.
const ( CodeDestinationNotDeclared = "destination_not_declared" CodeActingForAnother = "acting_for_another" CodeChapterOfBook = "chapter_of_book" CodeDestinationPushOnly = "destination_push_only" CodeDestinationTakesPlaylist = "destination_takes_playlist" CodeChoiceRefused = "choice_refused" )
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. CodeDestinationPushOnly refuses a placement from review on a push-only destination, which only a push places an item at. CodeDestinationTakesPlaylist refuses a placement on a destination whose deliverer adds the item to the playlist that a person picks, which only the watch choice places an item at. CodeChoiceRefused refuses a pick that its choice cannot carry out on the item, such as a watch that names no playlist where serve names no default.
const ( CommentsUnread = "unread" CommentsReading = "reading" CommentsUnclaimed = "unclaimed" CommentsDone = "done" CommentsFailed = "failed" )
The states of a read of an item's comments. Unread is an item whose comments a source reads and that nobody asked about. Unclaimed is a read queued while no worker heard from lately claims its tasks.
const ( ItemsListVersion = 3 ItemVersion = 2 ReviewListVersion = 4 PlacementVersion = 2 )
The schema versions of the answers whose shape more than one writer prints: schemas/items-list.schema.json, item.schema.json, review-list.schema.json and review-placement.schema.json.
const ( CodeRoutingRuleRefused = "routing_rule_refused" CodeRoutingRuleNotFound = "routing_rule_not_found" )
CodeRoutingRuleRefused refuses a rule that the set in force refuses, such as one naming a connector or a destination that it does not declare. CodeRoutingRuleNotFound refuses a retirement of a rule that nobody accepted.
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.
const ( OutcomeDone = "done" OutcomeFailed = "failed" OutcomeRetry = "retry" )
Report outcomes.
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.
const CodeCommentsNotRead = "comments_not_read"
CodeCommentsNotRead refuses a read of the comments of an item whose media type no source that this build carries reads comments of.
const CodeFamilyNotFound = "family_not_found"
CodeFamilyNotFound refuses a promotion naming a family that the store holds no standing of.
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.
const ItemsCollection = "ingestion-items"
ItemsCollection is the key of the collection of ingestion's items, as service-resource-collections-schema.json declares it.
const ItemsOutcomeVersion = 3
ItemsOutcomeVersion is the first version of the items list that gives each item its outcome and reads ?outcome= and ?chapters=. A serve of an earlier version ignores both and answers every item, so a client that filters refuses its answer.
const MaxBlobBytes = 4 << 30
MaxBlobBytes bounds one blob that a worker writes.
const MaxDropBytes = 256 << 20
MaxDropBytes bounds one dropped file. A folder connector takes larger files, such as books, by reference.
const MaxIdempotencyKeyLength = 200
MaxIdempotencyKeyLength is the most characters an Idempotency-Key holds.
const MaxListed = 1000
MaxListed is the most tasks one list answers.
const MaxMemoBytes = 100 << 20
MaxMemoBytes bounds one pushed memo's body, and a body past it answers 413. It holds about 3.5 hours of audio at 64 kbps. The route streams the body to the blob volume, so serve's memory stays flat in the memo's size.
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.
const ScopeCommentsRead = "ingestion.comments.read"
ScopeCommentsRead admits a caller to ask for the read of what an item's top comments say, which costs one model call per item.
const ScopeItemsPush = "ingestion.items.push"
ScopeItemsPush admits a caller to push a link or a memo, such as a phone's client, which holds no other scope.
const ScopeItemsRead = "ingestion.items.read"
ScopeItemsRead admits a caller to read items and their records.
const ScopeItemsReplay = "ingestion.items.replay"
ScopeItemsReplay admits a caller to run a stage again over landed items.
const ScopeRoutingRulesWrite = "ingestion.routing-rules.write"
ScopeRoutingRulesWrite admits a caller to accept or retire a routing rule for a person, who its body may name.
const ScopeTasksClaim = "ingestion.tasks.claim"
ScopeTasksClaim admits a worker to claim tasks, extend their leases and report them.
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 ¶
var ( RouteVersion = Route{ Pattern: "GET /api/v1/version", Scope: ScopeTasksClaim, Repeat: RepeatRead, Types: typesOf[VersionAnswer]("showVersion", "The version of the serve that answers"), } RouteTaskClaims = Route{ Pattern: "POST /api/v1/tasks/claims", Scope: ScopeTasksClaim, Repeat: RepeatOnce, Types: typesOf[ClaimAnswer]("claimTasks", "Lease the tasks that a worker's capabilities take").taking(reflect.TypeFor[ClaimRequest]()), } RouteTaskHeartbeats = Route{ Pattern: "POST /api/v1/tasks/{id}/heartbeats", Scope: ScopeTasksClaim, Repeat: RepeatByContent, Types: typesOf[TaskView]("heartbeatTask", "Extend the lease that a worker holds on a task").taking(reflect.TypeFor[HeartbeatRequest]()), } RouteTaskReports = Route{ Pattern: "POST /api/v1/tasks/{id}/reports", Scope: ScopeTasksClaim, Repeat: RepeatByContent, Types: typesOf[TaskView]("reportTask", "End a leased task with what its worker found").taking(reflect.TypeFor[ReportRequest]()), } RouteTaskParse = Route{ Pattern: "GET /api/v1/tasks/{id}/parse", Scope: ScopeTasksClaim, Repeat: RepeatRead, Types: typesOf[TaskParseAnswer]("showTaskParse", "The newest done parse of the item whose task the caller leases").reading(reflect.TypeFor[TaskParseQuery]()), } RouteTaskRetries = Route{ Pattern: "POST /api/v1/tasks/{id}/retries", Scope: "", Repeat: RepeatByContent, Types: typesOf[TaskRetryAnswer]("retryTask", "Queue a failed task again"), } RouteTasks = Route{ Pattern: "GET /api/v1/tasks", Scope: "", Repeat: RepeatRead, Types: typesOf[TasksAnswer]("listTasks", "The tasks in the states asked for, and the workers heard from").reading(reflect.TypeFor[TasksQuery]()), } RouteBlob = Route{ Pattern: "GET /api/v1/blobs/{sha256}", Scope: ScopeTasksClaim, Repeat: RepeatRead, Untyped: "it answers an artifact's bytes rather than JSON", } RouteBlobWrite = Route{ Pattern: "PUT /api/v1/blobs/{sha256}", Scope: ScopeTasksClaim, Repeat: RepeatByContent, Untyped: "it takes an artifact's bytes rather than JSON", } RouteBlobsUnpaired = Route{ Pattern: "GET /api/v1/blobs/unpaired", Scope: "", Repeat: RepeatRead, Types: typesOf[UnpairedAnswer]("listUnpairedBlobs", "Each blob that no row names, and each row whose bytes are gone"), } RouteItems = Route{ Pattern: "GET /api/v1/items", Scope: ScopeItemsRead, Repeat: RepeatRead, Types: typesOf[ItemsAnswer]("listItems", "A page of items, newest first").reading(reflect.TypeFor[ItemsQuery]()), } RouteItemsPush = Route{ Pattern: "POST /api/v1/items", Scope: ScopeItemsPush, Repeat: RepeatKeyed, Types: typesOf[PushAnswer]("pushItem", "Land a link through a push connector. A memo's audio lands here too, as its body rather than JSON"). taking(reflect.TypeFor[PushRequest]()).takingBytes("A memo's recording, M4A, MP3 or WAV, which the route tells by its opening bytes whatever the Content-Type"). reading(reflect.TypeFor[MemoQuery]()).answering(http.StatusCreated), } RouteItem = Route{ Pattern: "GET /api/v1/items/{key}", Scope: ScopeItemsRead, Repeat: RepeatRead, Types: typesOf[ItemAnswer]("showItem", "One item with every record of it, or the item as a resource").servingResource(reflect.TypeFor[ItemResource]()), } RouteItemParse = Route{ Pattern: "GET /api/v1/items/{key}/parse", Scope: ScopeItemsRead, Repeat: RepeatRead, Types: typesOf[ParseAnswer]("showItemParse", "The item's newest done parse, or the one that the query picks").reading(reflect.TypeFor[ParsePickQuery]()), } RouteReplays = Route{ Pattern: "POST /api/v1/replays", Scope: ScopeItemsReplay, Repeat: RepeatKeyed, Types: typesOf[ReplayAnswer]("replayStage", "Run a stage again over the items a replay selects, or estimate a model stage's replay"). taking(reflect.TypeFor[ReplayRequest]()).answering(http.StatusCreated), } RouteDeclarations = Route{ Pattern: "PUT /api/v1/declarations", Scope: ScopeDeclarationsApply, Repeat: RepeatByContent, Types: typesOf[DeclarationsAnswer]("applyDeclarations", "Put a declaration set in force").taking(reflect.TypeFor[DeclarationsRequest]()), } RouteConnectors = Route{ Pattern: "GET /api/v1/connectors", Scope: ScopeConnectorsRead, Repeat: RepeatRead, Types: typesOf[ConnectorsAnswer]("listConnectors", "Each connector in the set in force"), } RouteConnector = Route{ Pattern: "GET /api/v1/connectors/{name}", Scope: ScopeConnectorsRead, Repeat: RepeatRead, Types: typesOf[ConnectorView]("showConnector", "One connector in the set in force"), } RouteConnectorRuns = Route{ Pattern: "POST /api/v1/connectors/{name}/runs", Scope: ScopeConnectorsRun, Repeat: RepeatKeyed, Types: typesOf[RunAnswer]("runConnector", "Run a scheduled connector now").answering(http.StatusCreated, http.StatusAccepted), } RouteConnectorHold = Route{ Pattern: "POST /api/v1/connectors/{name}/hold", Scope: ScopeConnectorsHold, Repeat: RepeatByContent, Types: typesOf[HoldAnswer]("holdConnector", "Hold a connector's model stages for a person"), } RouteConnectorRelease = Route{ Pattern: "POST /api/v1/connectors/{name}/release", Scope: ScopeConnectorsRelease, Repeat: RepeatByContent, Types: typesOf[ReleaseAnswer]("releaseConnector", "Lift a connector's hold and release its first fill"), } RouteConnectorDrops = Route{ Pattern: "POST /api/v1/connectors/{name}/drops", Scope: ScopeItemsDrop, Repeat: RepeatKeyed, Untyped: "it takes a drop's file in the format its connector declares rather than JSON", } RouteReview = Route{ Pattern: "GET /api/v1/review", Scope: ScopeReviewRead, Repeat: RepeatRead, Types: typesOf[ReviewAnswer]("listReview", "Each item that waits on a person, the longest waiting first"), } RouteReviewPlace = Route{ Pattern: "POST /api/v1/review/{key}/place", Scope: ScopeReviewPlace, Repeat: RepeatByContent, Types: typesOf[PlacementAnswer]("placeItem", "Place an item by a review choice or on a destination").taking(reflect.TypeFor[PlaceRequest]()), } RouteReviewArchive = Route{ Pattern: "POST /api/v1/review/{key}/archive", Scope: ScopeReviewPlace, Repeat: RepeatByContent, Types: typesOf[PlacementAnswer]("archiveItem", "Keep an item on the personal side with no destination").taking(reflect.TypeFor[ArchiveRequest]()), } RouteReviewDrop = Route{ Pattern: "POST /api/v1/review/{key}/drop", Scope: ScopeReviewPlace, Repeat: RepeatByContent, Types: typesOf[PlacementAnswer]("dropItem", "Drop an item from review").taking(reflect.TypeFor[DropRequest]()), } RouteGateAgreement = Route{ Pattern: "GET /api/v1/gates/agreement", Scope: ScopeItemsRead, Repeat: RepeatRead, Untyped: "package accuracy owns its answer", } RouteItemMarks = Route{ Pattern: "POST /api/v1/items/{key}/marks", Scope: ScopeMarksWrite, Repeat: RepeatByContent, Types: typesOf[MarkAnswer]("markItem", "Mark an item low-quality or read").taking(reflect.TypeFor[MarkRequest]()), } RouteItemComments = Route{ Pattern: "POST /api/v1/items/{key}/comments", Scope: ScopeCommentsRead, Repeat: RepeatByContent, Types: typesOf[ItemCommentsAnswer]("readItemComments", "Ask for the read of an item's top comments, and how it stands"), } RouteGateTrust = Route{ Pattern: "GET /api/v1/gates/trust", Scope: ScopeItemsRead, Repeat: RepeatRead, Types: typesOf[GateTrustAnswer]("listGateTrust", "The trust ladder, and each quality gate family's standing on it"), } // RouteGateTrustPromote's family is <connector>@<prompt version>@<model>@<effort>. RouteGateTrustPromote = Route{ Pattern: "POST /api/v1/gates/trust/{family}/promote", Scope: ScopeTrustPromote, Repeat: RepeatByContent, Types: typesOf[PromotionAnswer]("promoteGateFamily", "Promote a quality gate family a rung").taking(reflect.TypeFor[PromoteRequest]()), } RouteGateProposals = Route{ Pattern: "GET /api/v1/gates/proposals", Scope: ScopeItemsRead, Repeat: RepeatRead, Untyped: "package promptproposal owns its answer", } RouteRoutingRules = Route{ Pattern: "GET /api/v1/routing-rules", Scope: ScopeItemsRead, Repeat: RepeatRead, Types: typesOf[RoutingRulesAnswer]("listRoutingRules", "The newest version of each routing rule that a person accepted"), } RouteRoutingRule = Route{ Pattern: "PUT /api/v1/routing-rules/{name}", Scope: ScopeRoutingRulesWrite, Repeat: RepeatByContent, Types: typesOf[RoutingRuleAnswer]("putRoutingRule", "Write a version of an accepted routing rule").taking(reflect.TypeFor[RoutingRuleRequest]()), } RouteRoutingRuleRetire = Route{ Pattern: "POST /api/v1/routing-rules/{name}/retire", Scope: ScopeRoutingRulesWrite, Repeat: RepeatByContent, Types: typesOf[RoutingRuleAnswer]("retireRoutingRule", "Retire an accepted routing rule").taking(reflect.TypeFor[RetireRuleRequest]()), } )
The route table. Each package registers its rows with Router.Handle, and a client sends through the row of the route it calls.
var ReplayStages = []string{ store.StageParse, store.StageStructure, store.StageContents, store.StageScan, store.StageTopics, store.StageQuality, store.StageQualityArm, store.StageModelRead, store.StageDeliver, }
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 Claimed ¶ added in v0.33.0
Claimed is each capability that a worker heard from within WorkersHeardWithin holds, so a queued task of any other waits on no worker.
func GateConfig ¶
GateConfig is the token check for issuer, accepting this product's person and service clients.
func 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 SniffMemo ¶ added in v0.37.0
SniffMemo is the media type of a memo whose body opens with head, and false where head opens none of store.MemoMediaTypes: an MP4 whose ftyp box names an audio brand, an MP3 that opens with its ID3 tag or a frame, or a RIFF WAVE. The route reads the bytes rather than the Content-Type, because a phone's share may name no type or the wrong one.
func ValidCause ¶
ValidCause reports whether cause is spelled as the place and drop routes take one.
Types ¶
type AfterStage ¶
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 ArchiveRequest ¶ added in v0.43.0
type ArchiveRequest struct {
Liked string `json:"liked,omitempty"`
Login string `json:"login,omitempty"`
Presented *store.Presented `json:"presented,omitempty"`
DecidedAfterMS *int64 `json:"decided_after_ms,omitempty"`
}
ArchiveRequest archives an item: done, its record kept with no destination, and the read mark written where the caller may write marks. Liked names what the person liked, one of route.Likes, and an archive that names none is kept as unstated. Login, Presented and DecidedAfterMS are a PlaceRequest's.
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 CommentsState ¶ added in v0.33.0
type CommentsState func(r store.ItemRecords, claimed map[string]bool) *ReviewComments
CommentsState is how the read of an item's comments stands in its records, given each capability that a live worker claims, and nil where no source of this build reads the item's comments. The comments stage answers it, so the review list reports the state that its route acts on.
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
// Links answers whether an extractor reads a pushed link, or fetches the
// page that it names. Nil lands none.
Links LinkExtractors
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 is nil for a push connector, whatever the stored set holds, because
// the route sets each item's zone by what the push carries: a link lands
// outside, and a memo as the owner's.
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"`
// HeldTS is when a person held the connector, and HoldDecidedBy who held
// it. Both are null while it is not held.
HeldTS *string `json:"held_ts"`
HoldDecidedBy *string `json:"hold_decided_by"`
// HeldTasks counts the queued tasks held by the connector, through a
// person's hold or its first fill.
HeldTasks int `json:"held_tasks"`
// 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 DecidedView ¶ added in v0.45.0
type DecidedView struct {
Gate string `json:"gate"`
Verdict string `json:"verdict"`
Decider string `json:"decider"`
DecidedBy string `json:"decided_by"`
Rule *string `json:"rule"`
Confidence *float64 `json:"confidence"`
Cause string `json:"cause"`
Destination *string `json:"destination"`
Playlist *string `json:"playlist"`
DecidedTS string `json:"decided_ts"`
}
DecidedView is the decision that left an item at its outcome: its gate and verdict, who made it, as store.Decision.Decider names them and as decided_by spells it, the rule's name where a rule made it, why, the destination and playlist it placed the item on, and when.
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"`
Playlist *string `json:"playlist"`
LikedMatch *store.RuleMatch `json:"liked_match"`
ClientID *string `json:"client_id"`
Presented *store.Presented `json:"presented"`
DecidedAfterMS *int64 `json:"decided_after_ms"`
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"`
Playlist *string `json:"playlist"`
// 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"`
Presented *store.Presented `json:"presented,omitempty"`
DecidedAfterMS *int64 `json:"decided_after_ms,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. A drop for low-quality also writes the low-quality mark where the caller may write marks. Presented and DecidedAfterMS are a PlaceRequest's.
type FindingView ¶
FindingView is one scanner finding and the text it matched.
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 ¶
HeartbeatRequest extends a lease by LeaseSeconds from now.
type HoldAnswer ¶ added in v0.38.0
type HoldAnswer struct {
SchemaVersion int `json:"schema_version"`
Connector string `json:"connector"`
// HeldTS and HoldDecidedBy are the first hold's, which a second hold
// keeps.
HeldTS string `json:"held_ts"`
HoldDecidedBy string `json:"hold_decided_by"`
// Held counts the queued tasks held by the connector now.
Held int `json:"held"`
}
HoldAnswer is what POST /api/v1/connectors/{name}/hold answers: schemas/connector-hold.schema.json.
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"`
// Progress is the parse's and the scan's progress, as
// store.ItemRecords.Progress reads it from their tasks and outputs.
Progress []store.StageProgress `json:"progress"`
// 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 ItemCommentsAnswer ¶ added in v0.33.0
type ItemCommentsAnswer struct {
SchemaVersion int `json:"schema_version"`
Key string `json:"key"`
Comments ReviewComments `json:"comments"`
}
ItemCommentsAnswer is what POST /api/v1/items/{key}/comments answers: schemas/item-comments.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"`
// Channel is who published the item, as its sightings name it, and null
// where none does.
Channel *string `json:"channel"`
Phase string `json:"phase"`
WaitingAt *string `json:"waiting_at"`
Side *string `json:"side"`
// Outcome is where the item's decisions leave it, as
// store.ItemRecords.Outcome decides it, and Decided the decision that left
// it there, null where it waits.
Outcome string `json:"outcome"`
Decided *DecidedView `json:"decided"`
// ReviewReason is why the item waits in review, as route.ReviewReasons
// names it, and null where it waits on no person.
ReviewReason *string `json:"review_reason"`
CreatedTS string `json:"created_ts"`
}
ItemListed is one item as the list shows it.
type ItemResource ¶ added in v0.53.0
type ItemResource struct {
SchemaVersion int `json:"schema_version"`
Kind string `json:"kind"`
Name string `json:"name"`
Metadata ItemResourceMetadata `json:"metadata"`
Spec ItemResourceSpec `json:"spec"`
Status ItemResourceStatus `json:"status"`
}
ItemResource is an item as resource-shape-schema.json holds it. GET /api/v1/items/{key} answers it where Accept names gofleetresources.MediaType.
type ItemResourceIdentifiers ¶ added in v0.53.0
type ItemResourceIdentifiers struct {
IngestionItem string `json:"ingestion-item"`
Flow string `json:"flow,omitempty"`
}
ItemResourceIdentifiers is each identity of an item that another store joins on, under its name in identifiers-shared-across-stores-schema.json.
type ItemResourceMetadata ¶ added in v0.53.0
type ItemResourceMetadata struct {
// Created is when the item landed.
Created time.Time `json:"created"`
// Updated is the newest of when the item's row, a sighting, an output and a
// decision changed.
Updated time.Time `json:"updated"`
// Owners names the item's parent: a chapter's book, or a topic's memo.
Owners []string `json:"owners,omitempty"`
Identifiers ItemResourceIdentifiers `json:"identifiers"`
}
ItemResourceMetadata is what an item carries as every resource does, in UTC.
type ItemResourceSpec ¶ added in v0.53.0
type ItemResourceSpec struct {
Key string `json:"key"`
MediaType string `json:"media_type"`
Zone store.Zone `json:"zone"`
Title string `json:"title,omitempty"`
URL string `json:"url,omitempty"`
// SourceTS is when the artifact was made at its source, where the source
// gives a time.
SourceTS time.Time `json:"source_ts,omitzero"`
// Connectors names each connector that sighted the item, first first.
Connectors []string `json:"connectors"`
}
ItemResourceSpec is what the item's source gave it as it landed.
type ItemResourceStatus ¶ added in v0.53.0
type ItemResourceStatus struct {
State string `json:"state"`
Conditions []gofleetresources.Condition `json:"conditions"`
// Children names each item the item produced: a book's chapters and a
// memo's topics.
Children []string `json:"children,omitempty"`
// Outcome is where the item's decisions leave it, as store.Outcomes names
// it.
Outcome string `json:"outcome"`
// Side is the side that the item's newest side decision placed it on.
Side string `json:"side,omitempty"`
// WaitingAt names the model stage where the item waits.
WaitingAt string `json:"waiting_at,omitempty"`
// ReviewReason is why the item waits in review, as route.ReviewReasons
// names it.
ReviewReason string `json:"review_reason,omitempty"`
}
ItemResourceStatus is where the item stands: its phase as its state, the conditions derived from its records on this read, and where its decisions leave 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 ItemsQuery ¶ added in v0.53.0
type ItemsQuery struct {
// After is the next cursor that an earlier page answered, and the page after it answers.
After string `json:"after,omitempty"`
// Outcome keeps the items at one outcome, as store.Outcomes names them.
Outcome string `json:"outcome,omitempty"`
// Chapters keeps each chapter of a book, which the list leaves out without it.
Chapters bool `json:"chapters,omitempty"`
// Limit caps the page at 1 or more. DefaultItemsListed caps it where it names none, and
// MaxItemsListed caps every page.
Limit *int `json:"limit,omitempty"`
}
ItemsQuery is what GET /api/v1/items reads from its query.
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"`
// FlowID is the flow of the task's item, a W3C trace id, which each call
// that the task makes for the item carries in its traceparent. A task
// that names no item carries none.
FlowID string `json:"flow_id,omitempty"`
Connector *string `json:"connector"`
Source *string `json:"source,omitempty"`
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"`
// Playlist is a watch's deliver task's: the playlist that the delivery
// adds the video to, kept the same way. Every other task carries none.
Playlist *string `json:"playlist,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"`
// Parse is the done parse that the prompt of a model stage's task quotes,
// as the claim read it: the item's reading parse, or the one extractor's
// that the stage reads. The task's call reads it, and its output names it.
// It is absent where the stage quotes no parse or the item holds none.
Parse *store.ParseRef `json:"parse,omitempty"`
// Lens, Note and NoteDraft are a model read's task's: the lens of the
// item's newest read decision, the note that a person wrote on it, and
// the note stage's draft where the decision took one instead. A draft
// never rides in Note, so a reader that knows only Note never reads a
// model's draft as the owner's. A note task carries Lens alone, and every
// other task none of them.
Lens *string `json:"lens,omitempty"`
Note *string `json:"note,omitempty"`
NoteDraft *string `json:"note_draft,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"`
// Keys are a refresh-metrics task's: the key of each item in review that
// a connector of its source sighted, as the claim read them, whose
// metrics the task reads again. Every other task carries none.
Keys []string `json:"keys,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. A refresh of a source's metrics names its source, and its capability is refresh-metrics:<source>.
func (LeasedTask) Answers ¶ added in v0.32.0
func (t LeasedTask) Answers() *string
Answers is the note that a model read's task answers: the person's note where the task carries one, the draft otherwise, and nil with neither.
type LinkExtractors ¶ added in v0.31.0
type LinkExtractors interface {
// LinkLanding is how the link keyed key lands, where link is its
// canonical URL.
LinkLanding(key, link string) LinkLanding
// LinkKinds names, in order, each kind of key whose link an extractor
// reads.
LinkKinds() []string
// PageMediaType is the media type that a link to a web page lands as,
// with no bytes, so that its parse fetches the page. It is false where no
// extractor fetches pages.
PageMediaType() (string, bool)
}
LinkExtractors answers whether an extractor reads a pushed link at its source, or fetches the web page that it names, and as what media type and URL it lands.
type LinkLanding ¶ added in v0.40.0
type LinkLanding struct {
// Lands is LinkReadAtSource or LinkPage, and "" where the link does not
// land.
Lands string
// MediaType and URL are what the item lands as, where the link lands.
MediaType, URL string
// Site is the kind of key whose site hosts a link that does not land,
// such as youtube for a channel's page, and "" otherwise.
Site string
}
LinkLanding is how a link lands as an item, as the extractors of a build read it. The push route and a feed's poll both ask it, so a link lands alike whichever connector meets it first.
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
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 MemoQuery ¶ added in v0.53.0
type MemoQuery struct {
// Connector names the push connector that the memo lands through, such as phone. A memo names
// one, and a link names its connector in its body instead.
Connector string `json:"connector,omitempty"`
// RecordedAt is when the memo was recorded, as an RFC 3339 time, and becomes the item's source
// time.
RecordedAt string `json:"recorded_at,omitempty"`
}
MemoQuery is what POST /api/v1/items reads from its query where its body is a memo's recording.
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"`
InputProducer *string `json:"input_producer"`
InputVersion *string `json:"input_version"`
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 ¶
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 ParsePickQuery ¶ added in v0.53.0
type ParsePickQuery struct {
// Extractor keeps the parses that one extractor wrote, such as pdf-text.
Extractor string `json:"extractor,omitempty"`
// Version keeps the parses at one extractor version.
Version string `json:"version,omitempty"`
}
ParsePickQuery is what a parse route reads from its query to pick one parse of the item.
type PlaceRequest ¶
type PlaceRequest struct {
Destination string `json:"destination,omitempty"`
Choice string `json:"choice,omitempty"`
Playlist string `json:"playlist,omitempty"`
Cause string `json:"cause,omitempty"`
Note *string `json:"note,omitempty"`
Login string `json:"login,omitempty"`
Presented *store.Presented `json:"presented,omitempty"`
DecidedAfterMS *int64 `json:"decided_after_ms,omitempty"`
}
PlaceRequest places an item on Destination, one the set in force declares, or by Choice, one of review's placing choices, and names one of the two. Playlist is the playlist that a watch adds the video to, and a watch that names none takes serve's [watch] default_playlist. 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. Presented is the review card as drawn when the person decided, and DecidedAfterMS how long after the drawing they decided, which a client that drew no card leaves out.
type PlacementAnswer ¶
type PlacementAnswer struct {
SchemaVersion int `json:"schema_version"`
Key string `json:"key"`
Decisions []DecisionView `json:"decisions"`
}
PlacementAnswer is what a placement, an archive 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 PushRequest ¶ added in v0.31.0
type PushRequest struct {
// Connector names the push connector that the link arrives through, one
// that the set in force declares.
Connector string `json:"connector"`
// URL is the link, an http or https URL naming a host.
URL string `json:"url"`
// Destination is where the person places the item, one that the set in
// force declares. Empty leaves the item to the gates.
Destination string `json:"destination,omitempty"`
}
PushRequest is what POST /api/v1/items reads as a link.
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 Refusal ¶ added in v0.53.0
type Refusal struct {
Error string `json:"error"`
Message string `json:"message"`
Code string `json:"code"`
Field string `json:"field,omitempty"`
}
Refusal is the body of every answer that refuses a request, as goapiauth's own refusals write it. A client branches on Code, and Message is for a person. A refusal of a body field the route does not read names it in Field. Some refusals carry more fields beside these, which a client reads where it knows them.
type ReleaseAnswer ¶ added in v0.38.0
type ReleaseAnswer struct {
SchemaVersion int `json:"schema_version"`
Connector string `json:"connector"`
// Released counts the held queued tasks that this request returned to the
// claims, which is 0 for a connector already released.
Released int `json:"released"`
}
ReleaseAnswer is what POST /api/v1/connectors/{name}/release answers: schemas/connector-release.schema.json.
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"`
// BlobSHA256 names the item's bytes, which the worker kept through the
// blob route before it reported the arrival, such as a page's HTML.
BlobSHA256 *string `json:"blob_sha256,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 ReportMetrics ¶ added in v0.30.0
ReportMetrics is one item's metrics as a refresh read them again at its source, by name, such as a video's views. serve writes them onto each sighting of the item by a connector of the task's source, and stamps when they were read. It changes nothing else of the sighting.
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"`
Fit *int `json:"fit,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 ReportPage ¶ added in v0.40.0
type ReportPage struct {
BlobSHA256 string `json:"blob_sha256"`
Title string `json:"title,omitempty"`
MediaType string `json:"media_type,omitempty"`
}
ReportPage is the page that a parse GET at its item's URL, because the item held no bytes, and kept through the blob route before it reported. serve makes it the item's bytes in the write that ends the lease, whatever the parse's outcome, where the item still holds none. Title is the page's own title, which fills an item that holds no title, and is outsider text. MediaType is the type that the item takes where the page is not of the type that the item landed as, such as a PDF. The item's parse is then the parse of that type's extractor, and MediaType is "" otherwise.
type ReportRequest ¶
type ReportRequest struct {
Token int64 `json:"token"`
RetryAfterSeconds int `json:"retry_after_seconds,omitempty"`
TaskResult
}
ReportRequest ends a lease with the result of the task's run, under the token that holds the lease. A retry's wait travels in whole seconds.
type RetireRuleRequest ¶ added in v0.34.0
type RetireRuleRequest struct {
Login string `json:"login,omitempty"`
}
RetireRuleRequest retires a routing rule, for the person a service names.
type ReviewAnswer ¶
type ReviewAnswer struct {
SchemaVersion int `json:"schema_version"`
Items []ReviewItem `json:"items"`
Destinations []ReviewDestination `json:"destinations"`
Choices []ReviewChoice `json:"choices"`
WatchDefaultPlaylist *string `json:"watch_default_playlist"`
}
ReviewAnswer is what GET /api/v1/review answers: schemas/review-list.schema.json. Destinations are those a placement by destination takes, in the order the set in force declares them, and Choices each of review's choices with the destination it places on. Both are nil where the set in force could not be read. WatchDefaultPlaylist is the playlist a watch takes where the pick names none, and nil where serve names none.
type ReviewChoice ¶ added in v0.43.0
type ReviewChoice struct {
Choice string `json:"choice"`
Side *string `json:"side"`
Destination *string `json:"destination"`
Playlist bool `json:"playlist"`
RunsHere bool `json:"runs_here"`
Missing *string `json:"missing"`
}
ReviewChoice is one of review's choices under the set in force: the side and the destination it places an item on, each nil for archive and drop, whether its pick names a playlist, whether the client that picks it runs psyche relate on its own machine, and why it places nothing where the set declares no destination it takes.
type ReviewComments ¶ added in v0.33.0
type ReviewComments struct {
State string `json:"state"`
Answer json.RawMessage `json:"answer"`
TaskID *string `json:"task_id"`
Error *string `json:"error"`
}
ReviewComments is how the read of an item's comments stands, and its answer once done. The answer is a model's over outsider text.
type ReviewDestination ¶
ReviewDestination is a declared destination and the side it gives an item. Side is null where the destination drops what it takes.
type ReviewGuess ¶
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"`
// Rule is the routing rule that would have decided an item that waits as
// rule-would-hide, and nil under any other reason.
Rule *ReviewRule `json:"rule"`
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"`
// NoteDraft is the note stage's newest done draft as the store keeps it,
// and null where none was drafted.
NoteDraft json.RawMessage `json:"note_draft"`
// MediaType is the item's, and SourceTS when its artifact was made at its
// source, such as a video's upload, and null where the source gave none.
MediaType string `json:"media_type"`
SourceTS *string `json:"source_ts"`
// Channel is who published the item, as its sightings name it, such as a
// video's channel or a save's subreddit as r/<name>, and null where none
// does. ChannelFields are the sighting fields that a drop decided by the
// channel stands for, empty where a drop names the channel's field as its
// own cause.
Channel *string `json:"channel"`
ChannelFields []string `json:"channel_fields"`
// LengthS is how long the item runs in seconds, and Views, Likes and
// CommentCount how it was received, each null where no sighting carries
// it.
LengthS *int64 `json:"length_s"`
Views *int64 `json:"views"`
Likes *int64 `json:"likes"`
CommentCount *int64 `json:"comment_count"`
// Comments is how the read of what the item's top comments say stands,
// and nil where no source of this build reads the item's comments.
Comments *ReviewComments `json:"comments"`
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 ReviewRule ¶ added in v0.34.0
ReviewRule is the routing rule whose review share drew an item: its name, and the destination that a keep would place it on, which is nil where a block would drop it.
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
Types *RouteTypes
Untyped string
}
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, what a repeat does, and the types it reads and answers. An empty scope admits a person's token alone. A row names its Types, or says in Untyped why openapi.json leaves it out, and never both.
type RouteTypes ¶ added in v0.53.0
type RouteTypes struct {
// contains filtered or unexported fields
}
RouteTypes is what one route reads and answers, by its Go types. A test reflects them into openapi.json, which the client module is generated from, and checks each typed route's real answer against that document.
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. h reads its query and body through readQuery and decode, which hold it to the types that its row names.
type Routes ¶
type Routes func(*Router)
Routes registers one package's routes.
func BlobRoutes ¶
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, run, hold and release each connector, drop a file and push a link or a memo.
func ItemRoutes ¶
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 ¶
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, comments CommentsState, watchDefault string, log *slog.Logger) Routes
ReviewRoutes are the routes for a person, or a service acting for one, to read the review queue, and place, archive or drop an item. A placement, an archive or a drop sent again with the same body appends nothing. watchDefault is the playlist that a watch takes where its pick names none, and "" where serve names none.
func RoutingRuleRoutes ¶ added in v0.34.0
RoutingRuleRoutes are the routes for a person, or a service acting for one, to accept a routing rule, retire one, and read each rule's newest version. A write sent again with the same body appends nothing.
func TaskRoutes ¶
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
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 RoutingRuleAnswer ¶ added in v0.34.0
type RoutingRuleAnswer struct {
SchemaVersion int `json:"schema_version"`
Rule RoutingRuleView `json:"rule"`
Appended bool `json:"appended"`
}
RoutingRuleAnswer is what a write of a routing rule answers: schemas/routing-rule-version.schema.json.
type RoutingRuleRequest ¶ added in v0.34.0
type RoutingRuleRequest struct {
Action string `json:"action"`
Match connectors.Match `json:"match"`
Destination string `json:"destination,omitempty"`
Login string `json:"login,omitempty"`
Proposal string `json:"proposal,omitempty"`
}
RoutingRuleRequest accepts a routing rule: schemas/routing-rules.schema.json#/$defs/accepted. A service writing it for a person names the person's Login, and writes it as its own where it names none.
type RoutingRuleView ¶ added in v0.34.0
type RoutingRuleView struct {
Name string `json:"name"`
Sequence int `json:"sequence"`
Action string `json:"action"`
Match connectors.Match `json:"match"`
Destination *string `json:"destination"`
Retired bool `json:"retired"`
Proposal *string `json:"proposal"`
DecidedBy string `json:"decided_by"`
ClientID *string `json:"client_id"`
DecidedTS string `json:"decided_ts"`
}
RoutingRuleView is one version of an accepted routing rule: schemas/routing-rules.schema.json#/$defs/version.
type RoutingRulesAnswer ¶ added in v0.34.0
type RoutingRulesAnswer struct {
SchemaVersion int `json:"schema_version"`
Rules []RoutingRuleView `json:"rules"`
}
RoutingRulesAnswer is what GET /api/v1/routing-rules answers: schemas/routing-rules-list.schema.json.
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"`
// MetricsReadTS is when the metrics were last taken from the source, by
// an arrival or by a refresh of an item in review, and null where no read
// stamped them.
MetricsReadTS *string `json:"metrics_read_ts"`
}
SightingView is one connector's arrival of the item.
type SlotGroup ¶ added in v0.29.0
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"`
InputProducer *string `json:"input_producer"`
InputVersion *string `json:"input_version"`
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 over which parse, 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"`
// Summary is the same read's summary, and nil where it answered a
// suggestion alone. The scanner reads only the sentence.
Summary *string `json:"summary"`
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 TaskParseQuery ¶ added in v0.53.0
type TaskParseQuery struct {
// Token is the lease token of the task, which the claim that leased it answered.
Token int64 `json:"token"`
ParsePickQuery
}
TaskParseQuery is what GET /api/v1/tasks/{id}/parse reads from its query.
type TaskResult ¶ added in v0.40.0
type TaskResult struct {
// Outcome is OutcomeDone, OutcomeFailed or OutcomeRetry.
Outcome string `json:"outcome"`
Error *string `json:"error,omitempty"`
// RetryAfter is how long a retry waits before its next claim. The report
// carries it as RetryAfterSeconds.
RetryAfter time.Duration `json:"-"`
// Wait marks a retry that waits on the far end, or on a stopping worker,
// rather than one that a fault in the run caused. Such a retry spends no
// attempt, and the service counts how long the task has waited since the
// first, as the claim's waited_seconds.
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"`
Metrics []ReportMetrics `json:"metrics,omitempty"`
// Page is the page that a parse fetched and kept for an item that held
// no bytes, which the service makes the item's bytes.
Page *ReportPage `json:"page,omitempty"`
}
TaskResult is how a worker's run of a task ended, as its handler answers it and its report carries it. 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. Metrics are what a refresh of a source's metrics read again, however it ended, so a refresh stopped partway keeps what it read. 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 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"`
// Source names the source whose metrics a refresh-metrics task reads
// again.
Source *string `json:"source"`
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 TasksQuery ¶ added in v0.53.0
type TasksQuery struct {
// State keeps the tasks in each state named, repeated, such as queued or failed.
State []string `json:"state,omitempty"`
// Limit caps the list at 1 to MaxListed tasks.
Limit *int `json:"limit,omitempty"`
// Workers is all to answer every worker, and absent to answer those heard from within
// WorkersHeardWithin.
Workers string `json:"workers,omitempty"`
}
TasksQuery is what GET /api/v1/tasks reads from its query.
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 []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"`
Unnamed []BlobAnswer `json:"unnamed"`
}
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 VersionAnswer ¶ added in v0.53.0
type VersionAnswer struct {
Version string `json:"version"`
}
VersionAnswer is what GET /api/v1/version answers: the version of the serve that answered.
type WaitingView ¶
type WaitingView struct {
Stage string `json:"stage"`
Reason string `json:"reason"`
Capability string `json:"capability"`
// HeldBy is the connector that holds the task, by a person's hold or its
// first fill.
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.