Thursday, September 3, 2015

Reading Gate's code

I needed to read again Gate's code to see how much Pwd diverged from it. Remember: Gate was a Pwd port, written some time ago, but not really maintained; whereas Pwd continued to evolve.

The most striking differences are:
  • Pwd supports named pipes and low-level sockets as client-server channels. (There was also a ZMQ attempt, not finished.) On the other hand, Gate only supports RPC on HTTP. I need to extract the "channels" behaviour, maybe with another naming since "channel" is a native Go concept. Then, I may want to implement a ZMQ "channel".
  • Pwd started to support a web interface, never finished. Gate could use one, too — but only if I intend to finish it (i.e. not now).
Otherwise, the porting was quite fidel to the original. Maybe too much; the server start and synchronization method uses the same kind of algorithm: start the server process, and try to open a socket until it answers and abort if it takes too long. Not pretty! That's why I want to use ZMQ instead: it should better hide those gory details.

To be continued…