ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.MetadataGzip

Description

Gzip one served metadata body at level 1, in native steps of at most 32 KiB. The caller's charge pays for the native workspace before the deflater exists and for each output buffer before it is allocated. The deflater is released on every exit, cancellation included, so a response is sent with no native state held. Each request owns its deflater: no compression history crosses requests.

Synopsis

Documentation

data GzipBody Source #

A complete gzip member, held as the buffers zlib wrote it into, and its exact length in bytes.

Constructors

GzipBody 

gzipMetadata :: (Int -> IO ()) -> ByteString -> IO GzipBody Source #

Compress a body. A native fault is a thrown ZlibFault: no request can act on it, so the perimeter answers 500.

gzipLazyBody :: GzipBody -> LByteString Source #

The body as one lazy value over its buffers, with no copy.

The charges (exported for the residency probe)

gzipWorkspaceBytes :: Int Source #

The native allowance: zlib documents 256 KiB plus a few KiB of deflate state at this window and memory level.

gzipBufferChargeBytes :: Int Source #

One output buffer's charge: a pinned 32 KiB buffer and its heap header occupy nine 4 KiB blocks.