Crate grafos_leasekit

Crate grafos_leasekit 

Source
Expand description

Lease renewal and TTL budgeting for grafOS.

This crate provides poll-driven lease renewal infrastructure. The core design is timer-free: callers drive progress by calling RenewalManager::tick with the current unix timestamp. This makes the crate compatible with no_std, WASM, and bare-metal environments.

§Core types

TypePurpose
RenewableLeaseTrait abstracting lease renewal across resource types
RenewalPolicyConfigures when to renew (threshold, jitter, backoff)
BackoffDeterministic exponential backoff with configurable cap
RenewalManagerManages multiple leases and drives renewals via tick()

§Adapters

Adapters for all grafos-std lease types are provided in the adapter module: MemLeaseAdapter, BlockLeaseAdapter, CpuLeaseAdapter, GpuLeaseAdapter, NetLeaseAdapter.

§Quick start

use grafos_leasekit::{RenewalManager, RenewalPolicy};

let mut mgr = RenewalManager::new();
let policy = RenewalPolicy::default();

// Register a lease (id, expiry, policy)
mgr.register(1, 1100, policy);

// Drive renewals — call tick() periodically with current time
let summary = mgr.tick(1080); // 80% through TTL

§Feature flags

FeatureDefaultEffect
stdYesEnables std in grafos-std
observeNoEnables grafos-observe metrics and events

Re-exports§

pub use adapter::BlockLeaseAdapter;
pub use adapter::CpuLeaseAdapter;
pub use adapter::GpuLeaseAdapter;
pub use adapter::MemLeaseAdapter;
pub use adapter::NetLeaseAdapter;

Modules§

adapter
Adapters that implement RenewableLease for grafos-std lease types.

Structs§

Backoff
Exponential backoff with a configurable cap.
RenewalManager
Callback invoked by the manager to actually perform a renewal.
RenewalPolicy
Controls when a lease should be renewed and how to handle failures.
RenewalSummary
Summary returned by RenewalManager::tick.

Enums§

LeaseStatus
Lease lifecycle status.

Traits§

RenewableLease
Uniform interface for renewing a lease regardless of resource type.