server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package server exposes the implemented Tessera HTTP subset for embedding. It does not provide a listener, authentication database, OAuth server, or durable store.

Index

Constants

View Source
const (
	MaxCreationRequestBytes = 256 << 10
	MaxCreationTypes        = 128
)

The bounds on a creation request. It precedes any dataset, so no dataset's limits can govern it, and it may now carry a whole schema — which is why both are advertised in server_limits rather than left for a client to find by being refused.

Variables

This section is empty.

Functions

func New

func New(engine store.Store, authenticate Authenticate) (http.Handler, error)

func NewWithOptions

func NewWithOptions(engine store.Store, authenticate Authenticate, options Options) (http.Handler, error)

Types

type Authenticate

type Authenticate func(context.Context, string) (store.Access, error)

Authenticate resolves a bearer credential using host-owned authentication. Current grants are checked independently by the store on every transaction.

type Options

type Options struct {
	// DeprecatedVersions announces planned retirement of still-served majors.
	// Empty omits the signal; dates never disable routes. The host must satisfy
	// the contract's overlap, notice and continued-client-support obligations.
	DeprecatedVersions []p.DeprecatedVersion
	// DisplayName is the operator's optional label for people, not identity.
	DisplayName          string
	AuthMethods          []string
	AuthorizationServers []string
	ContentOrigin        string
	// Provision opts a deployment into creating datasets over HTTP. Leaving it
	// nil is not an oversight: a server that offers the route is making a
	// promise of its own. The engine must also implement store.Provisioning,
	// or the route stays refused.
	Provision Provision
	// CreationOffered lets a deployment stop offering creation while it is
	// running. Capability is deployment state and authority is per-caller
	// state, so this is separate from Provision: one decides whether anybody
	// may create here, the other whether this caller may.
	//
	// nil means offered whenever the engine can provision and Provision is
	// supplied. Returning false withdraws the advertisement and refuses the
	// route with not_supported — and must leave recovery working, which is
	// what keeps "cannot create" distinguishable from "cannot reconcile".
	CreationOffered func() bool
	// SharedReads advertises that this deployment's authorization server
	// accepts a request to read everything shared with the account. The
	// record protocol serves such an installation like any other; it is the
	// approval that differs, and only the deployment knows whether it offers
	// one.
	SharedReads bool
	// Provisioned tells the deployment about a dataset that now exists, so
	// that whatever it does for the datasets it holds it also does for this
	// one. Without it a dataset created over the wire is one the engine knows
	// and the deployment does not: its creator holds it according to the
	// storage and according to nothing else, and no administration surface
	// can see it until the server is restarted.
	//
	// It runs before the response, on the fresh creation and on a replay
	// alike, so bookkeeping that failed once is retried by the retry the
	// caller was going to make anyway. It must therefore be idempotent, and
	// its failure is reported — the dataset exists and the idempotency key
	// recovers it, so a caller that retries gets both the identity and the
	// bookkeeping.
	Provisioned func(context.Context, store.Access, string) error
}

Options describes authentication methods actually supplied by the host. The credential resolver treats service tokens as their own principals; it does not borrow the grants of a person who provisioned them.

type Provision

type Provision func(context.Context, store.Access) error

Provision decides whether a caller may create a dataset. The protocol has no grant for it — its grants are all over a dataset that already exists — so the decision is the host's and there is no default. A host that supplies none leaves the route refusing.

Jump to

Keyboard shortcuts

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