Skip to content

Commit d99633f

Browse files
committed
improve: fdb → ledger
1 parent 550b7d6 commit d99633f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+490
-3157
lines changed

.config/nextest.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ slow-timeout = { period = "120s" }
9797
threads-required = 2
9898

9999
[[profile.default.overrides]]
100-
# FDB tests need to run serially to avoid conflicts
101-
filter = 'test(fdb) | test(foundationdb)'
100+
# Ledger tests need to run serially to avoid conflicts
101+
filter = 'test(ledger)'
102102
test-group = "database"
103103
threads-required = 1
104104

.env.example

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ INFERADB_CTRL__SERVER__WORKER_THREADS=4
3434
# Storage
3535
# =============================================================================
3636

37-
# Storage backend: "memory" or "foundationdb"
37+
# Storage backend: "memory" or "ledger"
3838
INFERADB_CTRL__STORAGE__BACKEND=memory
3939

40-
# FoundationDB cluster file (required if using foundationdb backend)
41-
# INFERADB_CTRL__STORAGE__FDB_CLUSTER_FILE=/etc/foundationdb/fdb.cluster
40+
# Ledger configuration (required if using ledger backend)
41+
# INFERADB_CTRL__STORAGE__LEDGER__ENDPOINT=http://localhost:50051
42+
# INFERADB_CTRL__STORAGE__LEDGER__CLIENT_ID=
43+
# INFERADB_CTRL__STORAGE__LEDGER__NAMESPACE_ID=
4244

4345
# =============================================================================
4446
# Authentication

.github/dependabot.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ updates:
1919
prefix: "deps"
2020
include: "scope"
2121
ignore:
22-
- dependency-name: "foundationdb"
23-
update-types:
24-
- "version-update:semver-major"
2522
- dependency-name: "tonic"
2623
update-types:
2724
- "version-update:semver-major"
@@ -75,7 +72,7 @@ updates:
7572
- "*"
7673

7774
- package-ecosystem: "docker"
78-
directory: "/docker/fdb-integration-tests"
75+
directory: "/docker/ledger-integration-tests"
7976
schedule:
8077
interval: "daily"
8178
time: "09:00"

.github/workflows/ci.yml

Lines changed: 85 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,6 @@ jobs:
118118
sudo apt-get install -y -qq mold
119119
mold --version
120120
121-
- name: Install FoundationDB client library
122-
run: |
123-
wget -q https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-clients_7.3.69-1_amd64.deb
124-
sudo dpkg -i foundationdb-clients_7.3.69-1_amd64.deb
125-
126121
- name: Cache Rust dependencies
127122
uses: step-security/rust-cache@f8fba7098297c8c53a7c9a30575ec2ad4ad85056 # v2.8.2
128123
with:
@@ -170,11 +165,6 @@ jobs:
170165
install_args: protobuf cargo:cargo-nextest
171166
cache: true
172167

173-
- name: Install FoundationDB client library
174-
run: |
175-
wget -q https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-clients_7.3.69-1_amd64.deb
176-
sudo dpkg -i foundationdb-clients_7.3.69-1_amd64.deb
177-
178168
- name: Cache Rust dependencies
179169
uses: step-security/rust-cache@f8fba7098297c8c53a7c9a30575ec2ad4ad85056 # v2.8.2
180170
with:
@@ -231,11 +221,6 @@ jobs:
231221
install_args: protobuf cargo:cargo-nextest
232222
cache: true
233223

234-
- name: Install FoundationDB client library
235-
run: |
236-
wget -q https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-clients_7.3.69-1_amd64.deb
237-
sudo dpkg -i foundationdb-clients_7.3.69-1_amd64.deb
238-
239224
- name: Download nextest archive
240225
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
241226
with:
@@ -265,6 +250,85 @@ jobs:
265250
path: target/nextest/ci/junit.xml
266251
retention-days: 7
267252

