Module accounting

Module accounting 

Source
Expand description

Process-level memory bounds and limiting for components.

This module lets components declare their expected memory usage and supports enforcing process-wide memory limits:

  • memory bounds: components declare their expected memory usage (a minimum required amount and a firm limit) via the MemoryBounds trait and MemoryBoundsBuilder,
  • bounds verification: BoundsVerifier checks that the combined bounds of all components fit within a MemoryGrant,
  • memory limiting: MemoryLimiter applies cooperative backpressure as the process approaches a configured memory limit,
  • component registry: ComponentRegistry ties these together, providing a nestable structure of components that can each declare bounds and register a resource group for runtime usage tracking.

Actual (as opposed to expected) memory usage and CPU time are tracked separately via the resource-tracking primitives in [saluki_common::resource_tracking]; the tracking allocator found there must be installed as the global allocator for runtime usage to be attributed to registered components.

Structs§

BoundsVerifier
Memory bounds verifier.
ComponentBounds
Memory bounds for a component.
ComponentRegistry
A registry for components for tracking memory bounds and runtime memory usage.
ComponentRegistryHandle
A cloneable, read-only handle to a component registry.
MemoryBoundsBuilder
Builder for defining the memory bounds of a component and its subcomponents.
MemoryGrant
A memory grant.
MemoryLimiter
A process-wide memory limiter.
ResourceAPIHandler
An API handler for reporting the resource usage and usage of all components.
VerifiedBounds
Verified bounds.

Enums§

UsageExpr
Represents a memory usage expression for a component.
VerifierError
A verification error.

Traits§

MemoryBounds
Memory bounds for a component.