Tips on TCP socket to postgresql middleware
dee0xeed at gmail.com
Sun Feb 20 15:20:17 UTC 2022
On Saturday, 19 February 2022 at 20:13:01 UTC, Chris Piker wrote:
> * general tips on which libraries to examine
Most people will probably say this is crazy,
but as to PG, one can do without libraries.
I am doing so during years (in C, not D) and
did not expierienced extremely complex troubles.
I mean I do not use libpq - instead I implement some
subset of the protocol, which is needed for particular program.
What I do not like in all these libs for working
with widely used services (postgres, redis etc) is
the fact that they all hide inside them i/o stuff,
Why have connect() in each library?
It is universal thing, as well as read() and write().
If I want several connection to DBMS in a program,
libraries like libpq compel me to use multithreading.
But what if I want to do many-many-many things concurrently
in a single thread?
Usually I design more or less complex (network) programs using
event-driven paradigm (reactor pattern) plus state machines.
In other words programs designed this way are, so to say,
hierarchical team of state machines, interacting with
each other as well as with outer world (signals,
timers, events from sockets etc)
More information about the Digitalmars-d-learn