pub struct Node {
pub group_path: String,
pub child_key: String,
/* private fields */
}Expand description
One node’s embeddings and child ids, read from the store on first use and then kept in memory.
Fields§
§group_path: StringThe node’s group in the store, such as /lvl_2/node_7.
child_key: Stringnode_ids for an internal node, item_ids for a leaf.
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(
store: ReadableListableStorage,
group_path: String,
child_key: String,
) -> Self
pub fn new( store: ReadableListableStorage, group_path: String, child_key: String, ) -> Self
Creates a Node for the group at group_path. Nothing is read until
embeddings or children is called.
Sourcepub fn embeddings(&self) -> Result<Option<&Array2<f32>>>
pub fn embeddings(&self) -> Result<Option<&Array2<f32>>>
Returns the node’s embeddings as f32, reading them on the first call. Ok(None) if the node was never written, Err if the read failed. Both results are cached.
Sourcepub fn children(&self) -> Result<Option<&Array1<u32>>>
pub fn children(&self) -> Result<Option<&Array1<u32>>>
Returns the node’s child ids as u32, reading them on the first call.
Ok(None) means the node was never written, Err if the read failed.
Both results are cached.
Sourcepub fn is_loaded(&self) -> bool
pub fn is_loaded(&self) -> bool
Checks whether embeddings or children has read data. Always false
for a node missing on disk or one whose read failed.
Sourcepub fn resident_bytes(&self) -> usize
pub fn resident_bytes(&self) -> usize
Returns the bytes of embeddings and child ids this node holds in memory, which the node cache counts against its limit.
Auto Trait Implementations§
impl !Freeze for Node
impl !RefUnwindSafe for Node
impl !UnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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