This is an automated email from the ASF dual-hosted git repository.
zyxxoo pushed a commit to branch refactor/rust-rewrite-design
in repository https://gitbox.apache.org/repos/asf/hugegraph.git
The following commit(s) were added to refs/heads/refactor/rust-rewrite-design
by this push:
new 0b2a51ebb test(oracle): add reproducible http history capture
0b2a51ebb is described below
commit 0b2a51ebb848229b11d99c2ef348e18f1d301e02
Author: vaughn <[email protected]>
AuthorDate: Sun Sep 13 15:58:01 2026 +0800
test(oracle): add reproducible http history capture
---
tools/raft-linearizability/capture_history.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/raft-linearizability/capture_history.py
b/tools/raft-linearizability/capture_history.py
new file mode 100755
index 000000000..f41a5470a
--- /dev/null
+++ b/tools/raft-linearizability/capture_history.py
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+"""Capture a small register history from an HTTP endpoint."""
+import argparse, json, time, urllib.request
+
+def main():
+ ap=argparse.ArgumentParser(); ap.add_argument('url');
ap.add_argument('--value',type=int,default=1);
ap.add_argument('--output',required=True); a=ap.parse_args()
+ ops=[]
+ def call(op, value=None):
+ ident=f'op-{len(ops)+1}'; start=time.monotonic_ns()
+ req=urllib.request.Request(a.url, method='GET' if op=='read' else
'POST', data=None if op=='read' else json.dumps({'value':value}).encode(),
headers={'Content-Type':'application/json'})
+ try:
+ with urllib.request.urlopen(req, timeout=10) as r:
body=r.read().decode(); observed=value if op=='write' else
json.loads(body).get('value')
+ finally: end=time.monotonic_ns()
+
ops.append({'id':ident,'op':op,'value':observed,'start':start,'end':end})
+ call('write', a.value); call('read')
+ with open(a.output,'w',encoding='utf-8') as f: json.dump(ops,f,indent=2)
+if __name__=='__main__': main()