Skip to main content

hopper_core/account/
mod.rs

1//! Account memory architecture.
2//!
3//! Hopper supports four account memory styles:
4//!
5//! 1. **Fixed Layout** -- Classic zero-copy `#[repr(C)]` overlay with a 16-byte header.
6//! 2. **Overlay Layout** -- Multiple typed views over different regions of one account.
7//! 3. **Segmented Layout** -- Fixed prefix + dynamic typed segments with a segment table.
8//! 4. **Arena Layout** -- Accounts as typed storage arenas (slab allocators, ring buffers).
9//!
10//! All styles share the same 16-byte header format for self-description.
11
12mod cursor;
13mod dynamic;
14mod header;
15mod lifecycle;
16mod overlay;
17mod pod;
18mod reader;
19mod realloc_guard;
20pub mod registry;
21mod segment;
22pub mod segment_role;
23mod verified;
24
25pub use cursor::{DataWriter, SliceCursor};
26pub use dynamic::{
27    read_dynamic_u16, read_dynamic_u32, read_dynamic_u8, write_dynamic_u16, write_dynamic_u32,
28    write_dynamic_u8, DynamicView, DynamicViewMut,
29};
30pub use header::{
31    check_header, read_discriminator, read_header_flags, read_layout_id, read_version,
32    write_header, AccountHeader, HEADER_FORMAT, HEADER_LEN,
33};
34pub use lifecycle::{
35    safe_close, safe_close_with_sentinel, safe_realloc, zero_init, CLOSE_SENTINEL,
36};
37pub use overlay::{overlay, overlay_mut};
38pub use pod::{
39    cast_unchecked, cast_unchecked_mut, pod_from_bytes, pod_from_bytes_mut, pod_read, pod_write,
40    FixedLayout, Pod,
41};
42pub use reader::AccountReader;
43pub use realloc_guard::ReallocGuard;
44pub use registry::{
45    segment_id, SegmentEntry, SegmentId, SegmentRegistry, SegmentRegistryMut,
46    MAX_REGISTRY_SEGMENTS, REGISTRY_HEADER_SIZE, REGISTRY_OFFSET, SEGMENT_ENTRY_SIZE,
47    SEG_FLAG_DYNAMIC, SEG_FLAG_FROZEN, SEG_FLAG_LOCKED,
48};
49pub use segment::{
50    SegmentDescriptor, SegmentSlice, SegmentSliceMut, SegmentTable, SegmentTableMut, MAX_SEGMENTS,
51    SEGMENT_DESC_SIZE,
52};
53pub use segment_role::{
54    SegmentRole, SEG_ROLE_AUDIT, SEG_ROLE_CACHE, SEG_ROLE_CORE, SEG_ROLE_EXTENSION, SEG_ROLE_INDEX,
55    SEG_ROLE_JOURNAL, SEG_ROLE_SHARD,
56};
57pub use verified::{VerifiedAccount, VerifiedAccountMut};