photoncloud-monorepo/flaredb/specs/003-kvs-consistency/contracts/kv_cas.md
centra 8f94aee1fa Fix R8: Convert submodule gitlinks to regular directories
- Remove gitlinks (160000 mode) for chainfire, flaredb, iam
- Add workspace contents as regular tracked files
- Update flake.nix to use simple paths instead of builtins.fetchGit

This resolves the nix build failure where submodule directories
appeared empty in the nix store.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-09 16:51:20 +09:00

29 lines
907 B
Markdown

# KvCas contracts (strong consistency)
## CompareAndSwap
- **RPC**: `kvrpc.KvCas/CompareAndSwap`
- **Request**:
- `namespace: string` (empty => `default`)
- `key: bytes`
- `value: bytes`
- `expected_version: uint64`
- **Response**:
- `success: bool`
- `current_version: uint64`
- `new_version: uint64`
- **Semantics**:
- Allowed only for `strong` namespaces; returns `FailedPrecondition` otherwise or when not leader (redirect required).
- Proposes via Raft; state machine applies with LWW timestamp wrapper.
## Get
- **RPC**: `kvrpc.KvCas/Get`
- **Request**:
- `namespace: string` (empty => `default`)
- `key: bytes`
- **Response**:
- `found: bool`
- `value: bytes`
- `version: uint64`
- **Semantics**:
- Allowed only for `strong` namespaces; returns `FailedPrecondition` if not leader.
- Reads versioned value (timestamp-prefixed) and returns decoded value plus version.