diff options
Diffstat (limited to 'examples/lib-dfscq-log/src/main2.rs')
-rw-r--r-- | examples/lib-dfscq-log/src/main2.rs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/examples/lib-dfscq-log/src/main2.rs b/examples/lib-dfscq-log/src/main2.rs new file mode 100644 index 0000000..9db235d --- /dev/null +++ b/examples/lib-dfscq-log/src/main2.rs | |||
@@ -0,0 +1,61 @@ | |||
1 | fn main() { | ||
2 | let solver = Solver::new(); | ||
3 | let output = Output::new(); | ||
4 | |||
5 | let blue_transaction_len = 5; | ||
6 | |||
7 | let blue_block = Block::builder().color(blue); | ||
8 | let dark_gray_block = Block::builder().color(dark_gray); | ||
9 | |||
10 | let log_layer = Layer::builder() | ||
11 | .name("LogAPI") | ||
12 | .push_entry( | ||
13 | Entry::builder() | ||
14 | .label("activeTxn: ") | ||
15 | .content( | ||
16 | Blocks::builder() | ||
17 | .push(blue_transaction_len, blue_block.build()) | ||
18 | .build(), | ||
19 | ) | ||
20 | .build(), | ||
21 | ) | ||
22 | .build(); | ||
23 | |||
24 | let other_transactions = [2, 7, 4]; | ||
25 | |||
26 | let group_commit_layer = Layer::builder() | ||
27 | .name("GroupCommit") | ||
28 | .push_entry( | ||
29 | Entry::builder() | ||
30 | .label("commitedTxn: ") | ||
31 | .content( | ||
32 | BlockList::builder() | ||
33 | .append( | ||
34 | other_transactions | ||
35 | .iter() | ||
36 | // TODO: need collect? | ||
37 | .map(|len| Blocks::builder().push(len, dark_gray_block.build())), | ||
38 | ) | ||
39 | .push(Blocks::builder().push(blue_transaction_len, blue_block.build())) | ||
40 | .build(), | ||
41 | ) | ||
42 | .build(), | ||
43 | ) | ||
44 | .build(); | ||
45 | |||
46 | let disk_log_layer = todo!(); | ||
47 | |||
48 | let applier_layer = todo!(); | ||
49 | |||
50 | let layers = &[ | ||
51 | &log_layer, | ||
52 | &group_commit_layer, | ||
53 | &disk_log_layer, | ||
54 | &applier_layer, | ||
55 | ]; | ||
56 | constraints::distribute_vertically(solver, layers); | ||
57 | constraints::align_left(solver, layers); | ||
58 | |||
59 | solver.solve(); | ||
60 | output.write_to_stdout(Output::Format::SVG); | ||
61 | } | ||