deltatrace-deterministic-re.../deltatrace/cli.py

20 lines
572 B
Python

"""Simple CLI to exercise deterministic replay of a toy delta-stream."""
import json
from deltatrace.replay import DeterministicReplayEngine
def main():
# Toy delta stream: two events with same timestamp to verify deterministic ordering
delta_stream = [
{"id": "e2", "type": "OrderEvent", "timestamp": 1.0, "payload": {}},
{"id": "e1", "type": "LocalEvent", "timestamp": 1.0, "payload": {}},
]
eng = DeterministicReplayEngine(delta_stream)
out = eng.run()
print(json.dumps(out, indent=2))
if __name__ == "__main__":
main()