diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-09-15 09:49:46 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-09-15 09:49:46 +0000 |
commit | d84135e9f17605b8f192ed88a6ea024f0995df1a (patch) | |
tree | e3d2f149ab98129218691ea2ccf3612985ecaa02 | |
parent | 02fc546e8545be4d466c178c838b382657becbcb (diff) |
Rename notifyPut to notifyPutDone since notification happens after
data structures have been updated.
14 files changed, 32 insertions, 32 deletions
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index c02aa033bb9..eeec8122703 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -198,7 +198,7 @@ public: { } - virtual void notifyPut(document::GlobalId gid, uint32_t lid, SerialNum) override { + virtual void notifyPutDone(document::GlobalId gid, uint32_t lid, SerialNum) override { _changeGid = gid; _changeLid = lid; _gidToLid[gid] = lid; diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp index 1c5287f15e5..6aafb3217c7 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/gid_to_lid_change_handler_test.cpp @@ -53,7 +53,7 @@ public: EXPECT_EQUAL(_createdListeners, _destroyedListeners); } - void notifyPut() { + void notifyPutDone() { lock_guard guard(_lock); ++_putChanges; } @@ -101,7 +101,7 @@ public: _stats.markCreatedListener(); } virtual ~MyListener() { _stats.markDestroyedListener(); } - virtual void notifyPut(GlobalId, uint32_t) override { _stats.notifyPut(); } + virtual void notifyPutDone(GlobalId, uint32_t) override { _stats.notifyPutDone(); } virtual void notifyRemove(GlobalId) override { _stats.notifyRemove(); } virtual void notifyRegistered() override { _stats.markRegisteredListener(); } virtual const vespalib::string &getName() const override { return _name; } @@ -138,8 +138,8 @@ struct Fixture _handler->addListener(std::move(listener)); } - void notifyPut(GlobalId gid, uint32_t lid, SerialNum serialNum) { - _handler->notifyPut(gid, lid, serialNum); + void notifyPutDone(GlobalId gid, uint32_t lid, SerialNum serialNum) { + _handler->notifyPutDone(gid, lid, serialNum); } void notifyRemove(GlobalId gid, SerialNum serialNum) { @@ -164,7 +164,7 @@ TEST_F("Test that we can register a listener", Fixture) TEST_DO(stats.assertListeners(1, 0, 0)); f.addListener(std::move(listener)); TEST_DO(stats.assertListeners(1, 1, 0)); - f.notifyPut(toGid(doc1), 10, 10); + f.notifyPutDone(toGid(doc1), 10, 10); TEST_DO(stats.assertChanges(1, 0)); f.removeListeners("testdoc", {}); TEST_DO(stats.assertListeners(1, 1, 1)); @@ -187,7 +187,7 @@ TEST_F("Test that we can register multiple listeners", Fixture) TEST_DO(stats1.assertListeners(1, 1, 0)); TEST_DO(stats2.assertListeners(1, 1, 0)); TEST_DO(stats3.assertListeners(1, 1, 0)); - f.notifyPut(toGid(doc1), 10, 10); + f.notifyPutDone(toGid(doc1), 10, 10); TEST_DO(stats1.assertChanges(1, 0)); TEST_DO(stats2.assertChanges(1, 0)); TEST_DO(stats3.assertChanges(1, 0)); @@ -229,11 +229,11 @@ TEST_F("Test that put is ignored if we have a pending remove", Fixture) f.addListener(std::move(listener)); f.notifyRemove(toGid(doc1), 20); TEST_DO(stats.assertChanges(0, 1)); - f.notifyPut(toGid(doc1), 10, 10); + f.notifyPutDone(toGid(doc1), 10, 10); TEST_DO(stats.assertChanges(0, 1)); f.notifyRemoveDone(toGid(doc1), 20); TEST_DO(stats.assertChanges(0, 1)); - f.notifyPut(toGid(doc1), 11, 30); + f.notifyPutDone(toGid(doc1), 11, 30); TEST_DO(stats.assertChanges(1, 1)); f.removeListeners("testdoc", {}); } @@ -247,15 +247,15 @@ TEST_F("Test that pending removes are merged", Fixture) TEST_DO(stats.assertChanges(0, 1)); f.notifyRemove(toGid(doc1), 40); TEST_DO(stats.assertChanges(0, 1)); - f.notifyPut(toGid(doc1), 10, 10); + f.notifyPutDone(toGid(doc1), 10, 10); TEST_DO(stats.assertChanges(0, 1)); f.notifyRemoveDone(toGid(doc1), 20); TEST_DO(stats.assertChanges(0, 1)); - f.notifyPut(toGid(doc1), 11, 30); + f.notifyPutDone(toGid(doc1), 11, 30); TEST_DO(stats.assertChanges(0, 1)); f.notifyRemoveDone(toGid(doc1), 40); TEST_DO(stats.assertChanges(0, 1)); - f.notifyPut(toGid(doc1), 12, 50); + f.notifyPutDone(toGid(doc1), 12, 50); TEST_DO(stats.assertChanges(1, 1)); f.removeListeners("testdoc", {}); } diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp index 4c6f9017000..1cea981e9ff 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp @@ -94,8 +94,8 @@ struct Fixture _listener = std::make_unique<GidToLidChangeListener>(_writer, _attr, _refCount, "test", "testdoc"); } - void notifyPut(const GlobalId &gid, uint32_t referencedDoc) { - _listener->notifyPut(gid, referencedDoc); + void notifyPutDone(const GlobalId &gid, uint32_t referencedDoc) { + _listener->notifyPutDone(gid, referencedDoc); } void notifyListenerRegistered() { @@ -114,9 +114,9 @@ TEST_F("Test that we can use gid to lid change listener", Fixture) TEST_DO(f.assertRefLid(0, 2)); TEST_DO(f.assertRefLid(0, 3)); f.allocListener(); - f.notifyPut(toGid(doc1), 10); - f.notifyPut(toGid(doc2), 20); - f.notifyPut(toGid(doc3), 30); + f.notifyPutDone(toGid(doc1), 10); + f.notifyPutDone(toGid(doc2), 20); + f.notifyPutDone(toGid(doc3), 30); TEST_DO(f.assertRefLid(10, 1)); TEST_DO(f.assertRefLid(20, 2)); TEST_DO(f.assertRefLid(10, 3)); diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp index a5231647158..d240c437ef2 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/gid_to_lid_change_registrator_test.cpp @@ -24,7 +24,7 @@ public: { } virtual ~MyListener() { } - virtual void notifyPut(document::GlobalId, uint32_t) override { } + virtual void notifyPutDone(document::GlobalId, uint32_t) override { } virtual void notifyRemove(document::GlobalId) override { } virtual void notifyRegistered() override { } virtual const vespalib::string &getName() const override { return _name; } diff --git a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp index c3c516a51dc..8f70d697b9a 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.cpp @@ -15,7 +15,7 @@ DummyGidToLidChangeHandler::~DummyGidToLidChangeHandler() } void -DummyGidToLidChangeHandler::notifyPut(GlobalId, uint32_t, SerialNum) +DummyGidToLidChangeHandler::notifyPutDone(GlobalId, uint32_t, SerialNum) { } diff --git a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h index 24773924aaa..28eb281ec95 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/reference/dummy_gid_to_lid_change_handler.h @@ -24,7 +24,7 @@ public: DummyGidToLidChangeHandler(); virtual ~DummyGidToLidChangeHandler(); - virtual void notifyPut(GlobalId gid, uint32_t lid, SerialNum serialNum) override; + virtual void notifyPutDone(GlobalId gid, uint32_t lid, SerialNum serialNum) override; virtual void notifyRemove(GlobalId gid, SerialNum serialNum) override; virtual void notifyRemoveDone(GlobalId gid, SerialNum serialNum) override; virtual void addListener(std::unique_ptr<IGidToLidChangeListener> listener) override; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp index d7b2c16867a..79c4ab0480e 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.cpp @@ -31,10 +31,10 @@ GidToLidChangeHandler::~GidToLidChangeHandler() } void -GidToLidChangeHandler::notifyPut(GlobalId gid, uint32_t lid) +GidToLidChangeHandler::notifyPutDone(GlobalId gid, uint32_t lid) { for (const auto &listener : _listeners) { - listener->notifyPut(gid, lid); + listener->notifyPutDone(gid, lid); } } @@ -47,7 +47,7 @@ GidToLidChangeHandler::notifyRemove(GlobalId gid) } void -GidToLidChangeHandler::notifyPut(GlobalId gid, uint32_t lid, SerialNum serialNum) +GidToLidChangeHandler::notifyPutDone(GlobalId gid, uint32_t lid, SerialNum serialNum) { lock_guard guard(_lock); auto itr = _pendingRemove.find(gid); @@ -55,7 +55,7 @@ GidToLidChangeHandler::notifyPut(GlobalId gid, uint32_t lid, SerialNum serialNum assert(itr->second > serialNum); return; // Document has already been removed later on } - notifyPut(gid, lid); + notifyPutDone(gid, lid); } void diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h index 840cb61cc2a..ea625fba3b3 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_handler.h @@ -27,13 +27,13 @@ class GidToLidChangeHandler : public std::enable_shared_from_this<GidToLidChange bool _closed; vespalib::hash_map<GlobalId, SerialNum, GlobalId::hash> _pendingRemove; - void notifyPut(GlobalId gid, uint32_t lid); + void notifyPutDone(GlobalId gid, uint32_t lid); void notifyRemove(GlobalId gid); public: GidToLidChangeHandler(); virtual ~GidToLidChangeHandler(); - virtual void notifyPut(GlobalId gid, uint32_t lid, SerialNum serialNum) override; + virtual void notifyPutDone(GlobalId gid, uint32_t lid, SerialNum serialNum) override; virtual void notifyRemove(GlobalId gid, SerialNum serialNum) override; virtual void notifyRemoveDone(GlobalId gid, SerialNum serialNum) override; diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp index 6a368997770..cb5c5de0f5a 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.cpp @@ -26,7 +26,7 @@ GidToLidChangeListener::~GidToLidChangeListener() } void -GidToLidChangeListener::notifyPut(document::GlobalId gid, uint32_t lid) +GidToLidChangeListener::notifyPutDone(document::GlobalId gid, uint32_t lid) { std::promise<bool> promise; std::future<bool> future = promise.get_future(); diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h index 35ff913d7af..0e9298e3e51 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h +++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_change_listener.h @@ -30,7 +30,7 @@ public: const vespalib::string &name, const vespalib::string &docTypeName); virtual ~GidToLidChangeListener(); - virtual void notifyPut(document::GlobalId gid, uint32_t lid) override; + virtual void notifyPutDone(document::GlobalId gid, uint32_t lid) override; virtual void notifyRemove(document::GlobalId gid) override; virtual void notifyRegistered() override; virtual const vespalib::string &getName() const override; diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h index 53ade83ff32..7de837236e8 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h @@ -40,7 +40,7 @@ public: /** * Notify gid to lid mapping change. */ - virtual void notifyPut(GlobalId gid, uint32_t lid, SerialNum serialNum) = 0; + virtual void notifyPutDone(GlobalId gid, uint32_t lid, SerialNum serialNum) = 0; virtual void notifyRemove(GlobalId gid, SerialNum serialNum) = 0; virtual void notifyRemoveDone(GlobalId gid, SerialNum serialNum) = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h index d02979e168f..ebae8d40611 100644 --- a/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h +++ b/searchcore/src/vespa/searchcore/proton/reference/i_gid_to_lid_change_listener.h @@ -17,7 +17,7 @@ class IGidToLidChangeListener { public: virtual ~IGidToLidChangeListener() { } - virtual void notifyPut(document::GlobalId gid, uint32_t lid) = 0; + virtual void notifyPutDone(document::GlobalId gid, uint32_t lid) = 0; virtual void notifyRemove(document::GlobalId gid) = 0; virtual void notifyRegistered() = 0; virtual const vespalib::string &getName() const = 0; diff --git a/searchcore/src/vespa/searchcore/proton/server/putdonecontext.cpp b/searchcore/src/vespa/searchcore/proton/server/putdonecontext.cpp index f05d8bc0823..efb5a58dd2e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/putdonecontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/putdonecontext.cpp @@ -31,7 +31,7 @@ PutDoneContext::~PutDoneContext() _docIdLimit->bumpUpLimit(_lid + 1); } if (_enableNotifyPut) { - _gidToLidChangeHandler.notifyPut(_gid, _lid, _serialNum); + _gidToLidChangeHandler.notifyPutDone(_gid, _lid, _serialNum); } } diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h index 41efb55e61c..c1c2e2909d9 100644 --- a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h +++ b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h @@ -44,7 +44,7 @@ public: _removes.emplace_back(docTypeName, keepNames); } - virtual void notifyPut(document::GlobalId, uint32_t, SerialNum) override { } + virtual void notifyPutDone(document::GlobalId, uint32_t, SerialNum) override { } virtual void notifyRemove(document::GlobalId, SerialNum) override { } virtual void notifyRemoveDone(document::GlobalId, SerialNum) override { } |