address management • ZIP Code validation and address completion in forms • Current status: gRPC API in a microservice • Address information is a static data ◦ 41,704 lines of CSV: 1.6 MiB ◦ Monthly updated ◦ We retrieve uniquely formatted data from USPS, parse it and generate a CSV file with K8s CronJob • No JS/browser dependency ZIP Code → Address Information
via Rust’s Build Scripts ◦ We don’t want to load CSV at runtime ◦ We want address data in binary • Embed the binary into code via include_bytes! • Compacted address info stored in Trie ◦ std::collections::HashMap → rust-phf → fs_trie • Export Wasm binary and JS compatibility layer via wasm-pack ZIP Code in string → Address Information in JSON
option • go:embed can be used embedding binary data in Wasm binary • Nice trie/radix tree library is needed with gob/binary format compatibility ◦ github.com/hashicorp/go-immutable-radix did not get along with gob ◦ * I just could not find one and there could be any out there Not changed so much since last time
Still TinyGo is a good option • We could see some improvements in the future? • Various matured Wasm runtime ◦ github.com/wasmerio/wasmer-go ◦ github.com/tetratelabs/wazero ◦ … Go has nice Wasm supports