12inline constexpr std::uint64_t
kRunQuotaMax = (std::uint64_t{1} << 53) - 1;
62 used,
requested,
limit,
peak,
committed,
reserved,
soft_nofile,
pid,
tid,
device,
72 std::array<std::uint64_t, 30>
slots{};
75 return slots[
static_cast<std::size_t
>(slot)];
78 return slots[
static_cast<std::size_t
>(slot)];
81using QuotaWire = std::array<unsigned char, kRunQuotaWireSize>;
103struct RunQuotaEndpoint;
116 std::uint64_t
id() const noexcept {
return ticket_; }
122 std::uint64_t
device = 0, std::uint64_t
inode = 0);
127 std::shared_ptr<RunQuotaEndpoint> endpoint_;
129 std::uint64_t ticket_ = 0;
149 std::shared_ptr<const QuotaSnapshot>
refusal()
const;
153 explicit RunQuota(std::shared_ptr<RunQuotaEndpoint> endpoint)
154 : endpoint_(
std::move(endpoint)) {}
155 std::shared_ptr<RunQuotaEndpoint> endpoint_;
QuotaTicket(QuotaTicket &&) noexcept=default
QuotaTicket & operator=(const QuotaTicket &)=delete
void commit(QuotaAmounts realized, std::uint64_t actual_extent, std::uint64_t device=0, std::uint64_t inode=0)
QuotaTicket(const QuotaTicket &)=delete
static RunQuota from_fd(int fd, QuotaRole role=QuotaRole::worker)
void release(QuotaObject, QuotaAmounts, std::uint64_t old_extent, std::uint64_t new_extent, QuotaStage, QuotaArtifact)
QuotaTicket reserve(QuotaObject, QuotaAmounts, std::uint64_t old_extent, std::uint64_t new_extent, QuotaStage, QuotaArtifact)
QuotaSnapshot snapshot(QuotaResource=QuotaResource::scratch_bytes)
QuotaSnapshot finish(QuotaResource=QuotaResource::scratch_bytes)
static RunQuota from_environment()
std::shared_ptr< const QuotaSnapshot > refusal() const
RunFailureValue run_quota_failure() noexcept
constexpr char kRunQuotaModeEnv[]
@ containment_unavailable
constexpr char kRunQuotaPythonFdEnv[]
std::uint64_t quota_rounded_extent(std::uint64_t extent, std::uint64_t block_size)
constexpr std::uint16_t kRunQuotaVersion
constexpr char kRunQuotaUnmanagedLine[]
constexpr char kRunQuotaNativeFdEnv[]
const char * last_admission_diagnostic() noexcept
constexpr std::uint64_t kRunQuotaMax
constexpr std::size_t kRunQuotaWireSize
const char * quota_line() noexcept
constexpr char kRunQuotaManagedLine[]
constexpr std::uint16_t kRunQuotaReply
QuotaMessage decode_quota_message(const unsigned char *, std::size_t)
constexpr char kRunQuotaEnforcement[]
QuotaWire encode_quota_message(const QuotaMessage &)
QuotaMode mode() noexcept
std::array< unsigned char, kRunQuotaWireSize > QuotaWire
A validated code and its canonical arguments: the JSON object with its keys sorted and no whitespace,...
std::uint64_t scratch_bytes
std::uint64_t descriptors
std::uint64_t output_bytes
std::uint64_t scratch_files
std::uint64_t operator[](QuotaSlot slot) const noexcept
std::array< std::uint64_t, 30 > slots
std::uint64_t & operator[](QuotaSlot slot) noexcept