remove ledb
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
2023-03-29 13:00:17 +03:00
parent b63e9aa45c
commit 5355d0398d
7 changed files with 38 additions and 442 deletions

View File

@@ -3,7 +3,7 @@ use std::{
io::{self, Cursor, Read, Write},
marker::PhantomData,
path::Path,
sync::Arc
sync::Arc,
};
use memmap::{Mmap, MmapOptions};
@@ -158,7 +158,7 @@ where
mmap: Mmap,
count: usize,
first_pos: LSize,
_t: Option<Arc<T>> // PhantomData replacement
_t: Option<Arc<T>>, // PhantomData replacement
}
impl<T> Reader<T>
@@ -179,7 +179,7 @@ where
mmap,
count,
first_pos,
_t: None
_t: None,
})
}
@@ -226,10 +226,6 @@ where
pub fn iter(&self) -> ReaderIter<'_, T> {
ReaderIter::new(self)
}
pub fn into_iter(self) -> ReaderIntoIter<T> {
ReaderIntoIter::new(self)
}
}
pub struct ReaderIter<'a, T>
@@ -396,7 +392,7 @@ where
}
}
impl<T> IntoIterator for Reader<T>
impl<T> IntoIterator for Reader<T>
where
T: bincode::Decode,
{
@@ -404,7 +400,7 @@ where
type IntoIter = ReaderIntoIter<Self::Item>;
fn into_iter(self) -> Self::IntoIter {
self.into_iter()
Self::IntoIter::new(self)
}
}
@@ -534,9 +530,12 @@ mod test {
let cur_items = items.clone();
let cur_reader = Arc::clone(&reader);
thread::spawn(move || {
cur_items.into_iter().zip(cur_reader.iter()).for_each(|pair| {
assert_eq!(pair.0, pair.1);
});
cur_items
.into_iter()
.zip(cur_reader.iter())
.for_each(|pair| {
assert_eq!(pair.0, pair.1);
});
});
}
}

View File

@@ -1,4 +1,3 @@
use ledb::Document;
use serde_derive::{Deserialize, Serialize};
use crate::source::{SourceQuestion, SourceQuestionsBatch};
@@ -12,11 +11,8 @@ macro_rules! make {
),+ ,..$Target::default()}}
}
#[derive(
Debug, Default, Clone, Serialize, Deserialize, Document, bincode::Decode, bincode::Encode,
)]
#[derive(Debug, Default, Clone, Serialize, Deserialize, bincode::Decode, bincode::Encode)]
pub struct BatchInfo {
#[document(primary)]
#[serde(default)]
pub filename: String,
#[serde(default)]
@@ -45,14 +41,10 @@ pub struct BatchInfo {
pub rating: String,
}
#[derive(
Debug, Default, Clone, Serialize, Deserialize, Document, bincode::Decode, bincode::Encode,
)]
#[derive(Debug, Default, Clone, Serialize, Deserialize, bincode::Decode, bincode::Encode)]
pub struct Question {
#[document(primary)]
#[serde(default)]
pub num: u32,
#[document(index)]
pub id: String,
pub description: String,
@@ -84,7 +76,6 @@ pub struct Question {
pub source: String,
#[serde(default)]
pub rating: String,
#[document(nested)]
#[serde(default)]
pub batch_info: BatchInfo,
}