Commit 656cf7b
authored
refactoring TxnEvent to support callback data and return error with callback function (ISCP integration Step 1) (#22596)
### **User description**
## What type of PR is this?
- [ ] API-change
- [ ] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [x] Code Refactoring
## Which issue(s) this PR fixes:
issue #22595
## What this PR does / why we need it:
refactoring txnevent
___
### **PR Type**
Enhancement
___
### **Description**
- Refactor TxnEvent callback system to support error handling
- Add context parameter to all callback functions
- Replace simple function callbacks with TxnEventCallback struct
- Update all callback registrations across services
___
### Diagram Walkthrough
```mermaid
flowchart LR
A["Old Callback System"] --> B["TxnEventCallback Struct"]
B --> C["Error Handling Support"]
B --> D["Context Parameter"]
C --> E["Service Updates"]
D --> E
```
<details> <summary><h3> File Walkthrough</h3></summary>
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><details><summary>9
files</summary><table>
<tr>
<td><strong>service_test.go</strong><dd><code>Update test mock callback
signature</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-1545c670565109e9085a67dbb7f5a2282ecc827539c27f35c7e873f086400b12">+1/-1</a>
</td>
</tr>
<tr>
<td><strong>engine_mock.go</strong><dd><code>Update mock method
signatures and parameters</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-7f25d270cc6d85f3c1655194a9dd2493991b59c88f63be8bf658e28360dd398a">+22/-20</a>
</td>
</tr>
<tr>
<td><strong>txn_mock.go</strong><dd><code>Update mock TxnOperator
callback signature</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-68e826bd15c3f0b74a031fad521dfb4ed97d3d9a22a29d40d0e1372c814dc646">+1/-1</a>
</td>
</tr>
<tr>
<td><strong>txn_test.go</strong><dd><code>Update test TxnOperator
callback signature</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-a62be3f347c14388335d2c9f5215f4cc4047061478716e92a7ff2008746667af">+1/-1</a>
</td>
</tr>
<tr>
<td><strong>store_sql_test.go</strong><dd><code>Update test callback
signature</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-7be9152998e4522d6fdd16ff7a5f3eefee803a694058c564957fd1ddc935017f">+1/-1</a>
</td>
</tr>
<tr>
<td><strong>storage_test.go</strong><dd><code>Refactor test callbacks
with error handling</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-63b189c4aababc87abb2af810b34dc7a30186c06fa339dc1b0c89c1ba540baf3">+24/-20</a>
</td>
</tr>
<tr>
<td><strong>storage_test.go</strong><dd><code>Update test storage
callbacks</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-da396b17f40cc6b15087240192c7f3f90448da0512eab47ff78b9cba0372d4ca">+20/-16</a>
</td>
</tr>
<tr>
<td><strong>operator_events_test.go</strong><dd><code>Update test with
new callback structure</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-de84152fc282697406e741e8fb983e52f1d11ac349071a4a6efe03eddfed3624">+6/-3</a>
</td>
</tr>
<tr>
<td><strong>entire_engine_test.go</strong><dd><code>Update test operator
callback signature</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-1e6781313efa2d3f2c37c97bcc6e8f3cf63d5af77cf95536e506e548d126be55">+1/-1</a>
</td>
</tr>
</table></details></td></tr><tr><td><strong>Enhancement</strong></td><td><details><summary>10
files</summary><table>
<tr>
<td><strong>service.go</strong><dd><code>Update callback registration
with new wrapper</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-720e966f9f67df5a9aa7a53b758545f61570d432058f4cebe0421da898eac954">+4/-3</a>
</td>
</tr>
<tr>
<td><strong>store_mem.go</strong><dd><code>Refactor callback to return
error and accept context</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-d45949e111d7a1330d3efe078395b2e8fb90a9607b05fd2a5d75c4dcb6656471">+12/-10</a>
</td>
</tr>
<tr>
<td><strong>service.go</strong><dd><code>Update callback with error
handling support</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-88d584535426969228aa47bd0449a801cc45faadb922595fa8493f7f13d7b495">+7/-5</a>
</td>
</tr>
<tr>
<td><strong>service.go</strong><dd><code>Update service callbacks with
new structure</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-013c985deca4c0e8533c2d68bc956730ca890c3181430ee095454481f55dce32">+26/-22</a>
</td>
</tr>
<tr>
<td><strong>client.go</strong><dd><code>Update client callback
registration and handlers</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-f4f177db5c0c25f4d24f1aced66ebcc38f7b0589ea867e55022a096211ff1565">+11/-5</a>
</td>
</tr>
<tr>
<td><strong>operator.go</strong><dd><code>Core refactoring of callback
system implementation</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-43f44107ace02cc2170c3138f30bd1e0ba258be040543c7e43e3a49b89d67c99">+37/-17</a>
</td>
</tr>
<tr>
<td><strong>operator_events.go</strong><dd><code>Implement new callback
structure and error handling</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-d466c303cce94e5a172125a9733d6e3075a6f8ec03fe6e8dbfd242878c486fb5">+11/-6</a>
</td>
</tr>
<tr>
<td><strong>types.go</strong><dd><code>Define TxnEventCallback struct
and helper functions</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-04dd5377bb096d114087521ac2b2f926bbe80f0459b98e1bb1d5a2774282b08a">+18/-1</a>
</td>
</tr>
<tr>
<td><strong>storage_txn_client.go</strong><dd><code>Update storage
callback signature</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-f3de47afbf03f0313e955d1981e7739483e2583ab25715940cbd860078c45d6a">+1/-1</a>
</td>
</tr>
<tr>
<td><strong>service_txn_event.go</strong><dd><code>Update trace service
callbacks with error handling</code>
</dd></td>
<td><a
href="https://github.com/matrixorigin/matrixone/pull/22596/files#diff-ccd9582830fcde4b37f16f52bfc51a3b6e5c88a5f9c3afdb63c45ba57ab873a3">+26/-20</a>
</td>
</tr>
</table></details></td></tr></tr></tbody></table>
</details>
___1 parent ffe9351 commit 656cf7b
File tree
18 files changed
+225
-148
lines changed- pkg
- bootstrap
- frontend
- test
- incrservice
- partitionservice
- shardservice
- txn
- client
- storage/memorystorage
- trace
- vm/engine
18 files changed
+225
-148
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
931 | 931 | | |
932 | 932 | | |
933 | 933 | | |
934 | | - | |
| 934 | + | |
935 | 935 | | |
936 | 936 | | |
937 | 937 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| |||
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
348 | | - | |
| 348 | + | |
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
354 | 355 | | |
355 | 356 | | |
356 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
72 | | - | |
73 | | - | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
| 288 | + | |
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | | - | |
129 | | - | |
130 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
157 | | - | |
158 | | - | |
159 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
160 | 163 | | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
166 | 170 | | |
167 | 171 | | |
168 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
199 | 201 | | |
200 | 202 | | |
201 | 203 | | |
| |||
220 | 222 | | |
221 | 223 | | |
222 | 224 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
129 | | - | |
130 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
131 | 132 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
161 | | - | |
162 | | - | |
163 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
164 | 167 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
170 | 174 | | |
171 | 175 | | |
172 | 176 | | |
| |||
0 commit comments