pages

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 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

Index

Constants

View Source
const (
	// ReasonNotReported: the stream has no name to match the gateway's series
	// by, so nothing it reports can be attributed to it.
	ReasonNotReported = metrics.ReasonNotReported

	// ReasonDestinationUnnamed: the manifest could not name where the stream
	// lands, so there is not even a destination to look at.
	ReasonDestinationUnnamed = metrics.ReasonDestinationUnnamed
)

The reasons a stream's health is unknown that the manifest decides. They are machine keys; the app writes the sentence in the reader's language.

View Source
const AttentionShown = 8

AttentionShown is how many failing workflows "Needs your attention" draws. Each one's cause is a read of its last run's log, and a section that reads every log of a bad night is a page that takes a minute; past eight, the list says how many more there are and where.

View Source
const CurlHead = "curl -H 'Authorization: Bearer <key>' "

CurlHead is the curl's fixed start. The key is a placeholder, always: the console's own is never written into a page.

View Source
const DefaultPerPage = 25

DefaultPerPage is the lists' page size. Twenty-five fits a laptop screen without endless scrolling and without forcing a page turn on every glance.

View Source
const FeedShown = 50

FeedShown is how many events the Overview's log draws: the last hours of a busy installation, not its history -- that is what the run list is for.

View Source
const HealthUnknown = metrics.HealthUnknown

HealthUnknown is what the console says when it cannot tell: the static answer below, and the live one (internal/metrics.Assess) when the gateway's /metrics say nothing usable.

View Source
const RecentRuns = 20

RecentRuns is how many of a workflow's last runs its row draws.

Variables

View Source
var InFlight = []string{"running", "queued", "retrying"}

InFlight is what "Running" lists: a run waiting in the queue, or for its retry, is as unfinished as one whose step is going.

View Source
var RuntimeLabels = map[string]string{
	"python": "Python", "go": "Go", "node": "Node.js", "java": "Java", "rust": "Rust",
	"php": "PHP", "ruby": "Ruby", "dotnet": ".NET", "sql": "SQL", "shell": "Shell",
	"dbt": "dbt", "spark": "Spark", "airbyte": "Airbyte", "soda": "Soda",
	"sqlmesh": "SQLMesh", "meltano": "Meltano", "dlt": "dlt", "duckdb": "DuckDB",
	"pandas": "pandas", "polars": "Polars", "airflow": "Airflow",
	"terraform": "Terraform",
}

RuntimeLabels is how a runtime's chip reads, as dag.js's LANG_LABEL writes it (pinned by TestTheStageRulesMatchDagJs). An id not here reads as itself.

View Source
var StageHighlight = []string{"in", "out", "groups", "rows", "pages", "objects"}

StageHighlight is the order the numbers worth showing come in, and dag.js's HIGHLIGHT is the same list (TestTheStageRulesMatchDagJs). Two of them fit a line; the rest are the graph panel's.

View Source
var StageStates = map[string]string{"done": "success", "running": "running", "failed": "failed", "aborted": "canceled"}

StageStates maps a stage's recorded state to the run states' palette, as dag.js's STAGE_STATE_COLORS does. Anything else is pending.

Functions

func AttachStepConfigs

func AttachStepConfigs(entries []postgres.CatalogEntry, configs map[postgres.StepKey]*postgres.WriterConfig)

AttachStepConfigs hangs each step's current configuration on the list's writers, by step and destination; a gateway writer, and a step that described nothing, are left as they are.

func AttachStreamConfigs

func AttachStreamConfigs(entries []postgres.CatalogEntry, configs map[postgres.StreamKey]*postgres.WriterConfig)

AttachStreamConfigs gives each gateway writer its stream's configuration, from the one read of every stream's (the catalog read leaves them out).

func AttemptText

func AttemptText(l postgres.StepLog) string

AttemptText is what an attempt printed, and the engine's own line about how it ended when that line is not already the end of the log. The Logs tab and the downloaded log.txt read it the same way.

func Cell

func Cell(v any) string

Cell is one value, as a grid shows it.

NULL IS NOT THE EMPTY STRING, and this is the last place that can still tell them apart: one is "nothing was recorded" and the other is a value somebody wrote. An em dash for the first, nothing for the second.

func ConfigYAML

func ConfigYAML(c *postgres.WriterConfig) string

ConfigYAML is the stream written back as YAML from what was published: its settings nested by their keys in the order they came, lists as lists, and the file's notes as comments above what they are about. It is not the gateway's file -- its ordering and quoting are the console's -- and the page says so.

func ConnectionOf

func ConnectionOf(target string) string

ConnectionOf is the connection a destination lives on, as `serve` reads it: the first segment after the scheme -- what a missing `brevis.yaml` entry is named by.

func CronMsg added in v0.43.0

func CronMsg(expr string) *i18n.Msg

CronMsg is a cron expression as a sentence for the app to say ("every day at 04:00"), or nil where the words are not sure of it: the caller shows the expression itself.

func DurationCat added in v0.43.0

func DurationCat(s string) i18n.Cat

durationWords is a duration a person says: "1 minute", "500 milliseconds" (a Msg). Anything that is not one whole unit stays as written (a string). DurationCat is durationWords for the API: the duration said, or the raw string, as a Cat (null for none).

func IsWorkflowState

func IsWorkflowState(s string) bool

IsWorkflowState says whether a state is one of the segment's questions; any other is a run state an older link carries.

func NoteHead

func NoteHead(note string) string

NoteHead is a note's first line, which is what a closed note shows.

func NoteRest

func NoteRest(note string) string

NoteRest is everything after the first line, or "" for a one-line note.

func OrderFailing

func OrderFailing(fs []postgres.FailingWorkflow) []postgres.FailingWorkflow

OrderFailing puts what needs the reader first: a workflow failing again and again before one that failed once, and within each, the latest first.

func Queryable

func Queryable(target string) bool

Queryable says this console can read the destination.

func RowsRead

func RowsRead(stages []postgres.Stage) *int64

RowsRead is how many rows a load's step read, from its stages in that load's run (screen-load-v2 LV2): the landing records only what was written. The first map's `in` is what entered the pipeline; with no map, the source's own `rows`. Nil when the stages do not say -- a step without the SDK, or a source that counts pages, not rows.

func SelectFor

func SelectFor(target string) string

SelectFor is a table's first look: every column, a hundred rows, the table named as a build names it -- `schema.table`, with no project or database, which is the connection's. "" for a destination that is not a table this console reads.

func SlotLabel added in v0.43.0

func SlotLabel(s Slot, zone string) i18n.Msg

SlotLabel is a slot as the Run drawer lists it, for the app's JSON.

func SplitTarget

func SplitTarget(t string) (where, what string)

SplitTarget cuts a URI into where and what -- `postgres://brevis_it/` and `public/landing_orders` -- so a table of them can dim the part every row shares. A legacy label (`bronze.payments`) splits at its last dot. Joined, the two halves are the target, character for character.

func StepName

func StepName(node string, mapIndex int) string

StepName is a step as a reader names it: an instance carries its index.

func Summary

func Summary(c *postgres.WriterConfig) i18n.Cat

Summary is a writer's configuration in one sentence -- a gateway stream's or an SDK pipeline's, for somebody who does not read YAML: what comes in, where it goes, how it is written, how often, and where what is refused goes.

WRITTEN FROM THE SETTINGS, NEVER GENERATED. Every word here is a template filled from a field the gateway published, so the sentence is wrong only when the configuration is -- and a setting it has no words for is left out rather than guessed at. The full list is right below it.

func TargetHref

func TargetHref(target string) string

TargetHref is a read target's page: /data/target, which forwards it to the stream or the load that owns it now that Catalog is Streams and Loads.

func TryValues

func TryValues(params []catalog.EndpointParam, q url.Values) url.Values

TryValues are the declared parameters a submitted form carries, the empty ones left out: an empty select is "use the default", which is the API's to apply, and an undeclared name is not forwarded at all.

func WriterLine

func WriterLine(r DataRow) string

WriterLine is who writes a destination, the first writer alone: the palette's hint.

Types

type AlertView added in v0.43.0

type AlertView struct {
	Tone      string     `json:"tone"`
	Wording   i18n.Msg   `json:"wording"`
	Channel   string     `json:"channel"`
	Attempts  int        `json:"attempts"`
	Err       string     `json:"err"`
	CreatedAt time.Time  `json:"createdAt"`
	Delivered *time.Time `json:"deliveredAt"`
}

type Attention

type Attention struct {
	Items []AttentionItem
	// More is how many failing workflows are not drawn.
	More int

	// Targets are the destinations whose data stopped coming; TargetsMore is
	// how many more there are.
	Targets     []TargetItem
	TargetsMore int
}

Attention is what needs the reader (screen-overview): the workflows whose last finished run failed, the most pressing first.

func (Attention) Total

func (a Attention) Total() int

Total is everything that needs the reader, drawn or not.

type AttentionItem

type AttentionItem struct {
	Workflow string
	RunID    uuid.UUID
	FailedAt time.Time
	Streak   int
	Cause    *diagnosis.Cause

	// Rerunnable is whether Rerun is offered -- not for a workflow that is
	// gone -- and Params are the values it sends: the failed run's, as far as
	// the workflow still declares them.
	Rerunnable bool
	Params     map[string]string
	// Rerunning is the workflow's run in flight, if any: then the item says
	// so and links to it instead of offering another.
	Rerunning string
}

AttentionItem is one workflow that failed: when, how many times in a row, and why -- read from that run's log, as its own page reads it.

type AutoItem added in v0.43.0

type AutoItem struct {
	Key          string     `json:"key"`
	Note         i18n.Msg   `json:"note"`
	Value        string     `json:"value"`
	At           *time.Time `json:"at"`
	DelaySeconds *int       `json:"delaySeconds"`
}

AutoItem is one auto param as the grid shows it: its key, what it means (a sentence the app says) and its value as data -- an instant, a lateness in seconds, or a plain Value.

type BarJSON added in v0.43.0

type BarJSON struct {
	RunID string `json:"runId"`
	Rows  *int64 `json:"rows"`
	Title string `json:"title"`
}

BarJSON is one load bar; LoadRecordJSON one row of the recent loads.

type Branch

type Branch struct {
	Target string
	Tree   []Schema
	Cut    bool

	// Open is the relation whose columns are drawn on the server path, and
	// empty on the fragment -- the island opens its own.
	Open string
	Cols []sqlserve.Column
}

