Further crufting
This commit is contained in:
@@ -23,13 +23,21 @@ type NewCodec func(io.ReadWriteCloser) Codec
|
||||
// connection. ReadBody may be called with a nil argument to force the
|
||||
// body to be read and discarded.
|
||||
type Codec interface {
|
||||
ReadHeader(*Message, MessageType) error
|
||||
ReadBody(interface{}) error
|
||||
Write(*Message, interface{}) error
|
||||
Reader
|
||||
Writer
|
||||
Close() error
|
||||
String() string
|
||||
}
|
||||
|
||||
type Reader interface {
|
||||
ReadHeader(*Message, MessageType) error
|
||||
ReadBody(interface{}) error
|
||||
}
|
||||
|
||||
type Writer interface {
|
||||
Write(*Message, interface{}) error
|
||||
}
|
||||
|
||||
// Message represents detailed information about
|
||||
// the communication, likely followed by the body.
|
||||
// In the case of an error, body may be nil.
|
||||
@@ -42,5 +50,5 @@ type Message struct {
|
||||
|
||||
// The values read from the socket
|
||||
Header map[string]string
|
||||
Body []byte
|
||||
Body []byte
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user