Spend a contention budget against a fixed capacity and turn the granted and denied counts into a spend, drain, or throttle remediation action.

Atomic Budget Remediation Report

atomic_budget_remediation_report.cpp
#include <iostream>
#include <string>

int main() {
    int requests = ;
    const int capacity = 2;
    int granted = 0;
    int denied = 0;

    for (int i = 0; i < requests; ++i) {
        if (granted < capacity) {
            granted += 1;
        } else {
            denied += 1;
        }
    }
    int spare = capacity - granted;

    std::string action;
    if (denied > 0) {
        action = "throttle";
    } else if (spare == 0) {
        action = "drain";
    } else {
        action = "spend";
    }

    std::cout << "requests=" << requests
              << " granted=" << granted
              << " denied=" << denied
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int requests = ;
    const int capacity = 2;
    int granted = 0;
    int denied = 0;

    for (int i = 0; i < requests; ++i) {
        if (granted < capacity) {
            granted += 1;
        } else {
            denied += 1;
        }
    }
    int spare = capacity - granted;

    std::string action;
    if (denied > 0) {
        action = "throttle";
    } else if (spare == 0) {
        action = "drain";
    } else {
        action = "spend";
    }

    std::cout << "requests=" << requests
              << " granted=" << granted
              << " denied=" << denied
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int requests = ;
    const int capacity = 2;
    int granted = 0;
    int denied = 0;

    for (int i = 0; i < requests; ++i) {
        if (granted < capacity) {
            granted += 1;
        } else {
            denied += 1;
        }
    }
    int spare = capacity - granted;

    std::string action;
    if (denied > 0) {
        action = "throttle";
    } else if (spare == 0) {
        action = "drain";
    } else {
        action = "spend";
    }

    std::cout << "requests=" << requests
              << " granted=" << granted
              << " denied=" << denied
              << " " << action << std::endl;
    return 0;
}
budget capacity The contention capacity and budget are scalars, so the granted and denied counts that drive the remediation action stay deterministic and free of atomic identity.