253+
# Ledger Integration Tests
254+
# Runs Control tests against a real Ledger server to verify storage backend integration.
255+
# Uses Docker Compose to start a single-node Ledger cluster, then runs native cargo tests.
256+
ledger-integration-tests:
257+
name: Ledger Integration Tests
258+
needs: build
259+
runs-on: ubuntu-latest
260+
permissions:
261+
contents: read
262+
timeout-minutes: 10
263+
env:
264+
CARGO_INCREMENTAL: 0
265+
RUSTFLAGS: "-C codegen-units=16 -C link-arg=-fuse-ld=mold"
266+
steps:
267+
- name: Harden the runner (Audit all outbound calls)
268+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
269+
with:
270+
egress-policy: audit
271+
272+
- name: Checkout code
273+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
274+
275+
- name: Install Rust toolchain
276+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
277+
with:
278+
toolchain: stable
279+
280+
- name: Install mold linker
281+
run: |
282+
sudo apt-get update -qq
283+
sudo apt-get install -y -qq mold
284+
285+
- name: Install development tools via Mise
286+
uses: step-security/mise-action@2fa1b2b4fa1577588d8ac75f4dfa0f67c266d2a0 # v3.4.1
287+
with:
288+
install_args: protobuf cargo:cargo-nextest
289+
cache: true
290+
291+
- name: Cache Rust dependencies
292+
uses: step-security/rust-cache@f8fba7098297c8c53a7c9a30575ec2ad4ad85056 # v2.8.2
293+
with:
294+
shared-key: management-ubuntu-latest-x86_64-unknown-linux-gnu
295+
save-if: false
296+
297+
- name: Start Ledger server
298+
working-directory: docker/ledger-integration-tests
299+
run: |
300+
docker-compose up -d ledger
301+
echo "Waiting for Ledger to be ready..."
302+
for i in {1..30}; do
303+
if docker-compose exec -T ledger nc -z localhost 50051 2>/dev/null; then
304+
echo "Ledger is ready!"
305+
break
306+
fi
307+
echo "Attempt $i/30: Ledger not ready yet..."
308+
sleep 2
309+
done
310+
# Final check
311+
docker-compose exec -T ledger nc -z localhost 50051 || (docker-compose logs ledger && exit 1)
312+
313+
- name: Run Ledger integration tests
314+
env:
315+
RUN_LEDGER_INTEGRATION_TESTS: "1"
316+
LEDGER_ENDPOINT: "http://localhost:50052"
317+
LEDGER_NAMESPACE_ID: "1"
318+
RUST_BACKTRACE: "1"
319+
run: |
320+
cargo nextest run \
321+
--package inferadb-control-storage \
322+
--test ledger_integration_tests \
323+
--features ledger \
324+
--profile ci \
325+
--no-fail-fast
326+
327+
- name: Stop Ledger server
328+
if: always()
329+
working-directory: docker/ledger-integration-tests
330+
run: docker-compose down -v
331+
268332
# Test code coverage (nightly only to reduce CI costs)
269333
coverage:
270334
name: Code Coverage
@@ -303,11 +367,6 @@ jobs:
303367
install_args: protobuf cargo:cargo-llvm-cov
304368
cache: true
305369

