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 ¶
Types ¶
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.