1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! `tokio`-runtime-backed [`Executor`] for the journaled history MMR.
//!
//! Layered identically to the executor introduced for transport-enc
//! Phase 2 (issue #156) but kept inside `mkit-core::history` so the
//! `history-mmr` feature is self-contained — consumers don't need to
//! depend on `mkit-transport-enc` just to persist commit history.
//!
//! ## Threading and `block_on`
//!
//! [`TokioExecutor`] wraps a long-lived [`Arc<tokio::runtime::Runtime>`].
//! Its `block_on` calls [`tokio::runtime::Handle::block_on`] on the
//! wrapped runtime. This is safe from any thread that is **not**
//! itself a tokio worker on the same runtime — synchronous mkit code
//! paths (`refs::update_ref`, the CLI's commit loop) are fine, but
//! calling `block_on` from inside a `runtime.spawn()` task on this
//! runtime would panic. The history module never spawns tasks of its
//! own onto this runtime, so the constraint is purely about external
//! callers.
use Arc;
use crateExecutor;
/// `Arc`-shared sync/async bridge for the journaled history MMR.
///
/// Wraps an owned `Arc<tokio::runtime::Runtime>`. The runtime survives
/// for as long as any `TokioExecutor` clone is held, which means a
/// single [`crate::history::CommitHistory`] holding one executor keeps
/// the runtime alive for every `append` / `prove` / `root` call in its
/// lifetime.