[distcc] Proposed distcc protocol change to support caching

Dan Kegel dank at kegel.com
Tue Feb 14 01:28:58 GMT 2006

We're prototyping adding caching to distcc/distccd.

We want to let clients retrieve a particular object file by
sending just the hash of the sources+commandline,
since in some situations that cuts down significantly on network traffic.

We also want to let clients opt out of caching
(say, if they are doing performance testing of the server
and want to avoid retrieving a cached file).

This seems to require a protocol change.

Here's what I'm thinking at the moment:

distcc protocol version 3 would have the client
send a new packet, OPTS, after the DIST packet.
OPTS would encode options as bits in the 64 bit argument.
The following option bits would be defined:

/* Flags to OR into argument to OPTS */
#define DISTCC_OPTS_LZO1X 1  /* content of bulk tokens compressed as
in protocol 2 */
#define DISTCC_OPTS_CACHE 2    /* client wants server to serve from cache */
#define DISTCC_OPTS_HASH_SHA1 4      /* client will send sha-1 hash */

If DISTCC_OPTS_CACHE is set, it means "please, server,
give me the result from the cache if present"

If DISTCC_OPTS_HASH_SHA1 is set, it means "client
will send HASH packet containing hex-encoded SHA-1
hash (details to be defined later) and wait for response
before sending DOTI packet"

The HASH packet is
HASH <len> <bytes>
and the contents are hex-encoded.

If the server has compiled that source before, it will respond with
the usual DONE ... sequence.  If it has not, it will respond
with a packet
NONE <zero>
and wait for the client to send the usual ARGC ... sequence.

How's that sound?
- Dan

Wine for Windows ISVs: http://kegel.com/wine/isv

More information about the distcc mailing list