Buckets store ratelimit data per major parameter. More...
#include <bucket.hpp>
Public Member Functions | |
bucket (rest_call &call, asio::io_context &_io_context, std::atomic< int64_t > &global_limit) | |
bool | is_global () const noexcept |
Check if globally ratelimited. More... | |
bool | can_perform () const noexcept |
Check if bucket can send a message without hitting the ratelimit. More... | |
rest::rest_reply | perform (rest::request_params params) |
Public Attributes | |
std::atomic< int64_t > | limit |
std::atomic< int64_t > | remaining |
std::atomic< int64_t > | reset |
bool | ignore_rates = false |
std::mutex | m |
rest_call & | _call |
std::queue< std::tuple < std::string, std::string, std::string, std::function < void(rest::rest_reply)> > > | _queue |
int32_t | reset_bypass = 0 |
Buckets store ratelimit data per major parameter.
Bucket class for tracking the ratelimits per snowflake per major parameter. Each bucket tracks a single major parameter and a single snowflake Current major parameters are GUILD, CHANNEL, and EMOJI
aegis::ratelimit::bucket::bucket | ( | rest_call & | call, |
asio::io_context & | _io_context, | ||
std::atomic< int64_t > & | global_limit | ||
) |
Construct a bucket object for tracking ratelimits per major parameter of the REST API (guild/channel/emoji)
|
noexcept |
Check if bucket can send a message without hitting the ratelimit.
|
noexcept |
Check if globally ratelimited.
std::atomic<int64_t> aegis::ratelimit::bucket::limit |
Rate limit current endpoint call limit
std::atomic<int64_t> aegis::ratelimit::bucket::remaining |
Rate limit remaining count
std::atomic<int64_t> aegis::ratelimit::bucket::reset |
Rate limit reset time