Page MenuHomePhabricator

[services][refactoring] Tunnelbroker - AMQP Manager refactoring into a class.
ClosedPublic

Authored by max on Feb 9 2022, 11:10 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 29, 8:20 PM
Unknown Object (File)
Wed, May 29, 8:20 PM
Unknown Object (File)
Wed, May 29, 8:20 PM
Unknown Object (File)
Wed, May 29, 8:20 PM
Unknown Object (File)
Wed, May 29, 8:19 PM
Unknown Object (File)
Wed, May 29, 8:13 PM
Unknown Object (File)
Fri, May 10, 11:10 AM
Unknown Object (File)
Apr 19 2024, 4:38 AM

Details

Summary

Refactoring AMQP Manager global functions into a class.

Linear task: ENG-589

Depends on D3124

Test Plan

Successfully built the service and run it with a successful connection to the AMQP server.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Feb 9 2022, 11:13 PM
Harbormaster failed remote builds in B6701: Diff 9508!
tomek requested changes to this revision.Feb 10 2022, 3:47 AM
tomek added inline comments.
services/tunnelbroker/docker-server/contents/server/src/Amqp/AmqpManager.h
12 ↗(On Diff #9508)

What advantages have you found in creating a new namespace for it? We're creating a new namespace to have just one class, so my guess is that we can keep the previous approach, but maybe I'm missing something.

14 ↗(On Diff #9508)

We also need to at least make the constructor private. If we want this to be even better singleton, we could also delete copy constructor and assignment operator.

17 ↗(On Diff #9508)

Shouldn't we use atomic also here?

services/tunnelbroker/docker-server/contents/server/src/server.cpp
34 ↗(On Diff #9508)

It looks like we don't need to specify the whole namespace here

43–44 ↗(On Diff #9508)

We agreed that we will keep capitalized names for methods generated by grpc, but it looks like RunServer and RunAmqpClient are defined by us and shouldn't be capitalized

This revision now requires changes to proceed.Feb 10 2022, 3:47 AM

Rebase, fixes by comments.

max added inline comments.
services/tunnelbroker/docker-server/contents/server/src/Amqp/AmqpManager.h
12 ↗(On Diff #9508)

What advantages have you found in creating a new namespace for it? We're creating a new namespace to have just one class, so my guess is that we can keep the previous approach, but maybe I'm missing something.

I agree that once we have only one class there is no need to create a new namespace. Removed it.

14 ↗(On Diff #9508)

We also need to at least make the constructor private. If we want this to be even better singleton, we could also delete copy constructor and assignment operator.

Make it private, makes sense.

17 ↗(On Diff #9508)

Shouldn't we use atomic also here?

Good catch! Std::atomic supports long long type, we can use it!
I've added it.

services/tunnelbroker/docker-server/contents/server/src/server.cpp
34 ↗(On Diff #9508)

It looks like we don't need to specify the whole namespace here

Right! Made it shorter.

43–44 ↗(On Diff #9508)

We agreed that we will keep capitalized names for methods generated by grpc, but it looks like RunServer and RunAmqpClient are defined by us and shouldn't be capitalized

We had comments about these functions before and agreed with you and @karol-bisztyga to use the same in all services. Now we have RunServer in other services. But I think we must switch to lower case in some follow-up diff for all server implementation in all services.

tomek added inline comments.
services/tunnelbroker/docker-server/contents/server/src/Service/TunnelbrokerServiceImpl.cpp
163 ↗(On Diff #9590)

We're inside comm::network, so we don't need to specify the namespace

services/tunnelbroker/docker-server/contents/server/src/server.cpp
43–44 ↗(On Diff #9508)

I think that all the function names should start with lowercase except the ones generated by grpc. I don't think this is important to fix it now though.

This revision is now accepted and ready to land.Feb 14 2022, 5:49 AM
This revision now requires review to proceed.Feb 14 2022, 5:49 AM
This revision is now accepted and ready to land.Feb 14 2022, 8:53 PM
max marked 5 inline comments as done.

Rebase and fix namespace.

max added inline comments.
services/tunnelbroker/docker-server/contents/server/src/Service/TunnelbrokerServiceImpl.cpp
163 ↗(On Diff #9590)

We're inside comm::network, so we don't need to specify the namespace

Thanks, fixed it.

services/tunnelbroker/docker-server/contents/server/src/server.cpp
43–44 ↗(On Diff #9508)

I think that all the function names should start with lowercase except the ones generated by grpc. I don't think this is important to fix it now though.

Yes, but it needs to be updated in all services in main.cpp.