hs-libp2p-0.2.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

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

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.