Components#
This document explains the repository by module and by runtime role.
Layer View#
Layer |
Main Crates |
Responsibility |
|---|---|---|
Store model |
|
Shared types, traits, lifecycle, and route model |
Metadata |
|
Persistent leases, segments, route policy, handoff, and |
Runtime |
|
User-facing API and all runtime decisions |
Python compatibility runtime |
|
Python-facing setup, dispatcher, dummy service, and shm compatibility path |
Admin |
|
Admin service and standalone |
CLI |
|
Standalone |
Transport binding |
|
Native TE/TENT linkage and Rust wrappers |
Python binding |
|
Private |
Validation |
|
End-to-end correctness and benchmark runs |
Core Model#
mooncake-store-core#
Purpose:
define the shared store vocabulary
keep metadata, client, and bindings on one consistent type system
Main content:
client identities and endpoint sets
leases and lifecycle states
routes, replicas, segments, and versions
hugepage configuration parsing shared by Rust and Python entry points
store traits such as
MetadataBackendandRouteDirectory
Read this crate first if you want to understand the data model before reading the runtime.
Metadata Backends#
mooncake-store-rs-metadata#
Purpose:
store durable coordination state outside the client process
provide one backend interface with multiple implementations
Backends:
Backend |
When It Is Used |
|---|---|
|
default local runs and e2e |
|
distributed store metadata |
|
tests |
Main responsibilities:
live client lease storage
segment announcement storage under the owning runtime; Redis stores these records in the same TTL-backed client resource hash as the lease
segment lifecycle updates
route policy and handoff storage
route storage for
MetadataOnlymode
Client Runtime#
mooncake-store-client#
This is the main crate that applications use.
It contains the public builder, the request API, the allocator logic, the route directory, the control plane, and the transport helpers.
Public entry points#
StoreClientStoreClientBuilderPutRequest,GetRequestReplicationPolicyPlacementPlanner
Internal runtime areas#
Area |
Files |
Responsibility |
|---|---|---|
Client assembly |
|
public builder, client composition, startup defaults |
Client runtime |
|
request-path logic, lifecycle, batching, reclaim, compatibility surface |
Membership sync |
|
prewarmed live-client snapshot and background refresh |
Control plane |
|
route RPC and allocator RPC between clients |
Route control |
|
embedded weighted rendezvous and metadata route mode |
Memory tracking |
|
local storage segments, scratch, registered buffers |
Placement planning |
|
storage-node filtering and selection helpers |
Observability |
|
tracing, metrics registry, HTTP export |
Transport helpers |
|
transfer submission and completion helpers |
Explicit route migration runtime#
The explicit route-migration runtime is implemented in the same
mooncake-store-client crate and is split across three pieces:
src/client/runtime_io.rssource-replica selection
explicit
copy/moveroute-delta constructionpayload copy, CAS route publish, and best-effort reclaim
src/client/state_adapters.rsexecutor-side task adapter
background worker that turns a control-plane request into one runtime migration execution
src/control_plane/*SubmitMigrationTaskandGetMigrationExecutionStatusmigration request validation and client/server wiring
This runtime layer is intentionally lower-level than the admin queue and HTTP operator surface. It is the executor-side kernel that later stacked PRs build on top of.
Transport Layer#
The top-level CMake project owns the native shim targets
mooncake_store_rs_classic_shim and mooncake_store_rs_tent_shim. CMake links
them to the existing transfer_engine and tent_shared targets, passes their
target-file paths into Cargo, and installs the shim libraries with the Python
component. The Rust sys crate owns the FFI surface and validates those explicit
paths; it does not configure or build CMake targets.
mooncake-store-rs-transport-sys#
Purpose:
expose Rust FFI over the classic-TE and TENT shims built by the top-level CMake project
What it does:
validates the explicit Mooncake source, CMake build, and shim-library paths passed by CMake
binds Rust transport code to the CMake-owned classic-TE and TENT shim libraries
leaves upstream TE/TENT targets and both shim implementations under CMake ownership
mooncake-store-rs-transport#
Purpose:
provide a safer Rust-facing transport API over the FFI layer
Main objects:
TentEngineTentEngineConfigClassicTransferEngineClassicEngineConfigTentTransportFactorytransport request and status types
Python Compatibility#
mooncake-store-rs-runtime#
Purpose:
provide the Rust compatibility runtime used by Python’s real and dummy modes
It owns setup configuration, dispatcher and hot-cache state, shared-memory registration, and the dummy client/service protocol. The Python bindings and CLI use this runtime; the admin crate owns its separate operator layer.
mooncake-store-py#
Purpose:
expose the Rust runtime to Python without reimplementing store logic
What it contains:
PyO3 bindings for the Python-facing Store classes and allocator wrappers
the private
mooncake._store_rsextension modulebinding-specific tensor and buffer wrappers
The root Python package exposes the selected backend through mooncake.store;
this crate provides the Store-RS native module consumed by that facade.
Admin and CLI#
mooncake-store-rs-admin#
This crate owns the admin HTTP/service layer and the fixed-backend
mooncake-store-rs-admin operator command.
mooncake-store-rs-cli#
This crate provides the fixed-backend mooncake-store-rs-client command and
mooncake-store-rs-bench benchmark command. These commands launch Store-RS
directly; MOONCAKE_STORE_BACKEND selects the Python facade only.
python/mooncake/store/rs#
Purpose:
Store-RS implementation selected by the root
mooncake.storefacadeload the private
_store_rsextension installed in the root wheel
It also provides Python-friendly wrappers for batch and buffer-oriented methods.
Validation and Examples#
mooncake-store-e2e#
Purpose:
prove that the runtime behaves correctly in realistic multi-client flows
print benchmark numbers for batch put and get
The e2e binary validates:
single and batch I/O
replication policy handling
routed remote writes
overwrite reclaim and delete reclaim
multi-tenant behavior
dynamic membership and elastic segment changes
hot-upgrade handoff flows
mooncake-store-rs-bench#
Purpose:
provide a standalone, production-grade benchmark and verification binary built from the Rust workspace
The bench binary provides three subcommands:
bench— concurrent single-key or batch read/write throughput and latency measurement with p50/p90/p99/p999 percentiles, configurable mode, interfaces, concurrency, batch size, and durationverify— sequential correctness checks including configurable single-key or batch read/write paths,get_into,is_exist, overwrite correctness, delete/reclaim, and tenant isolationsoak— long-duration stability test with per-operation fault injection (Redis jitter, metadata drop, transport delay, transport error) and optional read verification
See the benchmark guide for full usage.
Suggested Reading Order#
crates/mooncake-store-core