use std::sync::atomic::Ordering;
use crate::persistent_artrie::block_storage::BlockStorage;
impl<S: BlockStorage> super::dict_impl::PersistentVocabARTrie<S> {
pub fn get_index(&self, term: &str) -> Option<u64> {
self.get_index_lockfree(term)
}
pub fn get_term(&self, index: u64) -> Option<String> {
self.reverse_term_map
.as_ref()
.and_then(|m| m.get(&index).map(|e| e.value().clone()))
}
#[inline]
pub fn contains(&self, term: &str) -> bool {
self.get_index(term).is_some()
}
#[inline]
pub fn contains_index(&self, index: u64) -> bool {
self.get_term(index).is_some()
}
#[inline]
pub fn len(&self) -> usize {
self.entry_count.load(Ordering::Acquire)
}
#[inline]
pub fn is_empty(&self) -> bool {
self.len() == 0
}
#[inline]
pub fn start_index(&self) -> u64 {
self.start_index
}
#[inline]
pub fn next_index(&self) -> u64 {
self.next_index.load(Ordering::Acquire)
}
}