Nexus Embedded Platform 1.0.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
stream_budget.h File Reference

Optional constant-work snapshot and checked cold sizing. More...

#include "nexus/core/time.h"
#include "nexus/io/stream.h"

Go to the source code of this file.

Data Structures

struct  nx_stream_observation_t
 O(1) aggregate facts; free total does not imply cursor is free. More...
struct  nx_stream_budget_t
 Explicit engineering assumptions, no inferred hardware rate. More...
struct  nx_stream_budget_result_t
 Conservative declared-assumption budget; never physical evidence. More...

Functions

nx_result_t nx_stream_observe (const nx_stream_t *stream, nx_stream_observation_t *out)
 Snapshot maintained metadata under one short IRQ guard.
nx_result_t nx_stream_budget_calculate (const nx_stream_budget_t *budget, nx_stream_budget_result_t *out)
 Checked cold calculation, no stream mutation or allocation.

Detailed Description

Optional constant-work snapshot and checked cold sizing.

Author
Nexus Team

Definition in file stream_budget.h.

Function Documentation

◆ nx_stream_budget_calculate()

nx_result_t nx_stream_budget_calculate ( const nx_stream_budget_t * budget,
nx_stream_budget_result_t * out )

Checked cold calculation, no stream mutation or allocation.

Parameters
[in]budgetExplicit rate, longest release delay and pipeline.
[out]outDistinct output, unchanged on error or overflow.
Returns
SUCCESS, INVALID or EXHAUSTED for arithmetic overflow.
Note
required = targets + spares + ceil(rate*release_delay / (block_units*1000000)); payload is required*block*unit_bytes. Finite math is conservative under the declared FIFO frontier release bound; out-of-order release may still block the next cursor. Latency requires target_delay < floor(block/rate). This creates no backpressure or hardware qualification.

◆ nx_stream_observe()

nx_result_t nx_stream_observe ( const nx_stream_t * stream,
nx_stream_observation_t * out )

Snapshot maintained metadata under one short IRQ guard.

Parameters
[in]streamLive initialized storage, no concurrent destruction.
[out]outDistinct output, unchanged on rejected metadata/alias.
Returns
SUCCESS, INVALID or STATE for inconsistent control facts.
Note
Task/IRQ fixed work, no slot scan or payload access. Caller keeps all storage alive; no observer reference is retained. next_free is the ordinary stream cursor, not the private preposted cursor. Output is distinct from every payload.