> Sourced from [jeffijoe/deltio](https://github.com/jeffijoe/deltio) โ [MIT](https://github.com/jeffijoe/deltio/blob/09cb410afcbec7f9336607d0794784e9c614fcf0/CLAUDE.md).
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
Deltio is a high-performance Google Cloud Pub/Sub emulator written in Rust, designed as a lightweight alternative to the official emulator for local development and CI. Everything is in-memory (no persistence). It implements the official Google Pub/Sub gRPC API using proto definitions from googleapis/googleapis.
## Build & Development Commands
Requires Rust (stable) and `protoc` (Protocol Buffers compiler). Proto compilation happens automatically via `build.rs`.
```bash
cargo build # Debug build
cargo build --release # Release build (LTO, single codegen unit)
cargo test # All tests (unit + integration)
cargo test --test subscriber_test # Single integration test file
cargo test test_publish # Tests matching a name
cargo clippy # Lint
cargo fmt --all -- --check # Check formatting
cargo fmt # Auto-format
```
**E2E tests** (require a running Deltio instance):
```bash
./target/release/deltio --bind 0.0.0.0:8085 --log trace &
cd e2e && cargo run
```
**Note:** Integration tests use Unix sockets (via `TestHost` in `tests/test_helpers/mod.rs`), so they don't run on Windows.
## Architecture
### Actor Pattern
The core concurrency model uses actors communicating via tokio mpsc channels. Each actor runs as a spawned tokio task processing request enums, with oneshot channels for request-response patterns.
- **TopicActor** (`src/topics/topic_actor.rs`): Manages topic state โ published messages, attached subscriptions. Created by `Topic::new()`.
- **SubscriptionActor** (`src/subscriptions/subscription_actor.rs`): Manages subscription state โ pulled messages, ACKs, deadline modifications. Created by `Subscription::new()`.
### Manager Layer
- **TopicManager** (`src/topics/topic_manager.rs`): Coordinates topic creation/access using `Arc<RwLock<State>>`. Brief write locks during creation only.
- **SubscriptionManager** (`src/subscriptions/subscription_manager.rs`): Same pattern for subscriptions. Uses delegate callbacks for actor-to-manager notifications (e.g., deletion).
### gRPC Services
- **PublisherService** (`src/api/publisher.rs`): Implements the `Publisher` gRPC trait (create/get/list/delete topics, publish messages).
- **SubscriberService** (`src/api/subscriber.rs`): Implements the `Subscriber` gRPC trait (subscriptions, pull, streaming pull, ACK, push config).
### Push Subscriptions
`PushLoop` (`src/push/push_loop.rs`) runs a background async loop that polls registered push subscriptions and delivers messages via HTTP. Registry is shared between the subscription manager and push loop.
### Key Design Decisions
- **MiMalloc** global allocator for performance (disabled on 32-bit x86 Linux)
- **Arc\<TopicMessage\>** for zero-copy message sharing across subscriptions
- **Strongly-typed resource names** (`TopicName`, `SubscriptionName`) with format `projects/{project}/topics|subscriptions/{name}`
- **thiserror** for domain-specific error types mapped to gRPC Status codes in the API layer
## CI
CI runs on push/PR across Windows, macOS, Ubuntu. Lint/format checks run on Ubuntu only. Tests skip Windows (Unix socket requirement). E2E runs against a release binary on all platforms.
Add to your project
Paste into your project's CLAUDE.md or ~/.claude/CLAUDE.md for global rules.
More for Rust
Graphgrc CLAUDE.md
by @engseclabs
Build security program documentation using Git and Markdown
Polyphony CLAUDE.md
by @penso
Repo-native AI orchestration engine โ connects issue trackers (GitHub, GitLab, Linear, webhooks) to coding agents (Claude, Codex, Copilot, Pi) with isolated wor
Bitsandbytes CLAUDE.md
by @bitsandbytes-foundation
Accessible large language models via k-bit quantization for PyTorch.
Dotfiles CLAUDE.md
by @phatblat
CLAUDE.md for the Dotfiles project (Shell).
N8n Install CLAUDE.md
by @kossakovsky
๐ Self-hosted AI automation platform. Deploy n8n, Ollama, Flowise, RAG, Supabase & 30+ tools with one command. Auto HTTPS. Free Zapier/Make alternative.
Cc Plugin Catalog CLAUDE.md
by @giginet
Static site generator for Claude Code Plugin Marketplace repositories
MCP servers for Rust
mediar-ai/screenpipe
๐๏ธ ๐ฆ ๐ ๐ Local-first system capturing screen/audio with timestamped indexing, SQL/embedding storage, semantic search, LLM-powered history analysis, and event-triggered actions - enables building c
Rust MCP SDK
The official Rust SDK for the Model Context Protocol
devflowinc/trieve
๐๏ธ ๐ โ๏ธ ๐ - Crawl, embed, chunk, search, and retrieve information from datasets through
Browse by Tag
Get the Claude Code Starter Pack
Top CLAUDE.md rules for Next.js, TypeScript, Python, Go, and React โ free.
