server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package server is whittle's HTTP front door. It replaces the Python compressor's POST /v1/compress with a content-aware router + structural compressors (and delegates the prose path back to the Python service). The response shape matches the Python service closely enough that the edge-server caller — which reads only `compressed` + `action` — is unchanged.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(addr string) error

ListenAndServe builds the pipeline from the environment and serves the HTTP API on addr (":45871" if empty). Env: WHITTLE_MODEL_URL (enables the ML prose path), WHITTLE_MAX_CHARS (global ceiling), WHITTLE_PROSE_MAX_CHARS (prose latency ceiling).

func NewMux

func NewMux(p *compress.Pipeline) http.Handler

func NewMuxWithStore added in v0.2.0

func NewMuxWithStore(p *compress.Pipeline, store *Store) http.Handler

Types

type Store added in v0.2.0

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

func OpenStore added in v0.2.0

func OpenStore(dir string, maxBytes int64, ttl time.Duration) (*Store, error)

func (*Store) Get added in v0.2.0

func (s *Store) Get(id int64) (string, bool)

Get returns the original content for an alias, or ok=false (expired/unknown).

func (*Store) Put added in v0.2.0

func (s *Store) Put(content string) int64

Put stores content and returns its alias id (deduped by content hash).

Jump to

Keyboard shortcuts

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