car-state 0.1.1

State store for Common Agent Runtime
Documentation

car-state

Thread-safe state store for the Common Agent Runtime.

What it does

A key-value state store where every mutation produces a StateTransition record for audit and replay. Supports snapshots and restore for rollback. Uses parking_lot::Mutex for low-overhead concurrent access.

Usage

use car_state::StateStore;
use serde_json::Value;

let store = StateStore::new();
store.set("auth", Value::Bool(true), "action-1");
assert_eq!(store.get("auth"), Some(Value::Bool(true)));

let snap = store.snapshot();
store.set("temp", Value::from(42), "action-2");
store.restore(snap, 1); // rollback

Part of CAR -- see the main repo for full documentation.