Branch is one connection's listing, which the page and the fragment endpoint both draw.

ONE DEFINITION, TWO DOORS. The island asks for a connection's objects over `/api/sql/objects` and the first page view gets the same markup from the template; two pieces of markup for one tree is how the classes, the ARIA and the "this warehouse does not say" drift apart.

type CardJSON added in v0.43.0

type CardJSON struct {
	Key   string             `json:"key"`
	Title i18n.Msg           `json:"title"`
	Rows  []ExplainedRowJSON `json:"rows"`
}

type CatalogScreen

type CatalogScreen struct {
	// Rows are the destinations the filter keeps, worst first.
	Rows   []DataRow
	Filter DataFilter
	// Kinds are the kinds present; HasLegacy whether a legacy row exists.
	Kinds     []string
	HasLegacy bool
	// Total is every destination -- the legacy ones only when asked for --
	// and Shown those the filter keeps.
	Total, Shown int

	Now time.Time

	// Drawer is the destination the URL names (/data/target?u=), drawn open
	// over the list; nil draws none. Missing is a destination it named that
	// nobody writes.
	Drawer  *TargetView
	Missing string
	// contains filtered or unexported fields
}

CatalogScreen is /data (screen-catalog): every destination the ecosystem wrote, worst first, with what the filter keeps.

func BuildCatalog

func BuildCatalog(entries []postgres.CatalogEntry, f DataFilter, now time.Time) CatalogScreen

BuildCatalog judges every destination (BuildData) and keeps what the filter asks for. A legacy row -- a label, not a URI -- is shown only when asked for: it is history, and a list that opens on it buries what is current. The band counts each status with the kind, the search and the legacy switch as they are, so a count cannot disagree with the list its link opens.

func (CatalogScreen) Count

func (v CatalogScreen) Count(status string) int

Count is how many destinations a status choice would show.

type ChangeJSON added in v0.43.0

type ChangeJSON struct {
	At      time.Time        `json:"at"`
	RunID   string           `json:"runId"`
	First   bool             `json:"first"`
	Earlier bool             `json:"earlier"`
	Lines   []ChangeLineJSON `json:"lines"`
}

ChangeJSON is one version in a configuration's history.

type ChangeLine

type ChangeLine struct {
	Path string
	// contains filtered or unexported fields
}

ChangeLine is one setting's change, in words: "1m → 2m".

func (ChangeLine) ChangeText added in v0.43.0

func (l ChangeLine) ChangeText() i18n.Cat

ChangeText is one change as a person reads it, for the app to say.

type ChangeLineJSON added in v0.43.0

type ChangeLineJSON struct {
	Path string   `json:"path"`
	Text i18n.Cat `json:"text"`
}

type ChoiceJSON added in v0.43.0

type ChoiceJSON struct {
	Key   string `json:"key"`
	Label string `json:"label"`
}

ChoiceJSON is one choice of a filter: its key and its words.

type ConfigChange

type ConfigChange struct {
	At    time.Time
	Lines []ChangeLine

	// RunID is the run that first wrote with it, for a step's.
	RunID string

	// First marks the oldest version on record -- where the record begins,
	// with nothing before it to compare. False on the oldest of a history cut
	// at HistoryShown, which is not the first.
	First bool
}

ConfigChange is one version: from when, and what it changed.

type ConfigNote

type ConfigNote struct {
	Label, Text string
}

ConfigNote is a block's comment, by the block's path inside its section.

type ConfigRow

type ConfigRow struct {
	// Path is the setting's full path, and what the page tags the row with.
	Path string

	// Label is the path inside the section: `flush.every` under Buffer.
	Label string

	Value   string
	Default bool
	Note    string

	// List is the value's items when it is a list (`declared.schema`), each
	// as Value would write it; nil otherwise.
	List []string

	// Before are the comments of the blocks this row is the first setting of:
	// `sink.metastore`'s, before `metastore.type`. Shown once, where the block
	// begins, the way the file shows them.
	Before []ConfigNote
}

ConfigRow is one setting.

type ConfigSection

type ConfigSection struct {
	Key string

	// Note is the comment on the block's own key.
	Note string

	Rows []ConfigRow
}

ConfigSection is one block of settings: `buffer`, `sink`. Settings with no block of their own -- name, path, format -- are the "Stream" section.

func (ConfigSection) TitleMsg added in v0.43.0

func (s ConfigSection) TitleMsg() *i18n.Msg

TitleMsg is a block's key as a heading for the blocks every writer has: `dead_letter` is "Dead letter". A block somebody adds tomorrow has none, and the app makes a heading of its key.

type ConfigView

type ConfigView struct {

	// Note is the comment on the writer as a whole -- for a gateway, the one
	// above `- name:`, which is usually the contract its producers follow.
	Note     string
	Sections []ConfigSection

	// Changes are the writer's configurations over time, newest first, each
	// with what it changed from the one before.
	Changes []ConfigChange

	// DeadLetter is where a gateway stream's refused batches go and how to get
	// them back; nil for a writer that published none.
	DeadLetter *DeadLetterView
	// contains filtered or unexported fields
}

ConfigView is one writer's configuration, laid out for a page: the writer's own note, then its settings in sections, in the order the writer declared them.

func BuildConfig

func BuildConfig(c *postgres.WriterConfig) ConfigView

BuildConfig lays a configuration out by its paths alone, so a setting a writer adds tomorrow has a place on the page with no change here.

func (ConfigView) SummaryOf added in v0.43.0

func (v ConfigView) SummaryOf() i18n.Cat

SummaryOf is the configuration in one sentence, for the app to say. See Summary.

type ContextEntry

type ContextEntry struct {
	Step string
	// JSON is the published value, indented; empty with nothing published.
	JSON  string
	Bytes int
	// State says why there is no JSON: "running", "failed" or "none".
	State string
}

ContextEntry is what one step -- one instance of a mapped one -- published for the steps below it, as its last attempt left it.

func ContextOf

func ContextOf(r run.Run, logs []postgres.StepLog) []ContextEntry

ContextOf is the run's published context, step by step in the flow's order: for each instance, the latest attempt that published -- what the run's context holds -- and, when none did, why, from its last attempt.

type ContextView added in v0.43.0

type ContextView struct {
	Step  string `json:"step"`
	JSON  string `json:"json"`
	Bytes int    `json:"bytes"`
	// Note says why there is no JSON; null when there is.
	Note *i18n.Msg `json:"note"`
}

type DataFilter

type DataFilter struct {
	// Status is "attention" (late or stale) or one status; "" is all.
	Status string
	// Kind is a target scheme; "" is all.
	Kind string
	// Source is where a load's step reads (screen-loads): a Source's kind,
	// or "none" for a step that declared none; "" is all.
	Source string
	Legacy bool
	// Q searches the URI and the writers -- workflow, step, gateway and its
	// stream -- case-insensitively. "" is no search.
	Q string

	// Path is the page the filter's links go to; "" is /ingest/loads, the
	// list this filter narrows since Catalog became Streams and Loads.
	Path string
}

DataFilter narrows /data. It lives in the query string so a filtered page is a link somebody can send.

func ParseDataFilter

func ParseDataFilter(q url.Values) DataFilter

ParseDataFilter reads the filter from a query string.

type DataRow

type DataRow struct {
	postgres.CatalogEntry
	Status   catalog.Status
	Writers  []WriterView
	LastWhen *time.Time
	LastRows *int64
}

DataRow is one destination. Writers shadows the entry's own list with each writer's verdict attached.

type DataView

type DataView struct {
	Rows   []DataRow
	Counts map[catalog.Status]int
	Total  int

	// Kinds present, sorted, and whether any legacy row exists: the filter bar
	// offers only what would match something.
	Kinds     []string
	HasLegacy bool

	Filter DataFilter
}

DataView is /data as the template draws it: every destination with its verdict, worst first, and how many stand where.

func BuildData

func BuildData(entries []postgres.CatalogEntry, now time.Time) DataView

BuildData judges every writer against its own schedule and every destination by its best writer -- data arriving from any writer is data arriving -- then orders the page worst first and, within a status, most recently loaded first.

`now` is a parameter so the page is testable without a clock.

type DeadLetterJSON added in v0.43.0

type DeadLetterJSON struct {
	Where    i18n.Cat `json:"where"`
	Commands string   `json:"commands"`
	Readable bool     `json:"readable"`
	Write    string   `json:"write"`
}

DeadLetterJSON is the dead letter panel: where it is and the commands.

type DeadLetterView

type DeadLetterView struct {
	// Where is the dead letter in the summary's words, "files at gs://…", for
	// the app to say.
	Where i18n.Cat
	// Stream is the stream's NAME, which --stream takes; the page's own key
	// is the stream's path.
	Stream string
	// Readable is a `files` dead letter, the only kind the commands read.
	Readable bool
	// Write is the destination's write mode: append, merge, or empty for a
	// sink with no such notion -- Pub/Sub publishes again whatever it is
	// given. Read on the clicks stream of the local stack, which a merge
	// sentence described wrongly.
	Write string
}

