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
	}
}