Documentation
¶
Index ¶
Constants ¶
View Source
const ( // MinFragment is minimum fragment size in bytes. MinFragment = framing.HeaderLen + 4 // MaxFragment is minimum fragment size in bytes. MaxFragment = common.MaxUint24 - 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeaderAndPayload ¶
type HeaderAndPayload interface {
payload.Payload
// Header returns a header of frame.
Header() framing.FrameHeader
}
HeaderAndPayload is Payload which having a FrameHeader.
type Joiner ¶
type Joiner interface {
HeaderAndPayload
// First returns the first frame.
First() framing.Frame
// Push append a new frame and returns true if joiner is end.
Push(elem HeaderAndPayload) (end bool)
}
Joiner is used to join frames to a payload.
type Splitter ¶
type Splitter interface {
// Split split data and metadata to frames.
Split(placeholder int, data []byte, metadata []byte, onFrame func(idx int, fg framing.FrameFlag, body *common.ByteBuff)) error
// ShouldSplit returns the answer with given payload size.
ShouldSplit(size int) bool
}
Splitter is used to split payload data and metadata to frames.
func NewSplitter ¶
NewSplitter returns a new splitter.
Click to show internal directories.
Click to hide internal directories.