diff --git a/docs/api/options.rst b/docs/api/options.rst index 3b3ee87..7b27d99 100644 --- a/docs/api/options.rst +++ b/docs/api/options.rst @@ -730,6 +730,8 @@ CompressionTypes .. py:attribute:: snappy_compression .. py:attribute:: zlib_compression .. py:attribute:: bzip2_compression + .. py:attribute:: lz4_compression + .. py:attribute:: lz4hc_compression BytewiseComparator ================== diff --git a/docs/changelog.rst b/docs/changelog.rst index be29e43..f31d6c4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -58,6 +58,8 @@ New: * Add init options to :py:class:`rocksdb.BlockBasedTableFactory` * Add more option to :py:class:`rocksdb.PlainTableFactory` * Add :py:class:`rocksdb.WriteBatchIterator` +* add :py:attr:`rocksdb.CompressionType.lz4_compression` +* add :py:attr:`rocksdb.CompressionType.lz4hc_compression` Version 0.2 diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx index 9d7dedd..4ceb8cc 100644 --- a/rocksdb/_rocksdb.pyx +++ b/rocksdb/_rocksdb.pyx @@ -704,6 +704,8 @@ cdef class CompressionType(object): snappy_compression = u'snappy_compression' zlib_compression = u'zlib_compression' bzip2_compression = u'bzip2_compression' + lz4_compression = u'lz4_compression' + lz4hc_compression = u'lz4hc_compression' cdef class Options(object): cdef options.Options* opts @@ -787,6 +789,10 @@ cdef class Options(object): return CompressionType.zlib_compression elif self.opts.compression == options.kBZip2Compression: return CompressionType.bzip2_compression + elif self.opts.compression == options.kLZ4Compression: + return CompressionType.lz4_compression + elif self.opts.compression == options.kLZ4HCCompression: + return CompressionType.lz4hc_compression else: raise Exception("Unknonw type: %s" % self.opts.compression) @@ -799,6 +805,10 @@ cdef class Options(object): self.opts.compression = options.kZlibCompression elif value == CompressionType.bzip2_compression: self.opts.compression = options.kBZip2Compression + elif value == CompressionType.lz4_compression: + self.opts.compression = options.kLZ4Compression + elif value == CompressionType.lz4hc_compression: + self.opts.compression = options.kLZ4HCCompression else: raise TypeError("Unknown compression: %s" % value) diff --git a/rocksdb/options.pxd b/rocksdb/options.pxd index ca4fd68..de8db40 100644 --- a/rocksdb/options.pxd +++ b/rocksdb/options.pxd @@ -23,6 +23,8 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb": kSnappyCompression kZlibCompression kBZip2Compression + kLZ4Compression + kLZ4HCCompression ctypedef enum ReadTier: kReadAllTier