DeadLetterView is the dead-letter panel of a gateway stream (#86): where the buried batches are, and the commands that read them back and resend them -- run where the destination's credentials are. The console reads nothing of the dead letter itself and calls nothing: it only knows what was published.

func (DeadLetterView) Commands

func (d DeadLetterView) Commands() string

Commands are the two lines to copy, one per line. A string and not markup inside the <pre>: templ joins the lines of a template's text, and two commands pasted as one is a command that fails.

<gateway.yaml> is a placeholder because the manifest does not carry where the config sits inside the gateway's pod.

type EndpointFilter

type EndpointFilter struct {
	// Q searches the path, the API, the parameters and the tables read; API
	// is one API's name; State is "fresh" or "stale". "" is all.
	Q, API, State string
}

EndpointFilter narrows the list: Q searches the path, the API, the tables read and the parameters.

func ParseEndpointFilter

func ParseEndpointFilter(q url.Values) EndpointFilter

ParseEndpointFilter reads the filter from a query string; a state it does not know is ignored rather than turned into an empty page.

type EndpointRef

type EndpointRef struct {
	API, Name, Path, Href string
}

EndpointRef is an endpoint on a model's page, as one of its readers.

func ReadersOf

func ReadersOf(all []postgres.PublishedEndpoint) []EndpointRef

ReadersOf are the endpoints over a target, for its page.

type EndpointRow

type EndpointRow struct {
	API, Name, Path string
	// Keyed is true when each request reads as its key's tenant.
	Keyed       bool
	Params      []string
	Reads       []string
	PublishedAt time.Time
	// Required names the parameters a request must carry.
	Required map[string]bool

	// About is the first line of the note above the endpoint in its file.
	About string

	// Freshness is the worst of the tables it reads, by the catalog: "stale"
	// (late or stale), "fresh", or "" when the catalog knows none of them.
	Freshness string

	// Read is the catalog's row of the first table it reads, when the
	// catalog knows it: when it was rebuilt, and by whom.
	Read *DataRow

	// TTL is how long an answer is cached, from the API's manifest; "" with
	// no cache on record.
	TTL string
}

EndpointRow is one published endpoint.

func (EndpointRow) Href

func (r EndpointRow) Href() string

Href is the endpoint's own page.

func (EndpointRow) SearchText

func (r EndpointRow) SearchText() string

SearchText is what a search looks in, lower-cased: the path, the API, the parameters and the tables it reads.

type EndpointView

type EndpointView struct {
	Row    EndpointRow
	Params []ParamView
	Limits catalog.EndpointLimits
	// Lineage is one line per table read, in the endpoint's order; Manifest
	// what its API published beside it; Now the page's clock.
	Lineage  []LineageRow
	Manifest postgres.APIManifest
	Now      time.Time
	// About is the note above the endpoint in its file, if its author marked
	// one.
	About string

	// CanRun says this console may run the endpoint: it asks who you are,
	// and it has an address for the API. Without both there is no Try it.
	CanRun bool
	// Form is Try it's fields; Answer what the last Run brought back, or
	// RunErr why there is none.
	Form   []FormField
	Answer *endpointcall.Answer
	RunErr error
}

EndpointView is one endpoint's page: its contract, as published, and how the data it reads stands (screen-endpoints T4).

func BuildEndpoint

func BuildEndpoint(e postgres.PublishedEndpoint, entries []postgres.CatalogEntry, now time.Time) EndpointView

BuildEndpoint is the page of one endpoint, judged by the catalog's entries (with the writers' configurations attached, for where they read).

func (EndpointView) BumpCommand

func (v EndpointView) BumpCommand() string

BumpCommand is Clear cache (D5): the command that clears what the cache holds for the tables this endpoint reads, built from what its API published -- the variable the cache's address is read from and the dialect -- with each table named as a build keys it: no project on BigQuery, lowered on Postgres. A table of another warehouse is not the cache's. "" with no cache on record, or no table it keys.

func (EndpointView) CurlBase

func (v EndpointView) CurlBase() string

CurlBase is the address the curl calls, before its query string. ui.js rebuilds the rest from the form as somebody types, with the same escaping url.QueryEscape uses here, so a quote typed into a field cannot end the shell's quoted string.

func (EndpointView) StaleLine

func (v EndpointView) StaleLine() *LineageRow

StaleLine is the first table read that is late or stale: the one the warning names.

type EndpointsView

type EndpointsView struct {
	Rows []EndpointRow

	// Total, APIs, Fresh and Stale count every endpoint; Caches and
	// Connections are what the APIs published -- "redis", "warehouse
	// (bigquery)" -- for the summary.
	Total, APIs, Fresh, Stale int
	Caches, Connections       []string
	// APINames are the APIs present, sorted: the API filter's choices.
	APINames []string

	Filter EndpointFilter
	Now    time.Time
}

EndpointsView is Data → Endpoints (screen-endpoints): every published brevis-sql-api path the filter keeps, worst first by the data it reads, and the counts of every endpoint whatever is shown.

func BuildEndpoints

func BuildEndpoints(all []postgres.PublishedEndpoint, entries []postgres.CatalogEntry, f EndpointFilter, now time.Time) EndpointsView

BuildEndpoints is every endpoint under the filter (screen-endpoints T2), judged by the catalog's view of the tables it reads -- the worst of them -- worst first, then by API and path. The search drops what it does not match, on the server, so a searched list is a link.

type ExplainedCard

type ExplainedCard struct {
	Key  string
	Rows []ExplainedRow
}

ExplainedCard is one card: its key ("buffer") and its settings, in the order the label table gives them.

func ExplainConfig

func ExplainConfig(c *postgres.WriterConfig) []ExplainedCard

ExplainConfig lays a stream's settings out in cards. A card with nothing in it is left out.

type ExplainedRow

type ExplainedRow struct {
	Path, Value, Note string
	Default           bool
	// contains filtered or unexported fields
}

ExplainedRow is one setting: its path, its value as the file would write it, whether the gateway filled it in, and the file's note on it.

func (ExplainedRow) LabelMsg added in v0.43.0

func (r ExplainedRow) LabelMsg() *i18n.Msg

LabelMsg is the setting in the reader's words, or nil when this console has none for it: the app shows its key.

type ExplainedRowJSON added in v0.43.0

type ExplainedRowJSON struct {
	Path    string    `json:"path"`
	Label   *i18n.Msg `json:"label"`
	Value   string    `json:"value"`
	Default bool      `json:"default"`
	Note    string    `json:"note"`
}

ExplainedRowJSON and CardJSON are the stream's settings in cards.

type FeedLine

type FeedLine struct {
	At             time.Time
	Source         string
	What           i18n.Msg
	Subject, Actor string
	Href           string
	State          string
}

FeedLine is one event as the Overview's log draws it: when, from where (a source code the app names), the sentence with its subject apart -- drawn as code, and put where the reader's language wants it -- who did it, where it leads, and a run's state for its dot.

func FeedOf

func FeedOf(evs []postgres.Event) []FeedLine

FeedOf is the events as lines, in the order they came. A kind this version does not know -- written by a newer one -- is skipped rather than guessed.

type Filter

type Filter struct {
	Search string
	// State is one of the segment's questions (failing, running, paused,
	// manual), or a run state an older link carries (success, failed...),
	// which still filters, as a chip.
	State string
	// Active is the schedule filter older links carry: active | paused.
	Active string
	// Lang is a language or tool the workflow runs, as a logo key.
	Lang string

	// Tags is a set: a workflow must carry ALL of them. One `tag=` each in the
	// URL, in the order they were chosen.
	Tags []string

	// Project scopes the list to one project's workflows. It is what makes a
	// project more than a row on a screen: the slug is unique WITHIN a project,
	// so two of them can each have a `daily_ingest`, and until this existed
	// there was no way to look at one project's half of that.
	Project string

	// Sort is the sort field; Desc inverts it. They live in the URL for the same
	// reason the filters do: a sorted screen has to be pasteable to somebody
	// else.
	Sort string
	Desc bool

	Page    int
	PerPage int
}

Filter holds the search bar's state. It lives in the URL, not in memory: that way an applied filter can be pasted into the on-call chat and opens the same on the other side.

type Flow

type Flow struct {
	Nodes      []FlowNode
	DeadLetter *FlowNode
}

Flow is how data reaches a destination, as one writer's configuration declares it: a row of nodes from source to destination and, for a gateway stream, a branch where refused batches go.

DRAWN ONLY FROM WHAT IS DECLARED. Every label below is a configuration field or the destination itself; a part the configuration does not mention -- a buffer, a dead letter -- is not drawn. A diagram that showed them anyway would be inventing the pipeline it claims to describe.

func FlowOf

func FlowOf(c *postgres.WriterConfig, target string) *Flow

FlowOf reads a writer's configuration into a Flow, or nil when it has none to draw: a writer that did not describe itself (a Python, dbt or shell step), or a configuration that names neither a gateway's sink nor an SDK pipeline's source.

The two shapes are the ones Summary already tells apart: a gateway stream (`sink.type`) and an SDK pipeline (`source.driver`).

type FlowJSON added in v0.43.0

type FlowJSON struct {
	Nodes      []FlowNodeJSON `json:"nodes"`
	DeadLetter *FlowNodeJSON  `json:"deadLetter"`
}

type FlowNode

type FlowNode struct {
	Kind         string
	Main, Detail i18n.Cat
}

FlowNode is one step of a Flow. Kind is "source", "buffer", "destination" or "dead_letter"; Main is what it is, Detail how. Both are words for the app to put together (a string is the data's own, a Msg the console's): the buffer's triggers, the dead letter.

type FlowNodeJSON added in v0.43.0

type FlowNodeJSON struct {
	Kind   string   `json:"kind"`
	Main   i18n.Cat `json:"main"`
	Detail i18n.Cat `json:"detail"`
}

FlowNodeJSON and FlowJSON are a writer's flow, its words for the app to say.

type FormField

type FormField struct {
	Name, Kind, Value string
	// Options are a select's: an enum's values, a bool's, a period's. Empty
	// for an input.
	Options  []string
	Required bool
	MaxLen   int
}

FormField is one input of Try it, typed as its parameter is.

func TryForm

func TryForm(params []catalog.EndpointParam, sent url.Values) []FormField

TryForm is the endpoint's parameters as a form, holding what was last sent -- or, before anything was, each parameter's default.

type GatewayGroup

type GatewayGroup struct {
	Name    string
	Streams []Stream
}

GatewayGroup is one gateway and its streams.

func StreamsOf

func StreamsOf(entries []postgres.CatalogEntry) []GatewayGroup

StreamsOf regroups the catalog's gateway writers into gateways and their streams, both by name. A stream is keyed by (gateway, path); its sink and dead letter are the entries its writer lands on in each role.

type HolderView added in v0.43.0

type HolderView struct {
	RunID    string    `json:"runId"`
	Workflow string    `json:"workflow"`
	Since    time.Time `json:"since"`
}

type IdentityJSON added in v0.43.0

type IdentityJSON struct {
	Kind   string `json:"kind"`
	Legacy bool   `json:"legacy"`
	Where  string `json:"where"`
	Object string `json:"object"`
}

type KVView added in v0.43.0

type KVView struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Note  string `json:"note,omitempty"`
}

type LangChoice

type LangChoice struct {
	Key   string
	Count int
}

LangChoice is one language of the filter: a logo key, and how many workflows the rest of the filter keeps that run it.

type LineageRow

type LineageRow struct {
	Target   string
	Known    bool
	Status   catalog.Status
	LastWhen *time.Time
	Writer   *WriterView
	Source   Source
}

LineageRow is one table an endpoint reads, and what is known upstream of it: whether the catalog knows it, how it stands, its best writer -- the one the table's status is -- and where that writer reads, as declared.

func (LineageRow) Stale

func (l LineageRow) Stale() bool

Stale says the table is late or stale.

func (LineageRow) WriterHref

