24 namespace ExecutorResourceMgr_Namespace {
30 : resource_subtype(resource_subtype)
31 , policy_size_type(policy_size_type)
32 , size_info(size_info) {}
35 const size_t total_resource_quantity)
const {
38 return std::numeric_limits<size_t>::max();
42 return static_cast<size_t>(
48 return std::numeric_limits<size_t>::max();
53 const bool cap_at_total_available)
const {
54 const size_t max_per_query_grant_without_cap =
56 if (cap_at_total_available) {
57 return std::min(max_per_query_grant_without_cap, total_resource_quantity);
59 return max_per_query_grant_without_cap;
63 std::ostringstream oss;
64 oss <<
"RESOURCE TYPE: "
68 oss <<
"SIZE TYPE: Unlimited";
88 return resource_grant_policy;
93 const size_t constant_grant) {
97 return resource_grant_policy;
102 const double ratio_grant) {
106 return resource_grant_policy;
111 std::ostringstream oss;
112 switch (resource_concurrency_policy) {
114 oss <<
"Allow concurrent requests";
117 oss <<
"Allow single request for resource type";
120 oss <<
"Allow single request globally";
123 oss <<
"Disallow requests";
139 std::ostringstream oss;
141 <<
"Undersubscribed Policy: "
143 <<
" Oversubscribed Policy: "
bool operator==(const ConcurrentResourceGrantPolicy &rhs) const
ResourceConcurrencyPolicy
Specifies whether grants for a specified resource can be made concurrently (ALLOW_CONCURRENT_REQEUSTS...
size_t get_grant_quantity(const size_t total_resource_quantity) const
Used to calculate the maximum quantity that can be granted of the resource.
ResourceType resource_type
The type of a resource this concurrent resource grant policy pertains to.
ResourceGrantPolicySizeType
The sizing type for a ResourceGrantPolicy of a given resource type, specifying whether resource grant...
Specifies the policies for resource grants in the presence of other requests, both under situations o...
ResourceGrantPolicy gen_unlimited_resource_grant_policy(const ResourceSubtype resource_subtype)
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::UNLIMITED
ResourceSubtype
Stores the resource sub-type for a ExecutorResourcePool request.
ResourceConcurrencyPolicy concurrency_policy
The grant policy in effect when there are concurrent requests for the resource specified by resource_...
ResourceGrantPolicy gen_ratio_resource_grant_policy(const ResourceSubtype resource_subtype, const double ratio_grant)
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::RATIO_TO_TOTAL
std::string get_resource_concurrency_policy_string(const ResourceConcurrencyPolicy &resource_concurrency_policy)
ResourceGrantSizeInfo size_info
std::string to_string() const
ResourceConcurrencyPolicy oversubscription_concurrency_policy
The grant policy in effect when there are concurrent requests for the resource specified by resource_...
Specifies the policy for granting a resource of a specific ResourceSubtype. Note that this policy onl...
std::string to_string() const
ResourceGrantPolicy gen_constant_resource_grant_policy(const ResourceSubtype resource_subtype, const size_t constant_grant)
Generates a ResourceGrantPolicy with ResourceGrantPolicySizeType::CONSTANT
ResourceSubtype resource_subtype
std::string resource_type_to_string(const ResourceType resource_type)
static const char * ResourceSubtypeStrings[]
ResourceGrantPolicySizeType policy_size_type