- ChronDB was initially a server-based time-traveling key/value database with Git as its storage engine.
- The need to embed ChronDB in a Rust binary led to exploring GraalVM Native Image and FFI for polyglot compatibility.
- The architecture consists of five layers: Language Bindings, C API, Java Bridge, Clojure Bridge, and ChronDB Core.
- The handle registry pattern uses integer handles for clean FFI boundary crossing, avoiding pointer complexities.
- GraalVM Native Image requires Java layer with @CEntryPoint annotations for C-callable functions.
- The build process involves creating an uberjar, compiling Java with SVM classpath, and generating a shared library.
- Python bindings use ctypes for direct C library access, managing GraalVM isolate lifecycle and string encoding.
- Rust bindings leverage bindgen for FFI declarations, emphasizing ownership and RAII for safe resource management.
- Data flows through layers with JSON as the interchange format, ensuring consistent behavior across languages.
- The architecture allows for single source of truth, no runtime JVM dependency, and easy addition of new language bindings.