Reduce duplicate code using buildbox-common
Intro
Currently there are bits and pieces of code in recc
that are also implemented by buildbox-common
(a salient example of that is the CAS client).
We could benefit of having recc
import some of the functionality from buildbox-common
in order to avoid duplicate code. At the same time, some of the code in recc
could be moved to buildbox-common
, from where it can then be reused by other projects.
Overlapping code
casupload.cpp
CAS Client and recc
implements a subset of a CAS client (it only supports batch uploads). It serves as the base for a RemoteExecutionClient
that is used to check the Action Cache and submit Execute() requests. It also supports JWT authentication, but does not fetch Capabilities.
Both could be consolidated into a single CAS client, potentially keeping the RemoteExecutionClient
exclusive to recc
(implemented as a class that inherits from the CasClient
provided by -common
).
A potential obstacle for this refactoring is the fact that recc
's implementation is instrumented for metrics.
merkelize.cpp
Both projects have the same implementation in their sources.
fileutils.cpp
recc
implements helpers that are already present in buildbox-common
plus some path manipulation functions that would be beneficial to have in -common
(BuildGrid/buildbox/buildbox-common#9 (closed)).
requestmetadata.cpp
This is about to be also implemented in BuildGrid/buildbox/buildbox-common!74 (merged).
Logging
recc
has simple macros that only log to std::cout
and std::cerr
. Logging could be improved by using the ones provided by buildboxcommon::Logging
.