diff options
author | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-10-01 14:28:58 +0100 |
---|---|---|
committer | Joao Eduardo Luis <joao.luis@inktank.com> | 2013-10-02 01:28:22 +0100 |
commit | 18fcd91319be2be11e643eb40c5bd0beee21cf51 (patch) | |
tree | 7c8e691fd19e9fdeed176540d995b3b4a4a31577 | |
parent | d6ec7891ebcabce26d45cfe7b12cb3f7837ad417 (diff) | |
download | ceph-18fcd91319be2be11e643eb40c5bd0beee21cf51.tar.gz |
test: test_store_tool: add 'crc <prefix> <key>' command
Returns the CRC of contents for a given key with a given prefix.
Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
-rw-r--r-- | src/test/ObjectMap/test_store_tool/test_store_tool.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/test/ObjectMap/test_store_tool/test_store_tool.cc b/src/test/ObjectMap/test_store_tool/test_store_tool.cc index f81598ccfb8..66d55bee587 100644 --- a/src/test/ObjectMap/test_store_tool/test_store_tool.cc +++ b/src/test/ObjectMap/test_store_tool/test_store_tool.cc @@ -111,7 +111,7 @@ void usage(const char *pname) << " list [prefix]\n" << " exists <prefix> [key]\n" << " get <prefix> <key>\n" - << " verify <store path>\n" + << " crc <prefix> <key>\n" << " get-size\n" << std::endl; } @@ -183,8 +183,23 @@ int main(int argc, const char *argv[]) bl.hexdump(os); std::cout << os.str() << std::endl; - } else if (cmd == "verify") { - assert(0); + } else if (cmd == "crc") { + if (argc < 5) { + usage(argv[0]); + return 1; + } + string prefix(argv[3]); + string key(argv[4]); + + bool exists = false; + bufferlist bl = st.get(prefix, key, exists); + std::cout << "(" << prefix << ", " << key << ") "; + if (!exists) { + std::cout << " does not exist" << std::endl; + return 1; + } + std::cout << " crc " << bl.crc32c(0) << std::endl; + } else if (cmd == "get-size") { std::cout << "estimated store size: " << st.get_size() << std::endl; } else { |