docs: add d2 tool to repo and mempool arch diagram #597
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds
d2diagramming to this repo. This allows us to define diagrams declaratively in the repo and require that they be maintained, whenever there are substantial changes made, as a part of the PR process.This PR adds make targets
d2check,d2watch,d2gen,d2gen-all, which should be self explanatory. The standard styling to be used for all diagrams in this repo is defined by environment variables used by the make command, so manual styling need not (and should not) be used. The generated SVG should automatically support light/dark modes.We are opting to use the licensed
tala(instead of the freeelkordagre) layout engine as it uses a more sophisticated graph traversing algorithm that results in more cleaner, more compact diagrams. People making new contributions or edits can still generate and test usingtala, it will just have an "unlicensed" watermark.The plan is to get as singe license (relatively cheap) and integrate it into the CI. Before merging, the final CI step should update the SVGs with the watermark removed.
Mempool diagram
To start, I converted our
mempool_architecture.pngto an equivalentd2file. Please verify equivalency. This is the image used for reference:And this is the svg rendered by the d2 file (watermark to be removed):