rest_http

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

package: rest_http / transport type: logic job: extract the request's auth credential from the wire and carry it to the handlers limits: extraction only; core resolves it and applies grants (-> internal/core)

package: rest_http / transport type: logic job: answer a browser's cross-origin checks for the origins the config admits limits: transport only; which origins are admitted is policy, and policy is config's

A browser refuses a cross-origin read unless the server says the origin may have it, so without this an explorer served from anywhere but the API's own origin cannot call it at all. Which origins may is an operational choice about this deployment, so it is declared in the endpoint's config rather than decided here — and declaring none keeps a server that no browser is meant to reach exactly as closed as it is today.

package: rest_http / transport type: logic job: the write endpoint — POST /contribute limits: translation only; the merge runs behind core.Handle (-> internal/core)

package: rest_http / transport type: logic job: the dev-only endpoint — POST /dev/clock limits: translation only; whether the capability exists is core's (-> internal/core)

package: rest_http / transport type: logic job: the read endpoints — POST /query and the cacheable by-id GET reads limits: transport only; the read language is ranke-go's and the reads core's (-> internal/core)

package: rest_http / transport type: logic job: the operational endpoints — GET /health and GET /system/layers limits: translation only; the values come from core.Handle (-> internal/core)

package: rest_http / transport type: logic job: the verification run endpoints under /system/verification, and config mapping limits: translation only; runs are managed behind core.Handle (-> internal/core)

package: rest_http / transport type: adapter job: serves explorer.html when the `explorer` build tag embedded it (-> frontend) limits: a static asset route, no API surface — not part of the OpenAPI contract

package: rest_http / transport type: adapter job: the HTTP envelope — content-type + status + body copy, and error → status mapping limits: framing/rendering live in core's Stream; this sets headers/status and copies (-> internal/core)

package: rest_http / transport type: adapter job: REST/HTTP endpoint backend — the Endpoints port and its server lifecycle limits: transport + translation only; all capability lives behind core.Core (-> internal/core)

Package rest_http implements the generated openapi.ServerInterface: it lifts the raw credential off the wire, builds a core.Request, and renders what core.Handle answers. Auth and access live in core; this is pure transport.

By topic: auth.go (wire credential), respond.go (writers, error → status), endpoints_read.go, endpoints_contribute.go, endpoints_system.go, endpoints_verification.go — the Server's own lifecycle here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

Server is a running REST/HTTP endpoint driving core.Handle.

func New

func New(ctx context.Context, cfg scope.Section, c *core.Core) (*Server, error)

New builds the endpoint from its config section; "addr" listens (default ":8080").

func (*Server) AdvanceDevClock added in v1.15.0

func (s *Server) AdvanceDevClock(w http.ResponseWriter, r *http.Request)

AdvanceDevClock serves POST /dev/clock.

func (*Server) CancelVerification

func (s *Server) CancelVerification(w http.ResponseWriter, r *http.Request, reportId string)

CancelVerification serves POST /system/verifications/{id}/cancel.

func (*Server) Close

func (s *Server) Close() error

Close shuts the endpoint down.

func (*Server) Contribute

func (s *Server) Contribute(w http.ResponseWriter, r *http.Request)

Contribute serves POST /contribute. The body names the branch each claim joins, so core reads them from it and checks the C right on each.

func (*Server) DeleteVerification

func (s *Server) DeleteVerification(w http.ResponseWriter, r *http.Request, reportId string)

DeleteVerification serves DELETE /system/verifications/{id}.

func (*Server) GetArchiveClaim added in v1.14.0

func (s *Server) GetArchiveClaim(w http.ResponseWriter, r *http.Request, idParam string)

GetArchiveClaim serves GET /archive/claims/{id} — the $archive scope, the closure of the current head across every branch.

func (*Server) GetArchiveClaimContent added in v1.14.0

func (s *Server) GetArchiveClaimContent(w http.ResponseWriter, r *http.Request, idParam string)

GetArchiveClaimContent serves GET /archive/claims/{id}/content.

func (*Server) GetArchiveInfo added in v1.14.0

func (s *Server) GetArchiveInfo(w http.ResponseWriter, r *http.Request)

GetArchiveInfo serves GET /archive/info — the branch-table head and its shape, read in the $archive scope, which is the grant it needs.

func (*Server) GetBranchClaim

func (s *Server) GetBranchClaim(w http.ResponseWriter, r *http.Request, branch string, idParam string)

GetBranchClaim serves GET /branches/{branch}/claims/{id}.

func (*Server) GetBranchClaimContent

func (s *Server) GetBranchClaimContent(w http.ResponseWriter, r *http.Request, branch string, idParam string)

GetBranchClaimContent serves GET /branches/{branch}/claims/{id}/content — the content of claim {id} within that branch's closure (inline or blob, resolved by core).

func (*Server) GetBranchHead

func (s *Server) GetBranchHead(w http.ResponseWriter, r *http.Request, branch string)

GetBranchHead serves GET /branches/{branch}/head.

func (*Server) GetBranchInfo added in v1.14.0

func (s *Server) GetBranchInfo(w http.ResponseWriter, r *http.Request, branch string)

GetBranchInfo serves GET /branches/{branch}/info.

func (*Server) GetClaim added in v1.14.0

func (s *Server) GetClaim(w http.ResponseWriter, r *http.Request, idParam string)

GetClaim serves GET /universe/claims/{id} — the $universe scope, reached under no closure. The path drops the `$`, the grant checked does not.

func (*Server) GetClaimContent added in v1.14.0

func (s *Server) GetClaimContent(w http.ResponseWriter, r *http.Request, idParam string)

GetClaimContent serves GET /universe/claims/{id}/content.

func (*Server) GetVerification

func (s *Server) GetVerification(w http.ResponseWriter, r *http.Request, reportId string)

GetVerification serves GET /system/verifications/{id}.

func (*Server) Health

func (s *Server) Health(w http.ResponseWriter, r *http.Request)

Health serves GET /health.

func (*Server) ListBranches added in v1.14.0

func (s *Server) ListBranches(w http.ResponseWriter, r *http.Request)

ListBranches serves GET /branches. The scope is what the grant is held against, so the request names the reserved branch table: R on $branches is what admits it.

func (*Server) ListStorageLayers

func (s *Server) ListStorageLayers(w http.ResponseWriter, r *http.Request)

ListStorageLayers serves GET /system/layers.

func (*Server) ListVerifications

func (s *Server) ListVerifications(w http.ResponseWriter, r *http.Request)

ListVerifications serves GET /system/verification.

func (*Server) Query

func (s *Server) Query(w http.ResponseWriter, r *http.Request)

Query serves POST /query: it runs the declarative query and streams the results.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

Serve runs the endpoint until ctx is cancelled, then shuts down gracefully.

func (*Server) StartVerification

func (s *Server) StartVerification(w http.ResponseWriter, r *http.Request)

StartVerification serves POST /system/verification.

Jump to

Keyboard shortcuts

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