Revert "Renamed resource provider `AgentRegistrar` to `GenericRegistrar`."
This reverts commit f6becd6d6f3c8cee779903794ebcfb4f68405358. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6d563823 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6d563823 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6d563823 Branch: refs/heads/master Commit: 6d56382316930f5075b9ae2ba8ff0c71d845af47 Parents: b1e4946 Author: Alexander Rukletsov <[email protected]> Authored: Wed Apr 25 17:09:18 2018 +0200 Committer: Alexander Rukletsov <[email protected]> Committed: Wed Apr 25 17:09:18 2018 +0200 ---------------------------------------------------------------------- src/resource_provider/registrar.cpp | 35 +++++++++++----------- src/resource_provider/registrar.hpp | 10 +++---- src/tests/resource_provider_manager_tests.cpp | 4 +-- 3 files changed, 24 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/6d563823/src/resource_provider/registrar.cpp ---------------------------------------------------------------------- diff --git a/src/resource_provider/registrar.cpp b/src/resource_provider/registrar.cpp index 53b403e..dbb55dd 100644 --- a/src/resource_provider/registrar.cpp +++ b/src/resource_provider/registrar.cpp @@ -88,7 +88,7 @@ bool Registrar::Operation::set() Try<Owned<Registrar>> Registrar::create(Owned<Storage> storage) { - return new GenericRegistrar(std::move(storage)); + return new AgentRegistrar(std::move(storage)); } @@ -145,10 +145,10 @@ Try<bool> RemoveResourceProvider::perform(Registry* registry) } -class GenericRegistrarProcess : public Process<GenericRegistrarProcess> +class AgentRegistrarProcess : public Process<AgentRegistrarProcess> { public: - GenericRegistrarProcess(Owned<Storage> storage); + AgentRegistrarProcess(Owned<Storage> storage); Future<Nothing> recover(); @@ -182,13 +182,13 @@ private: }; -GenericRegistrarProcess::GenericRegistrarProcess(Owned<Storage> _storage) - : ProcessBase(process::ID::generate("resource-provider-generic-registrar")), +AgentRegistrarProcess::AgentRegistrarProcess(Owned<Storage> _storage) + : ProcessBase(process::ID::generate("resource-provider-agent-registrar")), storage(std::move(_storage)), state(storage.get()) {} -Future<Nothing> GenericRegistrarProcess::recover() +Future<Nothing> AgentRegistrarProcess::recover() { constexpr char NAME[] = "RESOURCE_PROVIDER_REGISTRAR"; @@ -206,8 +206,7 @@ Future<Nothing> GenericRegistrarProcess::recover() } -Future<bool> GenericRegistrarProcess::apply( - Owned<Registrar::Operation> operation) +Future<bool> AgentRegistrarProcess::apply(Owned<Registrar::Operation> operation) { if (recovered.isNone()) { return Failure("Attempted to apply the operation before recovering"); @@ -217,7 +216,7 @@ Future<bool> GenericRegistrarProcess::apply( } -Future<bool> GenericRegistrarProcess::_apply( +Future<bool> AgentRegistrarProcess::_apply( Owned<Registrar::Operation> operation) { if (error.isSome()) { @@ -235,7 +234,7 @@ Future<bool> GenericRegistrarProcess::_apply( } -void GenericRegistrarProcess::update() +void AgentRegistrarProcess::update() { CHECK(!updating); CHECK_NONE(error); @@ -276,7 +275,7 @@ void GenericRegistrarProcess::update() } -void GenericRegistrarProcess::_update( +void AgentRegistrarProcess::_update( const Future<Option<Variable<Registry>>>& store, const Registry& updatedRegistry, deque<Owned<Registrar::Operation>> applied) @@ -323,31 +322,31 @@ void GenericRegistrarProcess::_update( } -GenericRegistrar::GenericRegistrar(Owned<Storage> storage) - : process(new GenericRegistrarProcess(std::move(storage))) +AgentRegistrar::AgentRegistrar(Owned<Storage> storage) + : process(new AgentRegistrarProcess(std::move(storage))) { process::spawn(process.get(), false); } -GenericRegistrar::~GenericRegistrar() +AgentRegistrar::~AgentRegistrar() { process::terminate(*process); process::wait(*process); } -Future<Nothing> GenericRegistrar::recover() +Future<Nothing> AgentRegistrar::recover() { - return dispatch(process.get(), &GenericRegistrarProcess::recover); + return dispatch(process.get(), &AgentRegistrarProcess::recover); } -Future<bool> GenericRegistrar::apply(Owned<Operation> operation) +Future<bool> AgentRegistrar::apply(Owned<Operation> operation) { return dispatch( process.get(), - &GenericRegistrarProcess::apply, + &AgentRegistrarProcess::apply, std::move(operation)); } http://git-wip-us.apache.org/repos/asf/mesos/blob/6d563823/src/resource_provider/registrar.hpp ---------------------------------------------------------------------- diff --git a/src/resource_provider/registrar.hpp b/src/resource_provider/registrar.hpp index 3c10785..34cb166 100644 --- a/src/resource_provider/registrar.hpp +++ b/src/resource_provider/registrar.hpp @@ -105,22 +105,22 @@ private: }; -class GenericRegistrarProcess; +class AgentRegistrarProcess; -class GenericRegistrar : public Registrar +class AgentRegistrar : public Registrar { public: - GenericRegistrar(process::Owned<state::Storage> storage); + AgentRegistrar(process::Owned<state::Storage> storage); - ~GenericRegistrar() override; + ~AgentRegistrar() override; process::Future<Nothing> recover() override; process::Future<bool> apply(process::Owned<Operation> operation) override; private: - std::unique_ptr<GenericRegistrarProcess> process; + std::unique_ptr<AgentRegistrarProcess> process; }; http://git-wip-us.apache.org/repos/asf/mesos/blob/6d563823/src/tests/resource_provider_manager_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/resource_provider_manager_tests.cpp b/src/tests/resource_provider_manager_tests.cpp index ceb7854..72e8122 100644 --- a/src/tests/resource_provider_manager_tests.cpp +++ b/src/tests/resource_provider_manager_tests.cpp @@ -819,8 +819,8 @@ TEST_P(ResourceProviderManagerHttpApiTest, AgentEndpoint) class ResourceProviderRegistrarTest : public tests::MesosTest {}; -// Test that the generic resource provider registrar works as expected. -TEST_F(ResourceProviderRegistrarTest, GenericRegistrar) +// Test that the agent resource provider registrar works as expected. +TEST_F(ResourceProviderRegistrarTest, AgentRegistrar) { ResourceProviderID resourceProviderId; resourceProviderId.set_value("foo");
