Lines Matching defs:bucket
50 ev_token_bucket_init_(struct ev_token_bucket *bucket,
59 appropriate amount of bandwidth to the bucket.
61 if (bucket->read_limit > (ev_int64_t) cfg->read_maximum)
62 bucket->read_limit = cfg->read_maximum;
63 if (bucket->write_limit > (ev_int64_t) cfg->write_maximum)
64 bucket->write_limit = cfg->write_maximum;
66 bucket->read_limit = cfg->read_rate;
67 bucket->write_limit = cfg->write_rate;
68 bucket->last_updated = current_tick;
74 ev_token_bucket_update_(struct ev_token_bucket *bucket,
80 unsigned n_ticks = current_tick - bucket->last_updated;
88 bucket->limit += n_ticks * cfg->rate;
90 if (bucket->limit > cfg->maximum)
91 bucket->limit = cfg->maximum;
96 if ((cfg->read_maximum - bucket->read_limit) / n_ticks < cfg->read_rate)
97 bucket->read_limit = cfg->read_maximum;
99 bucket->read_limit += n_ticks * cfg->read_rate;
102 if ((cfg->write_maximum - bucket->write_limit) / n_ticks < cfg->write_rate)
103 bucket->write_limit = cfg->write_maximum;
105 bucket->write_limit += n_ticks * cfg->write_rate;
108 bucket->last_updated = current_tick;
195 0 if our bucket is wholly exhausted.
220 bucket, and take the smaller of our rate limit and the group
406 /* First, update the bucket */
525 /** Callback invoked every tick to add more elements to the group bucket