306-
- name: Install FoundationDB client library
307-
run: |
308-
wget -q https://github.com/apple/foundationdb/releases/download/7.3.69/foundationdb-clients_7.3.69-1_amd64.deb
309-
sudo dpkg -i foundationdb-clients_7.3.69-1_amd64.deb
310-
311370
- name: Restore build cache
312371
uses: step-security/rust-cache@f8fba7098297c8c53a7c9a30575ec2ad4ad85056 # v2.8.2
313372
with:
@@ -363,7 +422,7 @@ jobs:
363422
# Overall status check
364423
ci-success:
365424
name: CI Success
366-
needs: [changes, fmt, clippy, build, test, coverage, dependencies]
425+
needs: [changes, fmt, clippy, build, test, ledger-integration-tests, coverage, dependencies]
367426
runs-on: ubuntu-latest
368427
permissions:
369428
contents: read
@@ -394,6 +453,11 @@ jobs:
394453
echo "Tests failed"
395454
exit 1
396455
fi
456+
# Ledger integration tests verify storage backend
457+
if [[ "${{ needs.ledger-integration-tests.result }}" != "success" && "${{ needs.ledger-integration-tests.result }}" != "skipped" ]]; then
458+
echo "Ledger integration tests failed"
459+
exit 1
460+
fi
397461
# Coverage and dependencies can be skipped for Dependabot PRs
398462
if [[ "${{ needs.coverage.result }}" != "success" && "${{ needs.coverage.result }}" != "skipped" ]]; then
399463
echo "Coverage check failed"

