expose codec options
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
458388359a
commit
3f6852030f
@ -22,6 +22,10 @@ var (
|
||||
ErrUnknownContentType = errors.New("unknown content-type")
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultMaxMessageSize = 1024 * 1024 * 4 // 4Mb
|
||||
)
|
||||
|
||||
// MessageType
|
||||
type MessageType int
|
||||
|
||||
@ -55,6 +59,18 @@ type Message struct {
|
||||
Body []byte
|
||||
}
|
||||
|
||||
type Option func(*Options)
|
||||
|
||||
type Options struct {
|
||||
MaxMessageSize int64
|
||||
}
|
||||
|
||||
func MaxMessageSize(n int64) Option {
|
||||
return func(o *Options) {
|
||||
o.MaxMessageSize = n
|
||||
}
|
||||
}
|
||||
|
||||
func NewMessage(t MessageType) *Message {
|
||||
return &Message{Type: t, Header: metadata.New(0)}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user