summaryrefslogtreecommitdiff
path: root/port/port_example.h
diff options
context:
space:
mode:
authorgabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529>2011-07-21 02:40:18 +0000
committergabor@google.com <gabor@google.com@62dab493-f737-651d-591e-8d6aee1b9529>2011-07-21 02:40:18 +0000
commit60bd8015f21fdb63d5409b1191f8ea9d8f1a1b87 (patch)
treedab21fd0d1309be4e6851f690e1c011e79ddbf6b /port/port_example.h
parent6872ace90110799f87402cbc594c4cbf1bc474c7 (diff)
downloadleveldb-60bd8015f21fdb63d5409b1191f8ea9d8f1a1b87.tar.gz
Speed up Snappy uncompression, new Logger interface.
- Removed one copy of an uncompressed block contents changing the signature of Snappy_Uncompress() so it uncompresses into a flat array instead of a std::string. Speeds up readrandom ~10%. - Instead of a combination of Env/WritableFile, we now have a Logger interface that can be easily overridden applications that want to supply their own logging. - Separated out the gcc and Sun Studio parts of atomic_pointer.h so we can use 'asm', 'volatile' keywords for Sun Studio. git-svn-id: https://leveldb.googlecode.com/svn/trunk@39 62dab493-f737-651d-591e-8d6aee1b9529
Diffstat (limited to 'port/port_example.h')
-rw-r--r--port/port_example.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/port/port_example.h b/port/port_example.h
index 8a624f3..6bd9b49 100644
--- a/port/port_example.h
+++ b/port/port_example.h
@@ -96,11 +96,21 @@ class AtomicPointer {
extern bool Snappy_Compress(const char* input, size_t input_length,
std::string* output);
+// If input[0,input_length-1] looks like a valid snappy compressed
+// buffer, store the size of the uncompressed data in *result and
+// return true. Else return false.
+extern bool Snappy_GetUncompressedLength(const char* input, size_t length,
+ size_t* result);
+
// Attempt to snappy uncompress input[0,input_length-1] into *output.
// Returns true if successful, false if the input is invalid lightweight
// compressed data.
+//
+// REQUIRES: at least the first "n" bytes of output[] must be writable
+// where "n" is the result of a successful call to
+// Snappy_GetUncompressedLength.
extern bool Snappy_Uncompress(const char* input_data, size_t input_length,
- std::string* output);
+ char* output);
// ------------------ Miscellaneous -------------------