Documentation
¶
Overview ¶
Package serverapp composes stored-data application services and transports. Local lifecycle and remote authentication live outside this package.
Index ¶
- func FailureSummary(failures []CollectionFailure) string
- func Handler(ctx context.Context, service *contextservice.Service, ...) http.Handler
- func PageNavigation(r *http.Request) bool
- func Run(ctx context.Context, endpoints []Endpoint, tasks []Task, ready func()) error
- func SameOrigin(r *http.Request) bool
- type Capabilities
- type Collect
- type Collection
- type CollectionFailure
- type Collections
- type Endpoint
- type Options
- type Published
- type Selection
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FailureSummary ¶ added in v0.2.1
func FailureSummary(failures []CollectionFailure) string
FailureSummary joins failures for a single diagnostic.
func Handler ¶
func Handler(ctx context.Context, service *contextservice.Service, store reviewservice.MutationStore, assets fs.FS, defaultID string, options ...Options) http.Handler
func PageNavigation ¶ added in v0.2.5
PageNavigation reports a safe top-level document navigation, such as opening an emailed or shared link. Browsers send these cross-site with SameSite=Lax cookies; callers admit them only for page routes, never APIs.
func Run ¶
Run ties HTTP listeners and background work to one foreground lifetime. All tasks must honor cancellation before returning; storage closes afterwards.
func SameOrigin ¶
SameOrigin accepts HTTP and HTTPS deployments, including TLS termination.
Types ¶
type Capabilities ¶
type Capabilities struct {
IngestionEnabled bool
QueuedIngestion bool
Collection bool
// Selection is the collected checkouts' scope; empty without collection.
Selection Selection
}
Capabilities are resolved once by the transport composition. Both admission paths accept ingestion.Request; local collection calls the service directly.
func (Capabilities) Input ¶ added in v0.2.1
func (capabilities Capabilities) Input() string
Input names what a local process serves: its selected checkout or the discovered checkouts, which it can collect again, or one fixed capture (piped stdin or a fixture) with nothing to switch to. Only checkout processes own collections.
type Collect ¶ added in v0.2.1
Collect publishes completed checkout requests serially before returning the remaining checkout failures. It joins its workers before returning, including after cancellation or a publication error.
type Collection ¶ added in v0.2.1
type Collection struct {
Requests []ingestion.Request
Failures []CollectionFailure
}
Collection is one user-requested collection of the composition's selected checkouts. Failures name checkouts that could not be collected.
type CollectionFailure ¶ added in v0.2.1
type Collections ¶ added in v0.2.1
type Collections struct {
// contains filtered or unexported fields
}
Collections serializes checkout collection and publication. The first UI load request joins startup, including when startup finished before the browser opened. Later requests collect fresh snapshots. A disconnected browser does not cancel startup, whose lifetime belongs to the foreground process.
func NewCollections ¶ added in v0.2.1
func NewCollections(service *contextservice.Service, selection Selection, collect Collect, defaultID string) *Collections
func (*Collections) Initial ¶ added in v0.2.1
func (handler *Collections) Initial(completed func(Published, error)) Task
Initial reserves the startup result before serving requests and returns the task that collects it. Call once, before Run. Collection errors are reported to the UI and callback; the server stays available for retry.
func (*Collections) ServeHTTP ¶ added in v0.2.1
func (handler *Collections) ServeHTTP(w http.ResponseWriter, r *http.Request)
type Options ¶
type Options struct {
Queue ingestionqueue.Queue
// Collections coordinates local startup and explicit checkout collection.
// Piped captures, fixtures and remote storage have none.
Collections *Collections
}
func (Options) Capabilities ¶
func (options Options) Capabilities() Capabilities
type Published ¶ added in v0.2.1
type Published struct {
Publications []contextservice.Publication
Failures []CollectionFailure
// contains filtered or unexported fields
}
Published is the outcome of ingesting one collection.
func Publish ¶ added in v0.2.1
func Publish(ctx context.Context, service *contextservice.Service, collection Collection) (Published, error)
Publish selects each collected checkout into the composition's scope, then ingests it serially. Each observation commits atomically on its own; a rejected request is reported with its checkout and never blocks the others.
func (Published) Newest ¶ added in v0.2.1
func (published Published) Newest() (contextservice.Publication, bool)
Newest prefers current contexts with changes, then current clean contexts. Among equals, the checkout containing the collection's input path wins, so `diffx PATH` inside a worktree opens that worktree; then recent activity. A successful collection of older observations still has an available default.