Documentation
¶
Index ¶
Constants ¶
const ( DefaultMaxQueueBytes = 1 * 1024 * 1024 // 1MB max/queue DefaultMaxMessageBytes = 256 * 1024 // 256 KB )
Variables ¶
var ( PriorityTypeUnmarshal = map[string]PriorityType{ "unknown": UnknownType, "oldest": OldestType, "newest": NewestType, } PriorityTypeMarshal = map[PriorityType]string{ UnknownType: "unknown", OldestType: "oldest", NewestType: "newest", } )
var ( ErrInvalidInput = errors.New("invalid input") ErrMisconfiguredQOS = errors.New("misconfigured QOS") ErrQOSHasShutdown = errors.New("QOS has been shutdown") )
var ErrMaxMessageBytes = errors.New("wrp message payload exceeds maxMessageBytes")
var ErrPriorityTypeInvalid = errors.New("Priority type is invalid")
Functions ¶
func PriorityNewestMsg ¶ added in v0.1.4
func PriorityNewestMsg(i, j item) bool
func PriorityOldestMsg ¶ added in v0.1.4
func PriorityOldestMsg(i, j item) bool
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler queues incoming messages and sends them to the next wrpkit.Handler
func New ¶
New creates a new instance of the Handler struct. The parameter next is the handler that will be called and monitored for errors. Note, once Handler.Stop is called, any calls to Handler.HandleWrp will result in an ErrQOSHasShutdown error
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is a functional option type for QOS.
func MaxMessageBytes ¶
MaxMessageBytes is the largest allowable wrp message payload. Note, the default zero behavior is a 256KB payload size constraint.
func MaxQueueBytes ¶
MaxQueueBytes is the allowable max size of the qos' priority queue, based on the sum of all queued wrp message's payload. Note, the default zero behavior is a queue with a 1MB size constraint.
func Priority ¶ added in v0.1.4
func Priority(p PriorityType) Option
Priority determines what is used [newest, oldest message] for QualityOfService tie breakers, with the default being to prioritize the newest messages.
type PriorityType ¶ added in v0.1.4
type PriorityType int
const ( UnknownType PriorityType = iota OldestType NewestType )
func (PriorityType) String ¶ added in v0.1.4
func (pt PriorityType) String() string
String returns a human-readable string representation for an existing PriorityType, otherwise String returns the `unknown` string value.
func (*PriorityType) UnmarshalText ¶ added in v0.1.4
func (pt *PriorityType) UnmarshalText(b []byte) error
UnmarshalText unmarshals a PriorityType's enum value.