Skip to content

Commit

Permalink
fix review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Montsev committed Sep 26, 2024
1 parent aa68836 commit c910d2c
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 84 deletions.
38 changes: 4 additions & 34 deletions cloud/filestore/libs/storage/api/ss_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ namespace NCloud::NFileStore::NStorage {
////////////////////////////////////////////////////////////////////////////////

#define FILESTORE_SS_PROXY_REQUESTS(xxx, ...) \
xxx(DescribeScheme, __VA_ARGS__) \
xxx(ModifyScheme, __VA_ARGS__) \
xxx(WaitSchemeTx, __VA_ARGS__) \
\
xxx(DescribeFileStore, __VA_ARGS__) \
xxx(CreateFileStore, __VA_ARGS__) \
xxx(AlterFileStore, __VA_ARGS__) \
Expand All @@ -32,23 +28,12 @@ namespace NCloud::NFileStore::NStorage {

////////////////////////////////////////////////////////////////////////////////

struct TEvSSProxy
{
using TDescribeSchemeRequest =
::NCloud::NStorage::TEvSSProxy::TDescribeSchemeRequest;
using TDescribeSchemeResponse =
::NCloud::NStorage::TEvSSProxy::TDescribeSchemeResponse;

using TModifySchemeRequest =
::NCloud::NStorage::TEvSSProxy::TModifySchemeRequest;
using TModifySchemeResponse =
::NCloud::NStorage::TEvSSProxy::TModifySchemeResponse;
using TEvStorageSSProxy = ::NCloud::NStorage::TEvSSProxy;

using TWaitSchemeTxRequest =
::NCloud::NStorage::TEvSSProxy::TWaitSchemeTxRequest;
using TWaitSchemeTxResponse =
::NCloud::NStorage::TEvSSProxy::TWaitSchemeTxResponse;
////////////////////////////////////////////////////////////////////////////////

struct TEvSSProxy
{
//
// DescribeFileStore
//
Expand Down Expand Up @@ -162,21 +147,6 @@ struct TEvSSProxy

enum EEvents
{
EvDescribeSchemeRequest =
::NCloud::NStorage::TEvSSProxy::EEvents::EvDescribeSchemeRequest,
EvDescribeSchemeResponse =
::NCloud::NStorage::TEvSSProxy::EEvents::EvDescribeSchemeResponse,

EvModifySchemeRequest =
::NCloud::NStorage::TEvSSProxy::EEvents::EvModifySchemeRequest,
EvModifySchemeResponse =
::NCloud::NStorage::TEvSSProxy::EEvents::EvModifySchemeResponse,

EvWaitSchemeTxRequest =
::NCloud::NStorage::TEvSSProxy::EEvents::EvWaitSchemeTxRequest,
EvWaitSchemeTxResponse =
::NCloud::NStorage::TEvSSProxy::EEvents::EvWaitSchemeTxResponse,

EvBegin = TFileStoreEvents::SS_PROXY_START,

EvDescribeFileStoreRequest = EvBegin + 1,
Expand Down
7 changes: 4 additions & 3 deletions cloud/filestore/libs/storage/service/service_actor_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class TDescribeActor final
"Sending describe request for path %s",
path.Quote().c_str());

auto request = std::make_unique<TEvSSProxy::TEvDescribeSchemeRequest>(path);
auto request =
std::make_unique<TEvStorageSSProxy::TEvDescribeSchemeRequest>(path);

RequestsScheduled++;

Expand All @@ -73,7 +74,7 @@ class TDescribeActor final
STFUNC(StateWork)
{
switch (ev->GetTypeRewrite()) {
HFunc(TEvSSProxy::TEvDescribeSchemeResponse, HandleDescribeResponse);
HFunc(TEvStorageSSProxy::TEvDescribeSchemeResponse, HandleDescribeResponse);

default:
HandleUnexpectedEvent(ev, TFileStoreComponents::SERVICE);
Expand All @@ -82,7 +83,7 @@ class TDescribeActor final
}

void HandleDescribeResponse(
const TEvSSProxy::TEvDescribeSchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvDescribeSchemeResponse::TPtr& ev,
const TActorContext& ctx)
{
RequestsCompleted++;
Expand Down
12 changes: 6 additions & 6 deletions cloud/filestore/libs/storage/service/service_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ Y_UNIT_TEST_SUITE(TStorageServiceTest)
ui32 createChannelsCount = 0;
runtime.SetObserverFunc([&] (TAutoPtr<IEventHandle>& event) {
switch (event->GetTypeRewrite()) {
case TEvSSProxy::EvModifySchemeRequest: {
auto* msg = event->Get<TEvSSProxy::TEvModifySchemeRequest>();
case TEvStorageSSProxy::EvModifySchemeRequest: {
auto* msg = event->Get<TEvStorageSSProxy::TEvModifySchemeRequest>();
if (msg->ModifyScheme.GetOperationType() ==
NKikimrSchemeOp::ESchemeOpCreateFileStore)
{
Expand All @@ -340,8 +340,8 @@ Y_UNIT_TEST_SUITE(TStorageServiceTest)
ui32 alterChannelsCount = 0;
runtime.SetObserverFunc([&] (TAutoPtr<IEventHandle>& event) {
switch (event->GetTypeRewrite()) {
case TEvSSProxy::EvModifySchemeRequest: {
auto* msg = event->Get<TEvSSProxy::TEvModifySchemeRequest>();
case TEvStorageSSProxy::EvModifySchemeRequest: {
auto* msg = event->Get<TEvStorageSSProxy::TEvModifySchemeRequest>();
if (msg->ModifyScheme.GetOperationType() ==
NKikimrSchemeOp::ESchemeOpAlterFileStore)
{
Expand Down Expand Up @@ -953,8 +953,8 @@ Y_UNIT_TEST_SUITE(TStorageServiceTest)
auto& runtime = env.GetRuntime();
runtime.SetObserverFunc( [nodeIdx, error, &runtime] (TAutoPtr<IEventHandle>& event) {
switch (event->GetTypeRewrite()) {
case TEvSSProxy::EvDescribeSchemeRequest: {
auto response = std::make_unique<TEvSSProxy::TEvDescribeSchemeResponse>(
case TEvStorageSSProxy::EvDescribeSchemeRequest: {
auto response = std::make_unique<TEvStorageSSProxy::TEvDescribeSchemeResponse>(
error);
runtime.Send(
new IEventHandle(
Expand Down
14 changes: 5 additions & 9 deletions cloud/filestore/libs/storage/ss_proxy/ss_proxy_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ void TSSProxyActor::Bootstrap(const TActorContext& ctx)
bool TSSProxyActor::HandleRequests(STFUNC_SIG)
{
switch (ev->GetTypeRewrite()) {
HFunc(TEvStorageSSProxy::TEvDescribeSchemeRequest, HandleDescribeScheme);
HFunc(TEvStorageSSProxy::TEvModifySchemeRequest, HandleModifyScheme);

FILESTORE_SS_PROXY_REQUESTS(FILESTORE_HANDLE_REQUEST, TEvSSProxy)

default:
Expand All @@ -71,21 +74,14 @@ STFUNC(TSSProxyActor::StateWork)
////////////////////////////////////////////////////////////////////////////////

void TSSProxyActor::HandleDescribeScheme(
const TEvSSProxy::TEvDescribeSchemeRequest::TPtr& ev,
const TEvStorageSSProxy::TEvDescribeSchemeRequest::TPtr& ev,
const TActorContext& ctx)
{
ctx.Send(ev->Forward(StorageSSProxyActor));
}

void TSSProxyActor::HandleModifyScheme(
const TEvSSProxy::TEvModifySchemeRequest::TPtr& ev,
const TActorContext& ctx)
{
ctx.Send(ev->Forward(StorageSSProxyActor));
}

void TSSProxyActor::HandleWaitSchemeTx(
const TEvSSProxy::TEvWaitSchemeTxRequest::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeRequest::TPtr& ev,
const TActorContext& ctx)
{
ctx.Send(ev->Forward(StorageSSProxyActor));
Expand Down
7 changes: 7 additions & 0 deletions cloud/filestore/libs/storage/ss_proxy/ss_proxy_actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class TSSProxyActor final
private:
bool HandleRequests(STFUNC_SIG);

void HandleDescribeScheme(
const TEvStorageSSProxy::TEvDescribeSchemeRequest::TPtr& ev,
const NActors::TActorContext& ctx);
void HandleModifyScheme(
const TEvStorageSSProxy::TEvModifySchemeRequest::TPtr& ev,
const NActors::TActorContext& ctx);

FILESTORE_SS_PROXY_REQUESTS(FILESTORE_IMPLEMENT_REQUEST, TEvSSProxy)

STFUNC(StateWork);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TAlterFileStoreActor final

void ModifyScheme(const TActorContext& ctx);
void HandleModifySchemeResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx);

void ReplyAndDie(
Expand Down Expand Up @@ -94,14 +94,14 @@ void TAlterFileStoreActor::ModifyScheme(const TActorContext& ctx)
workingDir.Quote().c_str(),
name.Quote().c_str());

auto request = std::make_unique<TEvSSProxy::TEvModifySchemeRequest>(
auto request = std::make_unique<TEvStorageSSProxy::TEvModifySchemeRequest>(
std::move(modifyScheme));

NCloud::Send(ctx, MakeSSProxyServiceId(), std::move(request));
}

void TAlterFileStoreActor::HandleModifySchemeResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx)
{
const auto* msg = ev->Get();
Expand Down Expand Up @@ -133,7 +133,7 @@ void TAlterFileStoreActor::ReplyAndDie(
STFUNC(TAlterFileStoreActor::StateWork)
{
switch (ev->GetTypeRewrite()) {
HFunc(TEvSSProxy::TEvModifySchemeResponse, HandleModifySchemeResponse);
HFunc(TEvStorageSSProxy::TEvModifySchemeResponse, HandleModifySchemeResponse);

default:
HandleUnexpectedEvent(ev, TFileStoreComponents::SS_PROXY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class TCreateFileStoreActor final
private:
void CreateFileStore(const TActorContext& ctx);
void HandleCreateFileStoreResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx);

void EnsureDirs(const TActorContext& ctx);
void CreateDir(const TActorContext& ctx);
void HandleCreateDirResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx);

void ReplyAndDie(
Expand Down Expand Up @@ -109,14 +109,14 @@ void TCreateFileStoreActor::CreateFileStore(const TActorContext& ctx)
workingDir.Quote().c_str(),
name.Quote().c_str());

auto request = std::make_unique<TEvSSProxy::TEvModifySchemeRequest>(
auto request = std::make_unique<TEvStorageSSProxy::TEvModifySchemeRequest>(
std::move(modifyScheme));

NCloud::Send(ctx, MakeSSProxyServiceId(), std::move(request));
}

void TCreateFileStoreActor::HandleCreateFileStoreResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx)
{
const auto* msg = ev->Get();
Expand Down Expand Up @@ -183,14 +183,14 @@ void TCreateFileStoreActor::CreateDir(const TActorContext& ctx)
auto* op = modifyScheme.MutableMkDir();
op->SetName(name);

auto request = std::make_unique<TEvSSProxy::TEvModifySchemeRequest>(
auto request = std::make_unique<TEvStorageSSProxy::TEvModifySchemeRequest>(
std::move(modifyScheme));

NCloud::Send(ctx, MakeSSProxyServiceId(), std::move(request));
}

void TCreateFileStoreActor::HandleCreateDirResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx)
{
const auto* msg = ev->Get();
Expand Down Expand Up @@ -223,7 +223,7 @@ void TCreateFileStoreActor::ReplyAndDie(
STFUNC(TCreateFileStoreActor::StateCreateFileStore)
{
switch (ev->GetTypeRewrite()) {
HFunc(TEvSSProxy::TEvModifySchemeResponse, HandleCreateFileStoreResponse);
HFunc(TEvStorageSSProxy::TEvModifySchemeResponse, HandleCreateFileStoreResponse);

default:
HandleUnexpectedEvent(ev, TFileStoreComponents::SS_PROXY);
Expand All @@ -234,7 +234,7 @@ STFUNC(TCreateFileStoreActor::StateCreateFileStore)
STFUNC(TCreateFileStoreActor::StateCreateDir)
{
switch (ev->GetTypeRewrite()) {
HFunc(TEvSSProxy::TEvModifySchemeResponse, HandleCreateDirResponse);
HFunc(TEvStorageSSProxy::TEvModifySchemeResponse, HandleCreateDirResponse);

default:
HandleUnexpectedEvent(ev, TFileStoreComponents::SS_PROXY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TDescribeFileStoreActor final

void DescribeScheme(const TActorContext& ctx);
void HandleDescribeSchemeResponse(
const TEvSSProxy::TEvDescribeSchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvDescribeSchemeResponse::TPtr& ev,
const TActorContext& ctx);
void HandleWakeup(
const TActorContext& ctx);
Expand Down Expand Up @@ -81,12 +81,12 @@ void TDescribeFileStoreActor::DescribeScheme(const TActorContext& ctx)
Config->GetSchemeShardDir(),
FileSystemId);

auto request = std::make_unique<TEvSSProxy::TEvDescribeSchemeRequest>(path);
auto request = std::make_unique<TEvStorageSSProxy::TEvDescribeSchemeRequest>(path);
NCloud::Send(ctx, MakeSSProxyServiceId(), std::move(request));
}

void TDescribeFileStoreActor::HandleDescribeSchemeResponse(
const TEvSSProxy::TEvDescribeSchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvDescribeSchemeResponse::TPtr& ev,
const TActorContext& ctx)
{
const auto* msg = ev->Get();
Expand Down Expand Up @@ -164,7 +164,7 @@ void TDescribeFileStoreActor::ReplyAndDie(
STFUNC(TDescribeFileStoreActor::StateWork)
{
switch (ev->GetTypeRewrite()) {
HFunc(TEvSSProxy::TEvDescribeSchemeResponse, HandleDescribeSchemeResponse);
HFunc(TEvStorageSSProxy::TEvDescribeSchemeResponse, HandleDescribeSchemeResponse);

CFunc(TEvents::TSystem::Wakeup, HandleWakeup)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TDestroyFileStoreActor final

void ModifyScheme(const TActorContext& ctx);
void HandleModifySchemeResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx);

void ReplyAndDie(
Expand Down Expand Up @@ -93,14 +93,14 @@ void TDestroyFileStoreActor::ModifyScheme(const TActorContext& ctx)
workingDir.Quote().c_str(),
name.Quote().c_str());

auto request = std::make_unique<TEvSSProxy::TEvModifySchemeRequest>(
auto request = std::make_unique<TEvStorageSSProxy::TEvModifySchemeRequest>(
std::move(modifyScheme));

NCloud::Send(ctx, MakeSSProxyServiceId(), std::move(request));
}

void TDestroyFileStoreActor::HandleModifySchemeResponse(
const TEvSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TEvStorageSSProxy::TEvModifySchemeResponse::TPtr& ev,
const TActorContext& ctx)
{
NProto::TError error = ev->Get()->GetError();
Expand Down Expand Up @@ -135,7 +135,7 @@ void TDestroyFileStoreActor::ReplyAndDie(
STFUNC(TDestroyFileStoreActor::StateWork)
{
switch (ev->GetTypeRewrite()) {
HFunc(TEvSSProxy::TEvModifySchemeResponse, HandleModifySchemeResponse);
HFunc(TEvStorageSSProxy::TEvModifySchemeResponse, HandleModifySchemeResponse);

default:
HandleUnexpectedEvent(ev, TFileStoreComponents::SS_PROXY);
Expand Down
Loading

0 comments on commit c910d2c

Please sign in to comment.