Skip to content

feat: distributed_state_session convenience API - #86

Merged
transfix merged 2 commits into
masterfrom
feature/distributed-state-session
May 22, 2026
Merged

transfix merged 2 commits into
masterfrom
feature/distributed-state-session

Conversation

@transfix

Copy link
Copy Markdown
Owner

Summary

Implements the distributed_state_session high-level convenience API defined in the distributed state plan document. This class wires together all distributed state components from a single distributed_state_config struct, eliminating the need to manually assemble shards, transports, blob stores, and admin facades.

New Files

  • distributed_state_session.h: Header with distributed_state_config, sync_mode, delegation_target, transport_kind enums, and the session class
  • distributed_state_session.cpp: Implementation of join(), stop(), sync_path(), delegate(), undelegate(), and the background pump loop

API

auto session = distributed_state_session::join(app, {
  .cluster_id = "my_cluster",
  .node_id = "node1",
  .transport = transport_kind::grpc,
  .listen_address = "0.0.0.0:50051",
  .seeds = {"peer1:50051", "peer2:50051"},
  .mounts = {{"scene", sync_mode::read_write}},
  .pump_interval_ms = 10,
});

session->sync_path("data.volume", sync_mode::read_only);
session->delegate("remote.data", {"other_cluster", "host:50051"});
session->stop();

What join() Wires Together

  1. memory_state_blob_store
  2. Transport (inproc / IPC / gRPC based on config)
  3. Seed peer connections
  4. state_cluster_shard with policy flags (authority, write policy, delegation, conflicts, interest)
  5. Mount points → interest filters + write policy entries
  6. Transport ↔ shard registration
  7. state_distributed_admin facade
  8. Background pump thread (configurable interval)

Tests

12 new tests:

  • Lifecycle: join/stop, destructor safety, double-stop idempotency
  • Component access and policy flag propagation
  • Two-node inproc replication (write → pump → read on peer)
  • Background pump thread verification
  • Runtime sync_path, mount application
  • Delegation and undelegation
  • Admin facade attachment
  • IPC transport creation

@transfix
transfix force-pushed the feature/distributed-state-session branch from 54f4591 to f2b5194 Compare May 22, 2026 20:00
transfix added 2 commits May 22, 2026 15:33
Add a high-level distributed_state_session class that wires together all
distributed state components (shard, transport, blob store, compression,
admin) from a single distributed_state_config struct.

API:
- distributed_state_session::join(app, config) creates and starts a session
- stop() gracefully tears down in correct order
- sync_path(path, mode) adds runtime sync paths
- delegate(path, target) / undelegate(path) for subtree delegation
- Component accessors: shard(), transport(), blob_store(), admin()

Supports inproc, IPC, and gRPC (when CVC_ENABLE_GRPC) transports.
Configurable policy flags, mount points, seed peers, and background
pump thread.

Tests: 12 new tests covering lifecycle, replication, pump thread, sync
paths, mounts, delegation, policy flags, admin, and IPC transport.
@transfix
transfix force-pushed the feature/distributed-state-session branch from f2b5194 to b41475f Compare May 22, 2026 20:34
@transfix
transfix merged commit c297c8a into master May 22, 2026
13 checks passed
@transfix
transfix deleted the feature/distributed-state-session branch May 22, 2026 21:07
transfix added a commit that referenced this pull request Sep 22, 2026
#402 added the sim_world internal base nav_stats collector + its pycvc bindings
(nav_sim_world_begin_nav_stats / nav_sim_world_nav_stats) to bindings/pycvc/pycvc_nav.i.
Bump the core pycvc column recipes so the resolver republishes/picks up the rebuilt
pycvc (3.4.0+cvc.2) that carries the new symbols — unblocking grl-snam PR #86
(NativeSimWorld base-stats collection), which gates on HAS_SIM_WORLD_NAVSTATS.

Core columns only (pycvc-cp311/312/313 + pycvc-cp311-cuda); the pycvc-gl columns wrap
cvcGL (CVC_BUILD_PYCVC_GL) and don't include pycvc_nav.i, so they're unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant