rocksdb/port
Levi Tamasi 30fb9dd50f Introduce a helper method UncompressData (#7434)
Summary:
The patch introduces a helper method in `util/compression.h` called `UncompressData`
that dispatches calls to the correct uncompression method based on type, and changes
`UncompressBlockContentsForCompressionType` and `Benchmark::Uncompress` in
`db_bench` so they are implemented in terms of the new method. This eliminates
some code duplication. (`Benchmark::Compress` is also updated to use the previously
introduced `CompressData` helper.)

In addition, the patch brings the implementation of `Snappy_Uncompress` into sync with
the other uncompression methods by making the method compute the buffer size and allocate
the buffer itself. Finally, the patch eliminates some potentially risky back-and-forth conversions
between various unsigned and signed integer types by exposing the size of the allocated buffer
as a `size_t` instead of an `int`.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/7434

Test Plan:
`make check`
`./db_bench -benchmarks=compress,uncompress --compression_type ...`

Reviewed By: riversand963

Differential Revision: D23900011

Pulled By: ltamasi

fbshipit-source-id: b25df63ceec4639889be94acb22eb53e530c54e0
2020-09-25 09:01:45 -07:00
..
win Introduce a helper method UncompressData (#7434) 2020-09-25 09:01:45 -07:00
jemalloc_helper.h Fix jemalloc forward declarations (#6613) 2020-03-31 11:38:51 -07:00
lang.h C++20 compatibility (#6697) 2020-04-20 13:24:25 -07:00
likely.h Support pragma once in all header files and cleanup some warnings (#4339) 2018-09-05 18:13:31 -07:00
malloc.h Charge block cache for cache internal usage (#5797) 2019-09-16 15:26:21 -07:00
port_dirent.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
port_example.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
port_posix.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
port_posix.h Fix more defects reported by Coverity Scan (#6935) 2020-06-04 15:35:08 -07:00
port.h Change RocksDB License 2017-07-15 16:11:23 -07:00
README reverting disastrous MOE commit, returning to r21 2011-04-19 23:11:15 +00:00
stack_trace.cc build: make it compile with @mode/win (#7406) 2020-09-23 12:55:54 -07:00
stack_trace.h Fault injection in db_stress (#6538) 2020-04-10 17:21:26 -07:00
sys_time.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
util_logger.h Move some logging related files to logging/ (#5387) 2019-05-31 17:23:59 -07:00
xpress.h Change RocksDB License 2017-07-15 16:11:23 -07:00

This directory contains interfaces and implementations that isolate the
rest of the package from platform details.

Code in the rest of the package includes "port.h" from this directory.
"port.h" in turn includes a platform specific "port_<platform>.h" file
that provides the platform specific implementation.

See port_posix.h for an example of what must be provided in a platform
specific header file.