From 74acf83464d688f435a28a72e1fbd7dbfab57315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 25 Apr 2019 11:44:38 +0200 Subject: [PATCH] chore: Remove the NewIndexEvent type --- meilidb-data/src/index_event.rs | 45 --------------------------------- meilidb-data/src/lib.rs | 1 - 2 files changed, 46 deletions(-) delete mode 100644 meilidb-data/src/index_event.rs diff --git a/meilidb-data/src/index_event.rs b/meilidb-data/src/index_event.rs deleted file mode 100644 index 3a63295c9..000000000 --- a/meilidb-data/src/index_event.rs +++ /dev/null @@ -1,45 +0,0 @@ -use std::error::Error; - -use byteorder::{ReadBytesExt, WriteBytesExt}; - -use meilidb_core::{Index as WordIndex}; -use meilidb_core::data::DocIds; -use meilidb_core::write_to_bytes::WriteToBytes; -use meilidb_core::shared_data_cursor::{SharedDataCursor, FromSharedDataCursor}; - -enum NewIndexEvent<'a, S> { - RemovedDocuments(&'a DocIds), - UpdatedDocuments(&'a WordIndex), -} - -impl<'a, S> WriteToBytes for NewIndexEvent<'a, S> { - fn write_to_bytes(&self, bytes: &mut Vec) { - match self { - NewIndexEvent::RemovedDocuments(doc_ids) => { - let _ = bytes.write_u8(0); - doc_ids.write_to_bytes(bytes); - }, - NewIndexEvent::UpdatedDocuments(index) => { - let _ = bytes.write_u8(1); - // index.write_to_bytes(bytes); - } - } - } -} - -enum IndexEvent { - RemovedDocuments(DocIds), - UpdatedDocuments(WordIndex), -} - -impl FromSharedDataCursor for IndexEvent { - type Error = Box; - - fn from_shared_data_cursor(cursor: &mut SharedDataCursor) -> Result { - match cursor.read_u8()? { - 0 => DocIds::from_shared_data_cursor(cursor).map(IndexEvent::RemovedDocuments), - // 1 => WordIndex::from_shared_data_cursor(cursor).map(IndexEvent::UpdatedDocuments), - _ => Err("invalid index event type".into()), - } - } -} diff --git a/meilidb-data/src/lib.rs b/meilidb-data/src/lib.rs index 542741171..03f09728a 100644 --- a/meilidb-data/src/lib.rs +++ b/meilidb-data/src/lib.rs @@ -1,5 +1,4 @@ mod database; -mod index_event; mod indexer; mod number; mod ranked_map;