| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Zlib
Description
Owned zlib streams over the existing streaming-commons ABI. A caller opens a stream inside its
own bracket, advances it in bounded native calls, and releases it there, so the native state never
waits for a collector. Each call is an unsafe foreign call, which holds its capability and blocks
collection while it runs, so every step is bounded to keep that pause short.
Synopsis
- data ZlibFault
- openStream :: (ZStream' -> IO CInt) -> IO ZStream'
- initialiseInflate :: ZStream' -> CInt -> IO CInt
- initialiseDeflate :: ZStream' -> CInt -> CInt -> CInt -> CInt -> IO CInt
- releaseInflate :: ZStream' -> IO ()
- releaseDeflate :: ZStream' -> IO ()
- advanceStream :: (ZStream' -> IO CInt) -> ZStream' -> ByteString -> Ptr Word8 -> Int -> IO (CInt, Int, Int)
Opening and releasing a stream
A stream the native library could not allocate, or one that reported state no valid stream reaches.
Constructors
| ZlibAllocationFailed | |
| ZlibInitialisationFailed CInt | |
| InvalidZlibState CInt | |
| InvalidZlibCounters |
Instances
| Exception ZlibFault Source # | |
Defined in Ecluse.Core.Zlib Methods toException :: ZlibFault -> SomeException # fromException :: SomeException -> Maybe ZlibFault # displayException :: ZlibFault -> String # backtraceDesired :: ZlibFault -> Bool # | |
| Show ZlibFault Source # | |
| Eq ZlibFault Source # | |
openStream :: (ZStream' -> IO CInt) -> IO ZStream' Source #
Allocate a stream and run its initialiser. A failed initialiser frees the allocation before the fault escapes.
initialiseInflate :: ZStream' -> CInt -> IO CInt Source #
Initialise an inflater with the given window bits.
initialiseDeflate :: ZStream' -> CInt -> CInt -> CInt -> CInt -> IO CInt Source #
Initialise a deflater. The arguments after the stream are level, window bits, memory level, and strategy.
releaseInflate :: ZStream' -> IO () Source #
End an inflater and free its stream.
releaseDeflate :: ZStream' -> IO () Source #
End a deflater and free its stream.