| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
LibP2P.Yamux.Stream
Description
Yamux stream operations: read, write, close, reset.
Implements per-stream data transfer with flow control per HashiCorp yamux spec.md §DataWindowUpdateStream Close.
Synopsis
- streamWrite :: YamuxStream -> ByteString -> IO (Either YamuxError ())
- streamRead :: YamuxStream -> IO (Either YamuxError ByteString)
- streamReadRetained :: YamuxStream -> IO (Either YamuxError ByteString)
- streamClose :: YamuxStream -> IO (Either YamuxError ())
- streamReset :: YamuxStream -> IO ()
- releaseReceiveBuffer :: YamuxStream -> STM ()
Documentation
streamWrite :: YamuxStream -> ByteString -> IO (Either YamuxError ()) Source #
Write data to a stream. Blocks when send window is 0. Writable states: SYNSent (optimistic), Established, RemoteClose. Returns YamuxStreamClosed on LocalClose/Closed. Returns YamuxStreamReset on Reset.
streamRead :: YamuxStream -> IO (Either YamuxError ByteString) Source #
Read data and transfer ownership to the caller.
streamReadRetained :: YamuxStream -> IO (Either YamuxError ByteString) Source #
Read data while retaining its memory charge. The StreamIO adapter uses this to keep partially-consumed chunks accounted until its buffer drains.
streamClose :: YamuxStream -> IO (Either YamuxError ()) Source #
Half-close the stream by sending FIN flag. Only valid in Established or RemoteClose states.
streamReset :: YamuxStream -> IO () Source #
Reset the stream by sending RST flag.
releaseReceiveBuffer :: YamuxStream -> STM () Source #