From 8ae01c672040df699a612244f73c9638c15e3516 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Thu, 16 Nov 2017 11:55:09 +0000 Subject: 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. --- storageapi/src/vespa/storageapi/message/bucket.cpp | 6 ++++++ storageapi/src/vespa/storageapi/message/bucket.h | 1 + storageapi/src/vespa/storageapi/message/visitor.cpp | 6 ++++++ storageapi/src/vespa/storageapi/message/visitor.h | 1 + 4 files changed, 14 insertions(+) (limited to 'storageapi') 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 -- cgit v1.2.3