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, /system/whoami and /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: the two routes outside the API — explorer.html, and the root naming this build limits: static responses, no API surface — neither is 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 ¶
- func ValidateAddr(addr string) error
- type Server
- func (s *Server) AdvanceDevClock(w http.ResponseWriter, r *http.Request)
- func (s *Server) CancelVerification(w http.ResponseWriter, r *http.Request, reportId string)
- func (s *Server) Close() error
- func (s *Server) Contribute(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteVerification(w http.ResponseWriter, r *http.Request, reportId string)
- func (s *Server) GetArchiveClaim(w http.ResponseWriter, r *http.Request, idParam string)
- func (s *Server) GetArchiveClaimContent(w http.ResponseWriter, r *http.Request, idParam string)
- func (s *Server) GetArchiveInfo(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetBranchClaim(w http.ResponseWriter, r *http.Request, branch string, idParam string)
- func (s *Server) GetBranchClaimContent(w http.ResponseWriter, r *http.Request, branch string, idParam string)
- func (s *Server) GetBranchHead(w http.ResponseWriter, r *http.Request, branch string)
- func (s *Server) GetBranchInfo(w http.ResponseWriter, r *http.Request, branch string)
- func (s *Server) GetClaim(w http.ResponseWriter, r *http.Request, idParam string)
- func (s *Server) GetClaimContent(w http.ResponseWriter, r *http.Request, idParam string)
- func (s *Server) GetVerification(w http.ResponseWriter, r *http.Request, reportId string)
- func (s *Server) Handler() http.Handler
- func (s *Server) Health(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListBranches(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListStorageLayers(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListVerifications(w http.ResponseWriter, r *http.Request)
- func (s *Server) Query(w http.ResponseWriter, r *http.Request)
- func (s *Server) Serve(ctx context.Context) error
- func (s *Server) StartVerification(w http.ResponseWriter, r *http.Request)
- func (s *Server) Whoami(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateAddr ¶
ValidateAddr checks addr's form offline: a socket path must fit the sun_path limit, and a bare filesystem path missing the scheme is reported with the correction.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a running REST/HTTP endpoint driving core.Handle.
func New ¶
New builds the endpoint from its config section; "addr" listens (default ":8080"), a "unix://" scheme naming a Unix domain socket instead of a TCP address.
func (*Server) AdvanceDevClock ¶
func (s *Server) AdvanceDevClock(w http.ResponseWriter, r *http.Request)
AdvanceDevClock serves POST /dev/clock.
func (*Server) CancelVerification ¶
CancelVerification serves POST /system/verifications/{id}/cancel.
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 ¶
DeleteVerification serves DELETE /system/verifications/{id}.
func (*Server) GetArchiveClaim ¶
GetArchiveClaim serves GET /archive/claims/{id} — the $archive scope, the closure of the current head across every branch.
func (*Server) GetArchiveClaimContent ¶
GetArchiveClaimContent serves GET /archive/claims/{id}/content.
func (*Server) GetArchiveInfo ¶
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 ¶
GetBranchHead serves GET /branches/{branch}/head.
func (*Server) GetBranchInfo ¶
GetBranchInfo serves GET /branches/{branch}/info.
func (*Server) GetClaim ¶
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 ¶
GetClaimContent serves GET /universe/claims/{id}/content.
func (*Server) GetVerification ¶
GetVerification serves GET /system/verifications/{id}.
func (*Server) Handler ¶ added in v1.24.0
Handler is the routed endpoint, credential extraction and CORS included, without a listener under it. It is what Serve binds, so a caller driving the routes directly — the Go client's tests, which answer the real handler rather than a stub of their own making — exercises the same stack a request over a socket reaches.
func (*Server) Health ¶
func (s *Server) Health(w http.ResponseWriter, r *http.Request)
Health serves GET /health.
func (*Server) ListBranches ¶
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 ¶
Serve binds the endpoint's listener and runs until ctx is cancelled, then shuts down gracefully. Binding happens here, not in New, so building never claims a port.
func (*Server) StartVerification ¶
func (s *Server) StartVerification(w http.ResponseWriter, r *http.Request)
StartVerification serves POST /system/verification.