mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 15:04:22 +00:00
add wrapper
This commit is contained in:
@@ -14,3 +14,17 @@ type Envelope struct {
|
|||||||
Message proto.Message // message payload
|
Message proto.Message // message payload
|
||||||
ChannelID byte
|
ChannelID byte
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrapper is a Protobuf message that can contain a variety of inner messages
|
||||||
|
// (e.g. via oneof fields). If a Channel's message type implements Wrapper, the
|
||||||
|
// Router will automatically wrap outbound messages and unwrap inbound messages,
|
||||||
|
// such that reactors do not have to do this themselves.
|
||||||
|
type Wrapper interface {
|
||||||
|
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() (proto.Message, error)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user