func (l LineageRow) WriterHref() string

WriterHref is the writer's page: a stream's, or a load's.

type LoadChoice

type LoadChoice struct {
	URI, Href string
	Current   bool
}

LoadChoice is one destination a step writes, in the drawer that asks which; Current is the one open.

type LoadChoiceJSON added in v0.43.0

type LoadChoiceJSON struct {
	URI     string `json:"uri"`
	Current bool   `json:"current"`
}

LoadChoiceJSON is a destination a step writes, the open one marked.

type LoadDetailJSON added in v0.43.0

type LoadDetailJSON struct {
	Status      string           `json:"status"`
	Reason      i18n.Cat         `json:"reason"`
	Source      SourceJSON       `json:"source"`
	Target      PlaceJSON        `json:"target"`
	HasSchedule bool             `json:"hasSchedule"`
	When        i18n.Cat         `json:"when"`
	Cron        string           `json:"cron"`
	Timezone    string           `json:"timezone"`
	Legacy      bool             `json:"legacy"`
	Manual      bool             `json:"manual"`
	LastLoaded  *time.Time       `json:"lastLoaded"`
	LastRows    *int64           `json:"lastRows"`
	Read        *int64           `json:"read"`
	ReadNothing bool             `json:"readNothing"`
	Fixing      *string          `json:"fixing"`
	Bars        []BarJSON        `json:"bars"`
	Missed      int              `json:"missed"`
	Loads       []LoadRecordJSON `json:"loads"`
	LoadsCount  i18n.Msg         `json:"loadsCount"`
	Described   bool             `json:"described"`
	Config      *StepConfigJSON  `json:"config"`
	Changes     []ChangeJSON     `json:"changes"`
	ReadBy      []ReaderJSON     `json:"readBy"`
	Query       string           `json:"query"`
	Run         string           `json:"run"`
}

LoadDetailJSON is the open load.

type LoadJSON added in v0.43.0

type LoadJSON struct {
	Workflow string           `json:"workflow"`
	Step     string           `json:"step"`
	Choices  []LoadChoiceJSON `json:"choices"`
	Choosing bool             `json:"choosing"`
	Detail   *LoadDetailJSON  `json:"detail"`
}

LoadJSON is /api/ingest/loads/{workflow}/{step}. Choosing is a step that writes several destinations with none open: Detail is then null.

func LoadAsJSON added in v0.43.0

func LoadAsJSON(l LoadView) LoadJSON

LoadAsJSON lays one load out for the app.

type LoadRecordJSON added in v0.43.0

type LoadRecordJSON struct {
	LoadedAt time.Time `json:"loadedAt"`
	Rows     *int64    `json:"rows"`
	Bytes    *int64    `json:"bytes"`
	RunID    string    `json:"runId"`
}

type LoadRowJSON added in v0.43.0

type LoadRowJSON struct {
	Workflow   string     `json:"workflow"`
	Step       string     `json:"step"`
	Href       string     `json:"href"`
	Target     PlaceJSON  `json:"target"`
	Legacy     bool       `json:"legacy"`
	Status     string     `json:"status"`
	LastLoaded *time.Time `json:"lastLoaded"`
	Rows       *int64     `json:"rows"`
	Schedule   i18n.Cat   `json:"schedule"`
	Source     SourceJSON `json:"source"`
	Recent     []*int64   `json:"recent"`
	Fixing     *string    `json:"fixing"`
}

LoadRowJSON is one step landing on one destination.

type LoadTabs

type LoadTabs struct {
	// SourceHead are the source's own settings: its driver, and for a
	// from.Many its workers and policies. For a single source, all its rows.
	SourceHead []ConfigRow

	// SourceCount is how many sources a from.Many lists; 0 for one source.
	SourceCount int
	// Common are the settings every source has with the same value, default
	// flag and note, said once, labeled by their key ("timeout").
	Common []ConfigRow
	// Varying are the other keys, in the order they first appear, and
	// Sources one line per source with a cell per key (nil where a source
	// does not have it).
	Varying []string
	Sources []SourceLine

	// Transform are the stages in order, each its rows.
	Transform []TransformOp

	// Destination are the target's settings, without what it declares.
	Destination []ConfigRow

	// Schema is the declared columns with their role; SchemaRows the
	// `declared.*` rows they come from, which keep their notes.
	Schema     []SchemaColumn
	SchemaRows []ConfigRow

	// Other are sections none of the tabs is about, shown on Summary.
	Other []ConfigSection
}

LoadTabs is a step's configuration as a load's page shows it, in tabs (screen-load-v2 LV3): BuildConfig's rows, regrouped and never dropped -- RowCount says so.

func LoadConfigTabs

func LoadConfigTabs(v ConfigView) LoadTabs

LoadConfigTabs regroups a step's configuration for its load's tabs.

type LoadTarget

type LoadTarget struct {
	Workflow, Step string
	Place
	Legacy     bool
	Status     catalog.Status
	LastLoaded time.Time
	Rows       *int64

	// Cron and Timezone are the step's schedule; HasSchedule is false for
	// a workflow that only runs by hand.
	Cron, Timezone string
	HasSchedule    bool

	// Source is where the step reads, as its configuration declares it;
	// zero when it declared none.
	Source Source

	// Recent is the rows of the destination's last loads, oldest first, at
	// most recentShown -- only when this step is its only writer: an entry's
	// history is shared, and another step's loads in this step's sparkline
	// would be a lie.
	Recent []*int64

	// Many is set when the step writes more than one destination, so its
	// link has to say which.
	Many bool

	// RunInFlight is a run of the workflow that is queued or running: on a
	// late load, the run about to fix it.
	RunInFlight *string
}

LoadTarget is one step landing on one destination, judged against that step's own schedule.

func LoadsOf

func LoadsOf(entries []postgres.CatalogEntry, now time.Time) []LoadTarget

LoadsOf is every step landing on every destination, one row each, in the Catalog's order (screen-loads T2): worst first, then the most recently loaded. A gateway's stream is not a load. `now` judges freshness.

func (LoadTarget) Fixing

func (t LoadTarget) Fixing() *string

Fixing is the run in flight when the load is late or stale -- the one worth a link -- and nil otherwise.

func (LoadTarget) Href

func (t LoadTarget) Href() string

Href is the load's page; the destination goes in the query only when the step writes more than one.

func (LoadTarget) SearchText

func (t LoadTarget) SearchText() string

SearchText is what a search looks in, lower-cased: the workflow, the step, where the step reads and the destination.

type LoadView

type LoadView struct {
	TargetView
	Workflow, Step string

	// Read is how many rows the newest load's step read (RowsRead), nil
	// when its run's stages do not say.
	Read *int64

	// Source is where the step reads, as it declared.
	Source Source

	// Choices are the destinations a step writing several writes, the open
	// one marked; with none open (no ?target=) the drawer asks which.
	Choices []LoadChoice

	// Run is what Run now does (screen-loads T6): "now" runs a workflow with
	// no parameters at once, "params" opens its Run drawer to ask them, and
	// "" offers nothing -- a console with no scheduler, or a workflow it
	// cannot read. Back is the drawer's own address, which the run comes
	// back to.
	Run, Back string
}

LoadView is one load's drawer (screen-loads T4): the destination's view (TargetView) narrowed to the one step, plus who that step is and where it reads.

func BuildLoad

func BuildLoad(d postgres.TargetDetail, workflow, step string, now time.Time) LoadView

BuildLoad narrows a destination to the loads and the writer of one step: another workflow writing the same destination is a different load, and its rows in this step's bars would be a lie.

func (LoadView) Choosing

func (v LoadView) Choosing() bool

Choosing is a drawer that asks which destination, having none open.

func (LoadView) ReadNothing

func (v LoadView) ReadNothing() bool

ReadNothing is a last load that wrote nothing out of something read: a merge that found every row already there, or a filter that kept none -- the load that needs a look.

func (LoadView) StepConfig

func (v LoadView) StepConfig() (WriterConfigView, bool)

StepConfig is the step's own configuration on its load's page.

func (LoadView) Writer

func (v LoadView) Writer() *WriterView

Writer is the step's own writer row, with its verdict.

type LoadsFilterJSON added in v0.43.0

type LoadsFilterJSON struct {
	Status string `json:"status"`
	Source string `json:"source"`
	Q      string `json:"q"`
	Legacy bool   `json:"legacy"`
}

LoadsFilterJSON echoes the filter the server applied.

type LoadsJSON added in v0.43.0

type LoadsJSON struct {
	Rows      []LoadRowJSON      `json:"rows"`
	Total     int                `json:"total"`
	Workflows int                `json:"workflows"`
	Summary   map[string]int     `json:"summary"`
	Counts    map[string]int     `json:"counts"`
	Sources   []SourceChoiceJSON `json:"sources"`
	HasLegacy bool               `json:"hasLegacy"`
	Filter    LoadsFilterJSON    `json:"filter"`
}

LoadsJSON is /api/ingest/loads. Summary counts every load the page holds, Counts each band choice ("" for all) under the other filters.

func LoadsAsJSON added in v0.43.0

func LoadsAsJSON(v LoadsView) LoadsJSON

LoadsAsJSON lays the loads list out for the app.

type LoadsView

type LoadsView struct {
	Rows []LoadTarget

	// Summary, Total and Workflows describe every load the page holds --
	// legacy ones only when asked for -- whatever else is filtered: the line
	// under the title is the page's, not the filter's.
	Summary          map[catalog.Status]int
	Total, Workflows int

	// Sources are the origins present, in sourceOrder, for the origin
	// filter; "none" is a step that declared none.
	Sources   []string
	HasLegacy bool
	Filter    DataFilter
	Now       time.Time

	// Drawer is the load the URL names (/ingest/loads/{workflow}/{step}),
	// drawn open over the list (screen-loads T4); nil draws none. Missing is
	// a step it named that writes no destination Brevis knows.
	Drawer  *LoadView
	Missing string
	// contains filtered or unexported fields
}

LoadsView is /ingest/loads as the template draws it (screen-loads): the loads the filter keeps, and the counts beside them.

func BuildLoads

func BuildLoads(entries []postgres.CatalogEntry, f DataFilter, now time.Time) LoadsView

BuildLoads is every load under the filter (screen-loads T3). A legacy row waits until it is asked for, as in the Catalog; the search is the server's, so a searched list is a link and works with no script.

type LogBlock

