├── Cargo.lock
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── build.rs
├── proto
└── orderbook.proto
└── src
├── bin
├── grpc_client.rs
└── grpc_server.rs
├── constants.rs
├── error.rs
├── feed.rs
├── feed
├── client.rs
├── client
│ ├── tls.rs
│ └── ws.rs
├── listener.rs
├── listener
│ ├── orderbook_snap_change_forwarder.rs
│ └── orderbook_snap_change_forwarder
│ │ ├── binance.rs
│ │ └── bitstamp.rs
├── listener_aggregator.rs
├── listener_aggregator
│ └── top_bbo.rs
├── subscriber.rs
└── subscriber
│ ├── ws.rs
│ └── ws
│ ├── binance.rs
│ └── bitstamp.rs
├── lib.rs
├── service.rs
├── service
├── grpc.rs
└── grpc
│ └── orderbook_aggregator.rs
├── types.rs
└── util.rs
/Cargo.lock:
--------------------------------------------------------------------------------
1 | # This file is automatically @generated by Cargo.
2 | # It is not intended for manual editing.
3 | version = 3
4 |
5 | [[package]]
6 | name = "ahash"
7 | version = "0.7.6"
8 | source = "registry+https://github.com/rust-lang/crates.io-index"
9 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
10 | dependencies = [
11 | "getrandom",
12 | "once_cell",
13 | "version_check",
14 | ]
15 |
16 | [[package]]
17 | name = "anes"
18 | version = "0.1.6"
19 | source = "registry+https://github.com/rust-lang/crates.io-index"
20 | checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299"
21 |
22 | [[package]]
23 | name = "anstream"
24 | version = "0.3.2"
25 | source = "registry+https://github.com/rust-lang/crates.io-index"
26 | checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
27 | dependencies = [
28 | "anstyle",
29 | "anstyle-parse",
30 | "anstyle-query",
31 | "anstyle-wincon",
32 | "colorchoice",
33 | "is-terminal",
34 | "utf8parse",
35 | ]
36 |
37 | [[package]]
38 | name = "anstyle"
39 | version = "1.0.0"
40 | source = "registry+https://github.com/rust-lang/crates.io-index"
41 | checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
42 |
43 | [[package]]
44 | name = "anstyle-parse"
45 | version = "0.2.0"
46 | source = "registry+https://github.com/rust-lang/crates.io-index"
47 | checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
48 | dependencies = [
49 | "utf8parse",
50 | ]
51 |
52 | [[package]]
53 | name = "anstyle-query"
54 | version = "1.0.0"
55 | source = "registry+https://github.com/rust-lang/crates.io-index"
56 | checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
57 | dependencies = [
58 | "windows-sys",
59 | ]
60 |
61 | [[package]]
62 | name = "anstyle-wincon"
63 | version = "1.0.1"
64 | source = "registry+https://github.com/rust-lang/crates.io-index"
65 | checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
66 | dependencies = [
67 | "anstyle",
68 | "windows-sys",
69 | ]
70 |
71 | [[package]]
72 | name = "anyhow"
73 | version = "1.0.71"
74 | source = "registry+https://github.com/rust-lang/crates.io-index"
75 | checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
76 |
77 | [[package]]
78 | name = "arrayvec"
79 | version = "0.7.4"
80 | source = "registry+https://github.com/rust-lang/crates.io-index"
81 | checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
82 |
83 | [[package]]
84 | name = "async-stream"
85 | version = "0.3.5"
86 | source = "registry+https://github.com/rust-lang/crates.io-index"
87 | checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
88 | dependencies = [
89 | "async-stream-impl",
90 | "futures-core",
91 | "pin-project-lite",
92 | ]
93 |
94 | [[package]]
95 | name = "async-stream-impl"
96 | version = "0.3.5"
97 | source = "registry+https://github.com/rust-lang/crates.io-index"
98 | checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
99 | dependencies = [
100 | "proc-macro2",
101 | "quote",
102 | "syn 2.0.18",
103 | ]
104 |
105 | [[package]]
106 | name = "async-trait"
107 | version = "0.1.68"
108 | source = "registry+https://github.com/rust-lang/crates.io-index"
109 | checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842"
110 | dependencies = [
111 | "proc-macro2",
112 | "quote",
113 | "syn 2.0.18",
114 | ]
115 |
116 | [[package]]
117 | name = "atty"
118 | version = "0.2.14"
119 | source = "registry+https://github.com/rust-lang/crates.io-index"
120 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
121 | dependencies = [
122 | "hermit-abi 0.1.19",
123 | "libc",
124 | "winapi",
125 | ]
126 |
127 | [[package]]
128 | name = "autocfg"
129 | version = "1.1.0"
130 | source = "registry+https://github.com/rust-lang/crates.io-index"
131 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
132 |
133 | [[package]]
134 | name = "axum"
135 | version = "0.6.18"
136 | source = "registry+https://github.com/rust-lang/crates.io-index"
137 | checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39"
138 | dependencies = [
139 | "async-trait",
140 | "axum-core",
141 | "bitflags",
142 | "bytes",
143 | "futures-util",
144 | "http",
145 | "http-body",
146 | "hyper",
147 | "itoa",
148 | "matchit",
149 | "memchr",
150 | "mime",
151 | "percent-encoding",
152 | "pin-project-lite",
153 | "rustversion",
154 | "serde",
155 | "sync_wrapper",
156 | "tower",
157 | "tower-layer",
158 | "tower-service",
159 | ]
160 |
161 | [[package]]
162 | name = "axum-core"
163 | version = "0.3.4"
164 | source = "registry+https://github.com/rust-lang/crates.io-index"
165 | checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c"
166 | dependencies = [
167 | "async-trait",
168 | "bytes",
169 | "futures-util",
170 | "http",
171 | "http-body",
172 | "mime",
173 | "rustversion",
174 | "tower-layer",
175 | "tower-service",
176 | ]
177 |
178 | [[package]]
179 | name = "base64"
180 | version = "0.21.2"
181 | source = "registry+https://github.com/rust-lang/crates.io-index"
182 | checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d"
183 |
184 | [[package]]
185 | name = "bitflags"
186 | version = "1.3.2"
187 | source = "registry+https://github.com/rust-lang/crates.io-index"
188 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
189 |
190 | [[package]]
191 | name = "bitvec"
192 | version = "1.0.1"
193 | source = "registry+https://github.com/rust-lang/crates.io-index"
194 | checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
195 | dependencies = [
196 | "funty",
197 | "radium",
198 | "tap",
199 | "wyz",
200 | ]
201 |
202 | [[package]]
203 | name = "block-buffer"
204 | version = "0.10.4"
205 | source = "registry+https://github.com/rust-lang/crates.io-index"
206 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
207 | dependencies = [
208 | "generic-array",
209 | ]
210 |
211 | [[package]]
212 | name = "borsh"
213 | version = "0.10.3"
214 | source = "registry+https://github.com/rust-lang/crates.io-index"
215 | checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b"
216 | dependencies = [
217 | "borsh-derive",
218 | "hashbrown",
219 | ]
220 |
221 | [[package]]
222 | name = "borsh-derive"
223 | version = "0.10.3"
224 | source = "registry+https://github.com/rust-lang/crates.io-index"
225 | checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7"
226 | dependencies = [
227 | "borsh-derive-internal",
228 | "borsh-schema-derive-internal",
229 | "proc-macro-crate",
230 | "proc-macro2",
231 | "syn 1.0.109",
232 | ]
233 |
234 | [[package]]
235 | name = "borsh-derive-internal"
236 | version = "0.10.3"
237 | source = "registry+https://github.com/rust-lang/crates.io-index"
238 | checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb"
239 | dependencies = [
240 | "proc-macro2",
241 | "quote",
242 | "syn 1.0.109",
243 | ]
244 |
245 | [[package]]
246 | name = "borsh-schema-derive-internal"
247 | version = "0.10.3"
248 | source = "registry+https://github.com/rust-lang/crates.io-index"
249 | checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd"
250 | dependencies = [
251 | "proc-macro2",
252 | "quote",
253 | "syn 1.0.109",
254 | ]
255 |
256 | [[package]]
257 | name = "bumpalo"
258 | version = "3.13.0"
259 | source = "registry+https://github.com/rust-lang/crates.io-index"
260 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1"
261 |
262 | [[package]]
263 | name = "bytecheck"
264 | version = "0.6.11"
265 | source = "registry+https://github.com/rust-lang/crates.io-index"
266 | checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627"
267 | dependencies = [
268 | "bytecheck_derive",
269 | "ptr_meta",
270 | "simdutf8",
271 | ]
272 |
273 | [[package]]
274 | name = "bytecheck_derive"
275 | version = "0.6.11"
276 | source = "registry+https://github.com/rust-lang/crates.io-index"
277 | checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61"
278 | dependencies = [
279 | "proc-macro2",
280 | "quote",
281 | "syn 1.0.109",
282 | ]
283 |
284 | [[package]]
285 | name = "byteorder"
286 | version = "1.4.3"
287 | source = "registry+https://github.com/rust-lang/crates.io-index"
288 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
289 |
290 | [[package]]
291 | name = "bytes"
292 | version = "1.4.0"
293 | source = "registry+https://github.com/rust-lang/crates.io-index"
294 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
295 |
296 | [[package]]
297 | name = "cast"
298 | version = "0.3.0"
299 | source = "registry+https://github.com/rust-lang/crates.io-index"
300 | checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
301 |
302 | [[package]]
303 | name = "cc"
304 | version = "1.0.79"
305 | source = "registry+https://github.com/rust-lang/crates.io-index"
306 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
307 |
308 | [[package]]
309 | name = "cfg-if"
310 | version = "1.0.0"
311 | source = "registry+https://github.com/rust-lang/crates.io-index"
312 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
313 |
314 | [[package]]
315 | name = "ciborium"
316 | version = "0.2.1"
317 | source = "registry+https://github.com/rust-lang/crates.io-index"
318 | checksum = "effd91f6c78e5a4ace8a5d3c0b6bfaec9e2baaef55f3efc00e45fb2e477ee926"
319 | dependencies = [
320 | "ciborium-io",
321 | "ciborium-ll",
322 | "serde",
323 | ]
324 |
325 | [[package]]
326 | name = "ciborium-io"
327 | version = "0.2.1"
328 | source = "registry+https://github.com/rust-lang/crates.io-index"
329 | checksum = "cdf919175532b369853f5d5e20b26b43112613fd6fe7aee757e35f7a44642656"
330 |
331 | [[package]]
332 | name = "ciborium-ll"
333 | version = "0.2.1"
334 | source = "registry+https://github.com/rust-lang/crates.io-index"
335 | checksum = "defaa24ecc093c77630e6c15e17c51f5e187bf35ee514f4e2d67baaa96dae22b"
336 | dependencies = [
337 | "ciborium-io",
338 | "half",
339 | ]
340 |
341 | [[package]]
342 | name = "clap"
343 | version = "3.2.25"
344 | source = "registry+https://github.com/rust-lang/crates.io-index"
345 | checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
346 | dependencies = [
347 | "bitflags",
348 | "clap_lex 0.2.4",
349 | "indexmap",
350 | "textwrap",
351 | ]
352 |
353 | [[package]]
354 | name = "clap"
355 | version = "4.3.3"
356 | source = "registry+https://github.com/rust-lang/crates.io-index"
357 | checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0"
358 | dependencies = [
359 | "clap_builder",
360 | "clap_derive",
361 | "once_cell",
362 | ]
363 |
364 | [[package]]
365 | name = "clap_builder"
366 | version = "4.3.3"
367 | source = "registry+https://github.com/rust-lang/crates.io-index"
368 | checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab"
369 | dependencies = [
370 | "anstream",
371 | "anstyle",
372 | "bitflags",
373 | "clap_lex 0.5.0",
374 | "strsim",
375 | ]
376 |
377 | [[package]]
378 | name = "clap_derive"
379 | version = "4.3.2"
380 | source = "registry+https://github.com/rust-lang/crates.io-index"
381 | checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f"
382 | dependencies = [
383 | "heck",
384 | "proc-macro2",
385 | "quote",
386 | "syn 2.0.18",
387 | ]
388 |
389 | [[package]]
390 | name = "clap_lex"
391 | version = "0.2.4"
392 | source = "registry+https://github.com/rust-lang/crates.io-index"
393 | checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
394 | dependencies = [
395 | "os_str_bytes",
396 | ]
397 |
398 | [[package]]
399 | name = "clap_lex"
400 | version = "0.5.0"
401 | source = "registry+https://github.com/rust-lang/crates.io-index"
402 | checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
403 |
404 | [[package]]
405 | name = "colorchoice"
406 | version = "1.0.0"
407 | source = "registry+https://github.com/rust-lang/crates.io-index"
408 | checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
409 |
410 | [[package]]
411 | name = "cpufeatures"
412 | version = "0.2.7"
413 | source = "registry+https://github.com/rust-lang/crates.io-index"
414 | checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58"
415 | dependencies = [
416 | "libc",
417 | ]
418 |
419 | [[package]]
420 | name = "criterion"
421 | version = "0.4.0"
422 | source = "registry+https://github.com/rust-lang/crates.io-index"
423 | checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb"
424 | dependencies = [
425 | "anes",
426 | "atty",
427 | "cast",
428 | "ciborium",
429 | "clap 3.2.25",
430 | "criterion-plot",
431 | "itertools",
432 | "lazy_static",
433 | "num-traits",
434 | "oorandom",
435 | "plotters",
436 | "rayon",
437 | "regex",
438 | "serde",
439 | "serde_derive",
440 | "serde_json",
441 | "tinytemplate",
442 | "walkdir",
443 | ]
444 |
445 | [[package]]
446 | name = "criterion-plot"
447 | version = "0.5.0"
448 | source = "registry+https://github.com/rust-lang/crates.io-index"
449 | checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1"
450 | dependencies = [
451 | "cast",
452 | "itertools",
453 | ]
454 |
455 | [[package]]
456 | name = "crossbeam-channel"
457 | version = "0.5.8"
458 | source = "registry+https://github.com/rust-lang/crates.io-index"
459 | checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200"
460 | dependencies = [
461 | "cfg-if",
462 | "crossbeam-utils",
463 | ]
464 |
465 | [[package]]
466 | name = "crossbeam-deque"
467 | version = "0.8.3"
468 | source = "registry+https://github.com/rust-lang/crates.io-index"
469 | checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
470 | dependencies = [
471 | "cfg-if",
472 | "crossbeam-epoch",
473 | "crossbeam-utils",
474 | ]
475 |
476 | [[package]]
477 | name = "crossbeam-epoch"
478 | version = "0.9.15"
479 | source = "registry+https://github.com/rust-lang/crates.io-index"
480 | checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
481 | dependencies = [
482 | "autocfg",
483 | "cfg-if",
484 | "crossbeam-utils",
485 | "memoffset",
486 | "scopeguard",
487 | ]
488 |
489 | [[package]]
490 | name = "crossbeam-utils"
491 | version = "0.8.16"
492 | source = "registry+https://github.com/rust-lang/crates.io-index"
493 | checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
494 | dependencies = [
495 | "cfg-if",
496 | ]
497 |
498 | [[package]]
499 | name = "crypto-common"
500 | version = "0.1.6"
501 | source = "registry+https://github.com/rust-lang/crates.io-index"
502 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
503 | dependencies = [
504 | "generic-array",
505 | "typenum",
506 | ]
507 |
508 | [[package]]
509 | name = "digest"
510 | version = "0.10.7"
511 | source = "registry+https://github.com/rust-lang/crates.io-index"
512 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
513 | dependencies = [
514 | "block-buffer",
515 | "crypto-common",
516 | ]
517 |
518 | [[package]]
519 | name = "dragonflybot"
520 | version = "0.1.0"
521 | dependencies = [
522 | "async-stream",
523 | "async-trait",
524 | "clap 4.3.3",
525 | "criterion",
526 | "error-stack",
527 | "fastwebsockets",
528 | "gjson",
529 | "hyper",
530 | "prost",
531 | "rust_decimal",
532 | "serde_json",
533 | "strum",
534 | "tikv-jemallocator",
535 | "tokio",
536 | "tokio-rustls",
537 | "tokio-stream",
538 | "tonic",
539 | "tonic-build",
540 | "tracing",
541 | "tracing-subscriber",
542 | "webpki-roots",
543 | ]
544 |
545 | [[package]]
546 | name = "either"
547 | version = "1.8.1"
548 | source = "registry+https://github.com/rust-lang/crates.io-index"
549 | checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
550 |
551 | [[package]]
552 | name = "errno"
553 | version = "0.3.1"
554 | source = "registry+https://github.com/rust-lang/crates.io-index"
555 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
556 | dependencies = [
557 | "errno-dragonfly",
558 | "libc",
559 | "windows-sys",
560 | ]
561 |
562 | [[package]]
563 | name = "errno-dragonfly"
564 | version = "0.1.2"
565 | source = "registry+https://github.com/rust-lang/crates.io-index"
566 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
567 | dependencies = [
568 | "cc",
569 | "libc",
570 | ]
571 |
572 | [[package]]
573 | name = "error-stack"
574 | version = "0.3.1"
575 | source = "registry+https://github.com/rust-lang/crates.io-index"
576 | checksum = "5f00447f331c7f726db5b8532ebc9163519eed03c6d7c8b73c90b3ff5646ac85"
577 | dependencies = [
578 | "anyhow",
579 | "rustc_version",
580 | ]
581 |
582 | [[package]]
583 | name = "fastrand"
584 | version = "1.9.0"
585 | source = "registry+https://github.com/rust-lang/crates.io-index"
586 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
587 | dependencies = [
588 | "instant",
589 | ]
590 |
591 | [[package]]
592 | name = "fastwebsockets"
593 | version = "0.4.2"
594 | source = "registry+https://github.com/rust-lang/crates.io-index"
595 | checksum = "4440d134c17a95fdfc10f3fc29eaeae0f678ed985cc46b7f5fd8b0e2d5c05be3"
596 | dependencies = [
597 | "base64",
598 | "hyper",
599 | "pin-project",
600 | "rand",
601 | "sha1",
602 | "simdutf8",
603 | "tokio",
604 | "utf-8",
605 | ]
606 |
607 | [[package]]
608 | name = "fixedbitset"
609 | version = "0.4.2"
610 | source = "registry+https://github.com/rust-lang/crates.io-index"
611 | checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
612 |
613 | [[package]]
614 | name = "fnv"
615 | version = "1.0.7"
616 | source = "registry+https://github.com/rust-lang/crates.io-index"
617 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
618 |
619 | [[package]]
620 | name = "funty"
621 | version = "2.0.0"
622 | source = "registry+https://github.com/rust-lang/crates.io-index"
623 | checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
624 |
625 | [[package]]
626 | name = "futures-channel"
627 | version = "0.3.28"
628 | source = "registry+https://github.com/rust-lang/crates.io-index"
629 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2"
630 | dependencies = [
631 | "futures-core",
632 | ]
633 |
634 | [[package]]
635 | name = "futures-core"
636 | version = "0.3.28"
637 | source = "registry+https://github.com/rust-lang/crates.io-index"
638 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c"
639 |
640 | [[package]]
641 | name = "futures-sink"
642 | version = "0.3.28"
643 | source = "registry+https://github.com/rust-lang/crates.io-index"
644 | checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e"
645 |
646 | [[package]]
647 | name = "futures-task"
648 | version = "0.3.28"
649 | source = "registry+https://github.com/rust-lang/crates.io-index"
650 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65"
651 |
652 | [[package]]
653 | name = "futures-util"
654 | version = "0.3.28"
655 | source = "registry+https://github.com/rust-lang/crates.io-index"
656 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533"
657 | dependencies = [
658 | "futures-core",
659 | "futures-task",
660 | "pin-project-lite",
661 | "pin-utils",
662 | ]
663 |
664 | [[package]]
665 | name = "generic-array"
666 | version = "0.14.7"
667 | source = "registry+https://github.com/rust-lang/crates.io-index"
668 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
669 | dependencies = [
670 | "typenum",
671 | "version_check",
672 | ]
673 |
674 | [[package]]
675 | name = "getrandom"
676 | version = "0.2.10"
677 | source = "registry+https://github.com/rust-lang/crates.io-index"
678 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427"
679 | dependencies = [
680 | "cfg-if",
681 | "libc",
682 | "wasi",
683 | ]
684 |
685 | [[package]]
686 | name = "gjson"
687 | version = "0.8.1"
688 | source = "registry+https://github.com/rust-lang/crates.io-index"
689 | checksum = "43503cc176394dd30a6525f5f36e838339b8b5619be33ed9a7783841580a97b6"
690 |
691 | [[package]]
692 | name = "h2"
693 | version = "0.3.19"
694 | source = "registry+https://github.com/rust-lang/crates.io-index"
695 | checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782"
696 | dependencies = [
697 | "bytes",
698 | "fnv",
699 | "futures-core",
700 | "futures-sink",
701 | "futures-util",
702 | "http",
703 | "indexmap",
704 | "slab",
705 | "tokio",
706 | "tokio-util",
707 | "tracing",
708 | ]
709 |
710 | [[package]]
711 | name = "half"
712 | version = "1.8.2"
713 | source = "registry+https://github.com/rust-lang/crates.io-index"
714 | checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
715 |
716 | [[package]]
717 | name = "hashbrown"
718 | version = "0.12.3"
719 | source = "registry+https://github.com/rust-lang/crates.io-index"
720 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
721 | dependencies = [
722 | "ahash",
723 | ]
724 |
725 | [[package]]
726 | name = "heck"
727 | version = "0.4.1"
728 | source = "registry+https://github.com/rust-lang/crates.io-index"
729 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
730 |
731 | [[package]]
732 | name = "hermit-abi"
733 | version = "0.1.19"
734 | source = "registry+https://github.com/rust-lang/crates.io-index"
735 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
736 | dependencies = [
737 | "libc",
738 | ]
739 |
740 | [[package]]
741 | name = "hermit-abi"
742 | version = "0.2.6"
743 | source = "registry+https://github.com/rust-lang/crates.io-index"
744 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
745 | dependencies = [
746 | "libc",
747 | ]
748 |
749 | [[package]]
750 | name = "hermit-abi"
751 | version = "0.3.1"
752 | source = "registry+https://github.com/rust-lang/crates.io-index"
753 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
754 |
755 | [[package]]
756 | name = "http"
757 | version = "0.2.9"
758 | source = "registry+https://github.com/rust-lang/crates.io-index"
759 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482"
760 | dependencies = [
761 | "bytes",
762 | "fnv",
763 | "itoa",
764 | ]
765 |
766 | [[package]]
767 | name = "http-body"
768 | version = "0.4.5"
769 | source = "registry+https://github.com/rust-lang/crates.io-index"
770 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1"
771 | dependencies = [
772 | "bytes",
773 | "http",
774 | "pin-project-lite",
775 | ]
776 |
777 | [[package]]
778 | name = "httparse"
779 | version = "1.8.0"
780 | source = "registry+https://github.com/rust-lang/crates.io-index"
781 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
782 |
783 | [[package]]
784 | name = "httpdate"
785 | version = "1.0.2"
786 | source = "registry+https://github.com/rust-lang/crates.io-index"
787 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
788 |
789 | [[package]]
790 | name = "hyper"
791 | version = "0.14.26"
792 | source = "registry+https://github.com/rust-lang/crates.io-index"
793 | checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4"
794 | dependencies = [
795 | "bytes",
796 | "futures-channel",
797 | "futures-core",
798 | "futures-util",
799 | "h2",
800 | "http",
801 | "http-body",
802 | "httparse",
803 | "httpdate",
804 | "itoa",
805 | "pin-project-lite",
806 | "socket2",
807 | "tokio",
808 | "tower-service",
809 | "tracing",
810 | "want",
811 | ]
812 |
813 | [[package]]
814 | name = "hyper-timeout"
815 | version = "0.4.1"
816 | source = "registry+https://github.com/rust-lang/crates.io-index"
817 | checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1"
818 | dependencies = [
819 | "hyper",
820 | "pin-project-lite",
821 | "tokio",
822 | "tokio-io-timeout",
823 | ]
824 |
825 | [[package]]
826 | name = "indexmap"
827 | version = "1.9.3"
828 | source = "registry+https://github.com/rust-lang/crates.io-index"
829 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
830 | dependencies = [
831 | "autocfg",
832 | "hashbrown",
833 | ]
834 |
835 | [[package]]
836 | name = "instant"
837 | version = "0.1.12"
838 | source = "registry+https://github.com/rust-lang/crates.io-index"
839 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
840 | dependencies = [
841 | "cfg-if",
842 | ]
843 |
844 | [[package]]
845 | name = "io-lifetimes"
846 | version = "1.0.11"
847 | source = "registry+https://github.com/rust-lang/crates.io-index"
848 | checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
849 | dependencies = [
850 | "hermit-abi 0.3.1",
851 | "libc",
852 | "windows-sys",
853 | ]
854 |
855 | [[package]]
856 | name = "is-terminal"
857 | version = "0.4.7"
858 | source = "registry+https://github.com/rust-lang/crates.io-index"
859 | checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
860 | dependencies = [
861 | "hermit-abi 0.3.1",
862 | "io-lifetimes",
863 | "rustix",
864 | "windows-sys",
865 | ]
866 |
867 | [[package]]
868 | name = "itertools"
869 | version = "0.10.5"
870 | source = "registry+https://github.com/rust-lang/crates.io-index"
871 | checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
872 | dependencies = [
873 | "either",
874 | ]
875 |
876 | [[package]]
877 | name = "itoa"
878 | version = "1.0.6"
879 | source = "registry+https://github.com/rust-lang/crates.io-index"
880 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
881 |
882 | [[package]]
883 | name = "js-sys"
884 | version = "0.3.63"
885 | source = "registry+https://github.com/rust-lang/crates.io-index"
886 | checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790"
887 | dependencies = [
888 | "wasm-bindgen",
889 | ]
890 |
891 | [[package]]
892 | name = "lazy_static"
893 | version = "1.4.0"
894 | source = "registry+https://github.com/rust-lang/crates.io-index"
895 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
896 |
897 | [[package]]
898 | name = "libc"
899 | version = "0.2.144"
900 | source = "registry+https://github.com/rust-lang/crates.io-index"
901 | checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
902 |
903 | [[package]]
904 | name = "linux-raw-sys"
905 | version = "0.3.8"
906 | source = "registry+https://github.com/rust-lang/crates.io-index"
907 | checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
908 |
909 | [[package]]
910 | name = "log"
911 | version = "0.4.18"
912 | source = "registry+https://github.com/rust-lang/crates.io-index"
913 | checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
914 |
915 | [[package]]
916 | name = "matchit"
917 | version = "0.7.0"
918 | source = "registry+https://github.com/rust-lang/crates.io-index"
919 | checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40"
920 |
921 | [[package]]
922 | name = "memchr"
923 | version = "2.5.0"
924 | source = "registry+https://github.com/rust-lang/crates.io-index"
925 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
926 |
927 | [[package]]
928 | name = "memoffset"
929 | version = "0.9.0"
930 | source = "registry+https://github.com/rust-lang/crates.io-index"
931 | checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
932 | dependencies = [
933 | "autocfg",
934 | ]
935 |
936 | [[package]]
937 | name = "mime"
938 | version = "0.3.17"
939 | source = "registry+https://github.com/rust-lang/crates.io-index"
940 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
941 |
942 | [[package]]
943 | name = "mio"
944 | version = "0.8.8"
945 | source = "registry+https://github.com/rust-lang/crates.io-index"
946 | checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
947 | dependencies = [
948 | "libc",
949 | "wasi",
950 | "windows-sys",
951 | ]
952 |
953 | [[package]]
954 | name = "multimap"
955 | version = "0.8.3"
956 | source = "registry+https://github.com/rust-lang/crates.io-index"
957 | checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a"
958 |
959 | [[package]]
960 | name = "nu-ansi-term"
961 | version = "0.46.0"
962 | source = "registry+https://github.com/rust-lang/crates.io-index"
963 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
964 | dependencies = [
965 | "overload",
966 | "winapi",
967 | ]
968 |
969 | [[package]]
970 | name = "num-traits"
971 | version = "0.2.15"
972 | source = "registry+https://github.com/rust-lang/crates.io-index"
973 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
974 | dependencies = [
975 | "autocfg",
976 | ]
977 |
978 | [[package]]
979 | name = "num_cpus"
980 | version = "1.15.0"
981 | source = "registry+https://github.com/rust-lang/crates.io-index"
982 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
983 | dependencies = [
984 | "hermit-abi 0.2.6",
985 | "libc",
986 | ]
987 |
988 | [[package]]
989 | name = "once_cell"
990 | version = "1.17.2"
991 | source = "registry+https://github.com/rust-lang/crates.io-index"
992 | checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b"
993 |
994 | [[package]]
995 | name = "oorandom"
996 | version = "11.1.3"
997 | source = "registry+https://github.com/rust-lang/crates.io-index"
998 | checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
999 |
1000 | [[package]]
1001 | name = "os_str_bytes"
1002 | version = "6.5.1"
1003 | source = "registry+https://github.com/rust-lang/crates.io-index"
1004 | checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac"
1005 |
1006 | [[package]]
1007 | name = "overload"
1008 | version = "0.1.1"
1009 | source = "registry+https://github.com/rust-lang/crates.io-index"
1010 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
1011 |
1012 | [[package]]
1013 | name = "percent-encoding"
1014 | version = "2.3.0"
1015 | source = "registry+https://github.com/rust-lang/crates.io-index"
1016 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
1017 |
1018 | [[package]]
1019 | name = "petgraph"
1020 | version = "0.6.3"
1021 | source = "registry+https://github.com/rust-lang/crates.io-index"
1022 | checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4"
1023 | dependencies = [
1024 | "fixedbitset",
1025 | "indexmap",
1026 | ]
1027 |
1028 | [[package]]
1029 | name = "pin-project"
1030 | version = "1.1.0"
1031 | source = "registry+https://github.com/rust-lang/crates.io-index"
1032 | checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead"
1033 | dependencies = [
1034 | "pin-project-internal",
1035 | ]
1036 |
1037 | [[package]]
1038 | name = "pin-project-internal"
1039 | version = "1.1.0"
1040 | source = "registry+https://github.com/rust-lang/crates.io-index"
1041 | checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07"
1042 | dependencies = [
1043 | "proc-macro2",
1044 | "quote",
1045 | "syn 2.0.18",
1046 | ]
1047 |
1048 | [[package]]
1049 | name = "pin-project-lite"
1050 | version = "0.2.9"
1051 | source = "registry+https://github.com/rust-lang/crates.io-index"
1052 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
1053 |
1054 | [[package]]
1055 | name = "pin-utils"
1056 | version = "0.1.0"
1057 | source = "registry+https://github.com/rust-lang/crates.io-index"
1058 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
1059 |
1060 | [[package]]
1061 | name = "plotters"
1062 | version = "0.3.5"
1063 | source = "registry+https://github.com/rust-lang/crates.io-index"
1064 | checksum = "d2c224ba00d7cadd4d5c660deaf2098e5e80e07846537c51f9cfa4be50c1fd45"
1065 | dependencies = [
1066 | "num-traits",
1067 | "plotters-backend",
1068 | "plotters-svg",
1069 | "wasm-bindgen",
1070 | "web-sys",
1071 | ]
1072 |
1073 | [[package]]
1074 | name = "plotters-backend"
1075 | version = "0.3.5"
1076 | source = "registry+https://github.com/rust-lang/crates.io-index"
1077 | checksum = "9e76628b4d3a7581389a35d5b6e2139607ad7c75b17aed325f210aa91f4a9609"
1078 |
1079 | [[package]]
1080 | name = "plotters-svg"
1081 | version = "0.3.5"
1082 | source = "registry+https://github.com/rust-lang/crates.io-index"
1083 | checksum = "38f6d39893cca0701371e3c27294f09797214b86f1fb951b89ade8ec04e2abab"
1084 | dependencies = [
1085 | "plotters-backend",
1086 | ]
1087 |
1088 | [[package]]
1089 | name = "ppv-lite86"
1090 | version = "0.2.17"
1091 | source = "registry+https://github.com/rust-lang/crates.io-index"
1092 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
1093 |
1094 | [[package]]
1095 | name = "prettyplease"
1096 | version = "0.1.25"
1097 | source = "registry+https://github.com/rust-lang/crates.io-index"
1098 | checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86"
1099 | dependencies = [
1100 | "proc-macro2",
1101 | "syn 1.0.109",
1102 | ]
1103 |
1104 | [[package]]
1105 | name = "proc-macro-crate"
1106 | version = "0.1.5"
1107 | source = "registry+https://github.com/rust-lang/crates.io-index"
1108 | checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
1109 | dependencies = [
1110 | "toml",
1111 | ]
1112 |
1113 | [[package]]
1114 | name = "proc-macro2"
1115 | version = "1.0.59"
1116 | source = "registry+https://github.com/rust-lang/crates.io-index"
1117 | checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b"
1118 | dependencies = [
1119 | "unicode-ident",
1120 | ]
1121 |
1122 | [[package]]
1123 | name = "prost"
1124 | version = "0.11.9"
1125 | source = "registry+https://github.com/rust-lang/crates.io-index"
1126 | checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd"
1127 | dependencies = [
1128 | "bytes",
1129 | "prost-derive",
1130 | ]
1131 |
1132 | [[package]]
1133 | name = "prost-build"
1134 | version = "0.11.9"
1135 | source = "registry+https://github.com/rust-lang/crates.io-index"
1136 | checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270"
1137 | dependencies = [
1138 | "bytes",
1139 | "heck",
1140 | "itertools",
1141 | "lazy_static",
1142 | "log",
1143 | "multimap",
1144 | "petgraph",
1145 | "prettyplease",
1146 | "prost",
1147 | "prost-types",
1148 | "regex",
1149 | "syn 1.0.109",
1150 | "tempfile",
1151 | "which",
1152 | ]
1153 |
1154 | [[package]]
1155 | name = "prost-derive"
1156 | version = "0.11.9"
1157 | source = "registry+https://github.com/rust-lang/crates.io-index"
1158 | checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4"
1159 | dependencies = [
1160 | "anyhow",
1161 | "itertools",
1162 | "proc-macro2",
1163 | "quote",
1164 | "syn 1.0.109",
1165 | ]
1166 |
1167 | [[package]]
1168 | name = "prost-types"
1169 | version = "0.11.9"
1170 | source = "registry+https://github.com/rust-lang/crates.io-index"
1171 | checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13"
1172 | dependencies = [
1173 | "prost",
1174 | ]
1175 |
1176 | [[package]]
1177 | name = "ptr_meta"
1178 | version = "0.1.4"
1179 | source = "registry+https://github.com/rust-lang/crates.io-index"
1180 | checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1"
1181 | dependencies = [
1182 | "ptr_meta_derive",
1183 | ]
1184 |
1185 | [[package]]
1186 | name = "ptr_meta_derive"
1187 | version = "0.1.4"
1188 | source = "registry+https://github.com/rust-lang/crates.io-index"
1189 | checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac"
1190 | dependencies = [
1191 | "proc-macro2",
1192 | "quote",
1193 | "syn 1.0.109",
1194 | ]
1195 |
1196 | [[package]]
1197 | name = "quote"
1198 | version = "1.0.28"
1199 | source = "registry+https://github.com/rust-lang/crates.io-index"
1200 | checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488"
1201 | dependencies = [
1202 | "proc-macro2",
1203 | ]
1204 |
1205 | [[package]]
1206 | name = "radium"
1207 | version = "0.7.0"
1208 | source = "registry+https://github.com/rust-lang/crates.io-index"
1209 | checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
1210 |
1211 | [[package]]
1212 | name = "rand"
1213 | version = "0.8.5"
1214 | source = "registry+https://github.com/rust-lang/crates.io-index"
1215 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
1216 | dependencies = [
1217 | "libc",
1218 | "rand_chacha",
1219 | "rand_core",
1220 | ]
1221 |
1222 | [[package]]
1223 | name = "rand_chacha"
1224 | version = "0.3.1"
1225 | source = "registry+https://github.com/rust-lang/crates.io-index"
1226 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
1227 | dependencies = [
1228 | "ppv-lite86",
1229 | "rand_core",
1230 | ]
1231 |
1232 | [[package]]
1233 | name = "rand_core"
1234 | version = "0.6.4"
1235 | source = "registry+https://github.com/rust-lang/crates.io-index"
1236 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
1237 | dependencies = [
1238 | "getrandom",
1239 | ]
1240 |
1241 | [[package]]
1242 | name = "rayon"
1243 | version = "1.7.0"
1244 | source = "registry+https://github.com/rust-lang/crates.io-index"
1245 | checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
1246 | dependencies = [
1247 | "either",
1248 | "rayon-core",
1249 | ]
1250 |
1251 | [[package]]
1252 | name = "rayon-core"
1253 | version = "1.11.0"
1254 | source = "registry+https://github.com/rust-lang/crates.io-index"
1255 | checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
1256 | dependencies = [
1257 | "crossbeam-channel",
1258 | "crossbeam-deque",
1259 | "crossbeam-utils",
1260 | "num_cpus",
1261 | ]
1262 |
1263 | [[package]]
1264 | name = "redox_syscall"
1265 | version = "0.3.5"
1266 | source = "registry+https://github.com/rust-lang/crates.io-index"
1267 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
1268 | dependencies = [
1269 | "bitflags",
1270 | ]
1271 |
1272 | [[package]]
1273 | name = "regex"
1274 | version = "1.8.4"
1275 | source = "registry+https://github.com/rust-lang/crates.io-index"
1276 | checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f"
1277 | dependencies = [
1278 | "regex-syntax",
1279 | ]
1280 |
1281 | [[package]]
1282 | name = "regex-syntax"
1283 | version = "0.7.2"
1284 | source = "registry+https://github.com/rust-lang/crates.io-index"
1285 | checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78"
1286 |
1287 | [[package]]
1288 | name = "rend"
1289 | version = "0.4.0"
1290 | source = "registry+https://github.com/rust-lang/crates.io-index"
1291 | checksum = "581008d2099240d37fb08d77ad713bcaec2c4d89d50b5b21a8bb1996bbab68ab"
1292 | dependencies = [
1293 | "bytecheck",
1294 | ]
1295 |
1296 | [[package]]
1297 | name = "ring"
1298 | version = "0.16.20"
1299 | source = "registry+https://github.com/rust-lang/crates.io-index"
1300 | checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc"
1301 | dependencies = [
1302 | "cc",
1303 | "libc",
1304 | "once_cell",
1305 | "spin",
1306 | "untrusted",
1307 | "web-sys",
1308 | "winapi",
1309 | ]
1310 |
1311 | [[package]]
1312 | name = "rkyv"
1313 | version = "0.7.42"
1314 | source = "registry+https://github.com/rust-lang/crates.io-index"
1315 | checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58"
1316 | dependencies = [
1317 | "bitvec",
1318 | "bytecheck",
1319 | "hashbrown",
1320 | "ptr_meta",
1321 | "rend",
1322 | "rkyv_derive",
1323 | "seahash",
1324 | "tinyvec",
1325 | "uuid",
1326 | ]
1327 |
1328 | [[package]]
1329 | name = "rkyv_derive"
1330 | version = "0.7.42"
1331 | source = "registry+https://github.com/rust-lang/crates.io-index"
1332 | checksum = "b2e06b915b5c230a17d7a736d1e2e63ee753c256a8614ef3f5147b13a4f5541d"
1333 | dependencies = [
1334 | "proc-macro2",
1335 | "quote",
1336 | "syn 1.0.109",
1337 | ]
1338 |
1339 | [[package]]
1340 | name = "rust_decimal"
1341 | version = "1.30.0"
1342 | source = "registry+https://github.com/rust-lang/crates.io-index"
1343 | checksum = "d0446843641c69436765a35a5a77088e28c2e6a12da93e84aa3ab1cd4aa5a042"
1344 | dependencies = [
1345 | "arrayvec",
1346 | "borsh",
1347 | "bytecheck",
1348 | "byteorder",
1349 | "bytes",
1350 | "num-traits",
1351 | "rand",
1352 | "rkyv",
1353 | "serde",
1354 | "serde_json",
1355 | ]
1356 |
1357 | [[package]]
1358 | name = "rustc_version"
1359 | version = "0.4.0"
1360 | source = "registry+https://github.com/rust-lang/crates.io-index"
1361 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
1362 | dependencies = [
1363 | "semver",
1364 | ]
1365 |
1366 | [[package]]
1367 | name = "rustix"
1368 | version = "0.37.20"
1369 | source = "registry+https://github.com/rust-lang/crates.io-index"
1370 | checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0"
1371 | dependencies = [
1372 | "bitflags",
1373 | "errno",
1374 | "io-lifetimes",
1375 | "libc",
1376 | "linux-raw-sys",
1377 | "windows-sys",
1378 | ]
1379 |
1380 | [[package]]
1381 | name = "rustls"
1382 | version = "0.21.1"
1383 | source = "registry+https://github.com/rust-lang/crates.io-index"
1384 | checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e"
1385 | dependencies = [
1386 | "log",
1387 | "ring",
1388 | "rustls-webpki",
1389 | "sct",
1390 | ]
1391 |
1392 | [[package]]
1393 | name = "rustls-webpki"
1394 | version = "0.100.1"
1395 | source = "registry+https://github.com/rust-lang/crates.io-index"
1396 | checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b"
1397 | dependencies = [
1398 | "ring",
1399 | "untrusted",
1400 | ]
1401 |
1402 | [[package]]
1403 | name = "rustversion"
1404 | version = "1.0.12"
1405 | source = "registry+https://github.com/rust-lang/crates.io-index"
1406 | checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06"
1407 |
1408 | [[package]]
1409 | name = "ryu"
1410 | version = "1.0.13"
1411 | source = "registry+https://github.com/rust-lang/crates.io-index"
1412 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
1413 |
1414 | [[package]]
1415 | name = "same-file"
1416 | version = "1.0.6"
1417 | source = "registry+https://github.com/rust-lang/crates.io-index"
1418 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
1419 | dependencies = [
1420 | "winapi-util",
1421 | ]
1422 |
1423 | [[package]]
1424 | name = "scopeguard"
1425 | version = "1.1.0"
1426 | source = "registry+https://github.com/rust-lang/crates.io-index"
1427 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
1428 |
1429 | [[package]]
1430 | name = "sct"
1431 | version = "0.7.0"
1432 | source = "registry+https://github.com/rust-lang/crates.io-index"
1433 | checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4"
1434 | dependencies = [
1435 | "ring",
1436 | "untrusted",
1437 | ]
1438 |
1439 | [[package]]
1440 | name = "seahash"
1441 | version = "4.1.0"
1442 | source = "registry+https://github.com/rust-lang/crates.io-index"
1443 | checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
1444 |
1445 | [[package]]
1446 | name = "semver"
1447 | version = "1.0.17"
1448 | source = "registry+https://github.com/rust-lang/crates.io-index"
1449 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
1450 |
1451 | [[package]]
1452 | name = "serde"
1453 | version = "1.0.163"
1454 | source = "registry+https://github.com/rust-lang/crates.io-index"
1455 | checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
1456 | dependencies = [
1457 | "serde_derive",
1458 | ]
1459 |
1460 | [[package]]
1461 | name = "serde_derive"
1462 | version = "1.0.163"
1463 | source = "registry+https://github.com/rust-lang/crates.io-index"
1464 | checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
1465 | dependencies = [
1466 | "proc-macro2",
1467 | "quote",
1468 | "syn 2.0.18",
1469 | ]
1470 |
1471 | [[package]]
1472 | name = "serde_json"
1473 | version = "1.0.96"
1474 | source = "registry+https://github.com/rust-lang/crates.io-index"
1475 | checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1"
1476 | dependencies = [
1477 | "itoa",
1478 | "ryu",
1479 | "serde",
1480 | ]
1481 |
1482 | [[package]]
1483 | name = "sha1"
1484 | version = "0.10.5"
1485 | source = "registry+https://github.com/rust-lang/crates.io-index"
1486 | checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3"
1487 | dependencies = [
1488 | "cfg-if",
1489 | "cpufeatures",
1490 | "digest",
1491 | ]
1492 |
1493 | [[package]]
1494 | name = "sharded-slab"
1495 | version = "0.1.4"
1496 | source = "registry+https://github.com/rust-lang/crates.io-index"
1497 | checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
1498 | dependencies = [
1499 | "lazy_static",
1500 | ]
1501 |
1502 | [[package]]
1503 | name = "signal-hook-registry"
1504 | version = "1.4.1"
1505 | source = "registry+https://github.com/rust-lang/crates.io-index"
1506 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
1507 | dependencies = [
1508 | "libc",
1509 | ]
1510 |
1511 | [[package]]
1512 | name = "simdutf8"
1513 | version = "0.1.4"
1514 | source = "registry+https://github.com/rust-lang/crates.io-index"
1515 | checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a"
1516 |
1517 | [[package]]
1518 | name = "slab"
1519 | version = "0.4.8"
1520 | source = "registry+https://github.com/rust-lang/crates.io-index"
1521 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d"
1522 | dependencies = [
1523 | "autocfg",
1524 | ]
1525 |
1526 | [[package]]
1527 | name = "smallvec"
1528 | version = "1.10.0"
1529 | source = "registry+https://github.com/rust-lang/crates.io-index"
1530 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
1531 |
1532 | [[package]]
1533 | name = "socket2"
1534 | version = "0.4.9"
1535 | source = "registry+https://github.com/rust-lang/crates.io-index"
1536 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662"
1537 | dependencies = [
1538 | "libc",
1539 | "winapi",
1540 | ]
1541 |
1542 | [[package]]
1543 | name = "spin"
1544 | version = "0.5.2"
1545 | source = "registry+https://github.com/rust-lang/crates.io-index"
1546 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
1547 |
1548 | [[package]]
1549 | name = "strsim"
1550 | version = "0.10.0"
1551 | source = "registry+https://github.com/rust-lang/crates.io-index"
1552 | checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
1553 |
1554 | [[package]]
1555 | name = "strum"
1556 | version = "0.24.1"
1557 | source = "registry+https://github.com/rust-lang/crates.io-index"
1558 | checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f"
1559 | dependencies = [
1560 | "strum_macros",
1561 | ]
1562 |
1563 | [[package]]
1564 | name = "strum_macros"
1565 | version = "0.24.3"
1566 | source = "registry+https://github.com/rust-lang/crates.io-index"
1567 | checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59"
1568 | dependencies = [
1569 | "heck",
1570 | "proc-macro2",
1571 | "quote",
1572 | "rustversion",
1573 | "syn 1.0.109",
1574 | ]
1575 |
1576 | [[package]]
1577 | name = "syn"
1578 | version = "1.0.109"
1579 | source = "registry+https://github.com/rust-lang/crates.io-index"
1580 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
1581 | dependencies = [
1582 | "proc-macro2",
1583 | "quote",
1584 | "unicode-ident",
1585 | ]
1586 |
1587 | [[package]]
1588 | name = "syn"
1589 | version = "2.0.18"
1590 | source = "registry+https://github.com/rust-lang/crates.io-index"
1591 | checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e"
1592 | dependencies = [
1593 | "proc-macro2",
1594 | "quote",
1595 | "unicode-ident",
1596 | ]
1597 |
1598 | [[package]]
1599 | name = "sync_wrapper"
1600 | version = "0.1.2"
1601 | source = "registry+https://github.com/rust-lang/crates.io-index"
1602 | checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
1603 |
1604 | [[package]]
1605 | name = "tap"
1606 | version = "1.0.1"
1607 | source = "registry+https://github.com/rust-lang/crates.io-index"
1608 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
1609 |
1610 | [[package]]
1611 | name = "tempfile"
1612 | version = "3.6.0"
1613 | source = "registry+https://github.com/rust-lang/crates.io-index"
1614 | checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6"
1615 | dependencies = [
1616 | "autocfg",
1617 | "cfg-if",
1618 | "fastrand",
1619 | "redox_syscall",
1620 | "rustix",
1621 | "windows-sys",
1622 | ]
1623 |
1624 | [[package]]
1625 | name = "textwrap"
1626 | version = "0.16.0"
1627 | source = "registry+https://github.com/rust-lang/crates.io-index"
1628 | checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
1629 |
1630 | [[package]]
1631 | name = "thread_local"
1632 | version = "1.1.7"
1633 | source = "registry+https://github.com/rust-lang/crates.io-index"
1634 | checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
1635 | dependencies = [
1636 | "cfg-if",
1637 | "once_cell",
1638 | ]
1639 |
1640 | [[package]]
1641 | name = "tikv-jemalloc-sys"
1642 | version = "0.5.3+5.3.0-patched"
1643 | source = "registry+https://github.com/rust-lang/crates.io-index"
1644 | checksum = "a678df20055b43e57ef8cddde41cdfda9a3c1a060b67f4c5836dfb1d78543ba8"
1645 | dependencies = [
1646 | "cc",
1647 | "libc",
1648 | ]
1649 |
1650 | [[package]]
1651 | name = "tikv-jemallocator"
1652 | version = "0.5.0"
1653 | source = "registry+https://github.com/rust-lang/crates.io-index"
1654 | checksum = "20612db8a13a6c06d57ec83953694185a367e16945f66565e8028d2c0bd76979"
1655 | dependencies = [
1656 | "libc",
1657 | "tikv-jemalloc-sys",
1658 | ]
1659 |
1660 | [[package]]
1661 | name = "tinytemplate"
1662 | version = "1.2.1"
1663 | source = "registry+https://github.com/rust-lang/crates.io-index"
1664 | checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
1665 | dependencies = [
1666 | "serde",
1667 | "serde_json",
1668 | ]
1669 |
1670 | [[package]]
1671 | name = "tinyvec"
1672 | version = "1.6.0"
1673 | source = "registry+https://github.com/rust-lang/crates.io-index"
1674 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
1675 | dependencies = [
1676 | "tinyvec_macros",
1677 | ]
1678 |
1679 | [[package]]
1680 | name = "tinyvec_macros"
1681 | version = "0.1.1"
1682 | source = "registry+https://github.com/rust-lang/crates.io-index"
1683 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
1684 |
1685 | [[package]]
1686 | name = "tokio"
1687 | version = "1.28.2"
1688 | source = "registry+https://github.com/rust-lang/crates.io-index"
1689 | checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2"
1690 | dependencies = [
1691 | "autocfg",
1692 | "bytes",
1693 | "libc",
1694 | "mio",
1695 | "num_cpus",
1696 | "pin-project-lite",
1697 | "signal-hook-registry",
1698 | "socket2",
1699 | "tokio-macros",
1700 | "windows-sys",
1701 | ]
1702 |
1703 | [[package]]
1704 | name = "tokio-io-timeout"
1705 | version = "1.2.0"
1706 | source = "registry+https://github.com/rust-lang/crates.io-index"
1707 | checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf"
1708 | dependencies = [
1709 | "pin-project-lite",
1710 | "tokio",
1711 | ]
1712 |
1713 | [[package]]
1714 | name = "tokio-macros"
1715 | version = "2.1.0"
1716 | source = "registry+https://github.com/rust-lang/crates.io-index"
1717 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e"
1718 | dependencies = [
1719 | "proc-macro2",
1720 | "quote",
1721 | "syn 2.0.18",
1722 | ]
1723 |
1724 | [[package]]
1725 | name = "tokio-rustls"
1726 | version = "0.24.0"
1727 | source = "registry+https://github.com/rust-lang/crates.io-index"
1728 | checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5"
1729 | dependencies = [
1730 | "rustls",
1731 | "tokio",
1732 | ]
1733 |
1734 | [[package]]
1735 | name = "tokio-stream"
1736 | version = "0.1.14"
1737 | source = "registry+https://github.com/rust-lang/crates.io-index"
1738 | checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
1739 | dependencies = [
1740 | "futures-core",
1741 | "pin-project-lite",
1742 | "tokio",
1743 | ]
1744 |
1745 | [[package]]
1746 | name = "tokio-util"
1747 | version = "0.7.8"
1748 | source = "registry+https://github.com/rust-lang/crates.io-index"
1749 | checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d"
1750 | dependencies = [
1751 | "bytes",
1752 | "futures-core",
1753 | "futures-sink",
1754 | "pin-project-lite",
1755 | "tokio",
1756 | "tracing",
1757 | ]
1758 |
1759 | [[package]]
1760 | name = "toml"
1761 | version = "0.5.11"
1762 | source = "registry+https://github.com/rust-lang/crates.io-index"
1763 | checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
1764 | dependencies = [
1765 | "serde",
1766 | ]
1767 |
1768 | [[package]]
1769 | name = "tonic"
1770 | version = "0.9.2"
1771 | source = "registry+https://github.com/rust-lang/crates.io-index"
1772 | checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a"
1773 | dependencies = [
1774 | "async-trait",
1775 | "axum",
1776 | "base64",
1777 | "bytes",
1778 | "futures-core",
1779 | "futures-util",
1780 | "h2",
1781 | "http",
1782 | "http-body",
1783 | "hyper",
1784 | "hyper-timeout",
1785 | "percent-encoding",
1786 | "pin-project",
1787 | "prost",
1788 | "tokio",
1789 | "tokio-stream",
1790 | "tower",
1791 | "tower-layer",
1792 | "tower-service",
1793 | "tracing",
1794 | ]
1795 |
1796 | [[package]]
1797 | name = "tonic-build"
1798 | version = "0.9.2"
1799 | source = "registry+https://github.com/rust-lang/crates.io-index"
1800 | checksum = "a6fdaae4c2c638bb70fe42803a26fbd6fc6ac8c72f5c59f67ecc2a2dcabf4b07"
1801 | dependencies = [
1802 | "prettyplease",
1803 | "proc-macro2",
1804 | "prost-build",
1805 | "quote",
1806 | "syn 1.0.109",
1807 | ]
1808 |
1809 | [[package]]
1810 | name = "tower"
1811 | version = "0.4.13"
1812 | source = "registry+https://github.com/rust-lang/crates.io-index"
1813 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
1814 | dependencies = [
1815 | "futures-core",
1816 | "futures-util",
1817 | "indexmap",
1818 | "pin-project",
1819 | "pin-project-lite",
1820 | "rand",
1821 | "slab",
1822 | "tokio",
1823 | "tokio-util",
1824 | "tower-layer",
1825 | "tower-service",
1826 | "tracing",
1827 | ]
1828 |
1829 | [[package]]
1830 | name = "tower-layer"
1831 | version = "0.3.2"
1832 | source = "registry+https://github.com/rust-lang/crates.io-index"
1833 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
1834 |
1835 | [[package]]
1836 | name = "tower-service"
1837 | version = "0.3.2"
1838 | source = "registry+https://github.com/rust-lang/crates.io-index"
1839 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
1840 |
1841 | [[package]]
1842 | name = "tracing"
1843 | version = "0.1.37"
1844 | source = "registry+https://github.com/rust-lang/crates.io-index"
1845 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
1846 | dependencies = [
1847 | "cfg-if",
1848 | "pin-project-lite",
1849 | "tracing-attributes",
1850 | "tracing-core",
1851 | ]
1852 |
1853 | [[package]]
1854 | name = "tracing-attributes"
1855 | version = "0.1.24"
1856 | source = "registry+https://github.com/rust-lang/crates.io-index"
1857 | checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74"
1858 | dependencies = [
1859 | "proc-macro2",
1860 | "quote",
1861 | "syn 2.0.18",
1862 | ]
1863 |
1864 | [[package]]
1865 | name = "tracing-core"
1866 | version = "0.1.31"
1867 | source = "registry+https://github.com/rust-lang/crates.io-index"
1868 | checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a"
1869 | dependencies = [
1870 | "once_cell",
1871 | "valuable",
1872 | ]
1873 |
1874 | [[package]]
1875 | name = "tracing-log"
1876 | version = "0.1.3"
1877 | source = "registry+https://github.com/rust-lang/crates.io-index"
1878 | checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
1879 | dependencies = [
1880 | "lazy_static",
1881 | "log",
1882 | "tracing-core",
1883 | ]
1884 |
1885 | [[package]]
1886 | name = "tracing-subscriber"
1887 | version = "0.3.17"
1888 | source = "registry+https://github.com/rust-lang/crates.io-index"
1889 | checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
1890 | dependencies = [
1891 | "nu-ansi-term",
1892 | "sharded-slab",
1893 | "smallvec",
1894 | "thread_local",
1895 | "tracing-core",
1896 | "tracing-log",
1897 | ]
1898 |
1899 | [[package]]
1900 | name = "try-lock"
1901 | version = "0.2.4"
1902 | source = "registry+https://github.com/rust-lang/crates.io-index"
1903 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed"
1904 |
1905 | [[package]]
1906 | name = "typenum"
1907 | version = "1.16.0"
1908 | source = "registry+https://github.com/rust-lang/crates.io-index"
1909 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
1910 |
1911 | [[package]]
1912 | name = "unicode-ident"
1913 | version = "1.0.9"
1914 | source = "registry+https://github.com/rust-lang/crates.io-index"
1915 | checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0"
1916 |
1917 | [[package]]
1918 | name = "untrusted"
1919 | version = "0.7.1"
1920 | source = "registry+https://github.com/rust-lang/crates.io-index"
1921 | checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
1922 |
1923 | [[package]]
1924 | name = "utf-8"
1925 | version = "0.7.6"
1926 | source = "registry+https://github.com/rust-lang/crates.io-index"
1927 | checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
1928 |
1929 | [[package]]
1930 | name = "utf8parse"
1931 | version = "0.2.1"
1932 | source = "registry+https://github.com/rust-lang/crates.io-index"
1933 | checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
1934 |
1935 | [[package]]
1936 | name = "uuid"
1937 | version = "1.3.4"
1938 | source = "registry+https://github.com/rust-lang/crates.io-index"
1939 | checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81"
1940 |
1941 | [[package]]
1942 | name = "valuable"
1943 | version = "0.1.0"
1944 | source = "registry+https://github.com/rust-lang/crates.io-index"
1945 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
1946 |
1947 | [[package]]
1948 | name = "version_check"
1949 | version = "0.9.4"
1950 | source = "registry+https://github.com/rust-lang/crates.io-index"
1951 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
1952 |
1953 | [[package]]
1954 | name = "walkdir"
1955 | version = "2.3.3"
1956 | source = "registry+https://github.com/rust-lang/crates.io-index"
1957 | checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
1958 | dependencies = [
1959 | "same-file",
1960 | "winapi-util",
1961 | ]
1962 |
1963 | [[package]]
1964 | name = "want"
1965 | version = "0.3.0"
1966 | source = "registry+https://github.com/rust-lang/crates.io-index"
1967 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
1968 | dependencies = [
1969 | "log",
1970 | "try-lock",
1971 | ]
1972 |
1973 | [[package]]
1974 | name = "wasi"
1975 | version = "0.11.0+wasi-snapshot-preview1"
1976 | source = "registry+https://github.com/rust-lang/crates.io-index"
1977 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
1978 |
1979 | [[package]]
1980 | name = "wasm-bindgen"
1981 | version = "0.2.86"
1982 | source = "registry+https://github.com/rust-lang/crates.io-index"
1983 | checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73"
1984 | dependencies = [
1985 | "cfg-if",
1986 | "wasm-bindgen-macro",
1987 | ]
1988 |
1989 | [[package]]
1990 | name = "wasm-bindgen-backend"
1991 | version = "0.2.86"
1992 | source = "registry+https://github.com/rust-lang/crates.io-index"
1993 | checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb"
1994 | dependencies = [
1995 | "bumpalo",
1996 | "log",
1997 | "once_cell",
1998 | "proc-macro2",
1999 | "quote",
2000 | "syn 2.0.18",
2001 | "wasm-bindgen-shared",
2002 | ]
2003 |
2004 | [[package]]
2005 | name = "wasm-bindgen-macro"
2006 | version = "0.2.86"
2007 | source = "registry+https://github.com/rust-lang/crates.io-index"
2008 | checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258"
2009 | dependencies = [
2010 | "quote",
2011 | "wasm-bindgen-macro-support",
2012 | ]
2013 |
2014 | [[package]]
2015 | name = "wasm-bindgen-macro-support"
2016 | version = "0.2.86"
2017 | source = "registry+https://github.com/rust-lang/crates.io-index"
2018 | checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8"
2019 | dependencies = [
2020 | "proc-macro2",
2021 | "quote",
2022 | "syn 2.0.18",
2023 | "wasm-bindgen-backend",
2024 | "wasm-bindgen-shared",
2025 | ]
2026 |
2027 | [[package]]
2028 | name = "wasm-bindgen-shared"
2029 | version = "0.2.86"
2030 | source = "registry+https://github.com/rust-lang/crates.io-index"
2031 | checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93"
2032 |
2033 | [[package]]
2034 | name = "web-sys"
2035 | version = "0.3.63"
2036 | source = "registry+https://github.com/rust-lang/crates.io-index"
2037 | checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2"
2038 | dependencies = [
2039 | "js-sys",
2040 | "wasm-bindgen",
2041 | ]
2042 |
2043 | [[package]]
2044 | name = "webpki-roots"
2045 | version = "0.23.1"
2046 | source = "registry+https://github.com/rust-lang/crates.io-index"
2047 | checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338"
2048 | dependencies = [
2049 | "rustls-webpki",
2050 | ]
2051 |
2052 | [[package]]
2053 | name = "which"
2054 | version = "4.4.0"
2055 | source = "registry+https://github.com/rust-lang/crates.io-index"
2056 | checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
2057 | dependencies = [
2058 | "either",
2059 | "libc",
2060 | "once_cell",
2061 | ]
2062 |
2063 | [[package]]
2064 | name = "winapi"
2065 | version = "0.3.9"
2066 | source = "registry+https://github.com/rust-lang/crates.io-index"
2067 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
2068 | dependencies = [
2069 | "winapi-i686-pc-windows-gnu",
2070 | "winapi-x86_64-pc-windows-gnu",
2071 | ]
2072 |
2073 | [[package]]
2074 | name = "winapi-i686-pc-windows-gnu"
2075 | version = "0.4.0"
2076 | source = "registry+https://github.com/rust-lang/crates.io-index"
2077 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
2078 |
2079 | [[package]]
2080 | name = "winapi-util"
2081 | version = "0.1.5"
2082 | source = "registry+https://github.com/rust-lang/crates.io-index"
2083 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
2084 | dependencies = [
2085 | "winapi",
2086 | ]
2087 |
2088 | [[package]]
2089 | name = "winapi-x86_64-pc-windows-gnu"
2090 | version = "0.4.0"
2091 | source = "registry+https://github.com/rust-lang/crates.io-index"
2092 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
2093 |
2094 | [[package]]
2095 | name = "windows-sys"
2096 | version = "0.48.0"
2097 | source = "registry+https://github.com/rust-lang/crates.io-index"
2098 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
2099 | dependencies = [
2100 | "windows-targets",
2101 | ]
2102 |
2103 | [[package]]
2104 | name = "windows-targets"
2105 | version = "0.48.0"
2106 | source = "registry+https://github.com/rust-lang/crates.io-index"
2107 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
2108 | dependencies = [
2109 | "windows_aarch64_gnullvm",
2110 | "windows_aarch64_msvc",
2111 | "windows_i686_gnu",
2112 | "windows_i686_msvc",
2113 | "windows_x86_64_gnu",
2114 | "windows_x86_64_gnullvm",
2115 | "windows_x86_64_msvc",
2116 | ]
2117 |
2118 | [[package]]
2119 | name = "windows_aarch64_gnullvm"
2120 | version = "0.48.0"
2121 | source = "registry+https://github.com/rust-lang/crates.io-index"
2122 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
2123 |
2124 | [[package]]
2125 | name = "windows_aarch64_msvc"
2126 | version = "0.48.0"
2127 | source = "registry+https://github.com/rust-lang/crates.io-index"
2128 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
2129 |
2130 | [[package]]
2131 | name = "windows_i686_gnu"
2132 | version = "0.48.0"
2133 | source = "registry+https://github.com/rust-lang/crates.io-index"
2134 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
2135 |
2136 | [[package]]
2137 | name = "windows_i686_msvc"
2138 | version = "0.48.0"
2139 | source = "registry+https://github.com/rust-lang/crates.io-index"
2140 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
2141 |
2142 | [[package]]
2143 | name = "windows_x86_64_gnu"
2144 | version = "0.48.0"
2145 | source = "registry+https://github.com/rust-lang/crates.io-index"
2146 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
2147 |
2148 | [[package]]
2149 | name = "windows_x86_64_gnullvm"
2150 | version = "0.48.0"
2151 | source = "registry+https://github.com/rust-lang/crates.io-index"
2152 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
2153 |
2154 | [[package]]
2155 | name = "windows_x86_64_msvc"
2156 | version = "0.48.0"
2157 | source = "registry+https://github.com/rust-lang/crates.io-index"
2158 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
2159 |
2160 | [[package]]
2161 | name = "wyz"
2162 | version = "0.5.1"
2163 | source = "registry+https://github.com/rust-lang/crates.io-index"
2164 | checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
2165 | dependencies = [
2166 | "tap",
2167 | ]
2168 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "dragonflybot"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | [[bin]]
7 | name = "dragonflybot-grpc-server"
8 | path = "src/bin/grpc_server.rs"
9 |
10 | [[bin]]
11 | name = "dragonflybot-grpc-client"
12 | path = "src/bin/grpc_client.rs"
13 |
14 | [profile.performance]
15 | codegen-units = 1
16 | inherits = "release"
17 | incremental = false
18 | lto = "fat"
19 | panic = "abort"
20 | strip = true
21 |
22 | [dependencies]
23 | async-trait = "0.1.68"
24 | async-stream = "0.3.5"
25 | clap = { version = "4.3.3", features = ["derive"] }
26 | error-stack = "0.3.1"
27 | fastwebsockets = { version = "0.4.2", features = ["upgrade"] }
28 | gjson = "0.8"
29 | hyper = {version = "0.14.26", features = ["http1", "client"]}
30 | prost = "0.11"
31 | rust_decimal = "1.29.1"
32 | serde_json = "1.0"
33 | strum = { version = "0.24", features = ["derive"] }
34 | tikv-jemallocator = "0.5"
35 | tonic = "0.9.2"
36 | tokio = {version = "1.28.2", features = ["io-std", "macros", "net", "rt-multi-thread", "signal", "sync"]}
37 | tokio-rustls = "0.24.0"
38 | tokio-stream = "0.1.14"
39 | tracing = "0.1"
40 | tracing-subscriber = "0.3"
41 | webpki-roots = "0.23.1"
42 |
43 | [dev-dependencies]
44 | criterion = { version = "0.4", features = ["html_reports"] }
45 |
46 | [build-dependencies]
47 | tonic-build = "0.9.2"
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | ARG BUILD_PROFILE="performance"
2 |
3 | FROM clearlinux/os-core:latest as clearlinux-core
4 |
5 | FROM clearlinux:latest AS base
6 | # install system dependencies needed to build
7 | RUN swupd update -y --no-boot-update --3rd-party \
8 | && swupd bundle-add rust-basic devpkg-openssl openssl protobuf \
9 | && cargo install cargo-chef
10 | WORKDIR app
11 |
12 | FROM base AS planner
13 | COPY . .
14 | RUN cargo chef prepare --recipe-path recipe.json
15 |
16 | FROM base AS builder
17 | ARG BUILD_PROFILE
18 | ENV RUSTFLAGS="-C target-cpu=native"
19 | COPY --from=planner /app/recipe.json recipe.json
20 | # build dependencies - this is the caching Docker layer
21 | RUN cargo chef cook --release --recipe-path recipe.json
22 | # build application
23 | COPY . .
24 | RUN cargo build --profile $BUILD_PROFILE
25 |
26 | # branch build targets
27 | # `clearlinux-core` is updated daily, so we don't need to run updates
28 | FROM clearlinux-core AS branch-performance
29 | COPY --from=builder /app/target/release/dragonflybot-* /usr/local/bin/
30 | FROM clearlinux-core AS branch-dev
31 | COPY --from=builder /app/target/debug/dragonflybot-* /usr/local/bin/
32 | FROM branch-${BUILD_PROFILE} as after-condition
33 |
34 | # minimize the image from a couple GB to about 100MB
35 | FROM after-condition AS dragonflybot
36 | WORKDIR /usr/local/bin
37 | CMD ["./dragonflybot-grpc-server"]
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DragonflyBot
2 | A vertically scalable stream processing framework focusing on low latency, helping you scale
3 | and consume financial data feeds.
4 |
5 | ## Design
6 | The framework consists of 5 layers where each layer can be easily extended and can have its own
7 | builder.
8 |
9 | ### Client/protocol layer
10 | Here different clients (supporting different protocols) can be defined e.g. we can have a
11 | builder for WebSockets clients and a different builder for FIX clients.
12 |
13 | ### Feed subscriber layer
14 | Now that we have a connected client, each client/protocol in general require different subscription
15 | approaches e.g. a FIX connection might require different methods than a WebSocket connection. We
16 | can simply define the requirements or extend them on this layer.
17 |
18 | ### Feed listener layer
19 | Feed listeners are already subscribed to feeds (i.e. they require an active subscriber) and
20 | deal only with processing/responding to the data e.g. forward the message only if top of the order
21 | book has changed.
22 |
23 | ### Feed listener aggregator layer
24 | In practice, we connect to multiple feeds/venues. If we want to get a world view of all, we need to
25 | consume what the feed listeners are emitting in one place/worker. Doing this we can e.g. consume
26 | all the order book messages emitted (and filtered) from feed listeners and construct top best bid,
27 | best offer (BBO) of all order books (constructing BBO world view).
28 |
29 | ### Service layer
30 | The final layer - the place where you define your services which consume from feed listener
31 | aggregators and serve your subscribers e.g. a bot could subscribe to your service to get a BBO
32 | world view.
33 |
34 | ## Allowed topologies
35 | Since the layers are connected only with message passing queues, we can quickly change topologies
36 | from simple ones
37 | ```mermaid
38 | graph TD;
39 | trading_bot-->gRPC_server;
40 |
41 | gRPC_server-->feed_listener_aggregator;
42 | feed_listener_aggregator-->feed_listener1;
43 | feed_listener_aggregator-->feed_listener2;
44 | feed_listener_aggregator-->feed_listener3;
45 |
46 | feed_listener1-->feed_subscriber1;
47 | feed_listener2-->feed_subscriber2;
48 | feed_listener3-->feed_subscriber3;
49 |
50 | feed_subscriber1-->client1/protocol1;
51 | feed_subscriber2-->client2/protocol2;
52 | feed_subscriber3-->client3/protocol1;
53 | ```
54 | to more complex ones
55 | ```mermaid
56 | graph TD;
57 | trading_bot-->gRPC_server;
58 | legacy_customer-->FIX_server;
59 |
60 | gRPC_server-->|stream BBO| feed_listener_aggregator1;
61 | FIX_server-->|stream BBO| feed_listener_aggregator1;
62 | FIX_server-->|stream aggregated liquidity| feed_listener_aggregator2;
63 | FIX_server-->|liquidate big order| execution_engine
64 |
65 | feed_listener_aggregator1-->feed_listener1;
66 | feed_listener_aggregator1-->feed_listener2;
67 | feed_listener_aggregator1-->feed_listener3;
68 |
69 | feed_listener_aggregator2-->feed_listener1;
70 | feed_listener_aggregator2-->feed_listener2;
71 | feed_listener_aggregator2-->feed_listener3;
72 |
73 | feed_listener1-->feed_subscriber1;
74 | feed_listener2-->feed_subscriber2;
75 | feed_listener3-->feed_subscriber3;
76 |
77 | feed_subscriber1-->client1/protocol1;
78 | feed_subscriber2-->client2/protocol2;
79 | feed_subscriber3-->client3/protocol1;
80 | ```
81 | simply by changing the type of the queue (MPSC to e.g. SPMC) and introducing transformers if needed.
82 |
83 | ## Performance considerations
84 | ### WebSocket client
85 | Based on [WS benchmarks](https://github.com/nurmohammed840/web-socket-benchmark),
86 | [websocket.rs](https://github.com/nurmohammed840/websocket.rs) provides the fastest WS client. However,
87 | TLS doesn't seem to be supported. The second fastest - `fastwebsockets` supports TLS and reading
88 | single frames. So if we're only interested in top of the book, we could only read a part of the whole
89 | message i.e. read only the frames needed to get top N BBO.
90 |
91 | ### JSON document parsing
92 | Since we're only interested in top level access (getting bids/asks), we can go with property based
93 | parsing libs which are [up to 10x faster than libs which parse the whole JSON](https://github.com/AnnikaCodes/rust-json-parsing-benchmarks).
94 | Using property based parsing we also implement functionality of JSON stream parsers, parsing only the number of
95 | consecutive values needed i.e. for getting top 10 of the book, we parse only 10 values.
96 |
97 | ### Alternative allocators
98 | `tikv-jemallocator` is used for improving the performance of allocations.
99 |
100 | ### Other opportunities
101 | For small vectors `SmallVec` could be used.
102 |
103 |
104 | ## Usage
105 | To run an example where we aggregate order books and publish top 10 via a gRPC server:
106 | ```shell
107 | # start the gRPC server in the background
108 | cargo run --bin dragonflybot-grpc-server -- --instrument-name ethbtc&
109 |
110 | # run the client
111 | cargo run --bin dragonflybot-grpc-client
112 |
113 | # Docker
114 | DOCKER_BUILDKIT=1 docker build -t dragonflybot:latest .
115 |
116 | # run the server in the background
117 | docker run \
118 | --name dragonflybot_grpc_server \
119 | --rm \
120 | --user="$(id -u):$(id -u)" \
121 | --group-add="$(id -u)" \
122 | -p 127.0.0.1:50051:50051 \
123 | dragonflybot:latest \
124 | dragonflybot-grpc-server --instrument-name ethbtc &
125 |
126 | # run the gRPC client
127 | docker run \
128 | --name dragonflybot_grpc_client \
129 | --rm \
130 | --user="$(id -u):$(id -u)" \
131 | --group-add="$(id -u)" \
132 | --net="host" \
133 | dragonflybot:latest \
134 | dragonflybot-grpc-client
135 |
136 | # to stop containers
137 | docker stop dragonflybot_grpc_client \
138 | && docker stop dragonflybot_grpc_server
139 | ```
140 |
141 | ## Developing
142 | For developing a multi stage, multi branch Dockerfile, supporting Rust build cache via `cargo-chef` is available.
143 | ```shell
144 | # run tests
145 | cargo test
146 |
147 | DOCKER_BUILDKIT=1 docker build --build-arg "BUILD_PROFILE=dev" -t dragonflybot_dev:latest .
148 | ```
--------------------------------------------------------------------------------
/build.rs:
--------------------------------------------------------------------------------
1 | use tonic_build;
2 |
3 |
4 | fn main() -> Result<(), Box> {
5 | tonic_build::compile_protos("proto/orderbook.proto")?;
6 | Ok(())
7 | }
8 |
9 |
10 |
--------------------------------------------------------------------------------
/proto/orderbook.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package orderbook;
4 |
5 | service OrderbookAggregator {
6 | rpc BookSummary(Empty) returns (stream Summary);
7 | }
8 |
9 | message Empty {}
10 |
11 | message Summary {
12 | double spread = 1;
13 | repeated Level bids = 2;
14 | repeated Level asks = 3;
15 | }
16 |
17 | message Level {
18 | string exchange = 1;
19 | double price = 2;
20 | double amount = 3;
21 | }
--------------------------------------------------------------------------------
/src/bin/grpc_client.rs:
--------------------------------------------------------------------------------
1 | //! Example gRPC client that prints received messages
2 |
3 | use tokio;
4 | use tokio_stream::StreamExt;
5 | use tonic::transport;
6 |
7 | use dragonflybot::{constants, error, service::grpc::server::orderbook};
8 |
9 | type GrpcClient = orderbook::orderbook_aggregator_client::OrderbookAggregatorClient;
10 |
11 |
12 | async fn print_stream(client: &mut GrpcClient) {
13 | let rq = orderbook::Empty{};
14 | let mut stream = client.book_summary(rq)
15 | .await
16 | .unwrap()
17 | .into_inner();
18 |
19 | while let Some(item) = stream.next().await {
20 | println!("{:?}", item.unwrap());
21 | }
22 | }
23 |
24 |
25 | #[tokio::main]
26 | async fn main() -> Result<(), error::Error> {
27 | let mut client = GrpcClient::connect(
28 | format!("http://localhost:{}", constants::service::GRPC_SERVER_PORT)).await.unwrap();
29 | print_stream(&mut client).await;
30 |
31 | Ok(())
32 | }
--------------------------------------------------------------------------------
/src/bin/grpc_server.rs:
--------------------------------------------------------------------------------
1 | //! A gRPC server publishing top best bid&ask from aggregated order book
2 | #![deny(unsafe_code)]
3 | #[global_allocator]
4 | static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
5 |
6 | use std::sync::Arc;
7 |
8 | use clap::Parser;
9 | use dragonflybot::{constants, error, feed, service::grpc::orderbook_aggregator,
10 | service::grpc::server::orderbook::orderbook_aggregator_server, types, util};
11 | use error_stack::{IntoReport, Result, ResultExt};
12 | use tokio::sync::{broadcast, mpsc};
13 | use tonic;
14 | use tracing;
15 | use tracing_subscriber;
16 |
17 |
18 | #[derive(Parser, Debug)]
19 | #[command(author, version, about, long_about = None)]
20 | struct Args {
21 | /// Instrument name to subscribe to
22 | #[arg(short, long)]
23 | instrument_name: String,
24 | }
25 |
26 |
27 | fn main() -> Result<(), error::Error> {
28 | let args = Args::parse();
29 | let addr = format!("0.0.0.0:{}", constants::service::GRPC_SERVER_PORT).parse().unwrap();
30 | let instrument_name = args.instrument_name.to_owned();
31 |
32 | let logger = tracing_subscriber::fmt()
33 | .compact()
34 | .with_file(true)
35 | .with_line_number(true)
36 | .with_thread_ids(true)
37 | .with_target(false)
38 | .finish();
39 | tracing::subscriber::set_global_default(logger)
40 | .into_report()
41 | .change_context(error::Error)?;
42 |
43 | let threaded_runtime = tokio::runtime::Builder::new_multi_thread()
44 | .enable_io()
45 | .build()
46 | .into_report()
47 | .change_context(error::Error)
48 | .attach_printable("Cannot build threaded runtime")?;
49 |
50 | let (queue_feed_listener_tx, queue_aggregator_rx) =
51 | mpsc::channel::(constants::QUEUE_BUFFER_SIZE);
52 | let (broadcast_tx, _) =
53 | broadcast::channel::(1);
54 | let broadcast_aggregator_tx = Arc::new(broadcast_tx);
55 | let broadcast_aggregator_tx_clone = Arc::clone(&broadcast_aggregator_tx);
56 |
57 | //spawn listeners
58 | let cloned_queue1 = queue_feed_listener_tx.clone();
59 | let cloned_queue2 = queue_feed_listener_tx.clone();
60 | let cloned_instrument_name1 = instrument_name.to_owned();
61 | let cloned_instrument_name2 = instrument_name.to_owned();
62 |
63 | threaded_runtime.spawn(
64 | async move {
65 | let mut listener = feed::listener::orderbook_snap_change_forwarder::Listener::::new(
66 | constants::Feed::BinanceSpot,
67 | cloned_queue1,
68 | constants::listener::orderbook_snap_change_forwarder::msg_offset_orderbook_start::BINANCE,
69 | cloned_instrument_name1
70 | )
71 | .await.expect("Could not create new listener");
72 | let _ = listener.run().await;});
73 | threaded_runtime.spawn(
74 | async move {
75 | let mut listener = feed::listener::orderbook_snap_change_forwarder::Listener::::new(
76 | constants::Feed::BitstampSpot,
77 | cloned_queue2,
78 | constants::listener::orderbook_snap_change_forwarder::msg_offset_orderbook_start::BITSTAMP,
79 | cloned_instrument_name2
80 | )
81 | .await.expect("Could not create new listener");
82 | let _ = listener.run().await;});
83 |
84 |
85 | //start the gRPC server
86 | threaded_runtime.spawn(
87 | tonic::transport::Server::builder()
88 | .add_service(
89 | orderbook_aggregator_server::OrderbookAggregatorServer::new(
90 | orderbook_aggregator::OrderbookAggregatorService{
91 | context: {util::GrpcClientContext {
92 | instrument_name: instrument_name.to_owned(),
93 | broadcast_aggregator_tx: broadcast_aggregator_tx_clone,
94 | }
95 | }}))
96 | .serve(addr)
97 | );
98 |
99 | // run the aggregator in it's own thread
100 | let handle_thread = std::thread::spawn(||{
101 | let mut listener_aggregator = feed::listener_aggregator::top_bbo::Aggregator {
102 | queue_rx: queue_aggregator_rx,
103 | queue_tx: broadcast_aggregator_tx
104 | };
105 | listener_aggregator.run();
106 | });
107 | handle_thread.join().unwrap();
108 |
109 | Ok(())
110 | }
--------------------------------------------------------------------------------
/src/constants.rs:
--------------------------------------------------------------------------------
1 | use strum;
2 |
3 |
4 | pub const QUEUE_BUFFER_SIZE: usize = 1024 * 1024;
5 | pub const ORDER_PRICE_INF: i32 = 100_000_000; //a price not reachable by any fin. instrument
6 |
7 | pub enum Protocol {
8 | // ARROWHEAD, //Tokio Stock Exchange
9 | // BOE, //Chicago options
10 | // FIX,
11 | // OUCH,
12 | // PILLAR, //NYSE
13 | // REST,
14 | // SAIL, //Borsa Italia derivatives
15 | // T7ETI, //Xetra (Frankfurt Stock Exchange)
16 | // UTP, //Warshaw Stock Exchange
17 | WEBSOCKETS
18 | }
19 |
20 | pub mod listener {
21 | pub mod orderbook_snap_change_forwarder {
22 | pub const INIT_DUMMY_MSG: &str = "{\"data\":{\"timestamp\":\"1686616236\",\"microtimestamp\":\"1686616236740643\",\"bids\":[";
23 |
24 | pub mod msg_offset_orderbook_start {
25 | pub const BINANCE: usize = 76;
26 | pub const BITSTAMP: usize = 78;
27 | }
28 | }
29 | }
30 | pub mod feed_aggregator {
31 | pub const TOP_N_BBO: usize = 10;
32 | }
33 | pub mod service {
34 | pub const GRPC_SERVER_PORT: usize = 50051;
35 | }
36 |
37 | pub struct FeedInfo<'a> {
38 | pub domain: &'a str,
39 | pub path: &'a str,
40 | pub port: u16,
41 | pub protocol: Protocol
42 | }
43 |
44 | #[derive(strum::EnumCount, strum::EnumIter, Clone, Copy, Debug, strum::Display)]
45 | pub enum Feed {
46 | BinanceSpot,
47 | BitstampSpot
48 | }
49 | impl Feed {
50 | pub fn feed_info(&self) -> FeedInfo<'static> {
51 | match self {
52 | Feed::BinanceSpot => FeedInfo{domain: "stream.binance.com", path: "/stream", port: 9443, protocol: Protocol::WEBSOCKETS},
53 | Feed::BitstampSpot => FeedInfo{domain: "ws.bitstamp.net", path: "", port: 443, protocol: Protocol::WEBSOCKETS},
54 | }
55 | }
56 | pub fn feed_name_for_grpc_service(&self) -> &str {
57 | match self {
58 | Feed::BinanceSpot => "binance",
59 | Feed::BitstampSpot => "bitstamp"
60 | }
61 | }
62 | }
63 |
64 | pub mod feed {
65 | // create a binding/contract so only these types can be used in listeners and subscribers
66 | pub trait Feed {}
67 |
68 | pub struct BinanceSpot {} impl Feed for BinanceSpot {}
69 | pub struct BitstampSpot {} impl Feed for BitstampSpot {}
70 | }
--------------------------------------------------------------------------------
/src/error.rs:
--------------------------------------------------------------------------------
1 | use std::fmt;
2 |
3 | use error_stack::Context;
4 |
5 |
6 | #[derive(Debug)]
7 | pub struct Error;
8 | #[derive(Debug)]
9 | pub enum ClientError {
10 | Error,
11 | ParsingError,
12 | EndpointClosedConnection
13 | }
14 | #[derive(Debug)]
15 | pub struct ListenerError;
16 | #[derive(Debug)]
17 | pub struct ListenerAggregatorError;
18 | #[derive(Debug)]
19 | pub struct SubscriberError;
20 |
21 | impl Context for Error {}
22 | impl Context for ClientError {}
23 | impl Context for ListenerError {}
24 | impl Context for ListenerAggregatorError {}
25 | impl Context for SubscriberError {}
26 |
27 | impl fmt::Display for Error {
28 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
29 | f.write_str("MainError")
30 | }
31 | }
32 | impl fmt::Display for ClientError {
33 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34 | f.write_str("ClientError")
35 | }
36 | }
37 | impl fmt::Display for ListenerError {
38 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39 | f.write_str("MainError")
40 | }
41 | }
42 | impl fmt::Display for ListenerAggregatorError {
43 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44 | f.write_str("ListenerAggregatorError")
45 | }
46 | }
47 | impl fmt::Display for SubscriberError {
48 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
49 | f.write_str("SubscriberError")
50 | }
51 | }
--------------------------------------------------------------------------------
/src/feed.rs:
--------------------------------------------------------------------------------
1 | pub mod client;
2 | pub mod subscriber;
3 | pub mod listener;
4 | pub mod listener_aggregator;
--------------------------------------------------------------------------------
/src/feed/client.rs:
--------------------------------------------------------------------------------
1 | pub mod ws;
2 | mod tls;
--------------------------------------------------------------------------------
/src/feed/client/tls.rs:
--------------------------------------------------------------------------------
1 | use crate::error;
2 |
3 |
4 | /// Gets a TLS connection e.g. for the web socket client
5 | pub fn get_connector() -> Result {
6 | let mut root_store = tokio_rustls::rustls::RootCertStore::empty();
7 |
8 | root_store.add_server_trust_anchors(
9 | webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
10 | tokio_rustls::rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
11 | ta.subject,
12 | ta.spki,
13 | ta.name_constraints,
14 | )
15 | }),
16 | );
17 | let config = tokio_rustls::rustls::ClientConfig::builder()
18 | .with_safe_defaults()
19 | .with_root_certificates(root_store)
20 | .with_no_client_auth();
21 | Ok(tokio_rustls::TlsConnector::from(std::sync::Arc::new(config)))
22 | }
--------------------------------------------------------------------------------
/src/feed/client/ws.rs:
--------------------------------------------------------------------------------
1 | use error_stack::{IntoReport, Result, ResultExt, Report};
2 | use hyper::rt;
3 |
4 | use crate::constants;
5 | use crate::error;
6 | use super::tls;
7 |
8 |
9 | pub struct ClientManager<'a> {
10 | client: fastwebsockets::FragmentCollector,
11 | feed_info: constants::FeedInfo<'a>
12 | }
13 | struct SpawnExecutor;
14 |
15 | impl<'a> ClientManager<'a> {
16 | pub async fn new(feed_info: constants::FeedInfo<'a>) -> Result, error::ClientError> {
17 | Ok(ClientManager {
18 | client: get_ws_client(feed_info.domain, feed_info.port, feed_info.path).await?,
19 | feed_info})
20 | }
21 |
22 | /// Returns the whole message as received, as `String`
23 | ///
24 | /// In general we could work on single frames and thus avoid unneeded processing. However for some
25 | /// applications we just need the whole message. And that is what we return here - concatenated frames,
26 | /// from which we parse a string.
27 | pub async fn read_msg(&mut self) -> Result {
28 | match self.client.read_frame().await {
29 | Ok(frame) => {
30 | match frame.opcode {
31 | fastwebsockets::OpCode::Text => {
32 | String::from_utf8(frame.payload.to_vec())
33 | .into_report()
34 | .change_context(error::ClientError::ParsingError)
35 | .attach_printable("Could not parse to string")
36 | .attach(frame)
37 | }
38 | fastwebsockets::OpCode::Close => {
39 | Err(Report::new(error::ClientError::EndpointClosedConnection))
40 | }
41 | _ => Err(
42 | Report::new(error::ClientError::Error)
43 | .attach_printable("Unexpected opcode")
44 | .attach(frame.opcode)
45 | )
46 | }
47 | }
48 | Err(e) => Err(
49 | Report::new(error::ClientError::Error)
50 | .attach_printable("Cannot read frame")
51 | .attach(e)
52 | )
53 | }
54 | }
55 |
56 | pub async fn reconnect(&mut self) -> Result<(), error::ClientError> {
57 | self.client = get_ws_client(self.feed_info.domain, self.feed_info.port, self.feed_info.path)
58 | .await?;
59 | Ok(())
60 | }
61 |
62 | pub async fn send(&mut self, msg: &serde_json::Value) {
63 | let _ = self.client.write_frame(
64 | fastwebsockets::Frame::text(msg.to_string().as_bytes().to_vec().into()))
65 | .await;
66 | }
67 | }
68 |
69 | // `tokio` executor needed only to process the initial handshake where we upgrade to WS protocol
70 | impl rt::Executor for SpawnExecutor
71 | where
72 | Fut: std::future::Future + Send + 'static,
73 | Fut::Output: Send + 'static, {
74 | fn execute(&self, fut: Fut) {tokio::task::spawn(fut);}
75 | }
76 |
77 | /// Gets a connected web sockets client on a secure connection
78 | ///
79 | /// In order to upgrade the connection to the WS protocol, we first get a secure stream
80 | /// and upgrade the connection to the WS protocol with a handshake. As many servers
81 | /// require a `pong` response on their `ping`, this is always enabled in this client.
82 | async fn get_ws_client(domain: &str, port: u16, path: &str)
83 | -> Result, error::ClientError> {
84 | let addr = format!("{}:{}", domain, port);
85 | let tcp_stream = tokio::net::TcpStream::connect(&addr)
86 | .await
87 | .into_report()
88 | .change_context(error::ClientError::Error)
89 | .attach_printable("Establishing TCP stream failed")?;
90 |
91 | let domain_tls = tokio_rustls::rustls::ServerName::try_from(
92 | domain).map_err(|_| {
93 | Report::new(error::ClientError::Error).attach_printable("Invalid DNS name")})?;
94 | let tls_connector = tls::get_connector().unwrap();
95 | let tls_stream = tls_connector.connect(domain_tls, tcp_stream)
96 | .await
97 | .into_report()
98 | .change_context(error::ClientError::Error)
99 | .attach_printable("Could not establish TLS stream")?;
100 | let req = hyper::Request::builder()
101 | .method("GET")
102 | .uri(format!("wss://{}:{}{}", domain, port, path))
103 | .header("Host", &addr)
104 | .header(hyper::header::UPGRADE, "websocket")
105 | .header(hyper::header::CONNECTION, "upgrade")
106 | .header(
107 | "Sec-WebSocket-Key",
108 | fastwebsockets::handshake::generate_key(),
109 | )
110 | .header("Sec-WebSocket-Version", "13")
111 | .body(hyper::Body::empty())
112 | .into_report()
113 | .change_context(error::ClientError::Error)
114 | .attach_printable("Failed building request")?;
115 | let (mut ws, _) = fastwebsockets::handshake::client(
116 | &SpawnExecutor, req, tls_stream)
117 | .await
118 | .unwrap();
119 | ws.set_auto_pong(true);
120 | Ok(fastwebsockets::FragmentCollector::new(ws))
121 | }
--------------------------------------------------------------------------------
/src/feed/listener.rs:
--------------------------------------------------------------------------------
1 | pub mod orderbook_snap_change_forwarder;
--------------------------------------------------------------------------------
/src/feed/listener/orderbook_snap_change_forwarder.rs:
--------------------------------------------------------------------------------
1 | //! Order book snap change forwarder
2 | //!
3 | //! This worker subscribes to order book snapshots and forwards the order book to
4 | //! queue consumer only if anything in the order book has changed.
5 |
6 | mod binance;
7 | mod bitstamp;
8 |
9 | use std;
10 | use std::str::FromStr;
11 |
12 | use async_trait;
13 | use error_stack::{Result, ResultExt};
14 | use rust_decimal;
15 | use tokio;
16 | use tokio::sync::mpsc;
17 | use tracing;
18 |
19 | use crate::constants;
20 | use crate::constants::feed;
21 | use crate::constants::feed_aggregator;
22 | use constants::listener::orderbook_snap_change_forwarder;
23 | use crate::error;
24 | use crate::feed::subscriber::ws;
25 | use crate::feed::subscriber::ws::Subscribe;
26 | use crate::types;
27 | use crate::util;
28 |
29 |
30 | #[async_trait::async_trait]
31 | pub trait ParseMsg: Send {
32 | fn parse_json_array_slice(&self, feed: constants::Feed, msg: &str, gjson_path: &str) -> [util::Order; feed_aggregator::TOP_N_BBO] {
33 | //we might want to use a memory pool instead
34 | let mut orders = [util::Order::default(); feed_aggregator::TOP_N_BBO];
35 | let value = gjson::get(msg, gjson_path);
36 | let mut i: usize = 0;
37 |
38 | value.each(|_, value| {
39 | let tpl = value.array();
40 | let order = &mut orders[i];
41 | order.amount = rust_decimal::Decimal::from_str(tpl[1].str()).expect("Expected a string float");
42 | order.feed = feed;
43 | order.price = rust_decimal::Decimal::from_str(tpl[0].str()).expect("Expected a string float");
44 |
45 | i += 1;
46 | if i == feed_aggregator::TOP_N_BBO {false} else {true}
47 | });
48 | return orders;
49 | }
50 |
51 | /// Parses a snap of the order book msg
52 | ///
53 | /// # Warning
54 | /// We assume some basic invariants on the data are always true:
55 | /// - the order book snap msg always contains at least top N bids and asks
56 | /// - bids and asks are always ordered in the msg
57 | /// - bids and asks are ordered in the same way for all feeds we subscribe to
58 | ///
59 | /// We observe that to be the case from observing the data. However one could have a separate
60 | /// service that actually checks these invariants and if one gets violated, raises a signal/alarm.
61 | ///
62 | /// # Optimization considerations
63 | /// To get top N from the merged order book, we need to send only top N orders from each feed's
64 | /// order book.
65 | fn parse_orderbook_snap(&self, feed: constants::Feed, msg: &str) -> util::OrderBookTopN {
66 | let asks = self.parse_json_array_slice(feed, msg, "data.asks");
67 | let bids = self.parse_json_array_slice(feed, msg, "data.bids");
68 | util::OrderBookTopN {asks, bids}
69 | }
70 | }
71 |
72 |
73 | pub struct Listener<'a, T: feed::Feed> {
74 | feed: constants::Feed,
75 | instrument_name: String,
76 | msg_offset_orderbook_start: usize,
77 | subscriber: ws::Subscriber<'a, T>,
78 | queue_tx: mpsc::Sender
79 | }
80 |
81 | impl<'a, T: feed::Feed> Listener<'a, T>
82 | where ws::Subscriber<'a, T>: Subscribe, Self: ParseMsg {
83 | pub async fn new(feed: constants::Feed, queue_tx: mpsc::Sender,
84 | msg_offset_orderbook_start: usize, instrument_name: String)
85 | -> Result, error::ListenerError> {
86 | let subscriber = ws::Subscriber::<'a, T>::new(feed.feed_info()).await
87 | .change_context(error::ListenerError)?;
88 | Ok(Listener::<'a, T>{feed, msg_offset_orderbook_start, subscriber, queue_tx, instrument_name})
89 | }
90 |
91 | /// Notifies downstream to exclude this feed from the gRPC stream.
92 | ///
93 | /// In an event of an error or a reconnect, we don't want to propagate the error or stall the
94 | /// downstream updates causing calculations that result in states that don't represent the
95 | /// current market state. So in cases that require some time to recover e.g. reconnects, we
96 | /// update downstream with unreachable prices. Since downstream is sorting by (price, amount)
97 | /// this effectively causes our feed to be taken out of the resulting stream. And the gRPC
98 | /// client doesn't sees the stale data (no data for this feed until we recover).
99 | async fn exclude_listener_from_grpc_stream(&mut self) {
100 | tracing::warn!("Excluding feed from gRPC stream: {}", self.feed);
101 |
102 | let mut orderbook= util::OrderBookTopN::default();
103 | orderbook.set_unreachable_price();
104 |
105 | let feed_orderbook = util::FeedOrderBook{feed: self.feed.to_owned(), orderbook};
106 |
107 | match &self.queue_tx.send(Box::new(feed_orderbook)).await {
108 | Ok(_) => {}
109 | Err(e) => {tracing::error!("Cannot send item to queue: {}", e)}
110 | }
111 | }
112 |
113 | /// Detects if anything in the order book has changed
114 | ///
115 | /// # Details
116 | /// We can reduce this problem to string slice comparison i.e. we don't need to waste resources
117 | /// parsing, ordering and comparing the data. Note that this holds only for certain feeds and might
118 | /// not be true in general. It can work for feeds where we notice that:
119 | /// - bids and asks are already price ordered
120 | /// - bid and ask fields are at predictable positions
121 | /// - other fields (timestamp, instrument_name, etc.) are at predictable positions
122 | /// - field positions aren't changing
123 | ///
124 | /// # Optimization opportunities
125 | /// Since we're interested only in the change in top of the order book, we could avoid comparing
126 | /// the whole message to the previous one but compare only the top of the message. If we decide
127 | /// to go that way, same invariants apply as mentioned in the #Details section.
128 | fn has_orderbook_changed(&self, old_msg: &str, new_msg: &str) -> bool {
129 | if old_msg[self.msg_offset_orderbook_start..] == new_msg[self.msg_offset_orderbook_start..]
130 | {false} else {true}
131 | }
132 |
133 | /// Entry point for the task - worker
134 | pub async fn run(&mut self) -> Result<(), error::ListenerError> {
135 | let mut old_msg = orderbook_snap_change_forwarder::INIT_DUMMY_MSG.to_owned();
136 | self.subscriber.subscribe_to_l2_snap(&self.instrument_name).await
137 | .change_context(error::ListenerError)?;
138 |
139 | loop {
140 | match self.subscriber.client.read_msg().await {
141 | Ok(msg) => {
142 | if self.has_orderbook_changed(&old_msg, &msg) {
143 | let orderbook = self.parse_orderbook_snap(self.feed.to_owned(), &msg);
144 | let feed_orderbook = util::FeedOrderBook{feed: self.feed.to_owned(), orderbook};
145 |
146 | //we might want to use a memory pool instead of `Box`ing `feed_orderbook`
147 | match &self.queue_tx.send(Box::new(feed_orderbook)).await {
148 | Ok(_) => {}
149 | Err(e) => {tracing::error!("Cannot send item to queue: {}", e)}
150 | }
151 | old_msg = msg;
152 | }
153 | },
154 | Err(e) => {
155 | tracing::error!("Error reading from WebSockets: {}", e);
156 | self.exclude_listener_from_grpc_stream().await;
157 |
158 | match e.current_context() {
159 | error::ClientError::EndpointClosedConnection => {
160 | tracing::info!("WebSocket endpoint has closed the connection, attempting to reconnect to feed: {}", self.feed);
161 |
162 | // try to reestablish previous state
163 | self.subscriber.client.reconnect().await
164 | .change_context(error::ListenerError)?;
165 | self.subscriber.subscribe_to_l2_snap(&self.instrument_name).await
166 | .change_context(error::ListenerError)?;
167 | }
168 | error::ClientError::Error => {tracing::error!("Could not read from websockets: {}", e)}
169 | error::ClientError::ParsingError => {tracing::error!("Websockets msg could not be parsed: {}", e)}
170 | }
171 | }
172 | };
173 | }
174 | }
175 | }
176 |
177 |
178 | #[cfg(test)]
179 | mod tests {
180 | use super::*;
181 |
182 |
183 | //test different cases for this method
184 | mod has_orderbook_changed {
185 | use super::*;
186 |
187 | #[tokio::test]
188 | async fn test_orderbook_not_changed() {
189 | let new_msg = orderbook_snap_change_forwarder::INIT_DUMMY_MSG;
190 | let old_msg = orderbook_snap_change_forwarder::INIT_DUMMY_MSG;
191 |
192 | let (tx_binance, _) = mpsc::channel::(constants::QUEUE_BUFFER_SIZE);
193 | let tx_bitstamp = tx_binance.clone();
194 | let cloned_instrument_name1 = "btceth".to_owned();
195 | let cloned_instrument_name2 = cloned_instrument_name1.to_owned();
196 | let binance_spot = Listener::::new(
197 | constants::Feed::BinanceSpot,
198 | tx_binance,
199 | orderbook_snap_change_forwarder::msg_offset_orderbook_start::BINANCE,
200 | cloned_instrument_name1,
201 | ).await.expect("Cannot create listener");
202 | let bitstamp_spot = Listener::::new(
203 | constants::Feed::BitstampSpot,
204 | tx_bitstamp,
205 | orderbook_snap_change_forwarder::msg_offset_orderbook_start::BITSTAMP,
206 | cloned_instrument_name2
207 | ).await.expect("Cannot create listener");
208 |
209 | assert_eq!(binance_spot.has_orderbook_changed(&new_msg, &old_msg), false);
210 | assert_eq!(bitstamp_spot.has_orderbook_changed(&new_msg, &old_msg), false);
211 | }
212 |
213 | #[tokio::test]
214 | async fn test_orderbook_has_changed() {
215 | let (tx_binance, _) = mpsc::channel::(constants::QUEUE_BUFFER_SIZE);
216 | let tx_bitstamp = tx_binance.clone();
217 | let cloned_instrument_name1 = "btceth".to_owned();
218 | let cloned_instrument_name2 = cloned_instrument_name1.to_owned();
219 | let binance_spot = Listener::::new(
220 | constants::Feed::BinanceSpot,
221 | tx_binance,
222 | orderbook_snap_change_forwarder::msg_offset_orderbook_start::BINANCE,
223 | cloned_instrument_name1,
224 | ).await.expect("Cannot create listener");
225 | let bitstamp_spot = Listener::::new(
226 | constants::Feed::BitstampSpot,
227 | tx_bitstamp,
228 | orderbook_snap_change_forwarder::msg_offset_orderbook_start::BITSTAMP,
229 | cloned_instrument_name2
230 | ).await.expect("Cannot create listener");
231 |
232 | let old_msg = orderbook_snap_change_forwarder::INIT_DUMMY_MSG;
233 | let mut new_msg= old_msg.to_owned();
234 | new_msg.push_str("new updated_field");
235 |
236 | assert_eq!(binance_spot.has_orderbook_changed(&new_msg, &old_msg), true);
237 | assert_eq!(bitstamp_spot.has_orderbook_changed(&new_msg, &old_msg), true);
238 | }
239 | }
240 | }
--------------------------------------------------------------------------------
/src/feed/listener/orderbook_snap_change_forwarder/binance.rs:
--------------------------------------------------------------------------------
1 | use async_trait;
2 |
3 | use crate::constants::feed;
4 | use crate::feed::listener::orderbook_snap_change_forwarder;
5 |
6 |
7 | #[async_trait::async_trait]
8 | impl<'a> orderbook_snap_change_forwarder::ParseMsg for orderbook_snap_change_forwarder::Listener<'a, feed::BinanceSpot> {}
--------------------------------------------------------------------------------
/src/feed/listener/orderbook_snap_change_forwarder/bitstamp.rs:
--------------------------------------------------------------------------------
1 | use async_trait;
2 |
3 | use crate::constants::feed;
4 | use crate::feed::listener::orderbook_snap_change_forwarder;
5 |
6 |
7 | #[async_trait::async_trait]
8 | impl<'a> orderbook_snap_change_forwarder::ParseMsg for orderbook_snap_change_forwarder::Listener<'a, feed::BitstampSpot> {}
--------------------------------------------------------------------------------
/src/feed/listener_aggregator.rs:
--------------------------------------------------------------------------------
1 | pub mod top_bbo;
--------------------------------------------------------------------------------
/src/feed/listener_aggregator/top_bbo.rs:
--------------------------------------------------------------------------------
1 | //! Aggregates top N BBO from multiple feeds and publishes to the gRPC service
2 | //!
3 | //! Consumes queue from `orderbook_snap_change_forwarder` listener.
4 | use std;
5 | use std::sync::Arc;
6 |
7 | use rust_decimal;
8 | use rust_decimal::prelude::ToPrimitive;
9 | use strum::EnumCount;
10 | use tokio::sync::{broadcast, mpsc};
11 | use tracing;
12 |
13 | use crate::constants;
14 | use crate::constants::feed_aggregator;
15 | use crate::service::grpc::server::orderbook;
16 | use crate::types;
17 | use crate::util;
18 |
19 |
20 | pub struct Aggregator {
21 | pub queue_rx: mpsc::Receiver,
22 | pub queue_tx: Arc>
23 | }
24 |
25 | impl Aggregator {
26 | /// Runs the aggregator task, should be run in it's own thread
27 | ///
28 | /// When there's backlog in the queue, we try to catch up to the latest market state before we
29 | /// run the calculations.
30 | pub fn run(&mut self) {
31 | const RESERVED_SIZE:usize = constants::Feed::COUNT * feed_aggregator::TOP_N_BBO;
32 | let mut orderbooks = get_initialized_orderbooks();
33 | let mut new_update_available = false;
34 |
35 | loop {
36 | // process backlog
37 | loop {
38 | match self.queue_rx.try_recv() {
39 | Ok(feed_orderbook) => {
40 | let feed_id = feed_orderbook.feed as usize;
41 |
42 | // replace old order book reference with an updated one
43 | orderbooks[feed_id] = feed_orderbook.orderbook;
44 | new_update_available = true;
45 | }
46 | Err(mpsc::error::TryRecvError::Empty) => {
47 | // when all the backlog is processed, we should have a snapshot of latest
48 | // market state, continue with calculations
49 | break
50 | }
51 | Err(e) => {tracing::error!("Cannot receive from queue: {}", e)}
52 | }
53 | }
54 |
55 | if new_update_available {
56 | // We could allocate the vector before the loop but since we're storing references,
57 | // we'd have lifetime problems (the borrow checker doesn't recognize `.clear()`
58 | // dropping the refs). Another approach is using `std::mem::transmute` but that's
59 | // in the domain of unsafe code. Perhaps use a small memory pool.
60 | let mut asks: Vec<&util::Order> = vec![];
61 | let mut bids: Vec<&util::Order> = vec![];
62 | let mut asks_grpc: Vec = vec![];
63 | let mut bids_grpc: Vec = vec![];
64 | asks.reserve(RESERVED_SIZE);
65 | bids.reserve(RESERVED_SIZE);
66 | asks_grpc.reserve(feed_aggregator::TOP_N_BBO);
67 | bids_grpc.reserve(feed_aggregator::TOP_N_BBO);
68 |
69 | // Get top of the book from all books.
70 | // We concatenate only top N asks/bids from all order books to get sorted top N.
71 | // For that to be true, asks/bids need to be ordered (which we observe in the data we
72 | // receive).
73 | for orderbook in orderbooks.iter() {
74 | let sliced_asks = &orderbook.asks[0..feed_aggregator::TOP_N_BBO];
75 | for order in sliced_asks.iter() { asks.push(order); }
76 |
77 | let sliced_bids = &orderbook.bids[0..feed_aggregator::TOP_N_BBO];
78 | for order in sliced_bids.iter() { bids.push(order); }
79 | }
80 |
81 | // sort asks by (price increasing, amount decreasing)
82 | asks.sort_unstable_by(|a, b| {
83 | if a.price == b.price {
84 | b.amount.cmp(&a.amount)
85 | } else {
86 | a.price.cmp(&b.price)
87 | }
88 | });
89 | // sort bids by (price decreasing, amount decreasing)
90 | bids.sort_unstable_by(|a, b| {
91 | if a.price == b.price {
92 | b.amount.cmp(&a.amount)
93 | } else {
94 | b.price.cmp(&a.price)
95 | }
96 | });
97 |
98 | for ask in &asks[0..feed_aggregator::TOP_N_BBO] {
99 | asks_grpc.push(
100 | orderbook::Level {
101 | exchange: ask.feed.feed_name_for_grpc_service().to_owned(),
102 | price: ask.price.to_f64().unwrap(),
103 | amount: ask.amount.to_f64().unwrap()
104 | });
105 | }
106 | for bid in &bids[0..feed_aggregator::TOP_N_BBO] {
107 | bids_grpc.push(
108 | orderbook::Level {
109 | exchange: bid.feed.feed_name_for_grpc_service().to_owned(),
110 | price: bid.price.to_f64().unwrap(),
111 | amount: bid.amount.to_f64().unwrap()
112 | });
113 | }
114 |
115 | let spread = asks[0].price - bids[0].price;
116 | let orderbook_summary = orderbook::Summary {
117 | spread: spread.to_f64().unwrap(),
118 | asks: asks_grpc,
119 | bids: bids_grpc
120 | };
121 |
122 | //The top_bbo aggregator could send a more general message suitable for multiple consumers.
123 | //If that would be needed, we could introduce a transformer for the stream e.g. each
124 | //stream consumer would have it's own (async) transformer (method).
125 | match self.queue_tx.send(Box::new(orderbook_summary)) {
126 | Ok(_) => {
127 | //msg is sent
128 | }
129 | Err(_) => {
130 | //nobody subscribed to this broadcast yet
131 | }
132 | }
133 | new_update_available = false;
134 | }
135 | }
136 | }
137 | }
138 |
139 | /// Initializes order books to highest asks and lowest bids
140 | ///
141 | /// Since when the program starts, not all order books have the representable value of the market,
142 | /// the ordered results would include default values i.e. price = 0 for e.g. asks. To prevent that,
143 | /// we initialize the values to practically positive and negative infinities.
144 | fn get_initialized_orderbooks() -> [util::OrderBookTopN; constants::Feed::COUNT]{
145 | let mut orderbooks = [util::OrderBookTopN::default(); constants::Feed::COUNT];
146 |
147 | for orderbook in &mut orderbooks {orderbook.set_unreachable_price();}
148 | return orderbooks;
149 | }
--------------------------------------------------------------------------------
/src/feed/subscriber.rs:
--------------------------------------------------------------------------------
1 | pub mod ws;
--------------------------------------------------------------------------------
/src/feed/subscriber/ws.rs:
--------------------------------------------------------------------------------
1 | pub mod binance;
2 | pub mod bitstamp;
3 |
4 | use std;
5 |
6 | use async_trait;
7 | use error_stack::{Result, ResultExt};
8 |
9 | use crate::constants;
10 | use crate::constants::feed;
11 | use crate::error;
12 | use crate::feed::client;
13 |
14 |
15 | #[async_trait::async_trait]
16 | pub trait Subscribe: Send {
17 | async fn subscribe_to_l2_snap(&mut self, instrument_name: &str) -> Result<(), error::SubscriberError>;
18 | }
19 |
20 | pub struct Subscriber<'a, T: feed::Feed> {
21 | pub client: client::ws::ClientManager<'a>,
22 | marker: std::marker::PhantomData
23 | }
24 |
25 | impl<'a, T: feed::Feed> Subscriber<'a, T> {
26 | pub async fn new(feed_info: constants::FeedInfo<'a>) -> Result, error::SubscriberError> {
27 | let client = client::ws::ClientManager::new(feed_info).await
28 | .change_context(error::SubscriberError)?;
29 | Ok(Self{client, marker: std::marker::PhantomData})
30 | }
31 | }
--------------------------------------------------------------------------------
/src/feed/subscriber/ws/binance.rs:
--------------------------------------------------------------------------------
1 | use async_trait;
2 | use error_stack::{Result, Report};
3 | use serde_json;
4 | use tracing;
5 |
6 | use crate::constants::feed;
7 | use crate::error;
8 | use crate::feed::subscriber::ws;
9 |
10 |
11 | #[async_trait::async_trait]
12 | impl<'a> ws::Subscribe for ws::Subscriber<'a, feed::BinanceSpot> {
13 | async fn subscribe_to_l2_snap(&mut self, instrument_name: &str) -> Result<(), error::SubscriberError> {
14 | let rq = serde_json::json!({
15 | "method": "SUBSCRIBE",
16 | "params": [
17 | format!("{}@depth20@100ms", instrument_name)
18 | ],
19 | "id": 1
20 | });
21 | self.client.send(&rq).await;
22 |
23 | // verify subscription succeeded
24 | match self.client.read_msg().await {
25 | Ok(msg) => {
26 | if msg != "{\"result\":null,\"id\":1}" {
27 | return Err(Report::new(error::SubscriberError)
28 | .attach_printable("Subscribing to channel failed")
29 | .attach(msg))
30 | }
31 | tracing::info!("Subscribed to {}", instrument_name);
32 | }
33 | Err(e) => {
34 | return Err(Report::new(error::SubscriberError).attach(e))
35 | }
36 | }
37 | Ok(())
38 | }
39 | }
--------------------------------------------------------------------------------
/src/feed/subscriber/ws/bitstamp.rs:
--------------------------------------------------------------------------------
1 | use async_trait;
2 | use error_stack::{IntoReport, Result, ResultExt, Report};
3 | use serde_json;
4 | use tracing;
5 |
6 | use crate::constants::feed;
7 | use crate::error;
8 | use crate::feed::subscriber::ws;
9 |
10 |
11 | #[async_trait::async_trait]
12 | impl<'a> ws::Subscribe for ws::Subscriber<'a, feed::BitstampSpot> {
13 | async fn subscribe_to_l2_snap(&mut self, instrument_name: &str) -> Result<(), error::SubscriberError> {
14 | let rq = serde_json::json!({
15 | "event": "bts:subscribe",
16 | "data": {
17 | "channel": format!("order_book_{}", instrument_name)
18 | }
19 | });
20 | self.client.send(&rq).await;
21 |
22 | // verify subscription succeeded
23 | match self.client.read_msg().await {
24 | Ok(msg) => {
25 | let response: serde_json::Value = serde_json::from_str(&msg)
26 | .into_report()
27 | .change_context(error::SubscriberError)
28 | .attach(msg)?;
29 |
30 | if response["event"] != "bts:subscription_succeeded" {
31 | return Err(Report::new(error::SubscriberError)
32 | .attach_printable("Subscribing to channel failed")
33 | .attach(response))
34 | }
35 | tracing::info!("Subscribed to {}", instrument_name);
36 | }
37 | Err(e) => {
38 | return Err(Report::new(error::SubscriberError).attach(e))
39 | }
40 | }
41 | Ok(())
42 | }
43 | }
--------------------------------------------------------------------------------
/src/lib.rs:
--------------------------------------------------------------------------------
1 | pub mod constants;
2 | pub mod error;
3 | pub mod feed;
4 | pub mod types;
5 | pub mod util;
6 | pub mod service;
--------------------------------------------------------------------------------
/src/service.rs:
--------------------------------------------------------------------------------
1 | pub mod grpc;
--------------------------------------------------------------------------------
/src/service/grpc.rs:
--------------------------------------------------------------------------------
1 | pub mod orderbook_aggregator;
2 |
3 | pub mod server {
4 | pub mod orderbook {tonic::include_proto!("orderbook");}
5 | }
--------------------------------------------------------------------------------
/src/service/grpc/orderbook_aggregator.rs:
--------------------------------------------------------------------------------
1 | use std;
2 | use std::pin;
3 |
4 | use tokio::sync::{broadcast, mpsc};
5 | use tokio_stream;
6 | use tokio_stream::wrappers;
7 | use tonic;
8 | use tracing;
9 |
10 | use super::server::orderbook;
11 | use super::server::orderbook::orderbook_aggregator_server;
12 | use crate::constants;
13 | use crate::util;
14 |
15 |
16 | pub struct OrderbookAggregatorService {pub context: util::GrpcClientContext}
17 |
18 | #[tonic::async_trait]
19 | impl orderbook_aggregator_server::OrderbookAggregator for OrderbookAggregatorService {
20 | type BookSummaryStream =
21 | pin::Pin> + Send + 'static>>;
22 |
23 | async fn book_summary(&self, _: tonic::Request)
24 | -> Result, tonic::Status> {
25 | tracing::info!("New client connected");
26 | let mut broadcast_rx = self.context.broadcast_aggregator_tx.subscribe();
27 | let (queue_grpc_tx, queue_grpc_rx) =
28 | mpsc::channel::>(constants::QUEUE_BUFFER_SIZE);
29 |
30 | tokio::spawn(
31 | async move {
32 | loop {
33 | match broadcast_rx.recv().await {
34 | Ok(orderbook_summary) => {
35 | match queue_grpc_tx.send(Result::<_, tonic::Status>::Ok(*orderbook_summary)).await {
36 | Ok(_) => {}
37 | Err(_) => {
38 | //client disconnected
39 | tracing::info!("Client disconnected");
40 | break
41 | }
42 | }
43 | }
44 | Err(broadcast::error::RecvError::Lagged(_)) => {
45 | //If we lag behind, keep retrying until we get to the most recent data.
46 | loop {
47 | match broadcast_rx.recv().await {
48 | Ok(orderbook_summary) => {
49 | break match queue_grpc_tx.send(Result::<_, tonic::Status>::Ok(*orderbook_summary)).await {
50 | Ok(_) => {}
51 | Err(e) => {
52 | //client disconnected
53 | tracing::info!("Client disconnected: {}", e);
54 | break
55 | }
56 | }
57 | }
58 | Err(_) => {
59 | // we're lagging behind so continue with the loop until we
60 | // get to the current item on the queue
61 | }
62 | }
63 | }
64 | }
65 | Err(e) => {
66 | tracing::error!("Receiving from queue: {}", e);
67 | match queue_grpc_tx.send(Result::<_, tonic::Status>::Err(
68 | tonic::Status::new(tonic::Code::Internal, "Streaming error"))).await {
69 | Ok(_) => {}
70 | Err(_) => {
71 | //client disconnected
72 | tracing::info!("Client disconnected");
73 | break
74 | }
75 | }
76 | }
77 | }
78 | }
79 | }
80 | );
81 | let stream = wrappers::ReceiverStream::new(queue_grpc_rx);
82 | Ok(tonic::Response::new(Box::pin(stream) as Self::BookSummaryStream))
83 | }
84 | }
85 |
86 |
87 |
--------------------------------------------------------------------------------
/src/types.rs:
--------------------------------------------------------------------------------
1 | use crate::service::grpc::server::orderbook;
2 | use crate::util;
3 |
4 |
5 | pub type BoxedFeedOrderBook = Box;
6 | pub type BoxedOrderbookSummary = Box;
--------------------------------------------------------------------------------
/src/util.rs:
--------------------------------------------------------------------------------
1 | use std::sync::Arc;
2 |
3 | use rust_decimal;
4 | use tokio::sync::broadcast;
5 |
6 | use crate::constants;
7 | use crate::types;
8 |
9 |
10 | #[derive(Debug)]
11 | pub struct FeedOrderBook {
12 | pub feed: constants::Feed,
13 | pub orderbook: OrderBookTopN
14 | }
15 | #[derive(Clone, Copy, Debug)]
16 | pub struct Order {
17 | pub feed: constants::Feed,
18 | pub price: rust_decimal::Decimal,
19 | pub amount: rust_decimal::Decimal
20 | }
21 | impl Default for Order {
22 | fn default() -> Self {
23 | Self{
24 | feed: constants::Feed::BinanceSpot,
25 | price: rust_decimal::Decimal::from(0),
26 | amount: rust_decimal::Decimal::from(0)
27 | }
28 | }
29 | }
30 |
31 | #[derive(Clone, Copy, Debug)]
32 | pub struct OrderBookTopN {
33 | pub asks: [Order; constants::feed_aggregator::TOP_N_BBO],
34 | pub bids: [Order; constants::feed_aggregator::TOP_N_BBO]
35 | }
36 | impl Default for OrderBookTopN {
37 | fn default() -> Self {
38 | Self {
39 | asks: [Order::default(); constants::feed_aggregator::TOP_N_BBO],
40 | bids: [Order::default(); constants::feed_aggregator::TOP_N_BBO]
41 | }
42 | }
43 | }
44 | impl OrderBookTopN {
45 | pub fn set_unreachable_price(&mut self) {
46 | for order in &mut self.asks {
47 | order.price = rust_decimal::Decimal::from(constants::ORDER_PRICE_INF);
48 | }
49 | for order in &mut self.bids {
50 | order.price = rust_decimal::Decimal::from(-constants::ORDER_PRICE_INF);
51 | }
52 | }
53 | }
54 |
55 | pub struct GrpcClientContext {
56 | pub instrument_name: String,
57 | pub broadcast_aggregator_tx: Arc>
58 | }
--------------------------------------------------------------------------------