Add lz4 compression type.

This commit is contained in:
hofmockel 2015-07-05 13:52:17 +02:00
parent 302d1a6440
commit 2ef04007c4
4 changed files with 16 additions and 0 deletions

View file

@ -730,6 +730,8 @@ CompressionTypes
.. py:attribute:: snappy_compression .. py:attribute:: snappy_compression
.. py:attribute:: zlib_compression .. py:attribute:: zlib_compression
.. py:attribute:: bzip2_compression .. py:attribute:: bzip2_compression
.. py:attribute:: lz4_compression
.. py:attribute:: lz4hc_compression
BytewiseComparator BytewiseComparator
================== ==================

View file

@ -58,6 +58,8 @@ New:
* Add init options to :py:class:`rocksdb.BlockBasedTableFactory` * Add init options to :py:class:`rocksdb.BlockBasedTableFactory`
* Add more option to :py:class:`rocksdb.PlainTableFactory` * Add more option to :py:class:`rocksdb.PlainTableFactory`
* Add :py:class:`rocksdb.WriteBatchIterator` * Add :py:class:`rocksdb.WriteBatchIterator`
* add :py:attr:`rocksdb.CompressionType.lz4_compression`
* add :py:attr:`rocksdb.CompressionType.lz4hc_compression`
Version 0.2 Version 0.2

View file

@ -704,6 +704,8 @@ cdef class CompressionType(object):
snappy_compression = u'snappy_compression' snappy_compression = u'snappy_compression'
zlib_compression = u'zlib_compression' zlib_compression = u'zlib_compression'
bzip2_compression = u'bzip2_compression' bzip2_compression = u'bzip2_compression'
lz4_compression = u'lz4_compression'
lz4hc_compression = u'lz4hc_compression'
cdef class Options(object): cdef class Options(object):
cdef options.Options* opts cdef options.Options* opts
@ -787,6 +789,10 @@ cdef class Options(object):
return CompressionType.zlib_compression return CompressionType.zlib_compression
elif self.opts.compression == options.kBZip2Compression: elif self.opts.compression == options.kBZip2Compression:
return CompressionType.bzip2_compression 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: else:
raise Exception("Unknonw type: %s" % self.opts.compression) raise Exception("Unknonw type: %s" % self.opts.compression)
@ -799,6 +805,10 @@ cdef class Options(object):
self.opts.compression = options.kZlibCompression self.opts.compression = options.kZlibCompression
elif value == CompressionType.bzip2_compression: elif value == CompressionType.bzip2_compression:
self.opts.compression = options.kBZip2Compression 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: else:
raise TypeError("Unknown compression: %s" % value) raise TypeError("Unknown compression: %s" % value)

View file

@ -23,6 +23,8 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
kSnappyCompression kSnappyCompression
kZlibCompression kZlibCompression
kBZip2Compression kBZip2Compression
kLZ4Compression
kLZ4HCCompression
ctypedef enum ReadTier: ctypedef enum ReadTier:
kReadAllTier kReadAllTier