diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2017-10-17 01:19:04 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-17 12:02:29 +0000 |
commit | a110f409b9d56fc7542b110cd50956e3fefdb806 (patch) | |
tree | 567d9ad6afdb65c5ffe40dccb55cc1cedab06226 /storageapi | |
parent | dde45a05b010b6de1c62643cd9ecd37c091fdba9 (diff) |
Take document::Bucket instead of document::BucketId as constructor
argument to storage commands that inherit from BucketCommand.
Diffstat (limited to 'storageapi')
22 files changed, 179 insertions, 129 deletions
diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp index 4d5a33b1dec..f03c59f0887 100644 --- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp +++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp @@ -22,6 +22,7 @@ #include <sstream> using std::shared_ptr; +using document::BucketSpace; using document::ByteBuffer; using document::Document; using document::DocumentId; @@ -33,11 +34,20 @@ using vespalib::string; namespace storage { namespace api { +namespace { + +document::Bucket makeDocumentBucket(document::BucketId bucketId) +{ + return document::Bucket(BucketSpace::placeHolder(), bucketId); +} + +} + struct StorageProtocolTest : public CppUnit::TestFixture { document::TestDocMan _docMan; document::Document::SP _testDoc; document::DocumentId _testDocId; - document::BucketId _bucket{16, 0x51}; + document::Bucket _bucket; vespalib::Version _version5_0{5, 0, 12}; vespalib::Version _version5_1{5, 1, 0}; vespalib::Version _version5_2{5, 93, 30}; @@ -52,6 +62,7 @@ struct StorageProtocolTest : public CppUnit::TestFixture { : _docMan(), _testDoc(_docMan.createDocument()), _testDocId(_testDoc->getId()), + _bucket(makeDocumentBucket(document::BucketId(16, 0x51))), _protocol(_docMan.getTypeRepoSP(), _loadTypes) { _loadTypes.addLoadType(34, "foo", documentapi::Priority::PRI_NORMAL_2); @@ -427,8 +438,10 @@ StorageProtocolTest::testNotifyBucketChange51() { ScopedName test("testNotifyBucketChange51"); BucketInfo info(2, 3, 4); + document::BucketId modifiedBucketId(20, 1000); + document::Bucket modifiedBucket(makeDocumentBucket(modifiedBucketId)); NotifyBucketChangeCommand::SP cmd(new NotifyBucketChangeCommand( - document::BucketId(20, 1000), info)); + modifiedBucket, info)); NotifyBucketChangeCommand::SP cmd2(copyCommand(cmd, _version5_1)); CPPUNIT_ASSERT_EQUAL(document::BucketId(20, 1000), cmd2->getBucketId()); @@ -446,15 +459,16 @@ void StorageProtocolTest::testCreateBucket51() { ScopedName test("testCreateBucket51"); - document::BucketId id(623); + document::BucketId bucketId(623); + document::Bucket bucket(makeDocumentBucket(bucketId)); - CreateBucketCommand::SP cmd(new CreateBucketCommand(id)); + CreateBucketCommand::SP cmd(new CreateBucketCommand(bucket)); CreateBucketCommand::SP cmd2(copyCommand(cmd, _version5_1)); - CPPUNIT_ASSERT_EQUAL(id, cmd2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, cmd2->getBucketId()); CreateBucketReply::SP reply(new CreateBucketReply(*cmd)); CreateBucketReply::SP reply2(copyReply(reply)); - CPPUNIT_ASSERT_EQUAL(id, reply2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, reply2->getBucketId()); recordOutput(*cmd2); recordOutput(*reply2); @@ -465,20 +479,21 @@ void StorageProtocolTest::testDeleteBucket51() { ScopedName test("testDeleteBucket51"); - document::BucketId id(623); + document::BucketId bucketId(623); + document::Bucket bucket(makeDocumentBucket(bucketId)); - DeleteBucketCommand::SP cmd(new DeleteBucketCommand(id)); + DeleteBucketCommand::SP cmd(new DeleteBucketCommand(bucket)); BucketInfo info(0x100, 200, 300); cmd->setBucketInfo(info); DeleteBucketCommand::SP cmd2(copyCommand(cmd, _version5_1)); - CPPUNIT_ASSERT_EQUAL(id, cmd2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, cmd2->getBucketId()); CPPUNIT_ASSERT_EQUAL(info, cmd2->getBucketInfo()); DeleteBucketReply::SP reply(new DeleteBucketReply(*cmd)); // Not set automatically by constructor reply->setBucketInfo(cmd2->getBucketInfo()); DeleteBucketReply::SP reply2(copyReply(reply)); - CPPUNIT_ASSERT_EQUAL(id, reply2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, reply2->getBucketId()); CPPUNIT_ASSERT_EQUAL(info, reply2->getBucketInfo()); recordOutput(*cmd2); @@ -490,7 +505,8 @@ void StorageProtocolTest::testMergeBucket51() { ScopedName test("testMergeBucket51"); - document::BucketId id(623); + document::BucketId bucketId(623); + document::Bucket bucket(makeDocumentBucket(bucketId)); typedef api::MergeBucketCommand::Node Node; std::vector<Node> nodes; @@ -504,9 +520,9 @@ StorageProtocolTest::testMergeBucket51() chain.push_back(14); MergeBucketCommand::SP cmd( - new MergeBucketCommand(id, nodes, Timestamp(1234), 567, chain)); + new MergeBucketCommand(bucket, nodes, Timestamp(1234), 567, chain)); MergeBucketCommand::SP cmd2(copyCommand(cmd, _version5_1)); - CPPUNIT_ASSERT_EQUAL(id, cmd2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, cmd2->getBucketId()); CPPUNIT_ASSERT_EQUAL(nodes, cmd2->getNodes()); CPPUNIT_ASSERT_EQUAL(Timestamp(1234), cmd2->getMaxTimestamp()); CPPUNIT_ASSERT_EQUAL(uint32_t(567), cmd2->getClusterStateVersion()); @@ -514,7 +530,7 @@ StorageProtocolTest::testMergeBucket51() MergeBucketReply::SP reply(new MergeBucketReply(*cmd)); MergeBucketReply::SP reply2(copyReply(reply)); - CPPUNIT_ASSERT_EQUAL(id, reply2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, reply2->getBucketId()); CPPUNIT_ASSERT_EQUAL(nodes, reply2->getNodes()); CPPUNIT_ASSERT_EQUAL(Timestamp(1234), reply2->getMaxTimestamp()); CPPUNIT_ASSERT_EQUAL(uint32_t(567), reply2->getClusterStateVersion()); @@ -530,7 +546,8 @@ StorageProtocolTest::testSplitBucket51() { ScopedName test("testSplitBucket51"); - document::BucketId bucket(16, 0); + document::BucketId bucketId(16, 0); + document::Bucket bucket(makeDocumentBucket(bucketId)); SplitBucketCommand::SP cmd(new SplitBucketCommand(bucket)); CPPUNIT_ASSERT_EQUAL(0u, (uint32_t) cmd->getMinSplitBits()); CPPUNIT_ASSERT_EQUAL(58u, (uint32_t) cmd->getMaxSplitBits()); @@ -555,7 +572,7 @@ StorageProtocolTest::testSplitBucket51() document::BucketId(17, 1), BucketInfo(101, 1001, 10001, true, true))); SplitBucketReply::SP reply2(copyReply(reply)); - CPPUNIT_ASSERT_EQUAL(bucket, reply2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, reply2->getBucketId()); CPPUNIT_ASSERT_EQUAL(size_t(2), reply2->getSplitInfo().size()); CPPUNIT_ASSERT_EQUAL(document::BucketId(17, 0), reply2->getSplitInfo()[0].first); @@ -575,7 +592,8 @@ void StorageProtocolTest::testJoinBuckets51() { ScopedName test("testJoinBuckets51"); - document::BucketId bucket(16, 0); + document::BucketId bucketId(16, 0); + document::Bucket bucket(makeDocumentBucket(bucketId)); std::vector<document::BucketId> sources; sources.push_back(document::BucketId(17, 0)); sources.push_back(document::BucketId(17, 1)); @@ -591,7 +609,7 @@ StorageProtocolTest::testJoinBuckets51() CPPUNIT_ASSERT_EQUAL(sources, reply2->getSourceBuckets()); CPPUNIT_ASSERT_EQUAL(3, (int)cmd2->getMinJoinBits()); CPPUNIT_ASSERT_EQUAL(BucketInfo(3,4,5), reply2->getBucketInfo()); - CPPUNIT_ASSERT_EQUAL(bucket, reply2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, reply2->getBucketId()); recordOutput(*cmd2); recordOutput(*reply2); @@ -619,12 +637,14 @@ void StorageProtocolTest::testRemoveLocation51() { ScopedName test("testRemoveLocation51"); + document::BucketId bucketId(16, 1234); + document::Bucket bucket(makeDocumentBucket(bucketId)); RemoveLocationCommand::SP cmd( - new RemoveLocationCommand("id.group == \"mygroup\"", document::BucketId(16, 1234))); + new RemoveLocationCommand("id.group == \"mygroup\"", bucket)); RemoveLocationCommand::SP cmd2(copyCommand(cmd, _version5_1)); CPPUNIT_ASSERT_EQUAL(vespalib::string("id.group == \"mygroup\""), cmd2->getDocumentSelection()); - CPPUNIT_ASSERT_EQUAL(document::BucketId(16, 1234), cmd2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, cmd2->getBucketId()); RemoveLocationReply::SP reply(new RemoveLocationReply(*cmd2)); RemoveLocationReply::SP reply2(copyReply(reply)); @@ -689,7 +709,8 @@ void StorageProtocolTest::testGetBucketDiff51() { ScopedName test("testGetBucketDiff51"); - document::BucketId id(623); + document::BucketId bucketId(623); + document::Bucket bucket(makeDocumentBucket(bucketId)); std::vector<api::MergeBucketCommand::Node> nodes; nodes.push_back(4); @@ -709,7 +730,7 @@ StorageProtocolTest::testGetBucketDiff51() " header size: 100, body size: 65536, flags 0x1)"), entries.back().toString(true)); - GetBucketDiffCommand::SP cmd(new GetBucketDiffCommand(id, nodes, 1056)); + GetBucketDiffCommand::SP cmd(new GetBucketDiffCommand(bucket, nodes, 1056)); cmd->getDiff() = entries; GetBucketDiffCommand::SP cmd2(copyCommand(cmd, _version5_1)); @@ -730,7 +751,8 @@ void StorageProtocolTest::testApplyBucketDiff51() { ScopedName test("testApplyBucketDiff51"); - document::BucketId id(16, 623); + document::BucketId bucketId(16, 623); + document::Bucket bucket(makeDocumentBucket(bucketId)); std::vector<api::MergeBucketCommand::Node> nodes; nodes.push_back(4); @@ -738,7 +760,7 @@ StorageProtocolTest::testApplyBucketDiff51() std::vector<ApplyBucketDiffCommand::Entry> entries; entries.push_back(ApplyBucketDiffCommand::Entry()); - ApplyBucketDiffCommand::SP cmd(new ApplyBucketDiffCommand(id, nodes, 1234)); + ApplyBucketDiffCommand::SP cmd(new ApplyBucketDiffCommand(bucket, nodes, 1234)); cmd->getDiff() = entries; ApplyBucketDiffCommand::SP cmd2(copyCommand(cmd, _version5_1)); @@ -759,13 +781,14 @@ StorageProtocolTest::testMultiOperation51() { ScopedName test("testMultiOperation51"); - document::BucketId bucket(20, 0xf1f1f1f1f1ull); + document::BucketId bucketId(20, 0xf1f1f1f1f1ull); + document::Bucket bucket(makeDocumentBucket(bucketId)); DocumentTypeRepo::SP repo(new DocumentTypeRepo); MultiOperationCommand::SP cmd(new MultiOperationCommand(repo, bucket, 10000)); cmd->getOperations().addPut(*_testDoc); MultiOperationCommand::SP cmd2(copyCommand(cmd, _version5_1)); - CPPUNIT_ASSERT_EQUAL(bucket, cmd2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, cmd2->getBucketId()); CPPUNIT_ASSERT_EQUAL(*_testDoc, *cmd2->getOperations().begin()->getDocument()); @@ -782,14 +805,15 @@ StorageProtocolTest::testBatchPutRemove51() { ScopedName test("testBatchPutRemove51"); - document::BucketId bucket(20, 0xf1f1f1f1f1ull); + document::BucketId bucketId(20, 0xf1f1f1f1f1ull); + document::Bucket bucket(makeDocumentBucket(bucketId)); BatchPutRemoveCommand::SP cmd(new BatchPutRemoveCommand(bucket)); cmd->addPut(_testDoc, 100); cmd->addHeaderUpdate(_testDoc, 101, 1234); cmd->addRemove(_testDoc->getId(), 102); cmd->forceMsgId(556677); BatchPutRemoveCommand::SP cmd2(copyCommand(cmd, _version5_1)); - CPPUNIT_ASSERT_EQUAL(bucket, cmd2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, cmd2->getBucketId()); CPPUNIT_ASSERT_EQUAL(3, (int)cmd2->getOperationCount()); CPPUNIT_ASSERT_EQUAL(*_testDoc, *(dynamic_cast<const BatchPutRemoveCommand::PutOperation&>(cmd2->getOperation(0)).document)); CPPUNIT_ASSERT_EQUAL((uint64_t)100, cmd2->getOperation(0).timestamp); @@ -872,7 +896,8 @@ void StorageProtocolTest::testSetBucketState51() { ScopedName test("testSetBucketState51"); - document::BucketId bucket(16, 0); + document::BucketId bucketId(16, 0); + document::Bucket bucket(makeDocumentBucket(bucketId)); SetBucketStateCommand::SP cmd( new SetBucketStateCommand(bucket, SetBucketStateCommand::ACTIVE)); SetBucketStateCommand::SP cmd2(copyCommand(cmd, _version5_1)); @@ -881,8 +906,8 @@ StorageProtocolTest::testSetBucketState51() SetBucketStateReply::SP reply2(copyReply(reply)); CPPUNIT_ASSERT_EQUAL(SetBucketStateCommand::ACTIVE, cmd2->getState()); - CPPUNIT_ASSERT_EQUAL(bucket, cmd2->getBucketId()); - CPPUNIT_ASSERT_EQUAL(bucket, reply2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, cmd2->getBucketId()); + CPPUNIT_ASSERT_EQUAL(bucketId, reply2->getBucketId()); recordOutput(*cmd2); recordOutput(*reply2); diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp index 6725e6a46d7..d207b307593 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.cpp @@ -22,6 +22,8 @@ #include <vespa/log/log.h> LOG_SETUP(".storage.api.mbusprot.serialization.4_2"); +using document::BucketSpace; + namespace storage { namespace mbusprot { @@ -50,7 +52,8 @@ ProtocolSerialization4_2::onDecodeMultiOperationCommand(BBuf& buf) const std::vector<char> buffer(length); buf.getBytes(&buffer[0], length); bool keepTimestamps = SH::getBoolean(buf); - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::MultiOperationCommand::UP msg( new api::MultiOperationCommand(getTypeRepoSp(), bucket, buffer, keepTimestamps)); @@ -98,7 +101,9 @@ api::StorageCommand::UP ProtocolSerialization4_2::onDecodeBatchPutRemoveCommand(BBuf& buf) const { SH::getByte(buf); - std::unique_ptr<api::BatchPutRemoveCommand> cmd(new api::BatchPutRemoveCommand(document::BucketId(SH::getLong(buf)))); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); + std::unique_ptr<api::BatchPutRemoveCommand> cmd(new api::BatchPutRemoveCommand(bucket)); int length = SH::getInt(buf); for (int i = 0; i < length; i++) { @@ -169,7 +174,8 @@ api::StorageCommand::UP ProtocolSerialization4_2::onDecodeGetCommand(BBuf& buf) const { document::DocumentId did(SH::getString(buf)); - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::Timestamp beforeTimestamp(SH::getLong(buf)); bool headerOnly(SH::getBoolean(buf)); api::GetCommand::UP msg( @@ -191,7 +197,8 @@ api::StorageCommand::UP ProtocolSerialization4_2::onDecodeRemoveCommand(BBuf& buf) const { document::DocumentId did(SH::getString(buf)); - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::Timestamp timestamp(SH::getLong(buf)); api::RemoveCommand::UP msg(new api::RemoveCommand(bucket, did, timestamp)); onDecodeBucketInfoCommand(buf, *msg); @@ -212,12 +219,13 @@ void ProtocolSerialization4_2::onEncode( api::StorageCommand::UP ProtocolSerialization4_2::onDecodeRevertCommand(BBuf& buf) const { - document::BucketId bid(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); std::vector<api::Timestamp> tokens(SH::getInt(buf)); for (uint32_t i=0, n=tokens.size(); i<n; ++i) { tokens[i] = SH::getLong(buf); } - api::RevertCommand::UP msg(new api::RevertCommand(bid, tokens)); + api::RevertCommand::UP msg(new api::RevertCommand(bucket, tokens)); onDecodeBucketInfoCommand(buf, *msg); return api::StorageCommand::UP(msg.release()); } @@ -232,8 +240,9 @@ void ProtocolSerialization4_2::onEncode( api::StorageCommand::UP ProtocolSerialization4_2::onDecodeCreateBucketCommand(BBuf& buf) const { - document::BucketId bid(SH::getLong(buf)); - api::CreateBucketCommand::UP msg(new api::CreateBucketCommand(bid)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); + api::CreateBucketCommand::UP msg(new api::CreateBucketCommand(bucket)); onDecodeBucketInfoCommand(buf, *msg); return api::StorageCommand::UP(msg.release()); } @@ -256,7 +265,8 @@ api::StorageCommand::UP ProtocolSerialization4_2::onDecodeMergeBucketCommand(BBuf& buf) const { typedef api::MergeBucketCommand::Node Node; - document::BucketId bid(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); uint16_t nodeCount = SH::getShort(buf); std::vector<Node> nodes; nodes.reserve(nodeCount); @@ -267,7 +277,7 @@ ProtocolSerialization4_2::onDecodeMergeBucketCommand(BBuf& buf) const } api::Timestamp timestamp(SH::getLong(buf)); api::MergeBucketCommand::UP msg( - new api::MergeBucketCommand(bid, nodes, timestamp)); + new api::MergeBucketCommand(bucket, nodes, timestamp)); onDecodeCommand(buf, *msg); return api::StorageCommand::UP(msg.release()); } @@ -295,7 +305,8 @@ api::StorageCommand::UP ProtocolSerialization4_2::onDecodeGetBucketDiffCommand(BBuf& buf) const { typedef api::MergeBucketCommand::Node Node; - document::BucketId bid(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); uint16_t nodeCount = SH::getShort(buf); std::vector<Node> nodes; nodes.reserve(nodeCount); @@ -306,7 +317,7 @@ ProtocolSerialization4_2::onDecodeGetBucketDiffCommand(BBuf& buf) const } api::Timestamp timestamp = SH::getLong(buf); api::GetBucketDiffCommand::UP msg( - new api::GetBucketDiffCommand(bid, nodes, timestamp)); + new api::GetBucketDiffCommand(bucket, nodes, timestamp)); std::vector<api::GetBucketDiffCommand::Entry>& entries(msg->getDiff()); uint32_t entryCount = SH::getInt(buf); if (entryCount > buf.getRemaining()) { @@ -352,7 +363,8 @@ api::StorageCommand::UP ProtocolSerialization4_2::onDecodeApplyBucketDiffCommand(BBuf& buf) const { typedef api::MergeBucketCommand::Node Node; - document::BucketId bid(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); uint16_t nodeCount = SH::getShort(buf); std::vector<Node> nodes; nodes.reserve(nodeCount); @@ -363,7 +375,7 @@ ProtocolSerialization4_2::onDecodeApplyBucketDiffCommand(BBuf& buf) const } uint32_t maxBufferSize(SH::getInt(buf)); api::ApplyBucketDiffCommand::UP msg( - new api::ApplyBucketDiffCommand(bid, nodes, maxBufferSize)); + new api::ApplyBucketDiffCommand(bucket, nodes, maxBufferSize)); std::vector<api::ApplyBucketDiffCommand::Entry>& entries(msg->getDiff()); uint32_t entryCount = SH::getInt(buf); if (entryCount > buf.getRemaining()) { @@ -436,7 +448,8 @@ void ProtocolSerialization4_2::onEncode( api::StorageCommand::UP ProtocolSerialization4_2::onDecodeNotifyBucketChangeCommand(BBuf& buf) const { - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::BucketInfo info(getBucketInfo(buf)); api::NotifyBucketChangeCommand::UP msg( new api::NotifyBucketChangeCommand(bucket, info)); @@ -474,8 +487,9 @@ void ProtocolSerialization4_2::onEncode( api::StorageCommand::UP ProtocolSerialization4_2::onDecodeSplitBucketCommand(BBuf& buf) const { - document::BucketId id(SH::getLong(buf)); - api::SplitBucketCommand::UP msg(new api::SplitBucketCommand(id)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); + api::SplitBucketCommand::UP msg(new api::SplitBucketCommand(bucket)); msg->setMinSplitBits(SH::getByte(buf)); msg->setMaxSplitBits(SH::getByte(buf)); msg->setMinByteSize(SH::getInt(buf)); @@ -631,10 +645,11 @@ api::StorageCommand::UP ProtocolSerialization4_2::onDecodeRemoveLocationCommand(BBuf& buf) const { vespalib::stringref documentSelection = SH::getString(buf); - uint64_t bucketId = SH::getLong(buf); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::RemoveLocationCommand::UP msg; - msg.reset(new api::RemoveLocationCommand(documentSelection, document::BucketId(bucketId))); + msg.reset(new api::RemoveLocationCommand(documentSelection, bucket)); onDecodeCommand(buf, *msg); return api::StorageCommand::UP(msg.release()); } diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp index 192d23d1ec6..2bd160b1aab 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.cpp @@ -7,6 +7,7 @@ #include <vespa/storageapi/message/bucketsplitting.h> #include <vespa/storageapi/message/multioperation.h> +using document::BucketSpace; namespace storage { namespace mbusprot { @@ -102,9 +103,10 @@ api::StorageCommand::UP ProtocolSerialization5_0::onDecodePutCommand(BBuf& buf) const { document::Document::SP doc(SH::getDocument(buf, getTypeRepo())); - document::BucketId id(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::Timestamp ts(SH::getLong(buf)); - api::PutCommand::UP msg(new api::PutCommand(id, doc, ts)); + api::PutCommand::UP msg(new api::PutCommand(bucket, doc, ts)); msg->setUpdateTimestamp(SH::getLong(buf)); onDecodeBucketInfoCommand(buf, *msg); return api::StorageCommand::UP(msg.release()); @@ -222,7 +224,8 @@ ProtocolSerialization5_0::onDecodeUpdateCommand(BBuf& buf) const SERIALIZE_HEAD)); } - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::Timestamp timestamp(SH::getLong(buf)); api::UpdateCommand::UP msg( new api::UpdateCommand(bucket, update, timestamp)); @@ -275,8 +278,9 @@ ProtocolSerialization5_0::onEncode( api::StorageCommand::UP ProtocolSerialization5_0::onDecodeDeleteBucketCommand(BBuf& buf) const { - document::BucketId bid(SH::getLong(buf)); - api::DeleteBucketCommand::UP msg(new api::DeleteBucketCommand(bid)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); + api::DeleteBucketCommand::UP msg(new api::DeleteBucketCommand(bucket)); onDecodeBucketInfoCommand(buf, *msg); if (buf.getRemaining() >= SH::BUCKET_INFO_SERIALIZED_SIZE) { msg->setBucketInfo(getBucketInfo(buf)); @@ -503,7 +507,8 @@ ProtocolSerialization5_0::onEncode( api::StorageCommand::UP ProtocolSerialization5_0::onDecodeJoinBucketsCommand(BBuf& buf) const { - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::JoinBucketsCommand::UP msg(new api::JoinBucketsCommand(bucket)); uint32_t size = SH::getInt(buf); if (size > buf.getRemaining()) { diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp index 6d5a4b3102e..4f84eff0ab8 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.cpp @@ -17,6 +17,8 @@ #include <vespa/document/select/orderingspecification.h> #include <vespa/storageapi/messageapi/returncode.h> +using document::BucketSpace; + namespace storage { namespace mbusprot { @@ -70,7 +72,8 @@ void ProtocolSerialization5_1::onEncode( api::StorageCommand::UP ProtocolSerialization5_1::onDecodeSetBucketStateCommand(BBuf& buf) const { - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::SetBucketStateCommand::BUCKET_STATE state( static_cast<api::SetBucketStateCommand::BUCKET_STATE>( SH::getByte(buf))); @@ -110,7 +113,8 @@ api::StorageCommand::UP ProtocolSerialization5_1::onDecodeGetCommand(BBuf& buf) const { document::DocumentId did(SH::getString(buf)); - document::BucketId bucket(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); api::Timestamp beforeTimestamp(SH::getLong(buf)); std::string fieldSet(SH::getString(buf)); api::GetCommand::UP msg( @@ -211,9 +215,10 @@ void ProtocolSerialization5_1::onEncode( api::StorageCommand::UP ProtocolSerialization5_1::onDecodeCreateBucketCommand(BBuf& buf) const { - document::BucketId bid(SH::getLong(buf)); + document::BucketId bucketId(SH::getLong(buf)); + document::Bucket bucket(BucketSpace::placeHolder(), bucketId); bool setActive = SH::getBoolean(buf); - api::CreateBucketCommand::UP msg(new api::CreateBucketCommand(bid)); + api::CreateBucketCommand::UP msg(new api::CreateBucketCommand(bucket)); msg->setActive(setActive); onDecodeBucketInfoCommand(buf, *msg); return api::StorageCommand::UP(msg.release()); diff --git a/storageapi/src/vespa/storageapi/message/batch.cpp b/storageapi/src/vespa/storageapi/message/batch.cpp index a813d737702..f92d88e179e 100644 --- a/storageapi/src/vespa/storageapi/message/batch.cpp +++ b/storageapi/src/vespa/storageapi/message/batch.cpp @@ -39,8 +39,8 @@ BatchPutRemoveCommand::RemoveOperation::RemoveOperation(const document::Document { } -BatchPutRemoveCommand::BatchPutRemoveCommand(const document::BucketId& bucketId) - : BucketInfoCommand(MessageType::BATCHPUTREMOVE, bucketId), +BatchPutRemoveCommand::BatchPutRemoveCommand(const document::Bucket &bucket) + : BucketInfoCommand(MessageType::BATCHPUTREMOVE, bucket), _approxSize(0) { } diff --git a/storageapi/src/vespa/storageapi/message/batch.h b/storageapi/src/vespa/storageapi/message/batch.h index a1aec538e27..372d1bdb340 100644 --- a/storageapi/src/vespa/storageapi/message/batch.h +++ b/storageapi/src/vespa/storageapi/message/batch.h @@ -35,7 +35,7 @@ public: virtual const document::DocumentId& getDocumentId() const = 0; }; - explicit BatchPutRemoveCommand(const document::BucketId& id); + explicit BatchPutRemoveCommand(const document::Bucket &bucket); class PutOperation : public Operation { public: diff --git a/storageapi/src/vespa/storageapi/message/bucket.cpp b/storageapi/src/vespa/storageapi/message/bucket.cpp index 76d14946f36..983a65114b3 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.cpp +++ b/storageapi/src/vespa/storageapi/message/bucket.cpp @@ -26,8 +26,8 @@ IMPLEMENT_REPLY(NotifyBucketChangeReply) IMPLEMENT_COMMAND(SetBucketStateCommand, SetBucketStateReply) IMPLEMENT_REPLY(SetBucketStateReply) -CreateBucketCommand::CreateBucketCommand(const document::BucketId& id) - : MaintenanceCommand(MessageType::CREATEBUCKET, id), +CreateBucketCommand::CreateBucketCommand(const document::Bucket &bucket) + : MaintenanceCommand(MessageType::CREATEBUCKET, bucket), _active(false) { } @@ -65,8 +65,8 @@ CreateBucketReply::print(std::ostream& out, bool verbose, } } -DeleteBucketCommand::DeleteBucketCommand(const document::BucketId& id) - : MaintenanceCommand(MessageType::DELETEBUCKET, id) +DeleteBucketCommand::DeleteBucketCommand(const document::Bucket &bucket) + : MaintenanceCommand(MessageType::DELETEBUCKET, bucket) { } void @@ -98,10 +98,10 @@ DeleteBucketReply::print(std::ostream& out, bool verbose, } MergeBucketCommand::MergeBucketCommand( - const document::BucketId& id, const std::vector<Node>& nodes, + const document::Bucket &bucket, const std::vector<Node>& nodes, Timestamp maxTimestamp, uint32_t clusterStateVersion, const std::vector<uint16_t>& chain) - : MaintenanceCommand(MessageType::MERGEBUCKET, id), + : MaintenanceCommand(MessageType::MERGEBUCKET, bucket), _nodes(nodes), _maxTimestamp(maxTimestamp), _clusterStateVersion(clusterStateVersion), @@ -204,9 +204,9 @@ bool GetBucketDiffCommand::Entry::operator==(const Entry& e) const } GetBucketDiffCommand::GetBucketDiffCommand( - const document::BucketId& id, const std::vector<Node>& nodes, + const document::Bucket &bucket, const std::vector<Node>& nodes, Timestamp maxTimestamp) - : BucketCommand(MessageType::GETBUCKETDIFF, id), + : BucketCommand(MessageType::GETBUCKETDIFF, bucket), _nodes(nodes), _maxTimestamp(maxTimestamp) {} @@ -340,9 +340,9 @@ ApplyBucketDiffCommand::Entry::operator==(const Entry& e) const } ApplyBucketDiffCommand::ApplyBucketDiffCommand( - const document::BucketId& id, const std::vector<Node>& nodes, + const document::Bucket &bucket, const std::vector<Node>& nodes, uint32_t maxBufferSize) - : BucketInfoCommand(MessageType::APPLYBUCKETDIFF, id), + : BucketInfoCommand(MessageType::APPLYBUCKETDIFF, bucket), _nodes(nodes), _diff(), _maxBufferSize(maxBufferSize) @@ -534,8 +534,8 @@ RequestBucketInfoReply::print(std::ostream& out, bool verbose, } NotifyBucketChangeCommand::NotifyBucketChangeCommand( - const document::BucketId& id, const BucketInfo& info) - : BucketCommand(MessageType::NOTIFYBUCKETCHANGE, id), + const document::Bucket &bucket, const BucketInfo& info) + : BucketCommand(MessageType::NOTIFYBUCKETCHANGE, bucket), _info(info) { } @@ -571,7 +571,7 @@ NotifyBucketChangeReply::print(std::ostream& out, bool verbose, } SetBucketStateCommand::SetBucketStateCommand( - const document::BucketId& bucket, + const document::Bucket &bucket, BUCKET_STATE state) : MaintenanceCommand(MessageType::SETBUCKETSTATE, bucket), _state(state) diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index d571cfb48ec..d2bf97e7768 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -31,7 +31,7 @@ class CreateBucketCommand : public MaintenanceCommand { bool _active; public: - explicit CreateBucketCommand(const document::BucketId& id); + explicit CreateBucketCommand(const document::Bucket &bucket); void setActive(bool active) { _active = active; } bool getActive() const { return _active; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -60,7 +60,7 @@ public: class DeleteBucketCommand : public MaintenanceCommand { BucketInfo _info; public: - explicit DeleteBucketCommand(const document::BucketId& id); + explicit DeleteBucketCommand(const document::Bucket &bucket); const BucketInfo& getBucketInfo() const { return _info; } void setBucketInfo(const BucketInfo& info) { _info = info; } @@ -118,7 +118,7 @@ private: std::vector<uint16_t> _chain; public: - MergeBucketCommand(const document::BucketId&, + MergeBucketCommand(const document::Bucket &bucket, const std::vector<Node>&, Timestamp maxTimestamp, uint32_t clusterStateVersion = 0, @@ -196,7 +196,7 @@ private: std::vector<Entry> _diff; public: - GetBucketDiffCommand(const document::BucketId&, + GetBucketDiffCommand(const document::Bucket &bucket, const std::vector<Node>&, Timestamp maxTimestamp); ~GetBucketDiffCommand(); @@ -279,7 +279,7 @@ private: uint32_t _maxBufferSize; public: - ApplyBucketDiffCommand(const document::BucketId& id, + ApplyBucketDiffCommand(const document::Bucket &bucket, const std::vector<Node>& nodes, uint32_t maxBufferSize); ~ApplyBucketDiffCommand(); @@ -413,7 +413,7 @@ public: class NotifyBucketChangeCommand : public BucketCommand { BucketInfo _info; public: - NotifyBucketChangeCommand(const document::BucketId& bucket, + NotifyBucketChangeCommand(const document::Bucket &bucket, const BucketInfo& bucketInfo); const BucketInfo& getBucketInfo() const { return _info; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -454,7 +454,7 @@ public: private: BUCKET_STATE _state; public: - SetBucketStateCommand(const document::BucketId& bucket, BUCKET_STATE state); + SetBucketStateCommand(const document::Bucket &bucket, BUCKET_STATE state); void print(std::ostream& out, bool verbose, const std::string& indent) const override; BUCKET_STATE getState() const { return _state; } DECLARE_STORAGECOMMAND(SetBucketStateCommand, onSetBucketState) diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp b/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp index 3cbc0a3ab03..60c338d4d61 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.cpp @@ -11,8 +11,8 @@ IMPLEMENT_REPLY(SplitBucketReply) IMPLEMENT_COMMAND(JoinBucketsCommand, JoinBucketsReply) IMPLEMENT_REPLY(JoinBucketsReply) -SplitBucketCommand::SplitBucketCommand(const document::BucketId& id) - : MaintenanceCommand(MessageType::SPLITBUCKET, id), +SplitBucketCommand::SplitBucketCommand(const document::Bucket &bucket) + : MaintenanceCommand(MessageType::SPLITBUCKET, bucket), _minSplitBits(0), _maxSplitBits(58), _minByteSize(std::numeric_limits<uint32_t>::max()), @@ -70,7 +70,7 @@ SplitBucketReply::print(std::ostream& out, bool verbose, } } -JoinBucketsCommand::JoinBucketsCommand(const document::BucketId& target) +JoinBucketsCommand::JoinBucketsCommand(const document::Bucket &target) : MaintenanceCommand(MessageType::JOINBUCKETS, target), _minJoinBits(0) { diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.h b/storageapi/src/vespa/storageapi/message/bucketsplitting.h index c9f6ff68cee..115cd9f01bb 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.h +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.h @@ -45,7 +45,7 @@ private: uint32_t _minDocCount; public: - SplitBucketCommand(const document::BucketId& id); + SplitBucketCommand(const document::Bucket& bucket); uint8_t getMinSplitBits() const { return _minSplitBits; } uint8_t getMaxSplitBits() const { return _maxSplitBits; } @@ -93,7 +93,7 @@ class JoinBucketsCommand : public MaintenanceCommand { std::vector<document::BucketId> _sources; uint8_t _minJoinBits; public: - explicit JoinBucketsCommand(const document::BucketId& target); + explicit JoinBucketsCommand(const document::Bucket &target); std::vector<document::BucketId>& getSourceBuckets() { return _sources; } const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } void setMinJoinBits(uint8_t minJoinBits) { _minJoinBits = minJoinBits; } diff --git a/storageapi/src/vespa/storageapi/message/multioperation.cpp b/storageapi/src/vespa/storageapi/message/multioperation.cpp index d8044eae86e..a6494002e18 100644 --- a/storageapi/src/vespa/storageapi/message/multioperation.cpp +++ b/storageapi/src/vespa/storageapi/message/multioperation.cpp @@ -11,10 +11,10 @@ IMPLEMENT_COMMAND(MultiOperationCommand, MultiOperationReply) IMPLEMENT_REPLY(MultiOperationReply) MultiOperationCommand::MultiOperationCommand(const DocumentTypeRepo::SP &repo, - const document::BucketId& id, + const document::Bucket &bucket, int bufferSize, bool keepTimeStamps_) - : BucketInfoCommand(MessageType::MULTIOPERATION, id), + : BucketInfoCommand(MessageType::MULTIOPERATION, bucket), _buffer(), _operations(repo, 0, 0), _keepTimeStamps(keepTimeStamps_) @@ -27,10 +27,10 @@ MultiOperationCommand::MultiOperationCommand(const DocumentTypeRepo::SP &repo, } MultiOperationCommand::MultiOperationCommand(const DocumentTypeRepo::SP &repo, - const document::BucketId& id, + const document::Bucket &bucket, const std::vector<char>& buffer, bool keepTimeStamps_) - : BucketInfoCommand(MessageType::MULTIOPERATION, id), + : BucketInfoCommand(MessageType::MULTIOPERATION, bucket), _buffer(buffer), _operations(repo, 0, 0), _keepTimeStamps(keepTimeStamps_) @@ -42,7 +42,7 @@ MultiOperationCommand::MultiOperationCommand(const DocumentTypeRepo::SP &repo, } MultiOperationCommand::MultiOperationCommand(const MultiOperationCommand& o) - : BucketInfoCommand(MessageType::MULTIOPERATION, o.getBucketId()), + : BucketInfoCommand(MessageType::MULTIOPERATION, o.getBucket()), _buffer(o._buffer), _operations(o._operations.getTypeRepo(),0, 0), _keepTimeStamps(o._keepTimeStamps) diff --git a/storageapi/src/vespa/storageapi/message/multioperation.h b/storageapi/src/vespa/storageapi/message/multioperation.h index 3376a7cb036..3d80cd042ea 100644 --- a/storageapi/src/vespa/storageapi/message/multioperation.h +++ b/storageapi/src/vespa/storageapi/message/multioperation.h @@ -28,11 +28,11 @@ private: public: explicit MultiOperationCommand(const document::DocumentTypeRepo::SP &repo, - const document::BucketId& id, + const document::Bucket &bucket, int bufferSize, bool keepTimeStamps = false); explicit MultiOperationCommand(const document::DocumentTypeRepo::SP &repo, - const document::BucketId& id, + const document::Bucket &bucket, const std::vector<char>& buffer, bool keepTimeStamps = false); explicit MultiOperationCommand(const MultiOperationCommand& template_); diff --git a/storageapi/src/vespa/storageapi/message/persistence.cpp b/storageapi/src/vespa/storageapi/message/persistence.cpp index ffb284012fb..10dbc9f1313 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.cpp +++ b/storageapi/src/vespa/storageapi/message/persistence.cpp @@ -19,14 +19,14 @@ IMPLEMENT_REPLY(RemoveReply) IMPLEMENT_COMMAND(RevertCommand, RevertReply) IMPLEMENT_REPLY(RevertReply) -TestAndSetCommand::TestAndSetCommand(const MessageType & messageType, const document::BucketId & id) - : BucketInfoCommand(messageType, id) +TestAndSetCommand::TestAndSetCommand(const MessageType & messageType, const document::Bucket &bucket) + : BucketInfoCommand(messageType, bucket) {} TestAndSetCommand::~TestAndSetCommand() { } -PutCommand::PutCommand(const document::BucketId& id, +PutCommand::PutCommand(const document::Bucket &bucket, const document::Document::SP& doc, Timestamp time) - : TestAndSetCommand(MessageType::PUT, id), + : TestAndSetCommand(MessageType::PUT, bucket), _doc(doc), _timestamp(time), _updateTimestamp(0) @@ -97,10 +97,10 @@ PutReply::print(std::ostream& out, bool verbose, } } -UpdateCommand::UpdateCommand(const document::BucketId& id, +UpdateCommand::UpdateCommand(const document::Bucket &bucket, const document::DocumentUpdate::SP& update, Timestamp time) - : TestAndSetCommand(MessageType::UPDATE, id), + : TestAndSetCommand(MessageType::UPDATE, bucket), _update(update), _timestamp(time), _oldTimestamp(0) @@ -176,10 +176,10 @@ UpdateReply::print(std::ostream& out, bool verbose, } } -GetCommand::GetCommand(const document::BucketId& bid, +GetCommand::GetCommand(const document::Bucket &bucket, const document::DocumentId& docId, const vespalib::stringref & fieldSet, Timestamp before) - : BucketInfoCommand(MessageType::GET, bid), + : BucketInfoCommand(MessageType::GET, bucket), _docId(docId), _beforeTimestamp(before), _fieldSet(fieldSet) @@ -238,10 +238,10 @@ GetReply::print(std::ostream& out, bool verbose, } } -RemoveCommand::RemoveCommand(const document::BucketId& bid, +RemoveCommand::RemoveCommand(const document::Bucket &bucket, const document::DocumentId& docId, Timestamp timestamp) - : TestAndSetCommand(MessageType::REMOVE, bid), + : TestAndSetCommand(MessageType::REMOVE, bucket), _docId(docId), _timestamp(timestamp) { @@ -297,9 +297,9 @@ RemoveReply::print(std::ostream& out, bool verbose, } } -RevertCommand::RevertCommand(const document::BucketId& id, +RevertCommand::RevertCommand(const document::Bucket &bucket, const std::vector<Timestamp>& revertTokens) - : BucketInfoCommand(MessageType::REVERT, id), + : BucketInfoCommand(MessageType::REVERT, bucket), _tokens(revertTokens) { } diff --git a/storageapi/src/vespa/storageapi/message/persistence.h b/storageapi/src/vespa/storageapi/message/persistence.h index 9add004c730..7d18a01d748 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.h +++ b/storageapi/src/vespa/storageapi/message/persistence.h @@ -22,7 +22,7 @@ class TestAndSetCommand : public BucketInfoCommand { TestAndSetCondition _condition; public: - TestAndSetCommand(const MessageType & messageType, const document::BucketId & id); + TestAndSetCommand(const MessageType & messageType, const document::Bucket &bucket); ~TestAndSetCommand(); void setCondition(const TestAndSetCondition & condition) { _condition = condition; } @@ -47,7 +47,7 @@ class PutCommand : public TestAndSetCommand { Timestamp _updateTimestamp; public: - PutCommand(const document::BucketId&, const document::Document::SP&, Timestamp); + PutCommand(const document::Bucket &bucket, const document::Document::SP&, Timestamp); ~PutCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } @@ -116,7 +116,7 @@ class UpdateCommand : public TestAndSetCommand { Timestamp _oldTimestamp; public: - UpdateCommand(const document::BucketId&, + UpdateCommand(const document::Bucket &bucket, const document::DocumentUpdate::SP&, Timestamp); ~UpdateCommand(); @@ -194,7 +194,7 @@ class GetCommand : public BucketInfoCommand { vespalib::string _fieldSet; public: - GetCommand(const document::BucketId&, const document::DocumentId&, + GetCommand(const document::Bucket &bucket, const document::DocumentId&, const vespalib::stringref & fieldSet, Timestamp before = MAX_TIMESTAMP); ~GetCommand(); void setBeforeTimestamp(Timestamp ts) { _beforeTimestamp = ts; } @@ -254,7 +254,7 @@ class RemoveCommand : public TestAndSetCommand { Timestamp _timestamp; public: - RemoveCommand(const document::BucketId&, const document::DocumentId& docId, Timestamp timestamp); + RemoveCommand(const document::Bucket &bucket, const document::DocumentId& docId, Timestamp timestamp); ~RemoveCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } @@ -297,7 +297,7 @@ public: class RevertCommand : public BucketInfoCommand { std::vector<Timestamp> _tokens; public: - RevertCommand(const document::BucketId& bucket, + RevertCommand(const document::Bucket &bucket, const std::vector<Timestamp>& revertTokens); ~RevertCommand(); const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } diff --git a/storageapi/src/vespa/storageapi/message/removelocation.cpp b/storageapi/src/vespa/storageapi/message/removelocation.cpp index 74149932bd3..38b56101f04 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.cpp +++ b/storageapi/src/vespa/storageapi/message/removelocation.cpp @@ -10,8 +10,8 @@ IMPLEMENT_COMMAND(RemoveLocationCommand, RemoveLocationReply) IMPLEMENT_REPLY(RemoveLocationReply) RemoveLocationCommand::RemoveLocationCommand(const vespalib::stringref & documentSelection, - const document::BucketId& id) - : BucketInfoCommand(MessageType::REMOVELOCATION, id), + const document::Bucket &bucket) + : BucketInfoCommand(MessageType::REMOVELOCATION, bucket), _documentSelection(documentSelection) {} diff --git a/storageapi/src/vespa/storageapi/message/removelocation.h b/storageapi/src/vespa/storageapi/message/removelocation.h index 7ff1e70586d..4a3dec2e0f6 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.h +++ b/storageapi/src/vespa/storageapi/message/removelocation.h @@ -11,7 +11,7 @@ namespace api { class RemoveLocationCommand : public BucketInfoCommand { public: - RemoveLocationCommand(const vespalib::stringref & documentSelection, const document::BucketId&); + RemoveLocationCommand(const vespalib::stringref & documentSelection, const document::Bucket &bucket); ~RemoveLocationCommand(); void print(std::ostream& out, bool verbose, const std::string& indent) const override; diff --git a/storageapi/src/vespa/storageapi/message/stat.cpp b/storageapi/src/vespa/storageapi/message/stat.cpp index 7c8a5541313..b061be885ff 100644 --- a/storageapi/src/vespa/storageapi/message/stat.cpp +++ b/storageapi/src/vespa/storageapi/message/stat.cpp @@ -11,9 +11,9 @@ IMPLEMENT_REPLY(StatBucketReply) IMPLEMENT_COMMAND(GetBucketListCommand, GetBucketListReply) IMPLEMENT_REPLY(GetBucketListReply) -StatBucketCommand::StatBucketCommand(const document::BucketId& id, +StatBucketCommand::StatBucketCommand(const document::Bucket& bucket, const vespalib::stringref & documentSelection) - : BucketCommand(MessageType::STATBUCKET, id), + : BucketCommand(MessageType::STATBUCKET, bucket), _docSelection(documentSelection) { } @@ -59,8 +59,8 @@ StatBucketReply::print(std::ostream& out, bool verbose, } } -GetBucketListCommand::GetBucketListCommand(const document::BucketId& id) - : BucketCommand(MessageType::GETBUCKETLIST, id) +GetBucketListCommand::GetBucketListCommand(const document::Bucket &bucket) + : BucketCommand(MessageType::GETBUCKETLIST, bucket) { } diff --git a/storageapi/src/vespa/storageapi/message/stat.h b/storageapi/src/vespa/storageapi/message/stat.h index 4bff4b5a823..637c43255b8 100644 --- a/storageapi/src/vespa/storageapi/message/stat.h +++ b/storageapi/src/vespa/storageapi/message/stat.h @@ -21,7 +21,7 @@ class StatBucketCommand : public BucketCommand { private: vespalib::string _docSelection; public: - StatBucketCommand(const document::BucketId& bucket, + StatBucketCommand(const document::Bucket &bucket, const vespalib::stringref & documentSelection); ~StatBucketCommand(); @@ -51,7 +51,7 @@ public: */ class GetBucketListCommand : public BucketCommand { public: - GetBucketListCommand(const document::BucketId& bucket); + GetBucketListCommand(const document::Bucket &bucket); void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetBucketListCommand, onGetBucketList); }; diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.cpp b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.cpp index e91864e284d..5c041649484 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.cpp @@ -10,9 +10,9 @@ using document::BucketSpace; namespace storage { namespace api { -BucketCommand::BucketCommand(const MessageType& type, const BucketId& id) +BucketCommand::BucketCommand(const MessageType& type, const Bucket &bucket) : StorageCommand(type), - _bucket(BucketSpace::placeHolder(), id), + _bucket(bucket), _originalBucket() { } diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h index b31bcf5e88c..c098bc53751 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h @@ -18,7 +18,7 @@ class BucketCommand : public StorageCommand { document::BucketId _originalBucket; protected: - BucketCommand(const MessageType& type, const document::BucketId& id); + BucketCommand(const MessageType& type, const document::Bucket &bucket); public: DECLARE_POINTER_TYPEDEFS(BucketCommand); diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h index a6e2ba363ec..25fa01758ca 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h @@ -19,8 +19,8 @@ namespace api { class BucketInfoCommand : public BucketCommand { protected: - BucketInfoCommand(const MessageType& type, const document::BucketId& id) - : BucketCommand(type, id) {} + BucketInfoCommand(const MessageType& type, const document::Bucket &bucket) + : BucketCommand(type, bucket) {} public: DECLARE_POINTER_TYPEDEFS(BucketInfoCommand); diff --git a/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h b/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h index 377b85bef2f..7e9a41e6220 100644 --- a/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h @@ -9,8 +9,8 @@ namespace api { class MaintenanceCommand : public BucketInfoCommand { public: - MaintenanceCommand(const MessageType& type, const document::BucketId& id) - : BucketInfoCommand(type, id) + MaintenanceCommand(const MessageType& type, const document::Bucket &bucket) + : BucketInfoCommand(type, bucket) {} MaintenanceCommand(MaintenanceCommand &&) = default; MaintenanceCommand & operator = (MaintenanceCommand &&) = default; |