gcao/gene-new

Make it easy to expose a socket-like standard interface for IPC and network connections

Opened this issue · 0 comments

gcao commented

Interface between a server and a client.

Peer to peer interface like no distinction of server and client?
Not part of this feature.

The interface can be connected using a Unix socket or a TCP/IP network socket.

The interface should serve the major building block for different type of services that are available today, e.g. HTTP, database connection, message queue etc.

The interface can have a self-describing manifest that can be read by the client. The manifest should tell its purpose, its type (send, recv, send+recv etc), some information about the data structure that is transferred etc.

The manifest is like the swagger for a RESTful API. It can be pre-shared or accessed thru a sub-interface.

In order to send the manifest, we'll use a coexistent interface that can be used to query the manifest and maybe other features later (e.g. reset the data location on the server side). This will be called the control interface.

So for each interface, there are two sub-interfaces: the data sub-interface, and the optional control sub-interface. Manifest is available on the control sub-interface.
The control sub-interface can be connected/disconnected on its own.

Connection type:
Send only
Recv only
Send+Recv

Singleplex vs Multiplex?

Should we have built-in support for failover / load-balancing?

On the client side, handlers can be registered for received data.
Or polling can be used.

Flood handling:
How do we stop the server or the client from keep sending data?

Data must be a stream of Gene value

Interface vs sub-interface vs connection:

  • Interface = data sub-interface + optional control sub-interface
  • Multiple connections can be spawned for the same interface from same or different clients

Each connection should be connecting one server and one client only. Both the data and control sub-interface should allow one-way communication at any time even if it's a Send+Recv interface.