pub struct Status {
pub class: ObjectClass,
pub count: u32,
pub free: u32,
pub used: u32,
pub dirty: u32,
pub spare: u32,
}Expand description
What cmd::STATUS reports, for whichever ObjectClass the session opened.
The unit differs by class family. The slot-addressed classes (program, set list,
live, settings) count bytes: a program costs 141 = 121 body + 16 name + 4 CRC, a
set list 38 = 18 + 16 + 4. The library classes (piano, sample) count storage
blocks of Partition::allocation_unit net payload bytes each — just under 256
KiB for pianos and 128 KiB for samples on an Electro 5.
⚠️ free + used is not the capacity. A delete moves its space into
Self::dirty, not into free, so a report built from those two words shrinks
every time something is deleted. Self::total sums all four storage words, which
is constant, and Self::available is the space a write can actually reach —
free now, plus whatever the cleaning pass can reclaim out of dirty.
dirty and spare read 0 outside the library partitions.
Confirmed on hardware.
Fields§
§class: ObjectClass§count: u32§free: u32Space a write may use immediately, without a cleaning pass.
used: u32Space live objects occupy. Deleting lowers this and raises dirty.
dirty: u32Space held by deleted objects, reclaimable by cmd::WRITE_PREPARE. Survives a
power cycle, where free’s prepared state does not reliably.
spare: u32The fifth word: a small per-partition constant (1 and 2 observed), never seen to
move. Meaning unknown, and counted in Self::total only because the four
storage words together sum to a value that does not change.
Implementations§
Source§impl Status
impl Status
Sourcepub fn total(&self) -> u64
pub fn total(&self) -> u64
The partition’s capacity — constant per class, in the class’s own unit.
Sourcepub fn available(&self) -> u64
pub fn available(&self) -> u64
Space a write can reach: what is free now plus what cleaning can reclaim.
A partition reporting free 0 with a large dirty pool is entirely writable —
crate::op::write reclaims the shortfall before it begins.
Sourcepub fn bytes_per_item(&self) -> Option<u32>
pub fn bytes_per_item(&self) -> Option<u32>
Bytes per item, when every item of this class costs the same.
Only the slot-addressed classes resolve: their STATUS unit is bytes and every
item is one fixed record. The library classes count blocks of genuinely
variable-size content, and a class this crate cannot name has no known unit, so
both yield None whatever their counters happen to divide into.
Sourcepub fn slots(&self) -> Option<u32>
pub fn slots(&self) -> Option<u32>
Total item slots, for classes where items are fixed-size.
Far more meaningful than a byte count: programs report 400, which is exactly the 8 banks × 50 slots of an Electro 5.
pub fn used_percent(&self) -> f32
Sourcepub fn decode(class: ObjectClass, msg: &Message) -> Result<Self>
pub fn decode(class: ObjectClass, msg: &Message) -> Result<Self>
Decode a cmd::STATUS response: count, free, used, dirty, spare.
The five-word shape is what an Electro 5 answers. Confirmed on hardware. Only the first three words are required; a shorter reply decodes with the missing words as zero.