Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStreamDialer ¶
func NewStreamDialer(dialer transport.StreamDialer, nextSplit SplitIterator) (transport.StreamDialer, error)
NewStreamDialer creates a transport.StreamDialer that splits the outgoing stream according to nextSplit.
func NewWriter ¶
func NewWriter(writer io.Writer, nextSegmentLength SplitIterator) io.Writer
NewWriter creates a split Writer that calls the nextSegmentLength SplitIterator to determine the number bytes until the next split point until it returns zero.
Types ¶
type RepeatedSplit ¶
RepeatedSplit represents a split sequence of count segments with bytes length.
type SplitIterator ¶
type SplitIterator func() int64
SplitIterator is a function that returns how many bytes until the next split point, or zero if there are no more splits to do.
func NewFixedSplitIterator ¶
func NewFixedSplitIterator(n int64) SplitIterator
NewFixedSplitIterator is a helper function that returns a SplitIterator that returns the input number once, followed by zero. This is helpful for when you want to split the stream once in a fixed position.
func NewRepeatedSplitIterator ¶
func NewRepeatedSplitIterator(splits ...RepeatedSplit) SplitIterator
NewRepeatedSplitIterator is a helper function that returns a SplitIterator that returns split points according to splits. The splits input represents pairs of (count, bytes), meaning a sequence of count splits with bytes length. This is helpful for when you want to split the stream repeatedly at different positions and lengths.