2018-01-28 15:06:41 +00:00
|
|
|
package payload
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
|
|
|
// Payload is anything that can be binary encoded/decoded.
|
|
|
|
type Payload interface {
|
2019-01-25 11:20:35 +00:00
|
|
|
EncodeBinary(io.Writer) error
|
|
|
|
DecodeBinary(io.Reader) error
|
2018-01-28 15:06:41 +00:00
|
|
|
}
|
2019-09-13 09:03:07 +00:00
|
|
|
|
|
|
|
// NullPayload is a dummy payload with no fields.
|
|
|
|
type NullPayload struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewNullPayload returns zero-sized stub payload.
|
|
|
|
func NewNullPayload() *NullPayload {
|
|
|
|
return &NullPayload{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DecodeBinary implements the Payload interface.
|
|
|
|
func (p *NullPayload) DecodeBinary(r io.Reader) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// EncodeBinary implements the Payload interface.
|
|
|
|
func (p *NullPayload) EncodeBinary(r io.Writer) error {
|
|
|
|
return nil
|
|
|
|
}
|