mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
split wrap into wrap / unwrap types
This commit is contained in:
+1
-1
@@ -420,7 +420,7 @@ func createMConnection(
|
|||||||
"peer_id", string(p.ID()),
|
"peer_id", string(p.ID()),
|
||||||
"chID", fmt.Sprintf("%#x", chID),
|
"chID", fmt.Sprintf("%#x", chID),
|
||||||
}
|
}
|
||||||
if w, ok := msg.(Wrapper); ok {
|
if w, ok := msg.(Unwrapper); ok {
|
||||||
msg, err = w.Unwrap()
|
msg, err = w.Unwrap()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO(williambanfield) add error log line.
|
// TODO(williambanfield) add error log line.
|
||||||
|
|||||||
+6
-4
@@ -19,12 +19,14 @@ type Envelope struct {
|
|||||||
// (e.g. via oneof fields). If a Channel's message type implements Wrapper, the
|
// (e.g. via oneof fields). If a Channel's message type implements Wrapper, the
|
||||||
// Router will automatically wrap outbound messages and unwrap inbound messages,
|
// Router will automatically wrap outbound messages and unwrap inbound messages,
|
||||||
// such that reactors do not have to do this themselves.
|
// such that reactors do not have to do this themselves.
|
||||||
type Wrapper interface {
|
type Unwrapper interface {
|
||||||
proto.Message
|
proto.Message
|
||||||
|
|
||||||
// Wrap will take a message and wrap it in this one if possible.
|
|
||||||
Wrap(proto.Message) error
|
|
||||||
|
|
||||||
// Unwrap will unwrap the inner message contained in this message.
|
// Unwrap will unwrap the inner message contained in this message.
|
||||||
Unwrap() (proto.Message, error)
|
Unwrap() (proto.Message, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Wrapper interface {
|
||||||
|
// Wrap will take the underlying message and wrap it in its wrapper type.
|
||||||
|
Wrap() (proto.Message, error)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user