ac-distributed-state-and-replication
Keeping copies of data consistent when there is more than one copy: replication topologies and what each promises, read replicas and their staleness, leader election and split-brain prevention, quorum reads and writes and the arithmetic of their overlap, vector clocks and conflict detection, CRDTs and conflict-free merges, read-your-writes and session guarantees, and the written replication record. It explains the guarantees a replicated store can and cannot give; it never recommends a database product and never promises a consistency level. Use when asking "read replica", "replication lag", "split brain", "leader election", "quorum", "vector clock", "CRDT", "read your writes", "eventual consistency", "write conflict", "why did my write disappear", "stale read". Not for cache correctness and TTL choices (ac-caching-and-invalidation), not for schema migrations and backfills (ac-database-changes), not for event delivery between services (ac-event-driven-architecture).
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- ac-distributed-state-and-replication
- status
- seedling
- license
- MIT
- metadata
- { "domain": "software-engineering" }
- description
- Keeping copies of data consistent when there is more than one copy: replication topologies and what each promises, read replicas and their staleness, leader election and split-brain prevention, quorum reads and writes and the arithmetic of their overlap, vector clocks and conflict detection, CRDTs and conflict-free merges, read-your-writes and session guarantees, and the written replication record. It explains the guarantees a replicated store can and cannot give; it never recommends a database product and never promises a consistency level. Use when asking "read replica", "replication lag", "split brain", "leader election", "quorum", "vector clock", "CRDT", "read your writes", "eventual consistency", "write conflict", "why did my write disappear", "stale read". Not for cache correctness and TTL choices (ac-caching-and-invalidation), not for schema migrations and backfills (ac-database-changes), not for event delivery between services (ac-event-driven-architecture).
02 资源文件 11
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md392 B
- 参考文档subskills/crdts-and-merge.md3.0 KB
- 参考文档subskills/leader-election-and-split-brain.md3.0 KB
- 参考文档subskills/quorum-arithmetic.md3.0 KB
- 参考文档subskills/read-replicas-and-staleness.md3.2 KB
- 参考文档subskills/replication-record.md3.1 KB
- 参考文档subskills/replication-topologies.md3.1 KB
- 参考文档subskills/session-guarantees.md3.0 KB
- 参考文档subskills/vector-clocks-and-conflicts.md3.1 KB
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Distributed state and replication
Overview
Replication is keeping more than one copy of the same data, and every replication decision is a trade between consistency, availability, and latency — pick two at the replica level and the third degrades. The skill is knowing which guarantee your application actually needs, because the strongest one is the most expensive, and most applications do not need it for most operations.
This skill covers the mechanics: primary-replica versus multi-leader versus quorum topologies, the staleness a read replica carries and how to bound it, how leaders are elected and how split brain is prevented (or fails to be), the quorum arithmetic that makes reads and writes overlap, vector clocks and version vectors as conflict detectors, CRDTs as merges that cannot conflict, and the session guarantees that give a user their own writes back. Caching correctness is a different skill; so are migrations and event delivery.
Primary sources: https://jepsen.io/ and https://martinfowler.com/.
When to use
- When choosing or configuring a replication topology for a data store.
- When a read must see a recent write and the data is replicated.
- When more than one writer can accept writes for the same key.
- When a failover plan has to state what happens during and after.
When NOT to use
- For cache keys, TTL choices, and invalidation design (use ac-caching-and-invalidation).
- For schema changes, migration runners, and backfills (use ac-database-changes).
- For event delivery between services and consumer lag (use ac-event-driven-architecture).
Subskill Index
| Leaf | Domain segment | Scope (one line) |
|---|---|---|
subskills/replication-topologies.md |
software-engineering/replication-topologies |
Primary-replica, multi-leader, and leaderless; what each can promise. |
subskills/read-replicas-and-staleness.md |
software-engineering/read-replicas-and-staleness |
Replica lag, its causes, and bounding how far behind a read can be. |
subskills/leader-election-and-split-brain.md |
software-engineering/leader-election-and-split-brain |
Choosing a leader, fencing old ones, and the failure that is two. |
subskills/quorum-arithmetic.md |
software-engineering/quorum-arithmetic |
Read and write quorums, the overlap that makes them intersect, and the arithmetic of staleness. |
subskills/vector-clocks-and-conflicts.md |
software-engineering/vector-clocks-and-conflicts |
Detecting concurrent writes and what the detection costs. |
subskills/crdts-and-merge.md |
software-engineering/crdts-and-merge |
Data types whose merges cannot conflict, and their limits. |
subskills/session-guarantees.md |
software-engineering/session-guarantees |
Monotonic reads, read-your-writes, and routing a session to the right replica. |
subskills/replication-record.md |
software-engineering/replication-record |
The written record: topology, guarantees chosen, failover plan, and measured lag. |
Status and honest limits
Consistency guarantees are enforced by the store's implementation, not by intent, and implementations fail their own documentation — consistency under partitions and failures is an empirical property, verified by testing, not read off a feature list. Nothing here recommends a product, and a topology choice made without stating which operations need which guarantee is a choice made blind.
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.