Struct spacetimedb_table::var_len::VarLenGranule
source · #[repr(C, align(64))]pub struct VarLenGranule {
pub header: VarLenGranuleHeader,
pub data: [Byte; 62],
}
Expand description
Each variable length object in a page is stored as a linked-list of chunks.
These chunks are called granules and they can store up to 62 bytes of data
.
Additionally, 2 bytes are used for the header: VarLenGranuleHeader
.
Fields§
§header: VarLenGranuleHeader
The header of the granule, containing the length and the next-cell offset.
data: [Byte; 62]
The data storing some part, or whole, of the var-len object.
Implementations§
source§impl VarLenGranule
impl VarLenGranule
sourcepub const DATA_SIZE: usize = 62usize
pub const DATA_SIZE: usize = 62usize
The size, in bytes, of the data section of a variable length granule.
sourcepub const OBJECT_MAX_GRANULES_BEFORE_BLOB: usize = 16usize
pub const OBJECT_MAX_GRANULES_BEFORE_BLOB: usize = 16usize
The max number of granules an object can use before being put into large blob storage.
sourcepub const OBJECT_SIZE_BLOB_THRESHOLD: usize = 992usize
pub const OBJECT_SIZE_BLOB_THRESHOLD: usize = 992usize
The max size of an object before being put into large blob storage.
sourcepub const fn space_to_granules(available_len: Size) -> usize
pub const fn space_to_granules(available_len: Size) -> usize
Returns the number of granules that would fit into available_len
.
sourcepub const fn bytes_to_granules(len_in_bytes: usize) -> (usize, bool)
pub const fn bytes_to_granules(len_in_bytes: usize) -> (usize, bool)
Returns the number of granules needed to store an object of len_in_bytes
in size.
Also returns whether the object needs to go into the blob store.
sourcepub fn chunks(bytes: &[u8]) -> impl DoubleEndedIterator<Item = &[u8]>
pub fn chunks(bytes: &[u8]) -> impl DoubleEndedIterator<Item = &[u8]>
Chunks bytes
into an iterator where each element fits into a granule.
Auto Trait Implementations§
impl Freeze for VarLenGranule
impl RefUnwindSafe for VarLenGranule
impl Send for VarLenGranule
impl Sync for VarLenGranule
impl Unpin for VarLenGranule
impl UnwindSafe for VarLenGranule
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more