OmniSciDB
a5dc49c757
|
Specifies the policy for granting a resource of a specific ResourceSubtype
. Note that this policy only pertains to resource grants on an isolated basis, and that grant policy with respect to concurrent requests is controlled by ConcurrentResourceGrantPolicy
.
More...
#include <ResourceGrantPolicy.h>
Public Member Functions | |
ResourceGrantPolicy () | |
ResourceGrantPolicy (const ResourceSubtype resource_subtype, const ResourceGrantPolicySizeType policy_size_type, const ResourceGrantSizeInfo size_info) | |
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. More... | |
size_t | get_grant_quantity (const size_t total_resource_quantity, const bool cap_at_total_available) const |
Used to calculate the maximum quantity that can be granted of the resource, optionally capping at the specified total_resource_quantity . More... | |
std::string | to_string () const |
Public Attributes | |
ResourceSubtype | resource_subtype {ResourceSubtype::INVALID_SUBTYPE} |
ResourceGrantPolicySizeType | policy_size_type {ResourceGrantPolicySizeType::CONSTANT} |
ResourceGrantSizeInfo | size_info |
Specifies the policy for granting a resource of a specific ResourceSubtype
. Note that this policy only pertains to resource grants on an isolated basis, and that grant policy with respect to concurrent requests is controlled by ConcurrentResourceGrantPolicy
.
ExecutorResourcePool
uses get_grant_quantity
to determine the maximum allowable grants for each type of resource (on a static basis) when being initialized.
Definition at line 47 of file ResourceGrantPolicy.h.
|
inline |
Definition at line 52 of file ResourceGrantPolicy.h.
ExecutorResourceMgr_Namespace::ResourceGrantPolicy::ResourceGrantPolicy | ( | const ResourceSubtype | resource_subtype, |
const ResourceGrantPolicySizeType | policy_size_type, | ||
const ResourceGrantSizeInfo | size_info | ||
) |
Definition at line 26 of file ResourceGrantPolicy.cpp.
size_t ExecutorResourceMgr_Namespace::ResourceGrantPolicy::get_grant_quantity | ( | const size_t | total_resource_quantity | ) | const |
Used to calculate the maximum quantity that can be granted of the resource.
If policy_size_type
is a ratio, the max grantable quantity will be the ratio specified in the size_info
union times the specified total_resource_quantity
. If policy_size_type
is a constant, the max grantable quantity will be that constant, regardless of what is specified by total_resource_quantity
. If policy_size_type
is unlimited, the max grantable quantity will be unlimited, specifically the max allowed number for the size_t
type.
total_resource_quantity | - the total quantity available of the resource specified by ResourceGrantPolicy::resource_subtype |
ResourceGrantPolicy::resource_subtype
that can be granted Definition at line 34 of file ResourceGrantPolicy.cpp.
References ExecutorResourceMgr_Namespace::CONSTANT, ExecutorResourceMgr_Namespace::ResourceGrantSizeInfo::constant, policy_size_type, ExecutorResourceMgr_Namespace::RATIO_TO_TOTAL, ExecutorResourceMgr_Namespace::ResourceGrantSizeInfo::ratio_to_total, size_info, ExecutorResourceMgr_Namespace::UNLIMITED, and UNREACHABLE.
Referenced by get_grant_quantity().
size_t ExecutorResourceMgr_Namespace::ResourceGrantPolicy::get_grant_quantity | ( | const size_t | total_resource_quantity, |
const bool | cap_at_total_available | ||
) | const |
Used to calculate the maximum quantity that can be granted of the resource, optionally capping at the specified total_resource_quantity
.
If policy_size_type
is a ratio, the max grantable quantity will be the ratio specified in the size_info
union times the specified total_resource_quantity
. If policy_size_type
is a constant, the max grantable quantity will be that constant, regardless of what is specified by total_resource_quantity
. If policy_size_type
is unlimited, the max grantable quantity will be unlimited, specifically the max allowed number for the size_t
type. Regardless of the above, if cap_at_total_available
is set to true, then the return size will be the minimum of the above and total_resource_quantity
. This flag is used by ExecutorResourcePool::init_max_resource_grants_per_requests()
if oversubscription is not allowed (ResourceConcurrencyPolicy::DISALLOW_REQUESTS) as specified by `ConcurrentResourceGrantPolicy::oversubscription_concurrency_policy)
total_resource_quantity | - the total quantity available of the resource specified by ResourceGrantPolicy::resource_subtype |
ResourceGrantPolicy::resource_subtype
that can be granted Definition at line 52 of file ResourceGrantPolicy.cpp.
References get_grant_quantity().
std::string ExecutorResourceMgr_Namespace::ResourceGrantPolicy::to_string | ( | ) | const |
Definition at line 62 of file ResourceGrantPolicy.cpp.
References ExecutorResourceMgr_Namespace::CONSTANT, ExecutorResourceMgr_Namespace::ResourceGrantSizeInfo::constant, policy_size_type, ExecutorResourceMgr_Namespace::RATIO_TO_TOTAL, ExecutorResourceMgr_Namespace::ResourceGrantSizeInfo::ratio_to_total, resource_subtype, ExecutorResourceMgr_Namespace::ResourceSubtypeStrings, size_info, ExecutorResourceMgr_Namespace::UNLIMITED, and UNREACHABLE.
Referenced by ExecutorResourceMgr_Namespace::ExecutorResourcePool::log_parameters().
ResourceGrantPolicySizeType ExecutorResourceMgr_Namespace::ResourceGrantPolicy::policy_size_type {ResourceGrantPolicySizeType::CONSTANT} |
Definition at line 49 of file ResourceGrantPolicy.h.
Referenced by get_grant_quantity(), and to_string().
ResourceSubtype ExecutorResourceMgr_Namespace::ResourceGrantPolicy::resource_subtype {ResourceSubtype::INVALID_SUBTYPE} |
Definition at line 48 of file ResourceGrantPolicy.h.
Referenced by to_string().
ResourceGrantSizeInfo ExecutorResourceMgr_Namespace::ResourceGrantPolicy::size_info |
Definition at line 50 of file ResourceGrantPolicy.h.
Referenced by get_grant_quantity(), and to_string().