rpc/notify/notify_handlers.go

33 lines
725 B
Go
Raw Normal View History

2017-11-22 11:55:10 +00:00
package notify
import (
"git.loafle.net/commons_go/rpc/protocol"
)
type NotifyHandlers struct {
Codec protocol.ClientCodec
// The maximum number of pending requests in the queue.
//
// The number of pending requsts should exceed the expected number
// of concurrent goroutines calling client's methods.
// Otherwise a lot of ClientError.Overflow errors may appear.
//
// Default is DefaultPendingNotifies.
PendingNotifies int
}
func (nh *NotifyHandlers) GetCodec() protocol.ClientCodec {
return nh.Codec
}
func (nh *NotifyHandlers) GetPendingNotifies() int {
return nh.PendingNotifies
}
func (nh *NotifyHandlers) Validate() {
if nh.PendingNotifies <= 0 {
nh.PendingNotifies = DefaultPendingNotifies
}
}