diff options
author | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-06-16 19:16:06 +0300 |
---|---|---|
committer | ivanmorozov <ivanmorozov@yandex-team.com> | 2023-06-16 19:16:06 +0300 |
commit | b3a917acb08540c7ca714cad59a607aa1e731b19 (patch) | |
tree | 40547d176af4ec0272fd1f7101d3630c72227184 | |
parent | 06f9c4f449aed9cd2eb3996de068b794fa046fc5 (diff) | |
download | ydb-b3a917acb08540c7ca714cad59a607aa1e731b19.tar.gz |
use controller directly instead of actor/events
16 files changed, 126 insertions, 242 deletions
diff --git a/library/cpp/actors/core/invoke.h b/library/cpp/actors/core/invoke.h index 931a9767dd..a971f90631 100644 --- a/library/cpp/actors/core/invoke.h +++ b/library/cpp/actors/core/invoke.h @@ -107,4 +107,38 @@ namespace NActors { std::forward<TCallback>(callback), std::forward<TCompletion>(complete)); } + template <class TInvokeExecutor> + class TScheduledInvokeActivity: public TActor<TScheduledInvokeActivity<TInvokeExecutor>> { + private: + using TBase = TActor<TScheduledInvokeActivity<TInvokeExecutor>>; + const TMonotonic Timestamp; + TInvokeExecutor Executor; + public: + TScheduledInvokeActivity(TInvokeExecutor&& executor, const TMonotonic timestamp) + : TBase(&TBase::TThis::StateFunc) + , Timestamp(timestamp) + , Executor(std::move(executor)) { + } + + void StateFunc(STFUNC_SIG) { + Y_VERIFY(ev->GetTypeRewrite() == TEvents::TSystem::Wakeup); + auto g = TBase::PassAwayGuard(); + Executor(); + } + + void Registered(TActorSystem* sys, const TActorId& owner) override { + sys->Schedule(Timestamp, new IEventHandle(TEvents::TSystem::Wakeup, 0, TBase::SelfId(), owner, nullptr, 0)); + } + }; + + template<class TInvokeExecutor> + void ScheduleInvokeActivity(TInvokeExecutor&& executor, const TDuration d) { + TActivationContext::Register(new TScheduledInvokeActivity<TInvokeExecutor>(std::move(executor), TMonotonic::Now() + d)); + } + + template<class TInvokeExecutor> + void ScheduleInvokeActivity(TInvokeExecutor&& executor, const TMonotonic timestamp) { + TActivationContext::Register(new TScheduledInvokeActivity<TInvokeExecutor>(std::move(executor), timestamp)); + } + } // NActors diff --git a/ydb/services/bg_tasks/ds_table/executor_controller.cpp b/ydb/services/bg_tasks/ds_table/executor_controller.cpp index 05e888de04..71b9ae5ad5 100644 --- a/ydb/services/bg_tasks/ds_table/executor_controller.cpp +++ b/ydb/services/bg_tasks/ds_table/executor_controller.cpp @@ -2,6 +2,7 @@ #include "executor_controller.h" #include <ydb/services/bg_tasks/abstract/task.h> +#include <ydb/services/metadata/initializer/events.h> #include <library/cpp/actors/core/actor.h> diff --git a/ydb/services/metadata/ds_table/behaviour_registrator_actor.cpp b/ydb/services/metadata/ds_table/behaviour_registrator_actor.cpp index 39b90ddd15..c425674961 100644 --- a/ydb/services/metadata/ds_table/behaviour_registrator_actor.cpp +++ b/ydb/services/metadata/ds_table/behaviour_registrator_actor.cpp @@ -42,8 +42,8 @@ void TBehaviourRegistrator::Handle(TEvTableDescriptionFailed::TPtr& ev) { } void TBehaviourRegistrator::Handle(TEvStartRegistration::TPtr& /*ev*/) { - Register(new NInitializer::TDSAccessorInitialized(ReqConfig, - Behaviour->GetTypeId(), Behaviour->GetInitializer(), InternalController, RegistrationData->GetInitializationSnapshot())); + NInitializer::TDSAccessorInitialized::Execute(ReqConfig, + Behaviour->GetTypeId(), Behaviour->GetInitializer(), InternalController, RegistrationData->GetInitializationSnapshot()); } void TBehaviourRegistrator::Handle(NInitializer::TEvInitializationFinished::TPtr& ev) { diff --git a/ydb/services/metadata/ds_table/service.h b/ydb/services/metadata/ds_table/service.h index de7ef4f055..037c456c4c 100644 --- a/ydb/services/metadata/ds_table/service.h +++ b/ydb/services/metadata/ds_table/service.h @@ -7,7 +7,6 @@ #include <ydb/services/metadata/service.h> #include <ydb/services/metadata/initializer/common.h> -#include <ydb/services/metadata/initializer/events.h> #include <ydb/services/metadata/initializer/manager.h> #include <ydb/services/metadata/initializer/snapshot.h> #include <ydb/services/metadata/initializer/fetcher.h> diff --git a/ydb/services/metadata/initializer/CMakeLists.darwin-x86_64.txt b/ydb/services/metadata/initializer/CMakeLists.darwin-x86_64.txt index fef7600420..ef8a9baaa3 100644 --- a/ydb/services/metadata/initializer/CMakeLists.darwin-x86_64.txt +++ b/ydb/services/metadata/initializer/CMakeLists.darwin-x86_64.txt @@ -23,7 +23,6 @@ target_sources(services-metadata-initializer PRIVATE ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/accessor_init.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/behaviour.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/common.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/controller.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/events.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/manager.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/object.cpp diff --git a/ydb/services/metadata/initializer/CMakeLists.linux-aarch64.txt b/ydb/services/metadata/initializer/CMakeLists.linux-aarch64.txt index 2623584897..598ad07455 100644 --- a/ydb/services/metadata/initializer/CMakeLists.linux-aarch64.txt +++ b/ydb/services/metadata/initializer/CMakeLists.linux-aarch64.txt @@ -24,7 +24,6 @@ target_sources(services-metadata-initializer PRIVATE ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/accessor_init.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/behaviour.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/common.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/controller.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/events.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/manager.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/object.cpp diff --git a/ydb/services/metadata/initializer/CMakeLists.linux-x86_64.txt b/ydb/services/metadata/initializer/CMakeLists.linux-x86_64.txt index 2623584897..598ad07455 100644 --- a/ydb/services/metadata/initializer/CMakeLists.linux-x86_64.txt +++ b/ydb/services/metadata/initializer/CMakeLists.linux-x86_64.txt @@ -24,7 +24,6 @@ target_sources(services-metadata-initializer PRIVATE ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/accessor_init.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/behaviour.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/common.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/controller.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/events.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/manager.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/object.cpp diff --git a/ydb/services/metadata/initializer/CMakeLists.windows-x86_64.txt b/ydb/services/metadata/initializer/CMakeLists.windows-x86_64.txt index fef7600420..ef8a9baaa3 100644 --- a/ydb/services/metadata/initializer/CMakeLists.windows-x86_64.txt +++ b/ydb/services/metadata/initializer/CMakeLists.windows-x86_64.txt @@ -23,7 +23,6 @@ target_sources(services-metadata-initializer PRIVATE ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/accessor_init.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/behaviour.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/common.cpp - ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/controller.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/events.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/manager.cpp ${CMAKE_SOURCE_DIR}/ydb/services/metadata/initializer/object.cpp diff --git a/ydb/services/metadata/initializer/accessor_init.cpp b/ydb/services/metadata/initializer/accessor_init.cpp index 434f3babc4..33b036e0d6 100644 --- a/ydb/services/metadata/initializer/accessor_init.cpp +++ b/ydb/services/metadata/initializer/accessor_init.cpp @@ -1,5 +1,4 @@ #include "accessor_init.h" -#include "controller.h" #include "manager.h" #include <ydb/core/grpc_services/local_rpc/local_rpc.h> @@ -7,115 +6,100 @@ #include <ydb/services/metadata/abstract/common.h> #include <ydb/services/metadata/manager/alter.h> #include <ydb/services/metadata/service.h> +#include <library/cpp/actors/core/invoke.h> namespace NKikimr::NMetadata::NInitializer { -void TDSAccessorInitialized::Bootstrap() { - Become(&TDSAccessorInitialized::StateMain); - InternalController = std::make_shared<TInitializerInput>(SelfId()); - Send(SelfId(), new TEvInitializerPreparationStart); -} - -void TDSAccessorInitialized::Handle(TEvInitializerPreparationStart::TPtr& /*ev*/) { - InitializationBehaviour->Prepare(InternalController); -} - -class TModifierController: public NMetadata::NInitializer::IModifierExternalController { -private: - const TActorIdentity OwnerId; -public: - TModifierController(const TActorIdentity& ownerId) - : OwnerId(ownerId) - { - - } - virtual void OnModificationFinished(const TString& /*modificationId*/) override { - OwnerId.Send(OwnerId, new NModifications::TEvModificationFinished()); - } - virtual void OnModificationFailed(const TString& errorMessage, const TString& /*modificationId*/) override { - OwnerId.Send(OwnerId, new NModifications::TEvModificationProblem(errorMessage)); - } -}; - -void TDSAccessorInitialized::Handle(TEvInitializerPreparationFinished::TPtr& ev) { - auto modifiers = ev->Get()->GetModifiers(); - for (auto&& i : modifiers) { - TDBInitializationKey key(ComponentId, i->GetModificationId()); - if (InitializationSnapshot && InitializationSnapshot->GetObjects().contains(key)) { - continue; - } - Modifiers.emplace_back(i); +void TDSAccessorInitialized::DoNextModifier(const bool doPop) { + if (doPop) { + Modifiers.pop_front(); } if (Modifiers.size()) { ALS_INFO(NKikimrServices::METADATA_INITIALIZER) << "modifiers count: " << Modifiers.size(); - Modifiers.front()->Execute(std::make_shared<TModifierController>(SelfId()), Config); + Modifiers.front()->Execute(SelfPtr, Config); } else { ALS_INFO(NKikimrServices::METADATA_INITIALIZER) << "initialization finished"; ExternalController->OnInitializationFinished(ComponentId); + SelfPtr.reset(); } } -void TDSAccessorInitialized::Handle(TEvInitializerPreparationProblem::TPtr& ev) { - ALS_ERROR(NKikimrServices::METADATA_INITIALIZER) << "preparation problems: " << ev->Get()->GetErrorMessage(); - Schedule(TDuration::Seconds(1), new TEvInitializerPreparationStart); -} - -void TDSAccessorInitialized::DoNextModifier() { - Modifiers.pop_front(); - if (Modifiers.size()) { - Modifiers.front()->Execute(std::make_shared<TModifierController>(SelfId()), Config); - } else { - ALS_INFO(NKikimrServices::METADATA_INITIALIZER) << "initialization finished"; - ExternalController->OnInitializationFinished(ComponentId); - } -} - -void TDSAccessorInitialized::Handle(NActors::TEvents::TEvWakeup::TPtr& /*ev*/) { - Y_VERIFY(Modifiers.size()); - Modifiers.front()->Execute(std::make_shared<TModifierController>(SelfId()), Config); -} - -void TDSAccessorInitialized::Handle(TEvAlterFinished::TPtr& /*ev*/) { - DoNextModifier(); -} - -void TDSAccessorInitialized::Handle(TEvAlterProblem::TPtr& ev) { - AFL_ERROR(NKikimrServices::METADATA_INITIALIZER)("event", "alter_problem")("message", ev->Get()->GetErrorMessage()); - Schedule(TDuration::Seconds(1), new NModifications::TEvModificationFinished); +TDSAccessorInitialized::TDSAccessorInitialized(const NRequest::TConfig& config, + const TString& componentId, + IInitializationBehaviour::TPtr initializationBehaviour, + IInitializerOutput::TPtr controller, std::shared_ptr<TSnapshot> initializationSnapshot) + : Config(config) + , InitializationBehaviour(initializationBehaviour) + , ExternalController(controller) + , InitializationSnapshot(initializationSnapshot) + , ComponentId(componentId) +{ } -void TDSAccessorInitialized::Handle(NModifications::TEvModificationFinished::TPtr& /*ev*/) { +void TDSAccessorInitialized::OnModificationFinished(const TString& modificationId) { ALS_INFO(NKikimrServices::METADATA_INITIALIZER) << "modifiers count: " << Modifiers.size(); Y_VERIFY(Modifiers.size()); + Y_VERIFY(Modifiers.front()->GetModificationId() == modificationId); if (NProvider::TServiceOperator::IsEnabled() && InitializationSnapshot) { TDBInitialization dbInit(ComponentId, Modifiers.front()->GetModificationId()); NModifications::IOperationsManager::TExternalModificationContext extContext; extContext.SetUserToken(NACLib::TSystemUsers::Metadata()); auto alterCommand = std::make_shared<NModifications::TCreateCommand<TDBInitialization>>( - dbInit.SerializeToRecord(), TDBInitialization::GetBehaviour(), InternalController, + dbInit.SerializeToRecord(), TDBInitialization::GetBehaviour(), SelfPtr, NModifications::IOperationsManager::TInternalModificationContext(extContext)); - Sender<NProvider::TEvObjectsOperation>(alterCommand) - .SendTo(NProvider::MakeServiceId(SelfId().NodeId())); + + TActorContext::AsActorContext().Send(NProvider::MakeServiceId(TActorContext::AsActorContext().SelfID.NodeId()), + new NProvider::TEvObjectsOperation(alterCommand)); } else { - DoNextModifier(); + DoNextModifier(true); } } -void TDSAccessorInitialized::Handle(NModifications::TEvModificationProblem::TPtr& ev) { - AFL_ERROR(NKikimrServices::METADATA_INITIALIZER)("event", "modification_problem")("message", ev->Get()->GetErrorMessage()); - Schedule(TDuration::Seconds(1), new NActors::TEvents::TEvWakeup); +void TDSAccessorInitialized::OnPreparationFinished(const TVector<ITableModifier::TPtr>& modifiers) { + for (auto&& i : modifiers) { + TDBInitializationKey key(ComponentId, i->GetModificationId()); + if (InitializationSnapshot && InitializationSnapshot->GetObjects().contains(key)) { + continue; + } + Modifiers.emplace_back(i); + } + DoNextModifier(false); } -TDSAccessorInitialized::TDSAccessorInitialized(const NRequest::TConfig& config, - const TString& componentId, - IInitializationBehaviour::TPtr initializationBehaviour, - IInitializerOutput::TPtr controller, std::shared_ptr<TSnapshot> initializationSnapshot) - : Config(config) - , InitializationBehaviour(initializationBehaviour) - , ExternalController(controller) - , InitializationSnapshot(initializationSnapshot) - , ComponentId(componentId) +void TDSAccessorInitialized::OnPreparationProblem(const TString& errorMessage) const { + AFL_ERROR(NKikimrServices::METADATA_INITIALIZER)("event", "OnPreparationProblem")("error", errorMessage); + NActors::ScheduleInvokeActivity([self = this->SelfPtr]() {self->InitializationBehaviour->Prepare(self); }, TDuration::Seconds(1)); +} + +void TDSAccessorInitialized::OnAlteringProblem(const TString& errorMessage) { + AFL_ERROR(NKikimrServices::METADATA_INITIALIZER)("event", "OnAlteringProblem")("error", errorMessage); + NActors::ScheduleInvokeActivity([self = this->SelfPtr]() { + Y_VERIFY(self->Modifiers.size()); + self->OnModificationFinished(self->Modifiers.front()->GetModificationId()); + }, TDuration::Seconds(1)); +} + +void TDSAccessorInitialized::OnModificationFailed(const TString& errorMessage, const TString& modificationId) { + AFL_ERROR(NKikimrServices::METADATA_INITIALIZER)("event", "OnModificationFailed")("error", errorMessage)("modificationId", modificationId); + NActors::ScheduleInvokeActivity([self = this->SelfPtr]() { + Y_VERIFY(self->Modifiers.size()); + self->DoNextModifier(false); + }, TDuration::Seconds(1)); +} + +void TDSAccessorInitialized::OnAlteringFinished() { + DoNextModifier(true); +} + +void TDSAccessorInitialized::Execute(const NRequest::TConfig& config, const TString& componentId, + IInitializationBehaviour::TPtr initializationBehaviour, IInitializerOutput::TPtr controller, + std::shared_ptr<TSnapshot> initializationSnapshot) { + std::shared_ptr<TDSAccessorInitialized> initializer(new TDSAccessorInitialized(config, + componentId, initializationBehaviour, controller, initializationSnapshot)); + initializer->SelfPtr = initializer; + + initializationBehaviour->Prepare(initializer); } } diff --git a/ydb/services/metadata/initializer/accessor_init.h b/ydb/services/metadata/initializer/accessor_init.h index b5ac3c9102..1b2e07ebda 100644 --- a/ydb/services/metadata/initializer/accessor_init.h +++ b/ydb/services/metadata/initializer/accessor_init.h @@ -1,7 +1,5 @@ #pragma once #include "common.h" -#include "controller.h" -#include "events.h" #include "snapshot.h" #include <ydb/services/metadata/abstract/common.h> @@ -15,52 +13,38 @@ namespace NKikimr::NMetadata::NInitializer { -class TDSAccessorInitialized: public NActors::TActorBootstrapped<TDSAccessorInitialized> { +class TDSAccessorInitialized: public IInitializerInput, + public NModifications::IAlterController, + public NMetadata::NInitializer::IModifierExternalController +{ private: - TDeque<ITableModifier::TPtr> Modifiers; + mutable TDeque<ITableModifier::TPtr> Modifiers; const NRequest::TConfig Config; IInitializationBehaviour::TPtr InitializationBehaviour; IInitializerOutput::TPtr ExternalController; - TInitializerInput::TPtr InternalController; std::shared_ptr<TSnapshot> InitializationSnapshot; const TString ComponentId; - void Handle(TEvInitializerPreparationStart::TPtr& ev); - void Handle(TEvInitializerPreparationFinished::TPtr& ev); - void Handle(TEvInitializerPreparationProblem::TPtr& ev); - void Handle(NActors::TEvents::TEvWakeup::TPtr& ev); - void Handle(NModifications::TEvModificationFinished::TPtr& ev); - void Handle(NModifications::TEvModificationProblem::TPtr& ev); - void Handle(TEvAlterFinished::TPtr& ev); - void Handle(TEvAlterProblem::TPtr& ev); - void DoNextModifier(); -public: - static constexpr NKikimrServices::TActivity::EType ActorActivityType() { - return NKikimrServices::TActivity::METADATA_INITIALIZER; - } + std::shared_ptr<TDSAccessorInitialized> SelfPtr; + + void DoNextModifier(const bool doPop); + virtual void OnPreparationFinished(const TVector<ITableModifier::TPtr>& modifiers) override; + virtual void OnPreparationProblem(const TString& errorMessage) const override; + virtual void OnAlteringProblem(const TString& errorMessage) override; + virtual void OnAlteringFinished() override; + + virtual void OnModificationFinished(const TString& modificationId) override; + virtual void OnModificationFailed(const TString& errorMessage, const TString& modificationId) override; - void Bootstrap(); TDSAccessorInitialized(const NRequest::TConfig& config, const TString& componentId, IInitializationBehaviour::TPtr initializationBehaviour, IInitializerOutput::TPtr controller, std::shared_ptr<TSnapshot> initializationSnapshot); +public: + static void Execute(const NRequest::TConfig& config, + const TString& componentId, + IInitializationBehaviour::TPtr initializationBehaviour, + IInitializerOutput::TPtr controller, std::shared_ptr<TSnapshot> initializationSnapshot); - STATEFN(StateMain) { - switch (ev->GetTypeRewrite()) { - hFunc(NActors::TEvents::TEvWakeup, Handle); - hFunc(TEvInitializerPreparationStart, Handle); - hFunc(TEvInitializerPreparationFinished, Handle); - hFunc(TEvInitializerPreparationProblem, Handle); - hFunc(NModifications::TEvModificationFinished, Handle); - hFunc(NModifications::TEvModificationProblem, Handle); - hFunc(TEvAlterFinished, Handle); - hFunc(TEvAlterProblem, Handle); - default: - { - auto evType = ev->GetTypeName(); - Y_FAIL("unexpected event: %s", evType.data()); - } - } - } }; } diff --git a/ydb/services/metadata/initializer/common.h b/ydb/services/metadata/initializer/common.h index e73282b725..6ddb0b1ac4 100644 --- a/ydb/services/metadata/initializer/common.h +++ b/ydb/services/metadata/initializer/common.h @@ -97,7 +97,7 @@ public: class IInitializerInput { public: using TPtr = std::shared_ptr<IInitializerInput>; - virtual void OnPreparationFinished(const TVector<ITableModifier::TPtr>& modifiers) const = 0; + virtual void OnPreparationFinished(const TVector<ITableModifier::TPtr>& modifiers) = 0; virtual void OnPreparationProblem(const TString& errorMessage) const = 0; virtual ~IInitializerInput() = default; }; diff --git a/ydb/services/metadata/initializer/controller.cpp b/ydb/services/metadata/initializer/controller.cpp deleted file mode 100644 index 7a76227f02..0000000000 --- a/ydb/services/metadata/initializer/controller.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "controller.h" -#include "events.h" - -#include <ydb/services/metadata/manager/modification_controller.h> - -namespace NKikimr::NMetadata::NInitializer { - -void TInitializerInput::OnPreparationFinished(const TVector<ITableModifier::TPtr>& modifiers) const { - ActorId.Send(ActorId, new TEvInitializerPreparationFinished(modifiers)); -} - -void TInitializerInput::OnPreparationProblem(const TString& errorMessage) const { - ActorId.Send(ActorId, new TEvInitializerPreparationProblem(errorMessage)); -} - -void TInitializerInput::OnAlteringProblem(const TString& errorMessage) { - ActorId.Send(ActorId, new TEvAlterProblem(errorMessage)); -} - -void TInitializerInput::OnAlteringFinished() { - ActorId.Send(ActorId, new TEvAlterFinished()); -} - -void TInitializerOutput::OnInitializationFinished(const TString& id) const { - ActorId.Send(ActorId, new TEvInitializationFinished(id)); -} - -} diff --git a/ydb/services/metadata/initializer/controller.h b/ydb/services/metadata/initializer/controller.h deleted file mode 100644 index 062a20b464..0000000000 --- a/ydb/services/metadata/initializer/controller.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once -#include "common.h" - -#include <ydb/services/metadata/manager/common.h> - -namespace NKikimr::NMetadata::NInitializer { - -class TInitializerInput: public IInitializerInput, public NModifications::IAlterController { -private: - const TActorIdentity ActorId; -public: - using TPtr = std::shared_ptr<TInitializerInput>; - TInitializerInput(const TActorIdentity& actorId) - : ActorId(actorId) { - - } - - virtual void OnAlteringProblem(const TString& errorMessage) override; - virtual void OnAlteringFinished() override; - virtual void OnPreparationFinished(const TVector<ITableModifier::TPtr>& modifiers) const override; - virtual void OnPreparationProblem(const TString& errorMessage) const override; -}; - -class TInitializerOutput: public IInitializerOutput { -private: - const TActorIdentity ActorId; -public: - TInitializerOutput(const TActorIdentity& actorId) - : ActorId(actorId) { - - } - - virtual void OnInitializationFinished(const TString& id) const override; -}; - -} diff --git a/ydb/services/metadata/initializer/events.cpp b/ydb/services/metadata/initializer/events.cpp index 89f770ccce..405d4e5f84 100644 --- a/ydb/services/metadata/initializer/events.cpp +++ b/ydb/services/metadata/initializer/events.cpp @@ -1,5 +1,4 @@ #include "events.h" -#include <ydb/core/grpc_services/local_rpc/local_rpc.h> namespace NKikimr::NMetadata::NInitializer { diff --git a/ydb/services/metadata/initializer/events.h b/ydb/services/metadata/initializer/events.h index 93c4a36678..3fd40b59a6 100644 --- a/ydb/services/metadata/initializer/events.h +++ b/ydb/services/metadata/initializer/events.h @@ -1,65 +1,17 @@ #pragma once -#include "common.h" - -#include <ydb/services/metadata/ds_table/config.h> - -#include <library/cpp/actors/core/actor_bootstrapped.h> +#include <ydb/core/base/events.h> +#include <ydb/library/accessor/accessor.h> #include <library/cpp/actors/core/event_local.h> -#include <library/cpp/threading/future/core/future.h> -#include <library/cpp/actors/core/av_bootstrapped.h> namespace NKikimr::NMetadata::NInitializer { enum EEvents { - EvInitializerPreparationStart = EventSpaceBegin(TKikimrEvents::ES_METADATA_INITIALIZER), - EvInitializerPreparationFinished, - EvInitializerPreparationProblem, - EvInitializationFinished, - EvAlterFinished, - EvAlterProblem, + EvInitializationFinished = EventSpaceBegin(TKikimrEvents::ES_METADATA_INITIALIZER), EvEnd }; static_assert(EEvents::EvEnd < EventSpaceEnd(TKikimrEvents::ES_METADATA_INITIALIZER), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_METADATA_INITIALIZER)"); -class TEvInitializerPreparationStart: public TEventLocal<TEvInitializerPreparationStart, EEvents::EvInitializerPreparationStart> { -public: -}; - -class TEvAlterFinished: public TEventLocal<TEvAlterFinished, EEvents::EvAlterFinished> { -public: -}; - -class TEvAlterProblem: public TEventLocal<TEvAlterProblem, EEvents::EvAlterProblem> { -private: - YDB_READONLY_DEF(TString, ErrorMessage); -public: - TEvAlterProblem(const TString& errorMesage) - : ErrorMessage(errorMesage) { - - } -}; - -class TEvInitializerPreparationFinished: public TEventLocal<TEvInitializerPreparationFinished, EEvents::EvInitializerPreparationFinished> { -private: - YDB_READONLY_DEF(TVector<ITableModifier::TPtr>, Modifiers); -public: - TEvInitializerPreparationFinished(const TVector<ITableModifier::TPtr>& modifiers) - : Modifiers(modifiers) { - - } -}; - -class TEvInitializerPreparationProblem: public TEventLocal<TEvInitializerPreparationProblem, EEvents::EvInitializerPreparationProblem> { -private: - YDB_READONLY_DEF(TString, ErrorMessage); -public: - TEvInitializerPreparationProblem(const TString& errorMessage) - : ErrorMessage(errorMessage) { - - } -}; - class TEvInitializationFinished: public TEventLocal<TEvInitializationFinished, EEvents::EvInitializationFinished> { private: YDB_READONLY_DEF(TString, InitializationId); diff --git a/ydb/services/metadata/initializer/ya.make b/ydb/services/metadata/initializer/ya.make index bc7b34e8de..43c814eca0 100644 --- a/ydb/services/metadata/initializer/ya.make +++ b/ydb/services/metadata/initializer/ya.make @@ -4,7 +4,6 @@ SRCS( accessor_init.cpp behaviour.cpp common.cpp - controller.cpp events.cpp manager.cpp object.cpp |