ton of software that drives the platform • Data services like storage and VPC (networking) • A control plane for configuration and control • Divided up into services for various components 4
lots of software at lots of layers we’d be building: embedded OS, host OS, hypervisor, storage, control plane, etc. • Rust was becoming the consensus choice for low level systems • Was not obvious (to me) that it was ideal for higher level software • Memory safety is important up and down the stack • So is memory consumption and general robustness • … and it’s kind of in the name of the company 6
frameworks and didn’t find what we needed • Dropshot has OpenAPI at its core–define the API in Rust code, and emit the OpenAPI description • Many OpenAPI advocates say (and said) that this is basically wrong • We wanted one source of truth, the code was changing fast, so the code was going to be the truth • Built dropshot into all our services… and started to consume those APIs (Dave Pacheco and I gave a talk on Dropshot in 2020; link at the end) 7
for “pay attention, anything could be about to happen!” • Rust macros are spectacular: write Rust code to generate Rust tokens • The ecosystem around it is also spectacular: derive an AST from tokens, quote tokens, produce great error messages, etc. • Progenitor hides all the complexity of compiling OpenAPI into Rust within a macro invocation which makes it dead simple to use 13
it easy to do things the right way and hard to do them the wrong way e.g. we wanted one pagination mechanism • Upshot: in Progenitor we can automatically iterate over pages of items: 15
using it for our public SDK • Progenitor: ~20K LOC; SDK: ~60K LOC (generated) • Using the same AST in Progenitor to emit our end-user CLI • And an HTTP mocking library (in part, to test the CLI) 16
much too reluctant to start on Progenitor • If I had understood the complexity of OpenAPI and JSON Schema like I do now I might have been even more reluctant • You don’t need to solve the general problem! • For progenitor we would change the API to simplify generation! • Bryan Cantrill gave a great talk on “the primacy of toolmaking” (link at the end) 19
OpenAPI was definitely right… even though the ecosystem wasn’t what we had hoped • We knew we wanted to do things a bit differently at the HTTP API layer • Dropshot and Progenitor were important components we needed to build • We don’t build everything from scratch (even though it seems like it) • Areas where you have hopes and ambitions deserve at least a prototype! 20