Documentation
¶
Index ¶
Constants ¶
View Source
const ( Tag_Fresh = 0 // the default for new messages, or must be reset by clients Tag_OK = 1 // set by server only Tag_Dropped = 177 // set by chopper only )
Variables ¶
This section is empty.
Functions ¶
func Chopper_Start ¶
func Chopper_Start[T any]( ctx context.Context, chUp chan *Message[T], of ...func(*Chopper_Options), )
func SyncTransaction ¶
It's nice and simple, but you can't use it in select{}. See also ChDown.Transaction(). Note: please don't over-use this as a low-level primitive, it's best for high levels of abstraction code. For low-level, consider using the DQF pattern directly.
Types ¶
type ChDown ¶ added in v1.89.0
func (ChDown[T]) Transaction ¶ added in v1.89.0
This can be used in select{}. See also the SyncTransaction() function. Note: please don't over-use this as a low-level primitive, it's best for high levels of abstraction code. For low-level, consider using the DQF pattern directly.
type Chopper_Mode ¶
type Chopper_Mode struct {
Period time.Duration
ThresholdPerc float32 // threshold perc of full capacity, action happens if above it
ChopNPerc float32 // how much to chop per one action, perc of full capacity
NChopsToUpgrade int // e.g. after 5 successive chops, upgrade to faster mode
NNoChopsToDowngrade int // e.g. after 5 successive no-chops, downgrade to slower mode
}
type Chopper_Options ¶
type Chopper_Options struct {
Modes []Chopper_Mode // 0 is slowest, -1 is fastest
IfChoppedFunc func(n_chopped int)
UpgradeFunc func(from_mode, to_mode int)
DowngradeFunc func(from_mode, to_mode int)
}
Click to show internal directories.
Click to hide internal directories.