.serena/memories/codebase_structure.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ control/
1111
│ ├── inferadb-control-core/ # Business logic, entities, services
1212
│ ├── inferadb-control-discovery/ # Service discovery
1313
│ ├── inferadb-control-engine-client/ # Engine API client
14-
│ ├── inferadb-control-fdb-shared/ # FoundationDB shared utilities
15-
│ ├── inferadb-control-storage/ # Storage layer (FDB, in-memory)
14+
│ ├── inferadb-control-storage/ # Storage layer (Ledger, in-memory)
1615
│ ├── inferadb-control-test-fixtures/ # Test utilities and fixtures
1716
│ └── inferadb-control-types/ # Shared type definitions
1817
├── docs/ # Documentation
@@ -36,7 +35,7 @@ inferadb-control (binary)
3635
└── inferadb-control-core
3736
└── inferadb-control-config
3837
└── inferadb-control-storage
39-
└── FoundationDB
38+
└── Ledger
4039
└── inferadb-control-engine-client
4140
```
4241

@@ -45,8 +44,6 @@ inferadb-control (binary)
4544
- `clock` - Time utilities
4645
- `crypto` - Cryptographic operations
4746
- `email` - Email sending
48-
- `fdb_invalidation` - FDB cache invalidation
49-
- `fdb_jwks` - JWK storage in FDB
5047
- `id` - ID generation (Snowflake)
5148
- `jobs` - Background jobs
5249
- `jwt` - JWT token handling

.serena/memories/project_overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Multi-tenant administration headless APIs for InferaDB with Kubernetes-native de
77
- **Language**: Rust 1.85+ (stable toolchain)
88
- **Async Runtime**: Tokio
99
- **Web Framework**: Axum (REST), Tonic (gRPC)
10-
- **Storage**: FoundationDB (production) or in-memory (development)
10+
- **Storage**: Ledger (production) or in-memory (development)
1111
- **Authentication**: Argon2 (password), WebAuthn/FIDO2 (passkeys), OAuth, Email verification
1212
- **Cryptography**: Ed25519 (client certs), JWT (tokens), AES-GCM (encryption)
1313
- **Observability**: OpenTelemetry, Prometheus metrics, tracing

.serena/memories/suggested_commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## One-Time Setup
44
```bash
55
mise trust && mise install # Install tools via mise
6-
docker-compose up -d # Start FoundationDB (optional)
6+
docker-compose up -d # Start dependencies (optional)
77
export INFERADB_CTRL__AUTH__KEY_ENCRYPTION_SECRET=$(openssl rand -base64 32)
88
```
99

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ members = [
77
"crates/inferadb-control-core",
88
"crates/inferadb-control-discovery",
99
"crates/inferadb-control-engine-client",
10-
"crates/inferadb-control-fdb-shared",
1110
"crates/inferadb-control-storage",
1211
"crates/inferadb-control-test-fixtures",
1312
"crates/inferadb-control-types",
@@ -65,9 +64,6 @@ tower-http = { version = "0.6", features = [
6564
"trace",
6665
] }
6766

68-
# Storage
69-
foundationdb = { version = "0.10", features = ["fdb-7_3"] }
70-
7167
# Configuration
7268
clap = { version = "4.5", features = ["derive", "env"] }
7369
config = "0.15.18"

Dockerfile

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,21 @@
1212
FROM rustlang/rust:nightly-bookworm-slim AS builder
1313
WORKDIR /app
1414

15-
# Install build dependencies including FoundationDB client
15+
# Install build dependencies
1616
RUN apt-get update && apt-get install -y \
1717
pkg-config \
1818
libssl-dev \
1919
protobuf-compiler \
20-
wget \
2120
clang \
2221
libclang-dev \
2322
&& rm -rf /var/lib/apt/lists/*
2423

25-
# Install FoundationDB client library (required for fdb feature)
26-
# Detect architecture and download appropriate package
27-
RUN ARCH=$(dpkg --print-architecture) && \
28-
FDB_VERSION="7.3.69" && \
29-
if [ "$ARCH" = "amd64" ]; then \
30-
wget -q https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_amd64.deb && \
31-
dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb && \
32-
rm foundationdb-clients_${FDB_VERSION}-1_amd64.deb; \
33-
elif [ "$ARCH" = "arm64" ]; then \
34-
wget -q https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_aarch64.deb && \
35-
dpkg -i foundationdb-clients_${FDB_VERSION}-1_aarch64.deb && \
36-
rm foundationdb-clients_${FDB_VERSION}-1_aarch64.deb; \
37-
else \
38-
echo "Unsupported architecture: $ARCH" && exit 1; \
39-
fi
40-
4124
# Copy source code
4225
COPY Cargo.toml Cargo.lock ./
4326
COPY crates ./crates
4427

45-
# Build the application in release mode with FoundationDB support
46-
RUN cargo build --release --bin inferadb-control --features fdb
28+
# Build the application in release mode with Ledger support
29+
RUN cargo build --release --bin inferadb-control --features ledger
4730

4831
# Strip debug symbols to reduce binary size
4932
RUN strip /app/target/release/inferadb-control
@@ -61,31 +44,13 @@ LABEL org.opencontainers.image.licenses="BSL-1.1"
6144
LABEL org.opencontainers.image.source="https://github.com/inferadb/inferadb"
6245
LABEL org.opencontainers.image.documentation="https://docs.inferadb.com"
6346

64-
# Install runtime dependencies including FoundationDB client
47+
# Install runtime dependencies
6548
RUN apt-get update && apt-get install -y \
6649
ca-certificates \
6750
libssl3 \
6851
curl \
69-
wget \
7052
&& rm -rf /var/lib/apt/lists/*
7153

72-
# Install FoundationDB client library (required at runtime for FDB backend)
73-
RUN ARCH=$(dpkg --print-architecture) && \
74-
FDB_VERSION="7.3.69" && \
75-
if [ "$ARCH" = "amd64" ]; then \
76-
wget -q https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_amd64.deb && \
77-
dpkg -i foundationdb-clients_${FDB_VERSION}-1_amd64.deb && \
78-
rm foundationdb-clients_${FDB_VERSION}-1_amd64.deb; \
79-
elif [ "$ARCH" = "arm64" ]; then \
80-
wget -q https://github.com/apple/foundationdb/releases/download/${FDB_VERSION}/foundationdb-clients_${FDB_VERSION}-1_aarch64.deb && \
81-
dpkg -i foundationdb-clients_${FDB_VERSION}-1_aarch64.deb && \
82-
rm foundationdb-clients_${FDB_VERSION}-1_aarch64.deb; \
83-
else \
84-
echo "Unsupported architecture: $ARCH" && exit 1; \
85-
fi && \
86-
apt-get purge -y wget && \
87-
apt-get autoremove -y
88-
8954
# Create non-root user
9055
RUN useradd -r -u 65532 -s /sbin/nologin nonroot
9156

0 commit comments

Comments
 (0)