diff options
author | Yury Melnichek <melnichek@gmail.com> | 2012-09-25 00:02:21 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:43:50 +0300 |
commit | 122429fbf20f839cd36db16713891228bc1c4ec0 (patch) | |
tree | 6e72091778abd18bd5deada84836303d53adb160 /coding | |
parent | 5d851463c1b404af88f08ee8d612781d015f1e9b (diff) |
BlobStorage code review fixes.
Diffstat (limited to 'coding')
-rw-r--r-- | coding/blob_indexer.cpp | 2 | ||||
-rw-r--r-- | coding/blob_indexer.hpp | 6 | ||||
-rw-r--r-- | coding/blob_storage.cpp | 5 | ||||
-rw-r--r-- | coding/blob_storage.hpp | 6 |
4 files changed, 12 insertions, 7 deletions
diff --git a/coding/blob_indexer.cpp b/coding/blob_indexer.cpp index 05912e6ab4..ad7d35f584 100644 --- a/coding/blob_indexer.cpp +++ b/coding/blob_indexer.cpp @@ -13,7 +13,7 @@ BlobIndexer::BlobIndexer(Writer & writer, size_t maxUncompressedChunkSize, - function<void (char const *, size_t, string &)> const & compressor) : + CompressorType const & compressor) : m_writer(writer), m_maxUncompressedChunkSize(min(int(maxUncompressedChunkSize), (1 << BITS_IN_CHUNK_SIZE) - 1)), m_compressor(compressor), diff --git a/coding/blob_indexer.hpp b/coding/blob_indexer.hpp index 4aaa247028..3f23c1e3cc 100644 --- a/coding/blob_indexer.hpp +++ b/coding/blob_indexer.hpp @@ -9,9 +9,11 @@ class Writer; class BlobIndexer { public: + typedef function<void (char const *, size_t, string &)> CompressorType; + BlobIndexer(Writer & writer, size_t maxUncompressedChunkSize, - function<void (char const *, size_t, string &)> const & compressor); + CompressorType const & compressor); ~BlobIndexer(); // Add blob and return its id. @@ -24,7 +26,7 @@ private: Writer & m_writer; size_t const m_maxUncompressedChunkSize; - function<void (char const *, size_t, string &)> const m_compressor; + CompressorType m_compressor; static uint32_t const BITS_IN_CHUNK_SIZE = 20; diff --git a/coding/blob_storage.cpp b/coding/blob_storage.cpp index 0838838e98..d35f7e13ba 100644 --- a/coding/blob_storage.cpp +++ b/coding/blob_storage.cpp @@ -6,7 +6,8 @@ // nb - number of blobs // nc - number of chunks // -// [4| Header = "Blb1"] +// [3| Header = "Blb"] +// [1| logMaxChunkSize] // [*| Chunk 0 ] [*| Chunk 1 ] ... [*| Chunk nc-1] // [4| Chunk 1 pos] [4| Chunk 2 pos] ... [4| Pos after the last chunk] // [4| Blob info 0] [4| Blob info 1] ... [4| Blob info nb-1] @@ -23,7 +24,7 @@ BlobStorage::BlobStorage(Reader const * pReader, - function<void (char const *, size_t, char *, size_t)> decompressor) : + DecompressorType const & decompressor) : m_pReader(pReader), m_decompressor(decompressor) { Init(); diff --git a/coding/blob_storage.hpp b/coding/blob_storage.hpp index e1aa0ba194..e909f74e34 100644 --- a/coding/blob_storage.hpp +++ b/coding/blob_storage.hpp @@ -14,9 +14,11 @@ class BlobStorage public: DECLARE_EXCEPTION(OpenException, RootException); + typedef function<void (char const *, size_t, char *, size_t)> DecompressorType; + // Takes ownership of pReader and deletes it, even if exception is thrown. BlobStorage(Reader const * pReader, - function<void (char const *, size_t, char *, size_t)> decompressor); + DecompressorType const & decompressor); ~BlobStorage(); // Get blob by its number, starting from 0. @@ -35,7 +37,7 @@ private: static uint32_t const START_OFFSET = 4; scoped_ptr<Reader const> m_pReader; - function<void (char const *, size_t, char *, size_t)> m_decompressor; + DecompressorType m_decompressor; DDVector<uint32_t, PolymorphReader> m_blobInfo; DDVector<uint32_t, PolymorphReader> m_chunkOffset; |