madsim-rs / madsim

Magical Deterministic Simulator for distributed systems in Rust.
Apache License 2.0
644 stars 46 forks source link

feat(etcd): support load and dump #93

Closed wangrunji0408 closed 1 year ago

wangrunji0408 commented 1 year ago

This PR introduces Client::dump() and SimServer::load() function to dump and load etcd data. The data would be dumped in pretty json format, in which bytes are encoded in Rust ascii escape format to make it human-readable.

Example dump data:

{
  "revision": 516,
  "kv": {
    "cf/meta/leader": "\\n\\x0c0.0.0.0:5690",
  },
  "lease": {}
}