type LogBlock struct {
	Step     string // "load", or "load[2]" for an instance
	Attempt  int    // from 1, as a reader counts
	Status   string
	ExitCode *int
	// Running is a step whose log is not written yet: it arrives when the
	// step ends.
	Running bool
	Items   []LogItem
}

LogBlock is one attempt: its heading, and its lines.

type LogBlockView added in v0.43.0

type LogBlockView struct {
	Step     string        `json:"step"`
	Attempt  int           `json:"attempt"`
	Status   string        `json:"status"`
	ExitCode *int          `json:"exitCode"`
	Running  bool          `json:"running"`
	Items    []LogItemView `json:"items"`
}

type LogItem

type LogItem struct {
	N     int
	Text  string
	Level string // "info", "warn" or "err"
	Cause bool
	Gap   int
}

LogItem is a line, or -- with Gap set -- how many lines were left out.

type LogItemView added in v0.43.0

type LogItemView struct {
	N     int    `json:"n,omitempty"`
	Text  string `json:"text,omitempty"`
	Level string `json:"level,omitempty"`
	Cause bool   `json:"cause,omitempty"`
	Gap   int    `json:"gap,omitempty"`
}

type LogView added in v0.43.0

type LogView struct {
	Lines  int            `json:"lines"`
	CauseN int            `json:"causeN"`
	Blocks []LogBlockView `json:"blocks"`
}

type NextRun

type NextRun struct {
	Workflow string
	Cron     string
	Timezone string
	When     time.Time
	// Logos are what the workflow runs in.
	Logos []string
}

NextRun is a future trigger, already computed from the cron.

type NoteJSON added in v0.43.0

type NoteJSON struct {
	Label string `json:"label"`
	Text  string `json:"text"`
}

NoteJSON is a block's comment.

type NumberView added in v0.43.0

type NumberView struct {
	Key   string `json:"key"`
	Value any    `json:"value"`
}

NumberView is one number a stage produced: a count the app writes with the reader's separators, or the text it came as.

type ParamGroup

type ParamGroup struct {
	Name   string
	Params []wf.Param
}

ParamGroup is the params of one group, in the drawer's order.

type ParamView

type ParamView struct {
	Name, Type, Accepts, Default, Note string
	Required                           bool
	MaxLen                             int
	Min, Max                           *int64
}

ParamView is one parameter as a caller reads it. Accepts is a list the machine writes -- the values, the periods, a date's shape -- and the rest is said in the reader's words from MaxLen, Min and Max.

type Phase

type Phase struct {
	Key    string       `json:"key"`
	Label  i18n.Msg     `json:"label"`
	Detail *PhaseDetail `json:"detail"`
	State  string       `json:"state"`
}

Phase is one step of a run's life on the run page's strip: how it was made, when it started, how long it ran, how it ended. State is "done", "current", "pending" or "failed". Label is a sentence the app says; Detail is data the app writes (nil when there is nothing to say).

func PhasesOf

func PhasesOf(r run.Run, now time.Time) []Phase

PhasesOf reads a run's phases from its own times. The STATUS says which phase is now -- a queued run is waiting to start, a running or retrying one is running, a finished one is over -- and the times fill in the details: the slot, how late it started, the time running (as of now, so the live region's refresh moves it), and how it ended.

type PhaseDetail added in v0.43.0

type PhaseDetail struct {
	Kind  string     `json:"kind"`
	At    *time.Time `json:"at,omitempty"`
	Ms    *int64     `json:"ms,omitempty"`
	State string     `json:"state,omitempty"`
}

