@@ -18,32 +18,42 @@ namespace worker_proto {
1818
1919/*  protocol-specific definitions */ 
2020
21+ BuildResult read (const  Store & store, unsigned  int  version, Source & from, Phantom<BuildResult> _, DerivedPath req)
22+ {
23+     if  (GET_PROTOCOL_MINOR (version) < 29 ) {
24+         BuildResult res { .path  = req };
25+         res.status  = (BuildResult::Status) readInt (from);
26+         from >> res.errorMsg ;
27+         if  (GET_PROTOCOL_MINOR (version) >= 28 ) {
28+             auto  builtOutputs = read (store, version, from, Phantom<DrvOutputs> {});
29+             res.builtOutputs  = builtOutputs;
30+         }
31+         return  res;
32+     } else 
33+         return  read0 (store, version, from, Phantom<BuildResult>{}, req);
34+ }
35+ 
36+ void  writeWithoutReq (const  Store & store, unsigned  int  version, Sink & out, const  BuildResult & res)
37+ {
38+     if  (GET_PROTOCOL_MINOR (version) < 29 ) {
39+         out << res.status  << res.errorMsg ;
40+         if  (GET_PROTOCOL_MINOR (version) >= 28 ) {
41+             write (store, version, out, res.builtOutputs );
42+         }
43+     } else 
44+         write0 (store, version, out, res);
45+ }
46+ 
2147BuildResult read (const  Store & store, unsigned  int  version, Source & from, Phantom<BuildResult> _)
2248{
23-     auto  path = worker_proto::read (store, version, from, Phantom<DerivedPath> {});
24-     BuildResult res { .path  = path };
25-     res.status  = (BuildResult::Status) readInt (from);
26-     from
27-         >> res.errorMsg 
28-         >> res.timesBuilt 
29-         >> res.isNonDeterministic 
30-         >> res.startTime 
31-         >> res.stopTime ;
32-     res.builtOutputs  = worker_proto::read (store, version, from, Phantom<DrvOutputs> {});
33-     return  res;
49+     auto  req = read (store, version, from, Phantom<DerivedPath> {});
50+     return  read (store, version, from, Phantom<BuildResult> {}, req);
3451}
3552
3653void  write (const  Store & store, unsigned  int  version, Sink & to, const  BuildResult & res)
3754{
38-     worker_proto::write (store, version, to, res.path );
39-     to
40-         << res.status 
41-         << res.errorMsg 
42-         << res.timesBuilt 
43-         << res.isNonDeterministic 
44-         << res.startTime 
45-         << res.stopTime ;
46-     worker_proto::write (store, version, to, res.builtOutputs );
55+     write (store, version, to, res.path );
56+     writeWithoutReq (store, version, to, res);
4757}
4858
4959
0 commit comments