summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2019-08-15 18:53:42 +0200
committerTor Egge <Tor.Egge@broadpark.no>2019-08-15 18:53:42 +0200
commit22c4e3d3bf3d7176d6b7f699f00d676e6ffdcf4f (patch)
tree6f503d0de021515ec11e38735cf578ae8a5a9199 /vespalib
parentd150adfc74f3a050e91e6518b96562de731d76fa (diff)
Style fixes for UniqueStoreStringAllocator.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp12
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store.hpp6
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h10
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_allocator.hpp2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_builder.hpp2
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h9
6 files changed, 19 insertions, 22 deletions
diff --git a/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp b/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp
index c7659cd6154..048e1653ee4 100644
--- a/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp
+++ b/vespalib/src/tests/datastore/unique_store_string_allocator/unique_store_string_allocator_test.cpp
@@ -51,7 +51,7 @@ struct TestBase : public ::testing::Test {
return EntryRefType(ref).bufferId();
}
const BufferState &buffer_state(EntryRef ref) const {
- return allocator.getDataStore().getBufferState(get_buffer_id(ref));
+ return allocator.get_data_store().getBufferState(get_buffer_id(ref));
}
void assert_buffer_state(EntryRef ref, const BufferStats expStats) const {
EXPECT_EQ(expStats._used, buffer_state(ref).size());
@@ -61,8 +61,8 @@ struct TestBase : public ::testing::Test {
EXPECT_EQ(expStats._extra_hold, buffer_state(ref).getExtraHoldBytes());
}
void trim_hold_lists() {
- allocator.getDataStore().transferHoldLists(generation++);
- allocator.getDataStore().trimHoldLists(generation);
+ allocator.get_data_store().transferHoldLists(generation++);
+ allocator.get_data_store().trimHoldLists(generation);
}
};
@@ -122,7 +122,7 @@ TEST_F(StringTest, string_length_determines_buffer)
TEST_F(StringTest, free_list_is_used_when_enabled)
{
- allocator.getDataStore().enableFreeLists();
+ allocator.get_data_store().enableFreeLists();
EntryRef ref1 = add(small.c_str());
EntryRef ref2 = add(spaces1000.c_str());
remove(ref1);
@@ -138,7 +138,7 @@ TEST_F(StringTest, free_list_is_used_when_enabled)
TEST_F(StringTest, free_list_is_not_used_when_disabled)
{
- allocator.getDataStore().disableFreeLists();
+ allocator.get_data_store().disableFreeLists();
EntryRef ref1 = add(small.c_str());
EntryRef ref2 = add(spaces1000.c_str());
remove(ref1);
@@ -154,7 +154,7 @@ TEST_F(StringTest, free_list_is_not_used_when_disabled)
TEST_F(StringTest, free_list_is_never_used_for_move)
{
- allocator.getDataStore().enableFreeLists();
+ allocator.get_data_store().enableFreeLists();
EntryRef ref1 = add(small.c_str());
EntryRef ref2 = add(spaces1000.c_str());
EntryRef ref3 = add(small.c_str());
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
index f43f0116517..bc1873a2c3a 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
@@ -17,7 +17,7 @@ namespace search::datastore {
template <typename EntryT, typename RefT, typename Compare, typename Allocator>
UniqueStore<EntryT, RefT, Compare, Allocator>::UniqueStore()
: _allocator(),
- _store(_allocator.getDataStore()),
+ _store(_allocator.get_data_store()),
_dict(std::make_unique<UniqueStoreDictionary>())
{
}
@@ -31,7 +31,7 @@ UniqueStore<EntryT, RefT, Compare, Allocator>::add(const EntryType &value)
{
Compare comp(_store, value);
UniqueStoreAddResult result = _dict->add(comp, [this, &value]() -> EntryRef { return _allocator.allocate(value); });
- _allocator.getWrapped(result.ref()).inc_ref_count();
+ _allocator.get_wrapped(result.ref()).inc_ref_count();
return result;
}
@@ -47,7 +47,7 @@ template <typename EntryT, typename RefT, typename Compare, typename Allocator>
void
UniqueStore<EntryT, RefT, Compare, Allocator>::remove(EntryRef ref)
{
- auto &wrapped_entry = _allocator.getWrapped(ref);
+ auto &wrapped_entry = _allocator.get_wrapped(ref);
auto ref_count = wrapped_entry.get_ref_count();
assert(ref_count > 0u);
wrapped_entry.dec_ref_count();
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h
index 53f76d17569..cadc2b09c0e 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.h
@@ -33,16 +33,14 @@ public:
EntryRef allocate(const EntryType& value);
void hold(EntryRef ref);
EntryRef move(EntryRef ref) override;
- const WrappedEntryType& getWrapped(EntryRef ref) const
- {
+ const WrappedEntryType& get_wrapped(EntryRef ref) const {
RefType iRef(ref);
return *_store.template getEntry<WrappedEntryType>(iRef);
}
- const EntryType& get(EntryRef ref) const
- {
- return getWrapped(ref).value();
+ const EntryType& get(EntryRef ref) const {
+ return get_wrapped(ref).value();
}
- DataStoreType& getDataStore() { return _store; }
+ DataStoreType& get_data_store() { return _store; }
};
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.hpp
index 5bee5baf9c8..7a170507096 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_allocator.hpp
@@ -47,7 +47,7 @@ template <typename EntryT, typename RefT>
EntryRef
UniqueStoreAllocator<EntryT, RefT>::move(EntryRef ref)
{
- return _store.template allocator<WrappedEntryType>(0).alloc(getWrapped(ref)).ref;
+ return _store.template allocator<WrappedEntryType>(0).alloc(get_wrapped(ref)).ref;
}
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_builder.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_builder.hpp
index e63da8d80c6..030c8b6d6ba 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_builder.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_builder.hpp
@@ -37,7 +37,7 @@ UniqueStoreBuilder<Allocator>::makeDictionary()
{
auto ref_count_itr = _refCounts.cbegin();
for (auto ref : _refs) {
- auto& wrapped_entry = _allocator.getWrapped(ref);
+ auto& wrapped_entry = _allocator.get_wrapped(ref);
wrapped_entry.set_ref_count(*ref_count_itr);
++ref_count_itr;
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
index b4ceab4c804..0adb089da08 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_string_allocator.h
@@ -104,7 +104,7 @@ public:
EntryRef allocate(const char *value);
void hold(EntryRef ref);
EntryRef move(EntryRef ref) override;
- const UniqueStoreEntryBase& getWrapped(EntryRef ref) const {
+ const UniqueStoreEntryBase& get_wrapped(EntryRef ref) const {
RefType iRef(ref);
auto &state = _store.getBufferState(iRef.bufferId());
auto type_id = state.getTypeId();
@@ -114,8 +114,7 @@ public:
return *_store.template getEntry<WrappedExternalEntryType>(iRef);
}
}
- const char *get(EntryRef ref) const
- {
+ const char *get(EntryRef ref) const {
RefType iRef(ref);
auto &state = _store.getBufferState(iRef.bufferId());
auto type_id = state.getTypeId();
@@ -125,8 +124,8 @@ public:
return _store.template getEntry<WrappedExternalEntryType>(iRef)->value().c_str();
}
}
- DataStoreType& getDataStore() { return _store; }
- const DataStoreType& getDataStore() const { return _store; }
+ DataStoreType& get_data_store() { return _store; }
+ const DataStoreType& get_data_store() const { return _store; }
};
}