issue/43 Isolated SegmentMeta

This commit is contained in:
Paul Masurel
2017-01-21 11:23:29 +09:00
parent fba44b78b6
commit 093dcbd253
4 changed files with 25 additions and 23 deletions

View File

@@ -1,7 +1,5 @@
use schema::Schema;
use core::SegmentId;
use core::SegmentMeta;
/// Meta information about the `Index`.
///
@@ -29,21 +27,3 @@ impl IndexMeta {
}
}
}
#[derive(Clone, Debug, RustcDecodable,RustcEncodable)]
pub struct SegmentMeta {
pub segment_id: SegmentId,
pub num_docs: u32,
pub num_deleted_docs: u32,
}
#[cfg(test)]
impl SegmentMeta {
pub fn new(segment_id: SegmentId, num_docs: u32) -> SegmentMeta {
SegmentMeta {
segment_id: segment_id,
num_docs: num_docs,
num_deleted_docs: 0,
}
}
}

View File

@@ -7,6 +7,7 @@ mod segment_component;
mod segment;
mod index_meta;
mod pool;
mod segment_meta;
mod term_iterator;
use std::path::PathBuf;
@@ -18,7 +19,8 @@ pub use self::segment::Segment;
pub use self::segment::SegmentInfo;
pub use self::segment::SerializableSegment;
pub use self::index::Index;
pub use self::index_meta::{IndexMeta, SegmentMeta};
pub use self::segment_meta::SegmentMeta;
pub use self::index_meta::IndexMeta;
pub use self::term_iterator::TermIterator;
lazy_static! {

19
src/core/segment_meta.rs Normal file
View File

@@ -0,0 +1,19 @@
use core::SegmentId;
#[derive(Clone, Debug, RustcDecodable,RustcEncodable)]
pub struct SegmentMeta {
pub segment_id: SegmentId,
pub num_docs: u32,
pub num_deleted_docs: u32,
}
#[cfg(test)]
impl SegmentMeta {
pub fn new(segment_id: SegmentId, num_docs: u32) -> SegmentMeta {
SegmentMeta {
segment_id: segment_id,
num_docs: num_docs,
num_deleted_docs: 0,
}
}
}

View File

@@ -7,7 +7,8 @@ use std::result;
use std::io;
use std::marker::Sync;
/// Write-once read many (WORM) abstraction for where tantivy's index should be stored.
/// Write-once read many (WORM) abstraction for where
/// tantivy's data should be stored.
///
/// There are currently two implementations of `Directory`
///