let more = collections.len() > page_size;
if more {
collections.pop();
}
Ok((collections, more))
}
#[cfg(test)]
pub(crate) fn get_children_by_inscription_id(
&self,
inscription_id: InscriptionId,
) -> Result<Vec<InscriptionId>> {
let rtx = self.database.begin_read()?;
let Some(sequence_number) = rtx
.open_table(INSCRIPTION_ID_TO_SEQUENCE_NUMBER)?
.get(&inscription_id.store())?
.map(|sequence_number| sequence_number.value())
else {
return Ok(Vec::new());
};
self
.get_children_by_sequence_number_paginated(sequence_number, usize::max_value(), 0)
.map(|(children, _more)| children)
}
#[cfg(test)]
pub(crate) fn get_parent_by_inscription_id(
&self,
inscription_id: InscriptionId,
) -> InscriptionId {
let rtx = self.database.begin_read().unwrap();
let sequence_number = rtx
.open_table(INSCRIPTION_ID_TO_SEQUENCE_NUMBER)
.unwrap()
.get(&inscription_id.store())
.unwrap()
.unwrap()