Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add SnappyCompressionStrategy based on pure Java implementation.

Selected https://github.com/dain/snappy as it seems to be the fastest
implementation at the moment.
  • Loading branch information...
commit 44ca674f2ac510cd15f16d379742b921185637fd 1 parent e8ec37b
@ijuma ijuma authored
View
BIN  lib/snappy-0.1.jar
Binary file not shown
View
34 src/java/voldemort/store/compress/SnappyCompressionStrategy.java
@@ -0,0 +1,34 @@
+package voldemort.store.compress;
+
+import org.iq80.snappy.SnappyInputStream;
+import org.iq80.snappy.SnappyOutputStream;
+import voldemort.annotations.Experimental;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * Implementation of CompressionStrategy for the Snappy format. Snappy is optimized
+ * for speed.
+ *
+ * TODO Use block encoding instead of streams for better performance, see:
+ * https://github.com/dain/snappy/issues/4. Also be aware that the stream format may not be finalised
+ * yet.
+ */
+@Experimental
+public class SnappyCompressionStrategy extends StreamCompressionStrategy {
+
+ public String getType() {
+ return "snappy";
+ }
+
+ protected OutputStream wrapOutputStream(OutputStream underlying) throws IOException {
+ return new SnappyOutputStream(underlying);
+ }
+
+ protected InputStream wrapInputStream(InputStream underlying) throws IOException {
+ return new SnappyInputStream(underlying);
+ }
+
+}
Please sign in to comment.
Something went wrong with that request. Please try again.