Documentation ¶
Overview ¶
Package sideband implements a sideband mutiplex/demultiplexer
Index ¶
Constants ¶
const ( // Sideband legacy sideband type up to 1000-byte messages Sideband Type = iota // Sideband64k sideband type up to 65519-byte messages Sideband64k Type = iota // MaxPackedSize for Sideband type MaxPackedSize = 1000 // MaxPackedSize64k for Sideband64k type MaxPackedSize64k = 65520 )
Variables ¶
var ErrMaxPackedExceeded = errors.New("max. packed size exceeded")
ErrMaxPackedExceeded returned by Read, if the maximum packed size is exceeded
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel byte
Channel sideband channel
func (Channel) WithPayload ¶
WithPayload encode the payload as a message
type Demuxer ¶
type Demuxer struct { // Progress is where the progress messages are stored Progress Progress // contains filtered or unexported fields }
Demuxer demultiplexes the progress reports and error info interleaved with the packfile itself.
A sideband has three different channels the main one, called PackData, contains the packfile data; the ErrorMessage channel, that contains server errors; and the last one, ProgressMessage channel, containing information about the ongoing task happening in the server (optional, can be suppressed sending NoProgress or Quiet capabilities to the server)
In order to demultiplex the data stream, method `Read` should be called to retrieve the PackData channel, the incoming data from the ProgressMessage is written at `Progress` (if any), if any message is retrieved from the ErrorMessage channel an error is returned and we can assume that the connection has been closed.
func NewDemuxer ¶
NewDemuxer returns a new Demuxer for the given t and read from r
type Muxer ¶
type Muxer struct {
// contains filtered or unexported fields
}
Muxer multiplex the packfile along with the progress messages and the error information. The multiplex is perform using pktline format.
func NewMuxer ¶
NewMuxer returns a new Muxer for the given t that writes on w.
If t is equal to `Sideband` the max pack size is set to MaxPackedSize, in any other value is given, max pack is set to MaxPackedSize64k, that is the maximum length of a line in pktline format.