Replacer service scaffolding
Created by: rvantonder
Introduces the replacer service. The diff is large but that's because it borrows a lot of boiler from searcher and it's not possible to further separate out or cut down these components (tracing, debug, error checking, test format). I've added in line comments for the big differences to make review go quicker. High-level here is how this code differs from searcher:
-
As an initial approximation, requests take a
RewriteSpecification
comprising:- a
MatchTemplate
(pattern to match) - a
RewriteTemplate
(a replacement pattern) - a
FileExtension
(a basic filter on file names in the zip archive)
- a
-
Responses are not written back to the HTTP connection using RPC. Instead, external tool output from stdout is piped directly as chunked data to the HTTP response endpoint. This output is expected to follow json-lines format, and the frontend will perform line-buffering. The frontend part is not implemented in this diff.
-
A rudimentary type for calling out to external tools when performing replacements.
-
No external tool dependencies are added in this diff
This is scaffolding in the sense that (a) nothing on the front end calls replacer yet (b) no external tool dependencies are added or tested in this diff. Both of these will follow in smaller, more digestible diffs.