PhaseDetail is what a phase has to say, as data. Kind is "at" (when it was made), "slot" (the slot it represents), "late" (how long after its slot or trigger it started), "waiting" (how long it has waited), "ran" (how long it ran) or "ended" (how it ended: State is the run's status).

type Place

type Place struct {
	URI, Kind, Note string
}

Place is a destination: its URI and its kind (the scheme). Note is why a gateway destination has no URI -- its manifest could not name it -- and is empty otherwise.

func (Place) Label

func (p Place) Label() string

Label is the URI, or "unidentified" for a destination nothing could name.

type PlaceJSON added in v0.43.0

type PlaceJSON struct {
	URI   string `json:"uri"`
	Kind  string `json:"kind"`
	Where string `json:"where"`
	What  string `json:"what"`
	Note  string `json:"note"`
}

PlaceJSON is a destination: where it is, split for a row, and the name of its kind.

type ReaderJSON added in v0.43.0

type ReaderJSON struct {
	API  string `json:"api"`
	Name string `json:"name"`
	Path string `json:"path"`
	Href string `json:"href"`
}

ReaderJSON is a published endpoint that reads a destination.

type RowJSON added in v0.43.0

type RowJSON struct {
	Path    string     `json:"path"`
	Label   string     `json:"label"`
	Value   string     `json:"value"`
	Default bool       `json:"default"`
	Note    string     `json:"note"`
	List    []string   `json:"list"`
	Before  []NoteJSON `json:"before"`
}

RowJSON is one configuration setting.

type RunFilter

type RunFilter struct {
	State string
	// All says the operator picked "All" -- without it, no state means "the
	// default": Running when something is in flight, else All.
	All      bool
	Workflow string
	From     string // YYYY-MM-DDTHH, the same format the chart emits
	To       string
	Label    string // readable description of the period, built on the server

	Page    int
	PerPage int
}

RunFilter is the run screen's slice. It arrives through the query string, so a dashboard chart can point at "that hour's runs" with a link.

type RunLog

type RunLog struct {
	Blocks []LogBlock
	// Lines is how many lines the run's log has, drawn or not.
	Lines int
	// CauseN is the number of the line the run failed on; 0 with none.
	CauseN int
}

RunLog is the run's log as the Logs tab draws it: every attempt of every step, in the order they ran, numbered through.

func RunLogOf

func RunLogOf(logs []postgres.StepLog, cause *diagnosis.Cause) RunLog

RunLogOf numbers the run's log and reads each line's level. Each attempt keeps its last logTail lines, and the line the run failed on wherever it is; what is left out is counted, not lost -- the numbers keep counting it.

type RunNow

type RunNow struct {
	Slug, Cron, Zone string
	Back             string
	Now              time.Time
}

RunNow is what the Run dialog needs: the workflow, its schedule, and the page to come back to.

type RunPage

type RunPage struct {
	Run    run.Run
	Logs   []postgres.StepLog
	Raised []alerts.Record
	Wait   *postgres.Wait

	// Graph is the embedded graph JSON (nav-latency NL5). Only the full page
	// carries it; the live fragment does not redraw the graph.
	Graph string

	// Step is a one-step run's step, drawn as a line where a multi-step run
	// has its graph (screen-run-v2 RV3). Nil for every other run.
	Step *StepLine

	// Workflow is the CURRENT definition, for Rerun: what the trigger resolves
	// against. Nil when the workflow is gone, and then there is no Rerun.
	Workflow *wf.Workflow

	// Logos is what the workflow runs in, as the Runs list shows it.
	Logos []string

	// Cause is why a failed or retrying run failed; nil when there is nothing
	// to say. Streak is how many times in a row its workflow failed.
	Cause  *diagnosis.Cause
	Streak int
}

RunPage is what the run page and its live refresh are drawn from. One struct, filled by one helper in the handler, so the page and the fragment that refreshes it cannot read a run differently.

type RunView added in v0.43.0

type RunView struct {
	ID       string   `json:"id"`
	Workflow string   `json:"workflow"`
	Logos    []string `json:"logos"`

	Status string `json:"status"`
	// Attempt counts from 0, as the engine does.
	Attempt int `json:"attempt"`
	// InFlight allows Cancel; Terminal stops the app's polling (a failed run
	// is a retry away from running, so it is not terminal).
	InFlight bool `json:"inFlight"`
	Terminal bool `json:"terminal"`
	// Canceling is a cancel asked and not yet carried out.
	Canceling bool `json:"canceling"`

	// Trigger is how it was made, as the engine writes it ("schedule", "manual"...); the app says it.
	Trigger    string     `json:"trigger"`
	Slot       *time.Time `json:"slot"`
	CreatedAt  time.Time  `json:"createdAt"`
	StartedAt  *time.Time `json:"startedAt"`
	FinishedAt *time.Time `json:"finishedAt"`
	// DurationMs is nil while the run is in flight or never started.
	DurationMs *int64 `json:"durationMs"`

	// Rerun is "" (the workflow is gone), "now" (a click reruns it) or
	// "params" (it declares params, so a drawer is needed).
	Rerun string `json:"rerun"`

	Err    string       `json:"err"`
	Phases []Phase      `json:"phases"`
	Why    *WhyView     `json:"why"`
	Wait   *WaitView    `json:"wait"`
	Step   *StepLineV   `json:"step"`
	Auto   []AutoItem   `json:"auto"`
	Params []KVView     `json:"params"`
	Steps  []StepGroupV `json:"steps"`
	Alerts []AlertView  `json:"alerts"`
	// Context is what each step published, step by step.
	Context []ContextView `json:"context"`
	Log     LogView       `json:"log"`
}

RunView is the open run as the React app reads it: the same RunPage the templates draw, finished on the server (the words in the reader's language, the derived states, the numbered log), so the app holds no second reading of a run. Lists are never nil.

func NewRunView added in v0.43.0

func NewRunView(p RunPage, now time.Time) RunView

NewRunView finishes a RunPage for the app.

type SQLView

type SQLView struct {
	// Targets are the destinations a SELECT could name, from the catalog.
	// A bucket has no columns, and offering one here is the same mistake as
	// drawing a Query tab on it.
	Targets []string

	// Target is the one chosen, Statement what is in the box -- ECHOED BACK,
	// because a query refused for a typo with the box emptied is a query
	// somebody has to type again.
	Target    string
	Statement string
	// Preloaded says Statement is a table's first look from a link, not what
	// somebody ran: the island opens it in a tab of its own rather than over
	// the one somebody was writing in.
	Preloaded bool

	Result *sqlserve.Result
	// Refused is the service declining the statement, in its own words; the
	// page titles it (screen-sql T3). ErrKey is a failure the console words
	// itself, with ErrArg filling it; Err any other failure, as it came.
	Refused        string
	ErrKey, ErrArg string
	Err            string

	// Tree is what the chosen connection holds, grouped by schema. Empty
	// when the warehouse cannot say -- the capability is optional and a
	// workbench without a tree still runs queries.
	Tree []Schema

	// Writable says this connection accepts statements that CHANGE data,
	// as the service reported it. The console never decides this and never
	// reads the SQL to guess at it.
	Writable bool

	// TreeCut says the service cut the listing, which has to be drawn: a
	// browser silently showing half a warehouse would have somebody conclude
	// a table does not exist.
	TreeCut bool

	// Open is the one relation whose columns are drawn, as `schema.name`,
	// and empty when none is. ONE, because CHECKPOINT D made columns lazy:
	// a tree that drew every relation's would be the project-wide COLUMNS
	// query it refused, assembled one request at a time.
	Open string

	// Cols is what Open holds. Empty when the warehouse cannot say, which
	// is not an error -- Describer is optional.
	Cols []sqlserve.Column
}

SQLView is the workbench.

A SCREEN OF ITS OWN, AND THAT IS THE POINT. `/data` answers "what did the pipelines land, and is it on time"; this answers "what is in it". The second question is not asked one table at a time, which is what a tab on a destination page forces.

func BuildSQL

func BuildSQL(entries []postgres.CatalogEntry) SQLView

BuildSQL keeps only what can be queried.

func (SQLView) FirstQueryable

func (v SQLView) FirstQueryable() string

FirstQueryable is the destination the workbench opens on when it was given none: the first one it can read.

func (SQLView) Knows

func (v SQLView) Knows(target string) bool

Knows says the catalog lists this destination.

ONE FUNCTION, TWO CALLERS, AND THAT IS THE POINT. `/sql`'s GET path had this loop written out and its POST path had nothing, so a destination the catalog did not list was refused in a link and accepted in a body. Two copies of a rule are two rules; the second one was missing for as long as the first one existed.

func (SQLView) Unreadable

func (v SQLView) Unreadable() []string

Unreadable is the kinds of warehouse in the catalog this console cannot read, as their makers write them, for the sentence under the picker.

func (SQLView) Warehouses

func (v SQLView) Warehouses() []Warehouse

Warehouses is the picker's choices: one per connection.

type Schema

type Schema struct {
	Name   string
	Tables []string
}

Schema is one group in the tree.

func BuildTree

func BuildTree(rels []sqlserve.Relation) []Schema

BuildTree groups a listing by schema, in the order the service gave it.

THE SERVICE ORDERS, NOT THIS. Both dialects sort in SQL, where the warehouse's own collation decides -- re-sorting here would be a second opinion about which of `Orders` and `orders` comes first.

type SchemaColJSON added in v0.43.0

type SchemaColJSON struct {
	Name string   `json:"name"`
	Type string   `json:"type"`
	Role i18n.Cat `json:"role"`
}

type SchemaColumn

type SchemaColumn struct{ Name, Type, Role string }

SchemaColumn is one declared column, its type when declared, and its role when a setting names it: "partition", "cluster".

type SectionJSON added in v0.43.0

type SectionJSON struct {
	Key   string    `json:"key"`
	Title *i18n.Msg `json:"title"`
	Rows  []RowJSON `json:"rows"`
}

SectionJSON is a block of settings: its key, and its heading where the console has words for it (else the app makes one of the key).

type Slot

type Slot struct {
	At, From time.Time
}

Slot is one past slot of a schedule, and the window it processes: from the slot before it to itself, the same window its interval_start and interval_end are when it runs.

func RecentSlots

func RecentSlots(cron, zone string, now time.Time, n int) []Slot

RecentSlots is a schedule's last n slots up to now, newest first, in UTC: what "Run another slot" offers. A cron only says what comes next, so it walks forward from a window behind now, widening the window until it holds n slots and the one before the oldest -- a quarter-hour finds them in the first, a monthly in the last. A schedule that cannot be read, or never fires, has none.

type Source

type Source struct {

Source is where a step reads, as its configuration declares it (screen-loads): its kind -- "http", "file", "database", "other", or "" when it declared none -- the driver it named, the logo it is drawn with, and the place it reads from, when the driver says.

ONLY WHAT WAS DECLARED. Only the Go SDK describes a step's source; a Python, dbt or shell step has no Source, and it is not guessed from the destination or the step's name.

func SourceOf

func SourceOf(c *postgres.WriterConfig) Source

SourceOf reads a step's configuration into its Source; nil, or a gateway's configuration (which has a sink, not a source), is no Source.

type SourceChoiceJSON added in v0.43.0

type SourceChoiceJSON struct {
	Key   string   `json:"key"`
	Label i18n.Msg `json:"label"`
}

SourceChoiceJSON is one origin the loads filter offers: its key and its words.

type SourceJSON added in v0.43.0

type SourceJSON struct {
	Kind   string `json:"kind"`
	Driver string `json:"driver"`
	// Label is the origin's own name, the same in every language (a database,
	// a driver); LabelMsg says it where the console has words for it (http,
	// files): the app says one or the other.
	Label    string    `json:"label"`
	LabelMsg *i18n.Msg `json:"labelMsg"`
	Where    string    `json:"where"`
}

SourceJSON is where a step reads. Kind is empty when it declared none.

type SourceLine

type SourceLine struct {
	Index int
	Cells []*ConfigRow
}

SourceLine is one source of a from.Many: its position and its varying settings, aligned with LoadTabs.Varying.

type SourceRowsJS added in v0.43.0

type SourceRowsJS struct {
	Index int        `json:"index"`
	Cells []*RowJSON `json:"cells"`
}

SourceRowsJS is one source of a from.Many; Cells align with Varying and are null where the source lacks the key.

type StageCell

type StageCell struct {
	Label         i18n.Cat
	State, Detail string
	Ms            *int64
	Numbers       []StageNumber
}

StageCell is one SDK stage on the line: its label as a person reads it (source and target, not the wire's extract and load), its state, the identity it worked on, its duration and up to two numbers.

type StageJSON added in v0.43.0

type StageJSON struct {
	SourceDriver   string `json:"sourceDriver"`
	SourceCount    int    `json:"sourceCount"`
	Workers        *int   `json:"workers"`
	TransformCount int    `json:"transformCount"`
	TransformNames string `json:"transformNames"`
	TargetDriver   string `json:"targetDriver"`
	Dedup          string `json:"dedup"`
}

StageJSON is the path in one line: the facts, for the app to word.

type StageNumber

type StageNumber struct {
	Key   string
	Value any
}

StageNumber is one magnitude a stage produced: "3 in", "1 pages".

func StageNumbers

func StageNumbers(numbers map[string]any) []StageNumber

StageNumbers picks a stage's two numbers, in StageHighlight's order. A whole number is a number, which the app writes with the reader's separators, as the island's toLocaleString writes it; anything else is shown as it came.

type StageView added in v0.43.0

type StageView struct {
	Label   i18n.Cat     `json:"label"`
	State   string       `json:"state"`
	Detail  string       `json:"detail"`
	Ms      *int64       `json:"ms"`
	Numbers []NumberView `json:"numbers"`
}

type StepConfigJSON added in v0.43.0

type StepConfigJSON struct {
	Summary i18n.Cat      `json:"summary"`
	Note    string        `json:"note"`
	Flow    *FlowJSON     `json:"flow"`
	Stage   StageJSON     `json:"stage"`
	Other   []SectionJSON `json:"other"`

	SourceHead  []RowJSON      `json:"sourceHead"`
	SourceCount int            `json:"sourceCount"`
	Common      []RowJSON      `json:"common"`
	Varying     []string       `json:"varying"`
	Sources     []SourceRowsJS `json:"sources"`

	Transform []TransformJSON `json:"transform"`

	Identity    IdentityJSON `json:"identity"`
	Destination []RowJSON    `json:"destination"`

	Schema      []SchemaColJSON `json:"schema"`
	SchemaExtra []RowJSON       `json:"schemaExtra"`
	HasSchema   bool            `json:"hasSchema"`
}

StepConfigJSON is a step's configuration as its load's page shows it, in the tabs' grouping.

func StepConfigAsJSON added in v0.43.0

func StepConfigAsJSON(c WriterConfigView, target TargetView) StepConfigJSON

StepConfigAsJSON is the described configuration of a step.

type StepGroupV added in v0.43.0

type StepGroupV struct {
	Node    string        `json:"node"`
	Mapped  bool          `json:"mapped"`
	Status  string        `json:"status"`
	Ok      int           `json:"ok"`
	Total   int           `json:"total"`
	Command i18n.Cat      `json:"command"`
	Rows    []StepRowView `json:"rows"`
}

type StepItem

type StepItem struct {
	ID      string
	Command i18n.Cat
	// Langs is what it runs, language first; Uses what it wrote, as logo keys;
	// Needs the steps it depends on.
	Langs, Uses, Needs []string
	// LastStatus and LastMs are how it went the last time it ran; empty and
	// 0 when it never did.
	LastStatus string
	LastMs     int64
}

StepItem is one step of the Steps card's list.

type StepLine

type StepLine struct {
	Name, Status string
	// Action is the command or the typed action, whole: the line truncates it
	// and keeps the full text in its title.
	Action string
	// Runtime is the chip ("go", "python"); RuntimeInferred says the command
	// suggested it rather than the YAML declaring it.
	Runtime         string
	RuntimeInferred bool
	// SDK is the version the step announced; empty for a step that is not an
	// SDK one.
	SDK        string
	DurationMs int64
	// Published is how many values the step told the steps below it.
	Published int
	Stages    []StageCell
}

StepLine is a one-step run's step, drawn as a line instead of a canvas holding one box (screen-run-v2 RV3). Built by the API from the same graph build the island draws, so the two drawings say the same thing.

type StepLineV added in v0.43.0

type StepLineV struct {
	Name            string      `json:"name"`
	Status          string      `json:"status"`
	Action          string      `json:"action"`
	Runtime         string      `json:"runtime"`
	RuntimeInferred bool        `json:"runtimeInferred"`
	SDK             string      `json:"sdk"`
	DurationMs      int64       `json:"durationMs"`
	Published       int         `json:"published"`
	Stages          []StageView `json:"stages"`
}

type StepOutput

type StepOutput struct {
	Node   string
	Mapped bool
	// Status is the worst of its instances' last attempts, the color the
	// node has in the flow.
	Status string
	// Ok and Total count a mapped step's instances, the flow's "2/3".
	Ok, Total int
	// Command is what the step runs, as the flow's node subtitles it.
	Command i18n.Cat
	Rows    []StepRow
}

StepOutput is one step of the "Step output" section: one per NODE, as the flow above it draws one per node. A mapped step's instances are its rows, not three entries called "load" that nobody can tell apart.

func StepOutputs

func StepOutputs(r run.Run, logs []postgres.StepLog) []StepOutput

StepOutputs groups a run's logs by step, in the graph's order.

The logs come in the order the steps STARTED, which is not the order a reader follows: the instances of a mapped step start in any order, and a step on a branch can start after `end`. The definition gives the order the flow uses. When it cannot be read every log is still shown, in the order it came -- this section is where somebody looks when everything else broke.

type StepRow

type StepRow struct {
	postgres.StepLog
	// Item is what a mapped instance ran for -- the element of the list it
	// maps over, as the step received it in BREVIS_MAP_VALUE.
	Item    string
	Command i18n.Cat
}

StepRow is one attempt of one instance.

type StepRowView added in v0.43.0

type StepRowView struct {
	Node       string   `json:"node"`
	Item       string   `json:"item"`
	Status     string   `json:"status"`
	Attempt    int      `json:"attempt"`
	ExitCode   *int     `json:"exitCode"`
	DurationMs int64    `json:"durationMs"`
	Command    i18n.Cat `json:"command"`
	Err        string   `json:"err"`
}

type Stream

type Stream struct {
	Gateway, Path string
	Sink          Place
	DeadLetter    *Place
	PublishedAt   time.Time

	// Config is the stream as last published; nil for a version-1 manifest,
	// which described nothing but where it lands.
	Config *postgres.WriterConfig
}

Stream is a gateway stream, the unit of continuous ingest: where events are posted, the one destination they land on, and the dead letter that destination's refusals go to. THE DEAD LETTER BELONGS TO THE STREAM -- it is never an item of its own, which is what Catalog got wrong.

func FindStream

func FindStream(groups []GatewayGroup, gateway, path string) *Stream

FindStream is the stream with this gateway and path, or nil.

func (Stream) BatchIn

func (s Stream) BatchIn() i18n.Cat

BatchIn is how a stream batches, as a row says it: "2 minutes or 2,000", "30 seconds", "up to 500"; "" with no buffer declared.

func (Stream) DeadLetterShown

func (s Stream) DeadLetterShown() *Place

DeadLetterShown is the dead letter as a row draws it: the catalog's, or -- for one whose manifest could not name it, a path relative to the gateway's working directory -- what the stream declares, its kind and its path, the reason it has no URI kept as its note.

func (Stream) Field

func (s Stream) Field(path string) string

Field is a declared configuration value, as text; "" when the stream does not declare it, which the screens show as "—".

func (Stream) Health added in v0.43.0

func (s Stream) Health() StreamHealth

Health is what the console can say about the stream with no live source.

func (Stream) Href

func (s Stream) Href() string

Href is the stream's page: the gateway, then the stream's path as the tail.

func (Stream) Key

func (s Stream) Key() string

Key is the stream's identity as one string, for the page's markup.

func (Stream) Merge

func (s Stream) Merge() *bool

Merge says whether the sink merges, which there is no field for: it is a write mode. Nil when the stream does not declare a mode -- "no" would be a guess.

func (Stream) Mode

func (s Stream) Mode() string

Mode is how the sink writes, as declared: `sink.write`, or the write of an auto_table's tables.

func (Stream) Note

func (s Stream) Note() string

Note is the first line of the comment on the stream in the gateway's file (the one above `- name:`): what it is for, in its owner's words.

func (Stream) SearchText

func (s Stream) SearchText() string

SearchText is what a search looks in, lower-cased: the gateway, the path, where it lands and where its refusals go.

type StreamChangeJSON added in v0.43.0

type StreamChangeJSON struct {
	At   time.Time `json:"at"`
	Text i18n.Msg  `json:"text"`
}

StreamChangeJSON is one publish in a stream's history line: the first, or what it changed.

type StreamFilter

type StreamFilter struct {
	Q, Kind string
}

StreamFilter narrows /ingest/streams: a search over the path, the sink, the dead letter and the gateway, and the sink's kind. In the URL, like every list's.

func ParseStreamFilter

func ParseStreamFilter(q url.Values) StreamFilter

ParseStreamFilter reads the filter from a query string; a kind it does not know is ignored rather than turned into an empty page.

type StreamHealth added in v0.43.0

type StreamHealth = metrics.Health

StreamHealth is a stream's state, the key of its reason and the numbers that justify it (see internal/metrics.Health).

type StreamJSON added in v0.43.0

type StreamJSON struct {
	Gateway      string             `json:"gateway"`
	Path         string             `json:"path"`
	Sink         PlaceJSON          `json:"sink"`
	DeadLetter   *PlaceJSON         `json:"deadLetter"`
	PublishedAt  *time.Time         `json:"publishedAt"`
	Format       string             `json:"format"`
	Health       StreamHealth       `json:"health"`
	Lede         i18n.Cat           `json:"lede"`
	Summary      i18n.Cat           `json:"summary"`
	Flow         *FlowJSON          `json:"flow"`
	Tables       []string           `json:"tables"`
	CatalogHref  string             `json:"catalogHref"`
	Query        string             `json:"query"`
	ReadBy       []ReaderJSON       `json:"readBy"`
	HasConfig    bool               `json:"hasConfig"`
	Cards        []CardJSON         `json:"cards"`
	YAML         string             `json:"yaml"`
	Changes      []StreamChangeJSON `json:"changes"`
	DeadPanel    *DeadLetterJSON    `json:"deadLetterPanel"`
	BuriedMetric string             `json:"buriedMetric"`
	TestEvent    TestEventJSON      `json:"testEvent"`
}

StreamJSON is /api/ingest/streams/{gateway}/{path...}.

func StreamAsJSON added in v0.43.0

func StreamAsJSON(v StreamView) StreamJSON

StreamAsJSON lays one stream's page out for the app.

type StreamRowJSON added in v0.43.0

type StreamRowJSON struct {
	Gateway string    `json:"gateway"`
	Path    string    `json:"path"`
	Href    string    `json:"href"`
	Note    string    `json:"note"`
	Sink    PlaceJSON `json:"sink"`
	Batch   i18n.Cat  `json:"batch"`
	// BatchEvery and BatchRecords are the same batch as the declared values ("2m", 2000), for a
	// compact cell that reads the same in every language; Batch is the sentence for a tooltip.
	BatchEvery   string     `json:"batchEvery"`
	BatchRecords *int64     `json:"batchRecords"`
	DeadLetter   *PlaceJSON `json:"deadLetter"`
	// Health is added beside the old fields: a client that does not know it ignores it.
	Health StreamHealth `json:"health"`
}

StreamRowJSON is one gateway stream.

type StreamView

type StreamView struct {
	Stream

	// Live is the stream's health from the source, when there is one; the
	// static Health is used otherwise.
	Live *StreamHealth

	// Configured is the stream's configuration card -- settings by section,
	// the file's notes and the history of changes -- read from the sink's
	// detail; nil when the stream described nothing.
	Configured *WriterConfigView

	// SQL says a SQL service answers for the sink, so "Query destination"
	// leads somewhere.
	SQL bool

	// ReadBy are the published endpoints that read the sink: where the data
	// goes next, as far as Brevis knows (screen-streams T3).
	ReadBy []EndpointRef
}

StreamView is one stream's page.

func BuildStream

func BuildStream(s Stream, detail *postgres.TargetDetail) StreamView

BuildStream lays out a stream's page. detail is its sink's, which carries the configuration's history; without it the page still draws what the stream declares.

func (StreamView) BuriedMetric

func (v StreamView) BuriedMetric() string

BuriedMetric is the gateway's counter of what this stream buried, labeled by the stream's name as the gateway labels it.

func (StreamView) DeadLetterPanel

func (v StreamView) DeadLetterPanel() *DeadLetterView

DeadLetterPanel is the commands and the resend note, when the stream's configuration says what its dead letter is.

func (StreamView) Lede

func (v StreamView) Lede() i18n.Cat

Lede is the page's one sentence under its name: what comes in, where it goes, and that refusals are kept -- three pieces, so it does not repeat the overview's sentence.

func (StreamView) QueryHref

func (v StreamView) QueryHref() string

QueryHref opens the workbench on the sink.

func (StreamView) Queryable

func (v StreamView) Queryable() bool

Queryable says the sink is something SQL can read: not a topic, not files.

Not an Iceberg table either, for now: it IS a table, but the workbench behind this link is brevis-sql, which speaks Postgres and BigQuery. A link that opens a page unable to answer is worse than no link. It turns true the day brevis-sql reads a lake.

func (StreamView) Summary

func (v StreamView) Summary() i18n.Cat

Summary is one paragraph on what the stream does, from what it declares.

func (StreamView) Tables

func (v StreamView) Tables() []string

Tables are the sink's tables for an auto_table, by the prefixes it accepts ("agents_*"); nil for a sink that writes one place.

func (StreamView) TestAllow

func (v StreamView) TestAllow() string

TestAllow is the prefixes an auto_table accepts, comma separated; "" is any name its pattern accepts.

func (StreamView) TestBody

func (v StreamView) TestBody() string

TestBody is an example event in the stream's own format: an object for json, a list of them for array, one per line for ndjson -- with the field an identity routes by (`identity.source_key`) filled in, since the gateway refuses an event without it.

func (StreamView) TestCurlHead

func (v StreamView) TestCurlHead() string

TestCurlHead is the curl that sends a body to this stream, up to the body: $GATEWAY and $GATEWAY_TOKEN stand where the console does not know the gateway's address or its token (`listen.auth` is the gateway's, not the stream's). The body follows as a heredoc, so nothing in it needs quoting.

func (StreamView) TestDataset

func (v StreamView) TestDataset() string

TestDataset is where an auto_table's tables are; TestLands is where a stream that writes one place writes.

func (StreamView) TestFormat

func (v StreamView) TestFormat() string

TestFormat is the stream's declared format; json, the gateway's default, when it declares none.

func (StreamView) TestLands

func (v StreamView) TestLands() string

func (StreamView) TestTable

func (v StreamView) TestTable() string

TestTable is the field an event names its table in, for an auto_table stream -- always `table_name`, the gateway's fixed envelope -- and "" for one that writes one place.

type StreamsJSON added in v0.43.0

type StreamsJSON struct {
	Rows           []StreamRowJSON `json:"rows"`
	Total          int             `json:"total"`
	Gateways       int             `json:"gateways"`
	WithDeadLetter int             `json:"withDeadLetter"`
	// HealthCounts is every stream's health state, whatever the filter keeps.
	HealthCounts map[string]int `json:"healthCounts"`
	Kinds        []string       `json:"kinds"`
	Filter       struct {
		Kind string `json:"kind"`
		Q    string `json:"q"`
	} `json:"filter"`
}

StreamsJSON is /api/ingest/streams.

func StreamsAsJSON added in v0.43.0

func StreamsAsJSON(v StreamsView) StreamsJSON

StreamsAsJSON lays the streams list out for the app.

type StreamsView

type StreamsView struct {
	Rows                            []Stream
	Total, Gateways, WithDeadLetter int
	// HealthCounts is every stream's health state, whatever the filter shows.
	HealthCounts map[string]int
	// Healths is each stream's health by Stream.Key, the live one when the
	// builder was given a source.
	Healths map[string]StreamHealth
	Kinds   []string
	Filter  StreamFilter
}

StreamsView is /ingest/streams as drawn (screen-streams): the streams the filter keeps, one row each, and the counts of every stream whatever is shown.

func BuildStreamsWith added in v0.43.0

func BuildStreamsWith(entries []postgres.CatalogEntry, f StreamFilter, health func(Stream) StreamHealth) StreamsView

BuildStreamsWith is BuildStreams with the health of each stream said by health, which is how the live metrics reach the list and its counts.

type TargetItem

type TargetItem struct {
	Target   string
	Status   catalog.Status
	Workflow string
	Missed   time.Time

	// NoData: the writer ran and wrote nothing for longer than the table's own
	// quiet; Missed is then when data last landed.
	NoData bool
}

TargetItem is a destination whose data stopped coming: which writer missed its run, and when.

func AttentionTargets

func AttentionTargets(rows []DataRow, failing map[string]bool) []TargetItem

AttentionTargets are the destinations that need the reader, stale before late, as /data judges them (BuildData) -- one rule for "late", not two. A destination whose writer is already failing is left out: that is why it is late, and the workflow's item says so.

type TargetView

type TargetView struct {
	Row DataRow

	// Bars are the last loads, oldest first, each linking to its run; Missed
	// are the slots that went by since, past their grace, drawn dashed.
	Bars   []components.LoadBar
	Missed int

	// Loads are the same loads, newest first, for the table.
	Loads []postgres.TargetLoad

	// Configs are how this destination's writers are configured, one per
	// writer that described itself.
	Configs []WriterConfigView

	// Tabs says there is a SQL service to ask about this destination at
	// all, for the link to the workbench. Without one there is no link: one
	// that always answers "not configured" is a question nobody can act on.
	Tabs bool

	// ReadBy are the published endpoints whose SQL reads this target: its
	// consumers, beside its writers.
	ReadBy []EndpointRef
}

TargetView is one destination's page.

func BuildTarget

func BuildTarget(d postgres.TargetDetail, now time.Time) TargetView

BuildTarget judges the destination as the list does, and lays out its loads.

func (TargetView) WorkbenchHref

func (v TargetView) WorkbenchHref() string

WorkbenchHref opens `/sql` on this destination.

A TARGET IN A URL IS FINE AND A STATEMENT IS NOT, which is the distinction the workbench's POST keeps: this console already puts a target in `/data/target?u=`, and a query in a link would be a query in a proxy log.

type TestEventJSON added in v0.43.0

type TestEventJSON struct {
	Format   string `json:"format"`
	Body     string `json:"body"`
	CurlHead string `json:"curlHead"`
	Lands    string `json:"lands"`
	Table    string `json:"table"`
	// Allow and Dataset are what an auto_table's test event is checked by: the
	// prefixes a table name may start with ([] is any) and where the tables are.
	Allow   []string `json:"allow"`
	Dataset string   `json:"dataset"`
}

TestEventJSON is the example event and the curl that sends it.

type TransformJSON added in v0.43.0

type TransformJSON struct {
	Index string    `json:"index"`
	Rows  []RowJSON `json:"rows"`
}

type TransformOp

type TransformOp struct {
	Index string
	Rows  []ConfigRow
}

TransformOp is one stage of the transform: "1", and its rows.

type WaitView added in v0.43.0

type WaitView struct {
	Group   string       `json:"group"`
	Limit   int          `json:"limit"`
	Ahead   int          `json:"ahead"`
	Holders []HolderView `json:"holders"`
	// More is how many holders the three shown leave out.
	More int `json:"more"`
}

type Warehouse

type Warehouse struct {
	// Name is `scheme://connection`, which is what identifies a connection.
	Name string

	// Target is one whole destination on it, because that is what every
	// request carries.
	Target string
}

Warehouse is one connection, and one destination that reaches it.

func Warehouses

func Warehouses(targets []string) []Warehouse

Warehouses groups the catalog's destinations by the connection they live on.

A TARGET IS NOT A CONNECTION, and the tree is about connections. The catalog lists `bigquery://acme/bronze/orders` and `bigquery://acme/silver/daily` as two destinations, and `serve` resolves BOTH to one connection: `sql/internal/serve/target.go` reads a target as `scheme://connection/schema/table` and opens on the scheme and the FIRST segment -- `/v1/query` never looks at the rest. A tree with one root per target would draw the same warehouse twice, with identical contents under each.

THE SPLIT IS REPEATED HERE AND THAT IS A COST, stated rather than hidden. The engine cannot import that parser: it holds no warehouse code, and `engine-weight.sh` is what enforces it. What keeps the repetition honest is that this grouping is only a LABEL -- every request still carries a whole target, which `serve` parses itself -- so a grouping that got it wrong would draw a wrong heading and never wrong data.

type WhyView added in v0.43.0

type WhyView struct {
	Title   i18n.Msg `json:"title"`
	Streak  int      `json:"streak"`
	Excerpt string   `json:"excerpt"`
	// HasLine says the cause is a line of the log (Log.CauseN numbers it); one
	// read from the engine's error has no line to go to.
	HasLine bool `json:"hasLine"`
}

type Window

type Window struct {
	Key     string
	Span    time.Duration
	Grain   postgres.Grain
	Buckets int
}

Window is the span the Overview reads (screen-overview-v2): its key in the URL, how long it is, and how its chart is bucketed.

func ParseWindow

func ParseWindow(key string) Window

ParseWindow reads ?window=. Anything but the three keys is 24h.

type WorkflowCounts

type WorkflowCounts struct {
	State map[string]int
}

WorkflowCounts is how many workflows each state would show, with the rest of the filter as it is. A choice's count ignores its own filter -- "Failing 1" while "Paused" is chosen -- or every other choice would read 0. The key "" is the choice that does not filter.

type WorkflowPage

type WorkflowPage struct {
	Def wf.Workflow
	// Sum is the workflow's summary row: project, schedule state, the next
	// run. Nil when it could not be read; the page then says less.
	Sum    *postgres.WorkflowSummary
	Latest []postgres.RunSummary
	Stats  WorkflowStats
	// Graph is the embedded graph JSON; empty for a one-step workflow.
	Graph string
	// Step is a one-step workflow's step as a line, from its definition. Nil
	// when the graph draws it.
	Step *StepLine
	// Now is the page's clock, for "next run in 12m".
	Now time.Time
	// Langs is every language and tool the workflow runs, as logo keys.
	Langs []string
	// Steps are the Steps card's list, in the graph's order; Stages how many
	// columns the graph has; GraphLogos the logos the island borrows.
	Steps      []StepItem
	Stages     int
	GraphLogos []string
	// YAML is the Definition tab: the published workflow written back as a
	// file. Empty when it could not be written.
	YAML string
	// Day narrows the Runs tab to one UTC day -- a square of the calendar;
	// nil is the last runs.
	Day *time.Time
}

WorkflowPage is what a workflow's page is drawn from (screen-workflow-v2).

type WorkflowStats

type WorkflowStats struct {
	Window time.Duration
	Ind    postgres.Indicators
	Days   []postgres.Day

	// Load is what this workflow's SDK pipelines measured, per day. Empty for a
	// workflow whose steps are shell commands, which is why the panel checks
	// before drawing: four empty boxes would be four questions with no answer.
	Load []postgres.LoadDay
}

Workflow shows the published definition. With no run state: it is the screen for "what this workflow is", and it has to serve a workflow that never ran too. WorkflowStats is one workflow's numbers, over workflowWindow.

Every field degrades to its zero value on purpose: a definition has to stay readable with the database in trouble, and somebody looking at a broken installation is exactly who needs to read the graph.

type WorkflowsScreen

type WorkflowsScreen struct {
	// Rows are the page's workflows, filtered and sorted.
	Rows   []postgres.WorkflowSummary
	Filter Filter
	Counts WorkflowCounts
	// Tags are every workflow's tags, for the popover; Langs what they run.
	Tags  []string
	Langs []LangChoice
	// Recent are each row's last runs.
	Recent map[string][]postgres.RecentRun
	// RunsIn is what each row runs, every language and tool; Connects what
	// it talks to; Steps how many steps; Failing whether its last finished
	// run failed. By slug.
	RunsIn   map[string][]string
	Connects map[string][]string
	Steps    map[string]int
	Failing  map[string]bool
	// Params is whether each row declares parameters, which its Run asks
	// for in the workflow's drawer.
	Params map[string]bool
	// Now is the instant the page is drawn at: the Run dialogs' last slots
	// are up to it.
	Now time.Time
	// Total is every workflow; Filtered those the filter keeps.
	Total, Filtered int
}

WorkflowsScreen is everything the Workflows list draws.

type WriterConfigView

type WriterConfigView struct {
	Gateway, Stream, Role string
	PublishedAt           time.Time

	Workflow, Node string

	// Described is false for a step that never sent its configuration --
	// Python, dbt, a shell. Its section says so instead of being left out:
	// a writer missing from the list reads as nothing to see.
	Described bool

	Config ConfigView

	// Flow is how data reaches the destination through this writer, drawn
	// from what its configuration declares; nil when there is none to draw.
	Flow *Flow
}

WriterConfigView is a configuration on a destination's page, with whose it is: a gateway stream's (Gateway set) or a workflow step's.

func (WriterConfigView) Key

func (w WriterConfigView) Key() string

Key is what the page tags the section with: "gateway stream" or "workflow node".

type WriterView

type WriterView struct {
	postgres.CatalogWriter
	Verdict catalog.Verdict
}

WriterView is one writer and its verdict.

func (WriterView) Reason

func (w WriterView) Reason() i18n.Cat

Reason is why a writer stands where it does, in its own schedule's timezone: sentences for the app to say, one after the other; none for a writer that stands where it should.

Jump to

Keyboard shortcuts

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