api

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RateLimitMiddleware added in v0.10.0

func RateLimitMiddleware(ctx context.Context, rps float64, burst int) func(http.Handler) http.Handler

RateLimitMiddleware returns per-IP token bucket middleware. rps is the sustained rate (requests per second); burst is the bucket capacity. Each unique client IP gets its own limiter. Visitors not seen for 3 minutes are purged from the in-memory map by a background goroutine that exits when ctx is canceled.

func Shutdown

func Shutdown(srv *http.Server, timeout time.Duration) error

Shutdown gracefully shuts down an http.Server with the given timeout. This is a convenience helper used by the serve command.

Types

type Server

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

Server is an HTTP API server that exposes memory operations.

func NewServer

func NewServer(st store.Store, rec *recall.Recaller, emb embedder.Embedder, logger *slog.Logger, authToken, cursorSecret string) *Server

NewServer creates a new Server with the given dependencies.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns an http.Handler with all routes registered.

Jump to

Keyboard shortcuts

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