iceoryx icon indicating copy to clipboard operation
iceoryx copied to clipboard

Refactor IpcChannel

Open elfenpiff opened this issue 4 years ago • 1 comments

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 https://github.com/eclipse-iceoryx/iceoryx/pull/1527#discussion_r924372545):
    • MessageQueue class Ctor
    • NamedPipe class Ctor
    • Semaphore class Ctor
    • UnixDomainSocket class Ctor
    • SharedMemory class Ctor

elfenpiff avatar Jun 02 '21 19:06 elfenpiff

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.

elBoberido avatar Jun 02 '21 20:06 elBoberido