How google/snappy works
Project type and purpose
• Snappy is a C++ compression/decompression library (no GUI or web frontend).
• It provides both a C++ API (snappy::Compress/Uncompress) and a C API (snappy-c.h).
• The project includes test and benchmark executables, plus build scripts (CMake & Bazel).
File structure
• Top‐level build files: BUILD.bazel, WORKSPACE, CMakeLists.txt, .bazelrc, MODULE.bazel.
• Source code:
• snappy.cc / snappy.h: public C++ API and core logic.
• snappy-internal.h, snappy-stubs-internal.cc/h: portability abstractions.
• snappy-sinksource.cc/h: I/O adapters for custom sources/sinks.
• snappy-c.cc / snappy-c.h: C‐language bindings wrapping the C++ API.
• Tests & benchmarks:
• snappy_unittest.cc, snappy-test.cc, snappy_benchmark.cc, snappy_test_tool.cc
• testdata/: sample files for correctness and performance tests.
• Third-party:
• third_party/benchmark: Google Benchmark for performance tests.
• third_party/googletest: unit‐test framework.
• Documentation:
• docs/README.md, format_description.txt, framing_format.txt
Key insights from README
• Core goal: high‐speed compression, stable bitstream, robust error handling.
• Build instructions rely on CMake or Bazel; tests & benchmarks built alongside the library.
• The testdata dir is used by both tests and benchmarks.
• No external network services—entire project is self‐contained.
Diagramming conventions
• Use rectangles for modules/packages (e.g., “snappy core”, “C API wrapper”).
• Use parallelograms for executables (snappy_benchmark, snappy_test_tool).
• Blue for core library components
• Green for build infrastructure
• Orange for tooling (tests/bench)
• Gray for third‐party