Internal changes
PiperOrigin-RevId: 621907514
This commit is contained in:
committed by
Danila Kutenin
parent
0212163f6e
commit
e1e7329dc7
25
snappy.h
25
snappy.h
@@ -64,9 +64,6 @@ namespace snappy {
|
||||
// faster decompression speeds than snappy:1 and zstd:-3.
|
||||
int level = DefaultCompressionLevel();
|
||||
|
||||
constexpr CompressionOptions() = default;
|
||||
constexpr CompressionOptions(int compression_level)
|
||||
: level(compression_level) {}
|
||||
static constexpr int MinCompressionLevel() { return 1; }
|
||||
static constexpr int MaxCompressionLevel() { return 2; }
|
||||
static constexpr int DefaultCompressionLevel() { return 1; }
|
||||
@@ -78,10 +75,8 @@ namespace snappy {
|
||||
|
||||
// Compress the bytes read from "*reader" and append to "*writer". Return the
|
||||
// number of bytes written.
|
||||
// First version is to preserve ABI.
|
||||
size_t Compress(Source* reader, Sink* writer);
|
||||
size_t Compress(Source* reader, Sink* writer,
|
||||
CompressionOptions options);
|
||||
CompressionOptions options = {});
|
||||
|
||||
// Find the uncompressed length of the given stream, as given by the header.
|
||||
// Note that the true length could deviate from this; the stream could e.g.
|
||||
@@ -100,22 +95,16 @@ namespace snappy {
|
||||
// Original contents of *compressed are lost.
|
||||
//
|
||||
// REQUIRES: "input[]" is not an alias of "*compressed".
|
||||
// First version is to preserve ABI.
|
||||
size_t Compress(const char* input, size_t input_length,
|
||||
std::string* compressed);
|
||||
size_t Compress(const char* input, size_t input_length,
|
||||
std::string* compressed, CompressionOptions options);
|
||||
std::string* compressed, CompressionOptions options = {});
|
||||
|
||||
// Same as `Compress` above but taking an `iovec` array as input. Note that
|
||||
// this function preprocesses the inputs to compute the sum of
|
||||
// `iov[0..iov_cnt-1].iov_len` before reading. To avoid this, use
|
||||
// `RawCompressFromIOVec` below.
|
||||
// First version is to preserve ABI.
|
||||
size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt,
|
||||
std::string* compressed);
|
||||
size_t CompressFromIOVec(const struct iovec* iov, size_t iov_cnt,
|
||||
std::string* compressed,
|
||||
CompressionOptions options);
|
||||
CompressionOptions options = {});
|
||||
|
||||
// Decompresses "compressed[0..compressed_length-1]" to "*uncompressed".
|
||||
// Original contents of "*uncompressed" are lost.
|
||||
@@ -159,18 +148,14 @@ namespace snappy {
|
||||
// ... Process(output, output_length) ...
|
||||
// delete [] output;
|
||||
void RawCompress(const char* input, size_t input_length, char* compressed,
|
||||
size_t* compressed_length);
|
||||
void RawCompress(const char* input, size_t input_length, char* compressed,
|
||||
size_t* compressed_length, CompressionOptions options);
|
||||
size_t* compressed_length, CompressionOptions options = {});
|
||||
|
||||
// Same as `RawCompress` above but taking an `iovec` array as input. Note that
|
||||
// `uncompressed_length` is the total number of bytes to be read from the
|
||||
// elements of `iov` (_not_ the number of elements in `iov`).
|
||||
void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length,
|
||||
char* compressed, size_t* compressed_length);
|
||||
void RawCompressFromIOVec(const struct iovec* iov, size_t uncompressed_length,
|
||||
char* compressed, size_t* compressed_length,
|
||||
CompressionOptions options);
|
||||
CompressionOptions options = {});
|
||||
|
||||
// Given data in "compressed[0..compressed_length-1]" generated by
|
||||
// calling the Snappy::Compress routine, this routine
|
||||
|
||||
Reference in New Issue
Block a user