Homec4science

PhutilChannel, a stream/pipe I/O wrapper

Authored by epriestley <git@epriestley.com> on Jun 8 2012, 03:21.

Description

PhutilChannel, a stream/pipe I/O wrapper

Summary:
I'm in the process of implementing a Mercurial daemon which uses "hg serve --cmdserver" to improve the performance of Mercurial operations.

The rough design of this server is a proxy server that speaks the cmdserver protocol, opens an hg server on one end (via normal pipes), and listens to multiple clients on the other end (a unix domain socket).

We don't have many PHP servers right now, so we're a little weak on abstractions. This is probably a bit over-engineered, but this server has two different components which speak the same protocol but have different underlying transports:

  • The client speaks to a (proxied) cmdserver over a unix domain socket.
  • The server speaks to a (real) cmdserver over a pipe.

So separating "how to speak to a cmdserver" from "how to do I/O" seemed to make sense.

Test Plan: Implemented an actual server on top of this, see next diff.

Reviewers: csilvers, btrahan, vrana

Reviewed By: csilvers

CC: aran

Differential Revision: https://secure.phabricator.com/D2663

Details

Committed
epriestley <git@epriestley.com>Jun 8 2012, 03:21
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU38b9380b9e76: Micro-optimize idx()
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHU22fa96e6042b: PhutilChannel, a stream/pipe I/O wrapper (authored by epriestley <git@epriestley.com>).Jun 8 2012, 03:21