Documentation
¶
Overview ¶
Package httpapi serves the 2dph brain over HTTP.
Async by design: every request runs on its own goroutine, and CPU-heavy searches are serialized through a bounded worker pool so N requests can't spawn N backends at once.
Used by bin/brain/serve.go. Tests inject a fake API (no exec, no ladybug).
Index ¶
- func NewServer(api API, workers int) http.Handler
- func Run(api API)
- type API
- type ExecSearcher
- func (ExecSearcher) Audit(context.Context) ([]byte, error)
- func (ExecSearcher) Get(context.Context, string, bool) ([]byte, error)
- func (ExecSearcher) Ingest(context.Context) ([]byte, error)
- func (b ExecSearcher) Search(ctx context.Context, query string, limit int) ([]byte, error)
- func (ExecSearcher) Stats(context.Context) ([]byte, error)
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶ added in v0.4.0
type API interface {
Search(ctx context.Context, query string, limit int) ([]byte, error)
Get(ctx context.Context, id string, body bool) ([]byte, error)
Stats(ctx context.Context) ([]byte, error)
Audit(ctx context.Context) ([]byte, error)
Ingest(ctx context.Context) ([]byte, error)
}
API is the in-process brain surface. Production serve.go wires internal/brain.
type ExecSearcher ¶ added in v0.4.0
ExecSearcher shells out to var/bin/brain-search. Fallback when the serve binary is built without ladybug cgo (CI / tags=brain_serve only).
func (ExecSearcher) Audit ¶ added in v0.4.0
func (ExecSearcher) Audit(context.Context) ([]byte, error)
func (ExecSearcher) Ingest ¶ added in v0.4.0
func (ExecSearcher) Ingest(context.Context) ([]byte, error)
Click to show internal directories.
Click to hide internal directories.