changeset 63:5d5ece851f8f

Implement NoFilterPolicy as placeholder
author Lewin Bormann <lbo@spheniscida.de>
date Sat, 02 Jul 2016 19:07:35 +0200
parents 528985d33b75
children eb97abe0f590
files src/filter.rs
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/filter.rs	Sat Jul 02 15:50:30 2016 +0200
+++ b/src/filter.rs	Sat Jul 02 19:07:35 2016 +0200
@@ -10,6 +10,21 @@
     fn key_may_match(&self, key: &[u8], filter: &[u8]) -> bool;
 }
 
+/// Used for tables that don't have filter blocks but need a type parameter.
+pub struct NoFilterPolicy;
+
+impl FilterPolicy for NoFilterPolicy {
+    fn name(&self) -> &'static str {
+        "_"
+    }
+    fn create_filter(&self, _: &Vec<&[u8]>) -> Vec<u8> {
+        vec![]
+    }
+    fn key_may_match(&self, _: &[u8], _: &[u8]) -> bool {
+        true
+    }
+}
+
 const BLOOM_SEED: u32 = 0xbc9f1d34;
 
 /// A filter policy using a bloom filter internally.