MCPcopy Create free account
hub / github.com/PostHog/duckgres / CacheProxy

Struct CacheProxy

cmd/cache-proxy/proxy.go:42–57  ·  view source on GitHub ↗

CacheProxy is a forward HTTP proxy that caches responses on local NVMe. DuckDB httpfs sends each S3 request as a signed plain-HTTP request to the proxy; the proxy caches by URL+Range and forwards misses verbatim. The SigV4 signature stays valid because Host/URL are unchanged, so the proxy needs no A

Source from the content-addressed store, hash-verified

40// CacheProxy is a forward HTTP proxy that caches responses on local NVMe.
41// DuckDB httpfs sends each S3 request as a signed plain-HTTP request to the
42// proxy; the proxy caches by tenant scope (SigV4 access key ID) + URL + Range
43// and forwards misses verbatim. The SigV4 signature stays valid because
44// Host/URL are unchanged, so the proxy needs no AWS credentials of its own.
45type CacheProxy struct {
46 store *DiskCache
47 peers *PeerManager
48 client *http.Client
49 flights singleFlight
50
51 // connectDial dials CONNECT tunnel targets. It is net.DialTimeout in
52 // production and a seam in tests, where an allowed target (port 443,
53 // non-local hostname) cannot resolve to a real listener.
54 connectDial func(network, addr string, timeout time.Duration) (net.Conn, error)
55
56 originTimeout time.Duration
57 originRetryMaxAttempts int
58 originRetryInitialBackoff time.Duration
59 originRetryMaxBackoff time.Duration
60

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected