@@ -46,15 +46,24 @@ impl gasket::framework::Worker<Stage> for Worker {
46
46
let template = match unit {
47
47
ChainEvent :: Apply ( p, r) => {
48
48
let data = hbs_data ( p. clone ( ) , Some ( r. clone ( ) ) ) ;
49
- stage. templates . render ( "apply" , & data)
49
+ match r {
50
+ Record :: CborBlock ( _) => stage. templates . render ( "apply_cbor_block" , & data) ,
51
+ Record :: CborTx ( _) => stage. templates . render ( "apply_cbor_tx" , & data) ,
52
+ _ => stage. templates . render ( "apply" , & data) ,
53
+ }
50
54
}
51
55
ChainEvent :: Undo ( p, r) => {
52
56
let data = hbs_data ( p. clone ( ) , Some ( r. clone ( ) ) ) ;
53
- stage. templates . render ( "undo" , & data)
57
+ match r {
58
+ Record :: CborBlock ( _) => stage. templates . render ( "undo_cbor_block" , & data) ,
59
+ Record :: CborTx ( _) => stage. templates . render ( "undo_cbor_tx" , & data) ,
60
+ _ => stage. templates . render ( "undo" , & data) ,
61
+ }
54
62
}
55
63
ChainEvent :: Reset ( p) => {
56
64
let data = hbs_data ( p. clone ( ) , None ) ;
57
- stage. templates . render ( "reset" , & data)
65
+ stage. templates . render ( "reset_cbor_block" , & data) . ok ( ) ;
66
+ stage. templates . render ( "reset_cbor_tx" , & data)
58
67
}
59
68
} ;
60
69
@@ -91,9 +100,12 @@ pub struct Stage {
91
100
pub struct Config {
92
101
/// eg: sqlite::memory:
93
102
pub connection : String ,
94
- pub apply_template : String ,
95
- pub undo_template : String ,
96
- pub reset_template : String ,
103
+ pub apply_cbor_block_template : String ,
104
+ pub undo_cbor_block_template : String ,
105
+ pub apply_cbor_tx_template : String ,
106
+ pub undo_cbor_tx_template : String ,
107
+ pub reset_cbor_block_template : String ,
108
+ pub reset_cbor_tx_template : String ,
97
109
}
98
110
99
111
impl Config {
@@ -103,15 +115,27 @@ impl Config {
103
115
let mut templates = handlebars:: Handlebars :: new ( ) ;
104
116
105
117
templates
106
- . register_template_string ( "apply " , & self . apply_template )
118
+ . register_template_string ( "apply_cbor_block " , & self . apply_cbor_block_template )
107
119
. map_err ( Error :: config) ?;
108
120
109
121
templates
110
- . register_template_string ( "undo " , & self . undo_template )
122
+ . register_template_string ( "undo_cbor_block " , & self . undo_cbor_block_template )
111
123
. map_err ( Error :: config) ?;
112
124
113
125
templates
114
- . register_template_string ( "reset" , & self . reset_template )
126
+ . register_template_string ( "apply_cbor_tx" , & self . apply_cbor_tx_template )
127
+ . map_err ( Error :: config) ?;
128
+
129
+ templates
130
+ . register_template_string ( "undo_cbor_tx" , & self . undo_cbor_tx_template )
131
+ . map_err ( Error :: config) ?;
132
+
133
+ templates
134
+ . register_template_string ( "reset_cbor_block" , & self . reset_cbor_block_template )
135
+ . map_err ( Error :: config) ?;
136
+
137
+ templates
138
+ . register_template_string ( "reset_cbor_tx" , & self . reset_cbor_tx_template )
115
139
. map_err ( Error :: config) ?;
116
140
117
141
let stage = Stage {
0 commit comments