summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-02-02 12:54:29 +0000
committerGeir Storli <geirst@oath.com>2018-02-02 12:54:29 +0000
commit4d2fc52cfa76096c81253565874ed33b6b2fe565 (patch)
treec707f24a3619e914620d075b7c7ac85713b65bf2 /document
parent0c29fb32d7263487ce5d722e95e2fb89166b00c8 (diff)
Define and use fixed bucket spaces names.
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/fixed_bucket_spaces_test.cpp2
-rw-r--r--document/src/vespa/document/bucket/fixed_bucket_spaces.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/document/src/tests/fixed_bucket_spaces_test.cpp b/document/src/tests/fixed_bucket_spaces_test.cpp
index fab38c638a7..12c248adf37 100644
--- a/document/src/tests/fixed_bucket_spaces_test.cpp
+++ b/document/src/tests/fixed_bucket_spaces_test.cpp
@@ -44,11 +44,13 @@ void FixedBucketSpacesTest::bucket_space_from_name_throws_exception_for_unknown_
void FixedBucketSpacesTest::name_from_bucket_space_is_defined_for_default_space() {
CPPUNIT_ASSERT_EQUAL(vespalib::stringref("default"),
FixedBucketSpaces::to_string(FixedBucketSpaces::default_space()));
+ CPPUNIT_ASSERT_EQUAL(vespalib::stringref("default"), FixedBucketSpaces::default_space_name());
}
void FixedBucketSpacesTest::name_from_bucket_space_is_defined_for_global_space() {
CPPUNIT_ASSERT_EQUAL(vespalib::stringref("global"),
FixedBucketSpaces::to_string(FixedBucketSpaces::global_space()));
+ CPPUNIT_ASSERT_EQUAL(vespalib::stringref("global"), FixedBucketSpaces::global_space_name());
}
void FixedBucketSpacesTest::name_from_bucket_space_throws_exception_for_unknown_space() {
diff --git a/document/src/vespa/document/bucket/fixed_bucket_spaces.h b/document/src/vespa/document/bucket/fixed_bucket_spaces.h
index 87722c7a21c..c9786306897 100644
--- a/document/src/vespa/document/bucket/fixed_bucket_spaces.h
+++ b/document/src/vespa/document/bucket/fixed_bucket_spaces.h
@@ -16,6 +16,8 @@ VESPA_DEFINE_EXCEPTION(UnknownBucketSpaceException, vespalib::IllegalArgumentExc
struct FixedBucketSpaces {
static constexpr BucketSpace default_space() { return BucketSpace(1); };
static constexpr BucketSpace global_space() { return BucketSpace(2); }
+ static vespalib::stringref default_space_name() { return to_string(default_space()); }
+ static vespalib::stringref global_space_name() { return to_string(global_space()); }
// Post-condition: returned space has valid() == true iff name
// is either "default" or "global".