MCPcopy Create free account
hub / github.com/argumentcomputer/ix / decode_io_buffer_data

Function decode_io_buffer_data

crates/ffi/src/aiur/protocol.rs:736–747  ·  view source on GitHub ↗
(
  arr: &LeanArray<LeanBorrowed<'_>>,
)

Source from the content-addressed store, hash-verified

734}
735
736/// `MemAvailable` from `/proc/meminfo`, in bytes (Linux; includes
737/// reclaimable page cache). `None` if unreadable — the caller then
738/// disables the gate rather than guessing.
739fn available_ram_bytes() -> Option<usize> {
740 let s = std::fs::read_to_string("/proc/meminfo").ok()?;
741 let rest = s.lines().find_map(|l| l.strip_prefix("MemAvailable:"))?;
742 let kib: usize = rest.trim().trim_end_matches("kB").trim().parse().ok()?;
743 Some(kib * 1024)
744}
745
746// cast_precision_loss: the [ram-gate] line renders byte counts in GiB
747// for humans; f64's 52-bit mantissa is exact far past any real budget.
748#[allow(clippy::cast_precision_loss)]
749#[unsafe(no_mangle)]
750extern "C" fn rs_aiur_toplevel_shard_check_batch(

Callers 1

decode_io_bufferFunction · 0.85

Calls 6

lean_unbox_gFunction · 0.85
as_arrayMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45
getMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected