Documentation ¶
Index ¶
- type Error
- type OpError
- type Payload
- func (p *Payload) Close() error
- func (p *Payload) FeedIn(r io.Reader, supportBinary bool) error
- func (p *Payload) FlushOut(w io.Writer) error
- func (p *Payload) NextReader() (frame.Type, packet.Type, io.ReadCloser, error)
- func (p *Payload) NextWriter(ft frame.Type, pt packet.Type) (io.WriteCloser, error)
- func (p *Payload) Pause()
- func (p *Payload) Resume()
- func (p *Payload) SetReadDeadline(t time.Time) error
- func (p *Payload) SetWriteDeadline(t time.Time) error
- func (p *Payload) Store(op string, err error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Payload ¶
type Payload struct {
// contains filtered or unexported fields
}
Payload does encode or decode to payload protocol.
func (*Payload) FeedIn ¶
FeedIn feeds in a new reader for NextReader. Multi-FeedIn needs be called sync.
If Close called when FeedIn, it returns io.EOF. If having Pause-ed when FeedIn, it returns ErrPaused. If NextReader has timeout, it returns ErrTimeout. If read error while FeedIn, it returns read error.
func (*Payload) FlushOut ¶
FlushOut write data from NextWriter. FlushOut needs be called sync.
If Close called when FlushOut, it returns io.EOF. If Pause called when FlushOut, it flushes out a NOOP message and return nil. If NextWriter has timeout, it returns ErrTimeout. If write error while FlushOut, it returns write error.
func (*Payload) NextReader ¶
NextReader returns a reader for next frame. NextReader and SetReadDeadline needs be called sync.
If Close called when NextReader, it returns io.EOF. Pause doesn't affect to NextReader. NextReader should wait till resumed and next FeedIn.
func (*Payload) NextWriter ¶
NextWriter returns a writer for next frame. NextWriter and SetWriterDeadline needs be called sync. NextWriter will wait a FlushOut call, then it returns WriteCloser which encode package to FlushOut's Writer.
If Close called when NextWriter, it returns io.EOF. If beyond the time set by SetWriteDeadline, it returns ErrTimeout. If Pause called when NextWriter, it returns ErrPaused.
func (*Payload) Pause ¶
func (p *Payload) Pause()
Pause pauses the payload. It will wait all reader and writer closed which created from NextReader or NextWriter. It can call in multi-goroutine.
func (*Payload) Resume ¶
func (p *Payload) Resume()
Resume resumes the payload. It can call in multi-goroutine.
func (*Payload) SetReadDeadline ¶
SetReadDeadline sets next reader deadline. NextReader and SetReadDeadline needs be called sync. NextReader will wait a FeedIn call, then it returns ReadCloser which decodes packet from FeedIn's Reader.
If Close called when SetReadDeadline, it returns io.EOF. If beyond the time set by SetReadDeadline, it returns ErrTimeout. Pause doesn't affect to SetReadDeadline.
func (*Payload) SetWriteDeadline ¶
SetWriteDeadline sets next writer deadline. NextWriter and SetWriteDeadline needs be called sync.
If Close called when SetWriteDeadline, it returns io.EOF. Pause doesn't affect to SetWriteDeadline.