Skip to content

Commit 49a381b

Browse files
committed
feat: add proc_open fallback driver for zero-dependency PHP usage
ext-ffi is no longer required — moved to `suggest` in composer.json. When FFI is unavailable, the wrapper automatically spawns `anvildb-server` (a new Rust binary) and communicates via JSON-over-stdin/stdout pipes. - Add DriverInterface, FFIDriver, ProcessDriver, DriverFactory abstraction - Add anvildb-server binary (core/src/bin/server.rs) with full command set - Refactor AnvilDb, Collection, QueryBuilder from \FFI\CData to DriverInterface - Update release.yml to package anvildb-server alongside the shared library - Update docs: architecture, ci-cd, wrapper-development, READMEs Both drivers pass all 22 PHP tests and 50 Rust tests. Override with ANVILDB_DRIVER=ffi|process or ANVILDB_BIN_PATH env vars.
1 parent e13ec2d commit 49a381b

20 files changed

Lines changed: 1770 additions & 273 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ CONTRIBUTING.md export-ignore
2626
*.so binary
2727
*.dylib binary
2828
*.dll binary
29+
anvildb-server binary
30+
anvildb-server.exe binary

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
run: |
6565
mkdir -p dist/${{ matrix.dir }}
6666
cp target/${{ matrix.target }}/release/${{ matrix.artifact }} dist/${{ matrix.dir }}/
67+
cp target/${{ matrix.target }}/release/anvildb-server dist/${{ matrix.dir }}/
6768
tar -czf anvildb-${{ matrix.dir }}.tar.gz -C dist ${{ matrix.dir }}
6869
6970
- name: Package artifact (Windows)
@@ -72,6 +73,7 @@ jobs:
7273
run: |
7374
mkdir -p dist/${{ matrix.dir }}
7475
cp target/${{ matrix.target }}/release/${{ matrix.artifact }} dist/${{ matrix.dir }}/
76+
cp target/${{ matrix.target }}/release/anvildb-server.exe dist/${{ matrix.dir }}/
7577
tar -czf anvildb-${{ matrix.dir }}.tar.gz -C dist ${{ matrix.dir }}
7678
7779
- name: Upload artifact

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The goal was to have something fast for scaffolding projects and prototyping ide
4040

4141
## Wrappers
4242

43-
The core exposes a C API (`anvildb.h`) — any language with FFI support can integrate.
43+
The core exposes a C API (`anvildb.h`) and a JSON-over-pipes protocol (`anvildb-server`) — any language can integrate via FFI or subprocess.
4444

4545
| Language | Package | Status |
4646
|----------|---------|--------|
@@ -55,9 +55,11 @@ Application
5555
|
5656
v
5757
Language Wrapper (PHP, Python, etc.)
58-
| JSON strings + opaque handle
59-
v
60-
Rust Core Engine (libanvildb.so)
58+
| |
59+
| FFI (direct, fastest) | Process (no extensions needed)
60+
| JSON strings + handle | JSON lines over stdin/stdout
61+
v v
62+
Rust Core Engine anvildb-server
6163
| - Write Buffer (dirty tracking + batched flush)
6264
| - LRU Cache (auto-invalidated)
6365
| - In-memory Indexes (Hash / Unique / Range)

core/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ description = "Core engine for AnvilDB — high-performance JSON file-based stor
88
name = "anvildb"
99
crate-type = ["cdylib", "rlib"]
1010

11+
[[bin]]
12+
name = "anvildb-server"
13+
path = "src/bin/server.rs"
14+
1115
[features]
1216
default = []
1317
debug-logs = ["env_logger"]

0 commit comments

Comments
 (0)