api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package api is the sheet API's HTTP surface: one URL per document, the action selected by method × media type. The document plane (store, version, apply, notify) evaluates no expression; the compute plane — enabled when the operator turns it on — serves computed values in the SPECIFICATION §9 vendor types, making every served sheet an IMPORT*-able origin.

Index

Constants

View Source
const (
	TypeDoc     = "application/vnd.tsvsheet.doc+tsv"
	TypeEdits   = "application/vnd.tsvsheet.edits+tsv"
	TypeCells   = "application/vnd.tsvsheet.cells+tsv"
	TypeSheet   = "application/vnd.tsvsheet+tsv"
	TypeCell    = "application/vnd.tsvsheet.cell+tsv"
	TypeRow     = "application/vnd.tsvsheet.row+tsv"
	TypeColumn  = "application/vnd.tsvsheet.column+tsv"
	TypeRange   = "application/vnd.tsvsheet.range+tsv"
	TypeTSV     = "text/tab-separated-values"
	TypeCSV     = "text/csv"
	TypeStream  = "text/event-stream"
	TypeProblem = "application/problem+json"
)

The +tsv media-type family the API speaks. TypeDoc and TypeEdits are the document plane's own; the §9 vendor types (TypeSheet through TypeRange) mean computed values, exactly as the language's IMPORT* builtins request them.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock func() time.Time

Clock supplies the compute plane's evaluation time, injected so volatile functions are deterministic under test.

type ComputePlane

type ComputePlane bool

ComputePlane selects whether the server carries the engine's compute plane.

const (
	DocumentPlaneOnly ComputePlane = false
	WithComputePlane  ComputePlane = true
)

The two plane configurations, named at the call sites.

type Config

type Config struct {
	Store          *store.Store
	Clock          Clock
	Limits         tsvsheet.Limits
	ComputeEnabled ComputePlane
}

Config assembles a handler.

type Handler

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

Handler is the sheet API's http.Handler.

Pointer receivers are necessary: the handler owns the feed hub and the idempotency replay cache, which carry mutexes and shared maps.

func NewHandler

func NewHandler(config Config) Handler

NewHandler builds the API handler over its store.

func (Handler) ServeHTTP

func (handler Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes one request: the path names a document (optionally with a `!` reference suffix), the method and media types name the action.

Jump to

Keyboard shortcuts

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