Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor IpcChannel #832

Open
9 tasks
elfenpiff opened this issue Jun 2, 2021 · 1 comment
Open
9 tasks

Refactor IpcChannel #832

elfenpiff opened this issue Jun 2, 2021 · 1 comment
Labels
refactoring Refactor code without adding features technical debt unclean code and design flaws

Comments

@elfenpiff
Copy link
Contributor

elfenpiff commented Jun 2, 2021

Brief feature description

The current IpcChannel abstraction is just a type alias with the big downside that all ipc channels (message queue, unix domain sockets, named pipes and the upcoming qnx message passing) have to support all the features of the message queue.

We require an IpcChannel abstraction which reduces the interface to a very small subset of common functionality (send, receive).

Detailed information

  • Create IpcChannel abstraction with the following interface.
template<typename IpcType> // could be MessageQueue, UnixDomainSocket, NamedPipe etc.
class IpcChannel {
  public:
    IpcChannel(const IpcType::connectionInformation_t & );
    bool send(const IpcMessage_t& msg);
    bool timedSend(const IpcMessage_t & msg, const units::Duration & timeout);
    cxx::optional<IpcMessage_t> receive();
    cxx::optional<IpcMessage_t> timedReceive(const units::Duration & timeout);
};

The IpcChannel object should be always in a valid and usable state, if the ctor can fail use the creation pattern.

  • replace current IpcChannel alias with new IpcChannel abstraction
  • refactor UnixDomainSockets so that it is a true unix domain socket abstraction.
  • remove isOutdated from all IPC constructs
  • adjust UnixDomainSockets tests
  • refactor NamedPipe so that the MessageQueue compatibility code is removed and the full feature set is supported
  • implement unit tests for NamedPipes
  • remove std::string from everything
  • For better readability, create argument structs for the following functions (search for ticket number in codebase, consider iox-#1196 fix unix domain socket warnings #1527 (comment)):
    • MessageQueue class Ctor
    • NamedPipe class Ctor
    • Semaphore class Ctor
    • UnixDomainSocket class Ctor
    • SharedMemory class Ctor
@elfenpiff elfenpiff added refactoring Refactor code without adding features technical debt unclean code and design flaws labels Jun 2, 2021
@elBoberido
Copy link
Member

The interface is not sufficient since we potentially need to do some checks when RouDi or an application starts like if an IpcChannel is already available or deleted from the file system.

Removing std::string could be done once we switch to a binary serialization. I already have a PoC for this, just need some time to finish it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactor code without adding features technical debt unclean code and design flaws
Projects
None yet
Development

No branches or pull requests

2 participants