diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-11-16 11:55:09 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-11-16 11:55:09 +0000 |
commit | 8ae01c672040df699a612244f73c9638c15e3516 (patch) | |
tree | 3666dd5787f7dff31cf82c1f65fdd0c7c4e55407 | |
parent | 7a6772d914b0de0ecf683f1233c349e34067ec37 (diff) |
Add getBucket() method to storage commands/replies that have
bucket space but no specific bucket id. Returns bucket with
proper bucket space and unset (aka null) bucket id.
6 files changed, 21 insertions, 0 deletions
diff --git a/storage/src/vespa/storage/common/bucketmessages.cpp b/storage/src/vespa/storage/common/bucketmessages.cpp index 1d9d64ad24f..3157bad49e5 100644 --- a/storage/src/vespa/storage/common/bucketmessages.cpp +++ b/storage/src/vespa/storage/common/bucketmessages.cpp @@ -39,6 +39,12 @@ ReadBucketListReply::ReadBucketListReply(const ReadBucketList& cmd) ReadBucketListReply::~ReadBucketListReply() { } +document::Bucket +ReadBucketListReply::getBucket() const +{ + return document::Bucket(_bucketSpace, document::BucketId()); +} + void ReadBucketListReply::print(std::ostream& out, bool verbose, const std::string& indent) const { diff --git a/storage/src/vespa/storage/common/bucketmessages.h b/storage/src/vespa/storage/common/bucketmessages.h index 0ff7a22aa4d..941928b1064 100644 --- a/storage/src/vespa/storage/common/bucketmessages.h +++ b/storage/src/vespa/storage/common/bucketmessages.h @@ -55,6 +55,7 @@ public: document::BucketSpace getBucketSpace() const { return _bucketSpace; } spi::PartitionId getPartition() const { return _partition; } + document::Bucket getBucket() const override; spi::BucketIdListResult::List& getBuckets() { return _buckets; } const spi::BucketIdListResult::List& getBuckets() const { diff --git a/storageapi/src/vespa/storageapi/message/bucket.cpp b/storageapi/src/vespa/storageapi/message/bucket.cpp index 18ad95c2c02..0961a8f6edc 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.cpp +++ b/storageapi/src/vespa/storageapi/message/bucket.cpp @@ -475,6 +475,12 @@ RequestBucketInfoCommand::RequestBucketInfoCommand( { } +document::Bucket +RequestBucketInfoCommand::getBucket() const +{ + return document::Bucket(_bucketSpace, document::BucketId()); +} + void RequestBucketInfoCommand::print(std::ostream& out, bool verbose, const std::string& indent) const diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index 05838600a24..5fba1a3bf65 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -363,6 +363,7 @@ public: const vespalib::string& getDistributionHash() const { return _distributionHash; } document::BucketSpace getBucketSpace() const { return _bucketSpace; } + document::Bucket getBucket() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; diff --git a/storageapi/src/vespa/storageapi/message/visitor.cpp b/storageapi/src/vespa/storageapi/message/visitor.cpp index 7b5a614bd3e..3cb6f72d5d9 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.cpp +++ b/storageapi/src/vespa/storageapi/message/visitor.cpp @@ -68,6 +68,12 @@ CreateVisitorCommand::CreateVisitorCommand(const CreateVisitorCommand& o) CreateVisitorCommand::~CreateVisitorCommand() {} +document::Bucket +CreateVisitorCommand::getBucket() const +{ + return document::Bucket(_bucketSpace, document::BucketId()); +} + void CreateVisitorCommand::print(std::ostream& out, bool verbose, const std::string& indent) const diff --git a/storageapi/src/vespa/storageapi/message/visitor.h b/storageapi/src/vespa/storageapi/message/visitor.h index f252ecd344f..e1850686222 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.h +++ b/storageapi/src/vespa/storageapi/message/visitor.h @@ -86,6 +86,7 @@ public: VisitorId getVisitorId() const { return _visitorId; } uint32_t getVisitorCmdId() const { return _visitorCmdId; } document::BucketSpace getBucketSpace() const { return _bucketSpace; } + document::Bucket getBucket() const override; const vespalib::string & getLibraryName() const { return _libName; } const vespalib::string & getInstanceId() const { return _instanceId; } const vespalib::string & getControlDestination() const |