Parakeet is a Rust-based Bluesky AppServer aiming to implement most of the functionality required to support the Bluesky client
appview atproto bluesky rust appserver

bring over the old firehose consumer (but this time with label support)

+1090
+843
Cargo.lock
··· 18 18 checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" 19 19 20 20 [[package]] 21 + name = "android-tzdata" 22 + version = "0.1.1" 23 + source = "registry+https://github.com/rust-lang/crates.io-index" 24 + checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" 25 + 26 + [[package]] 27 + name = "android_system_properties" 28 + version = "0.1.5" 29 + source = "registry+https://github.com/rust-lang/crates.io-index" 30 + checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" 31 + dependencies = [ 32 + "libc", 33 + ] 34 + 35 + [[package]] 21 36 name = "anstream" 22 37 version = "0.6.18" 23 38 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 98 113 ] 99 114 100 115 [[package]] 116 + name = "base-x" 117 + version = "0.2.11" 118 + source = "registry+https://github.com/rust-lang/crates.io-index" 119 + checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" 120 + 121 + [[package]] 101 122 name = "bitflags" 102 123 version = "2.8.0" 103 124 source = "registry+https://github.com/rust-lang/crates.io-index" 104 125 checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" 105 126 106 127 [[package]] 128 + name = "block-buffer" 129 + version = "0.10.4" 130 + source = "registry+https://github.com/rust-lang/crates.io-index" 131 + checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 132 + dependencies = [ 133 + "generic-array", 134 + ] 135 + 136 + [[package]] 137 + name = "bumpalo" 138 + version = "3.16.0" 139 + source = "registry+https://github.com/rust-lang/crates.io-index" 140 + checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 141 + 142 + [[package]] 107 143 name = "bytemuck" 108 144 version = "1.21.0" 109 145 source = "registry+https://github.com/rust-lang/crates.io-index" 110 146 checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" 111 147 112 148 [[package]] 149 + name = "byteorder" 150 + version = "1.5.0" 151 + source = "registry+https://github.com/rust-lang/crates.io-index" 152 + checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 153 + 154 + [[package]] 113 155 name = "bytes" 114 156 version = "1.9.0" 115 157 source = "registry+https://github.com/rust-lang/crates.io-index" 116 158 checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" 117 159 118 160 [[package]] 161 + name = "cbor4ii" 162 + version = "0.2.14" 163 + source = "registry+https://github.com/rust-lang/crates.io-index" 164 + checksum = "b544cf8c89359205f4f990d0e6f3828db42df85b5dac95d09157a250eb0749c4" 165 + dependencies = [ 166 + "serde", 167 + ] 168 + 169 + [[package]] 170 + name = "cc" 171 + version = "1.2.10" 172 + source = "registry+https://github.com/rust-lang/crates.io-index" 173 + checksum = "13208fcbb66eaeffe09b99fffbe1af420f00a7b35aa99ad683dfc1aa76145229" 174 + dependencies = [ 175 + "shlex", 176 + ] 177 + 178 + [[package]] 119 179 name = "cfg-if" 120 180 version = "1.0.0" 121 181 source = "registry+https://github.com/rust-lang/crates.io-index" 122 182 checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 123 183 124 184 [[package]] 185 + name = "chrono" 186 + version = "0.4.39" 187 + source = "registry+https://github.com/rust-lang/crates.io-index" 188 + checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" 189 + dependencies = [ 190 + "android-tzdata", 191 + "iana-time-zone", 192 + "js-sys", 193 + "num-traits", 194 + "serde", 195 + "wasm-bindgen", 196 + "windows-targets", 197 + ] 198 + 199 + [[package]] 200 + name = "ciborium" 201 + version = "0.2.2" 202 + source = "registry+https://github.com/rust-lang/crates.io-index" 203 + checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" 204 + dependencies = [ 205 + "ciborium-io", 206 + "ciborium-ll", 207 + "serde", 208 + ] 209 + 210 + [[package]] 211 + name = "ciborium-io" 212 + version = "0.2.2" 213 + source = "registry+https://github.com/rust-lang/crates.io-index" 214 + checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" 215 + 216 + [[package]] 217 + name = "ciborium-ll" 218 + version = "0.2.2" 219 + source = "registry+https://github.com/rust-lang/crates.io-index" 220 + checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" 221 + dependencies = [ 222 + "ciborium-io", 223 + "half", 224 + ] 225 + 226 + [[package]] 227 + name = "cid" 228 + version = "0.11.1" 229 + source = "registry+https://github.com/rust-lang/crates.io-index" 230 + checksum = "3147d8272e8fa0ccd29ce51194dd98f79ddfb8191ba9e3409884e751798acf3a" 231 + dependencies = [ 232 + "core2", 233 + "multibase", 234 + "multihash", 235 + "serde", 236 + "serde_bytes", 237 + "unsigned-varint", 238 + ] 239 + 240 + [[package]] 125 241 name = "clap" 126 242 version = "4.5.26" 127 243 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 171 287 name = "consumer" 172 288 version = "0.1.0" 173 289 dependencies = [ 290 + "chrono", 291 + "ciborium", 174 292 "eyre", 175 293 "figment", 294 + "futures", 295 + "ipld-core", 176 296 "serde", 297 + "serde_bytes", 298 + "serde_ipld_dagcbor", 177 299 "tokio", 300 + "tokio-tungstenite", 178 301 "tracing", 179 302 "tracing-subscriber", 180 303 ] 181 304 182 305 [[package]] 306 + name = "core-foundation" 307 + version = "0.9.4" 308 + source = "registry+https://github.com/rust-lang/crates.io-index" 309 + checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 310 + dependencies = [ 311 + "core-foundation-sys", 312 + "libc", 313 + ] 314 + 315 + [[package]] 316 + name = "core-foundation-sys" 317 + version = "0.8.7" 318 + source = "registry+https://github.com/rust-lang/crates.io-index" 319 + checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" 320 + 321 + [[package]] 322 + name = "core2" 323 + version = "0.4.0" 324 + source = "registry+https://github.com/rust-lang/crates.io-index" 325 + checksum = "b49ba7ef1ad6107f8824dbe97de947cbaac53c44e7f9756a1fba0d37c1eec505" 326 + dependencies = [ 327 + "memchr", 328 + ] 329 + 330 + [[package]] 331 + name = "cpufeatures" 332 + version = "0.2.17" 333 + source = "registry+https://github.com/rust-lang/crates.io-index" 334 + checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" 335 + dependencies = [ 336 + "libc", 337 + ] 338 + 339 + [[package]] 340 + name = "crunchy" 341 + version = "0.2.3" 342 + source = "registry+https://github.com/rust-lang/crates.io-index" 343 + checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" 344 + 345 + [[package]] 346 + name = "crypto-common" 347 + version = "0.1.6" 348 + source = "registry+https://github.com/rust-lang/crates.io-index" 349 + checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 350 + dependencies = [ 351 + "generic-array", 352 + "typenum", 353 + ] 354 + 355 + [[package]] 356 + name = "data-encoding" 357 + version = "2.7.0" 358 + source = "registry+https://github.com/rust-lang/crates.io-index" 359 + checksum = "0e60eed09d8c01d3cee5b7d30acb059b76614c918fa0f992e0dd6eeb10daad6f" 360 + 361 + [[package]] 362 + name = "data-encoding-macro" 363 + version = "0.1.16" 364 + source = "registry+https://github.com/rust-lang/crates.io-index" 365 + checksum = "5b16d9d0d88a5273d830dac8b78ceb217ffc9b1d5404e5597a3542515329405b" 366 + dependencies = [ 367 + "data-encoding", 368 + "data-encoding-macro-internal", 369 + ] 370 + 371 + [[package]] 372 + name = "data-encoding-macro-internal" 373 + version = "0.1.14" 374 + source = "registry+https://github.com/rust-lang/crates.io-index" 375 + checksum = "1145d32e826a7748b69ee8fc62d3e6355ff7f1051df53141e7048162fc90481b" 376 + dependencies = [ 377 + "data-encoding", 378 + "syn", 379 + ] 380 + 381 + [[package]] 382 + name = "digest" 383 + version = "0.10.7" 384 + source = "registry+https://github.com/rust-lang/crates.io-index" 385 + checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 386 + dependencies = [ 387 + "block-buffer", 388 + "crypto-common", 389 + ] 390 + 391 + [[package]] 183 392 name = "equivalent" 184 393 version = "1.0.1" 185 394 source = "registry+https://github.com/rust-lang/crates.io-index" 186 395 checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 187 396 188 397 [[package]] 398 + name = "errno" 399 + version = "0.3.10" 400 + source = "registry+https://github.com/rust-lang/crates.io-index" 401 + checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" 402 + dependencies = [ 403 + "libc", 404 + "windows-sys 0.59.0", 405 + ] 406 + 407 + [[package]] 189 408 name = "eyre" 190 409 version = "0.6.12" 191 410 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 194 413 "indenter", 195 414 "once_cell", 196 415 ] 416 + 417 + [[package]] 418 + name = "fastrand" 419 + version = "2.3.0" 420 + source = "registry+https://github.com/rust-lang/crates.io-index" 421 + checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 197 422 198 423 [[package]] 199 424 name = "figment" ··· 210 435 ] 211 436 212 437 [[package]] 438 + name = "fnv" 439 + version = "1.0.7" 440 + source = "registry+https://github.com/rust-lang/crates.io-index" 441 + checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 442 + 443 + [[package]] 444 + name = "foreign-types" 445 + version = "0.3.2" 446 + source = "registry+https://github.com/rust-lang/crates.io-index" 447 + checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 448 + dependencies = [ 449 + "foreign-types-shared", 450 + ] 451 + 452 + [[package]] 453 + name = "foreign-types-shared" 454 + version = "0.1.1" 455 + source = "registry+https://github.com/rust-lang/crates.io-index" 456 + checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 457 + 458 + [[package]] 459 + name = "futures" 460 + version = "0.3.31" 461 + source = "registry+https://github.com/rust-lang/crates.io-index" 462 + checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" 463 + dependencies = [ 464 + "futures-channel", 465 + "futures-core", 466 + "futures-executor", 467 + "futures-io", 468 + "futures-sink", 469 + "futures-task", 470 + "futures-util", 471 + ] 472 + 473 + [[package]] 474 + name = "futures-channel" 475 + version = "0.3.31" 476 + source = "registry+https://github.com/rust-lang/crates.io-index" 477 + checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" 478 + dependencies = [ 479 + "futures-core", 480 + "futures-sink", 481 + ] 482 + 483 + [[package]] 484 + name = "futures-core" 485 + version = "0.3.31" 486 + source = "registry+https://github.com/rust-lang/crates.io-index" 487 + checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" 488 + 489 + [[package]] 490 + name = "futures-executor" 491 + version = "0.3.31" 492 + source = "registry+https://github.com/rust-lang/crates.io-index" 493 + checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" 494 + dependencies = [ 495 + "futures-core", 496 + "futures-task", 497 + "futures-util", 498 + ] 499 + 500 + [[package]] 501 + name = "futures-io" 502 + version = "0.3.31" 503 + source = "registry+https://github.com/rust-lang/crates.io-index" 504 + checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" 505 + 506 + [[package]] 507 + name = "futures-macro" 508 + version = "0.3.31" 509 + source = "registry+https://github.com/rust-lang/crates.io-index" 510 + checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" 511 + dependencies = [ 512 + "proc-macro2", 513 + "quote", 514 + "syn", 515 + ] 516 + 517 + [[package]] 518 + name = "futures-sink" 519 + version = "0.3.31" 520 + source = "registry+https://github.com/rust-lang/crates.io-index" 521 + checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" 522 + 523 + [[package]] 524 + name = "futures-task" 525 + version = "0.3.31" 526 + source = "registry+https://github.com/rust-lang/crates.io-index" 527 + checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" 528 + 529 + [[package]] 530 + name = "futures-util" 531 + version = "0.3.31" 532 + source = "registry+https://github.com/rust-lang/crates.io-index" 533 + checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" 534 + dependencies = [ 535 + "futures-channel", 536 + "futures-core", 537 + "futures-io", 538 + "futures-macro", 539 + "futures-sink", 540 + "futures-task", 541 + "memchr", 542 + "pin-project-lite", 543 + "pin-utils", 544 + "slab", 545 + ] 546 + 547 + [[package]] 548 + name = "generic-array" 549 + version = "0.14.7" 550 + source = "registry+https://github.com/rust-lang/crates.io-index" 551 + checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 552 + dependencies = [ 553 + "typenum", 554 + "version_check", 555 + ] 556 + 557 + [[package]] 558 + name = "getrandom" 559 + version = "0.2.15" 560 + source = "registry+https://github.com/rust-lang/crates.io-index" 561 + checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 562 + dependencies = [ 563 + "cfg-if", 564 + "libc", 565 + "wasi", 566 + ] 567 + 568 + [[package]] 213 569 name = "gimli" 214 570 version = "0.31.1" 215 571 source = "registry+https://github.com/rust-lang/crates.io-index" 216 572 checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" 217 573 218 574 [[package]] 575 + name = "half" 576 + version = "2.4.1" 577 + source = "registry+https://github.com/rust-lang/crates.io-index" 578 + checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" 579 + dependencies = [ 580 + "cfg-if", 581 + "crunchy", 582 + ] 583 + 584 + [[package]] 219 585 name = "hashbrown" 220 586 version = "0.15.2" 221 587 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 228 594 checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" 229 595 230 596 [[package]] 597 + name = "http" 598 + version = "1.2.0" 599 + source = "registry+https://github.com/rust-lang/crates.io-index" 600 + checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" 601 + dependencies = [ 602 + "bytes", 603 + "fnv", 604 + "itoa", 605 + ] 606 + 607 + [[package]] 608 + name = "httparse" 609 + version = "1.9.5" 610 + source = "registry+https://github.com/rust-lang/crates.io-index" 611 + checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" 612 + 613 + [[package]] 614 + name = "iana-time-zone" 615 + version = "0.1.61" 616 + source = "registry+https://github.com/rust-lang/crates.io-index" 617 + checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" 618 + dependencies = [ 619 + "android_system_properties", 620 + "core-foundation-sys", 621 + "iana-time-zone-haiku", 622 + "js-sys", 623 + "wasm-bindgen", 624 + "windows-core", 625 + ] 626 + 627 + [[package]] 628 + name = "iana-time-zone-haiku" 629 + version = "0.1.2" 630 + source = "registry+https://github.com/rust-lang/crates.io-index" 631 + checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" 632 + dependencies = [ 633 + "cc", 634 + ] 635 + 636 + [[package]] 231 637 name = "indenter" 232 638 version = "0.3.3" 233 639 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 250 656 checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" 251 657 252 658 [[package]] 659 + name = "ipld-core" 660 + version = "0.4.1" 661 + source = "registry+https://github.com/rust-lang/crates.io-index" 662 + checksum = "b4ede82a79e134f179f4b29b5fdb1eb92bd1b38c4dfea394c539051150a21b9b" 663 + dependencies = [ 664 + "cid", 665 + "serde", 666 + "serde_bytes", 667 + ] 668 + 669 + [[package]] 253 670 name = "is_terminal_polyfill" 254 671 version = "1.70.1" 255 672 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 262 679 checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" 263 680 264 681 [[package]] 682 + name = "js-sys" 683 + version = "0.3.77" 684 + source = "registry+https://github.com/rust-lang/crates.io-index" 685 + checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" 686 + dependencies = [ 687 + "once_cell", 688 + "wasm-bindgen", 689 + ] 690 + 691 + [[package]] 265 692 name = "lazy_static" 266 693 version = "1.5.0" 267 694 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 272 699 version = "0.2.169" 273 700 source = "registry+https://github.com/rust-lang/crates.io-index" 274 701 checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" 702 + 703 + [[package]] 704 + name = "linux-raw-sys" 705 + version = "0.4.15" 706 + source = "registry+https://github.com/rust-lang/crates.io-index" 707 + checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" 275 708 276 709 [[package]] 277 710 name = "lock_api" ··· 316 749 ] 317 750 318 751 [[package]] 752 + name = "multibase" 753 + version = "0.9.1" 754 + source = "registry+https://github.com/rust-lang/crates.io-index" 755 + checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" 756 + dependencies = [ 757 + "base-x", 758 + "data-encoding", 759 + "data-encoding-macro", 760 + ] 761 + 762 + [[package]] 763 + name = "multihash" 764 + version = "0.19.3" 765 + source = "registry+https://github.com/rust-lang/crates.io-index" 766 + checksum = "6b430e7953c29dd6a09afc29ff0bb69c6e306329ee6794700aee27b76a1aea8d" 767 + dependencies = [ 768 + "core2", 769 + "serde", 770 + "unsigned-varint", 771 + ] 772 + 773 + [[package]] 774 + name = "native-tls" 775 + version = "0.2.12" 776 + source = "registry+https://github.com/rust-lang/crates.io-index" 777 + checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" 778 + dependencies = [ 779 + "libc", 780 + "log", 781 + "openssl", 782 + "openssl-probe", 783 + "openssl-sys", 784 + "schannel", 785 + "security-framework", 786 + "security-framework-sys", 787 + "tempfile", 788 + ] 789 + 790 + [[package]] 319 791 name = "nu-ansi-term" 320 792 version = "0.46.0" 321 793 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 326 798 ] 327 799 328 800 [[package]] 801 + name = "num-traits" 802 + version = "0.2.19" 803 + source = "registry+https://github.com/rust-lang/crates.io-index" 804 + checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" 805 + dependencies = [ 806 + "autocfg", 807 + ] 808 + 809 + [[package]] 329 810 name = "object" 330 811 version = "0.36.7" 331 812 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 339 820 version = "1.20.2" 340 821 source = "registry+https://github.com/rust-lang/crates.io-index" 341 822 checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" 823 + 824 + [[package]] 825 + name = "openssl" 826 + version = "0.10.68" 827 + source = "registry+https://github.com/rust-lang/crates.io-index" 828 + checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" 829 + dependencies = [ 830 + "bitflags", 831 + "cfg-if", 832 + "foreign-types", 833 + "libc", 834 + "once_cell", 835 + "openssl-macros", 836 + "openssl-sys", 837 + ] 838 + 839 + [[package]] 840 + name = "openssl-macros" 841 + version = "0.1.1" 842 + source = "registry+https://github.com/rust-lang/crates.io-index" 843 + checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 844 + dependencies = [ 845 + "proc-macro2", 846 + "quote", 847 + "syn", 848 + ] 849 + 850 + [[package]] 851 + name = "openssl-probe" 852 + version = "0.1.6" 853 + source = "registry+https://github.com/rust-lang/crates.io-index" 854 + checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" 855 + 856 + [[package]] 857 + name = "openssl-sys" 858 + version = "0.9.104" 859 + source = "registry+https://github.com/rust-lang/crates.io-index" 860 + checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" 861 + dependencies = [ 862 + "cc", 863 + "libc", 864 + "pkg-config", 865 + "vcpkg", 866 + ] 342 867 343 868 [[package]] 344 869 name = "overload" ··· 423 948 checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" 424 949 425 950 [[package]] 951 + name = "pin-utils" 952 + version = "0.1.0" 953 + source = "registry+https://github.com/rust-lang/crates.io-index" 954 + checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 955 + 956 + [[package]] 957 + name = "pkg-config" 958 + version = "0.3.31" 959 + source = "registry+https://github.com/rust-lang/crates.io-index" 960 + checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" 961 + 962 + [[package]] 963 + name = "ppv-lite86" 964 + version = "0.2.20" 965 + source = "registry+https://github.com/rust-lang/crates.io-index" 966 + checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" 967 + dependencies = [ 968 + "zerocopy", 969 + ] 970 + 971 + [[package]] 426 972 name = "proc-macro2" 427 973 version = "1.0.93" 428 974 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 454 1000 ] 455 1001 456 1002 [[package]] 1003 + name = "rand" 1004 + version = "0.8.5" 1005 + source = "registry+https://github.com/rust-lang/crates.io-index" 1006 + checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1007 + dependencies = [ 1008 + "libc", 1009 + "rand_chacha", 1010 + "rand_core", 1011 + ] 1012 + 1013 + [[package]] 1014 + name = "rand_chacha" 1015 + version = "0.3.1" 1016 + source = "registry+https://github.com/rust-lang/crates.io-index" 1017 + checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1018 + dependencies = [ 1019 + "ppv-lite86", 1020 + "rand_core", 1021 + ] 1022 + 1023 + [[package]] 1024 + name = "rand_core" 1025 + version = "0.6.4" 1026 + source = "registry+https://github.com/rust-lang/crates.io-index" 1027 + checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1028 + dependencies = [ 1029 + "getrandom", 1030 + ] 1031 + 1032 + [[package]] 457 1033 name = "redox_syscall" 458 1034 version = "0.5.8" 459 1035 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 469 1045 checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 470 1046 471 1047 [[package]] 1048 + name = "rustix" 1049 + version = "0.38.44" 1050 + source = "registry+https://github.com/rust-lang/crates.io-index" 1051 + checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" 1052 + dependencies = [ 1053 + "bitflags", 1054 + "errno", 1055 + "libc", 1056 + "linux-raw-sys", 1057 + "windows-sys 0.59.0", 1058 + ] 1059 + 1060 + [[package]] 1061 + name = "rustversion" 1062 + version = "1.0.19" 1063 + source = "registry+https://github.com/rust-lang/crates.io-index" 1064 + checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" 1065 + 1066 + [[package]] 472 1067 name = "ryu" 473 1068 version = "1.0.18" 474 1069 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 484 1079 ] 485 1080 486 1081 [[package]] 1082 + name = "schannel" 1083 + version = "0.1.27" 1084 + source = "registry+https://github.com/rust-lang/crates.io-index" 1085 + checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" 1086 + dependencies = [ 1087 + "windows-sys 0.59.0", 1088 + ] 1089 + 1090 + [[package]] 487 1091 name = "scopeguard" 488 1092 version = "1.2.0" 489 1093 source = "registry+https://github.com/rust-lang/crates.io-index" 490 1094 checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 491 1095 492 1096 [[package]] 1097 + name = "security-framework" 1098 + version = "2.11.1" 1099 + source = "registry+https://github.com/rust-lang/crates.io-index" 1100 + checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" 1101 + dependencies = [ 1102 + "bitflags", 1103 + "core-foundation", 1104 + "core-foundation-sys", 1105 + "libc", 1106 + "security-framework-sys", 1107 + ] 1108 + 1109 + [[package]] 1110 + name = "security-framework-sys" 1111 + version = "2.14.0" 1112 + source = "registry+https://github.com/rust-lang/crates.io-index" 1113 + checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" 1114 + dependencies = [ 1115 + "core-foundation-sys", 1116 + "libc", 1117 + ] 1118 + 1119 + [[package]] 493 1120 name = "serde" 494 1121 version = "1.0.217" 495 1122 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 499 1126 ] 500 1127 501 1128 [[package]] 1129 + name = "serde_bytes" 1130 + version = "0.11.15" 1131 + source = "registry+https://github.com/rust-lang/crates.io-index" 1132 + checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" 1133 + dependencies = [ 1134 + "serde", 1135 + ] 1136 + 1137 + [[package]] 502 1138 name = "serde_derive" 503 1139 version = "1.0.217" 504 1140 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 510 1146 ] 511 1147 512 1148 [[package]] 1149 + name = "serde_ipld_dagcbor" 1150 + version = "0.6.1" 1151 + source = "registry+https://github.com/rust-lang/crates.io-index" 1152 + checksum = "ded35fbe4ab8fdec1f1d14b4daff2206b1eada4d6e708cb451d464d2d965f493" 1153 + dependencies = [ 1154 + "cbor4ii", 1155 + "ipld-core", 1156 + "scopeguard", 1157 + "serde", 1158 + ] 1159 + 1160 + [[package]] 513 1161 name = "serde_json" 514 1162 version = "1.0.136" 515 1163 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 531 1179 ] 532 1180 533 1181 [[package]] 1182 + name = "sha1" 1183 + version = "0.10.6" 1184 + source = "registry+https://github.com/rust-lang/crates.io-index" 1185 + checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 1186 + dependencies = [ 1187 + "cfg-if", 1188 + "cpufeatures", 1189 + "digest", 1190 + ] 1191 + 1192 + [[package]] 534 1193 name = "sharded-slab" 535 1194 version = "0.1.7" 536 1195 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 540 1199 ] 541 1200 542 1201 [[package]] 1202 + name = "shlex" 1203 + version = "1.3.0" 1204 + source = "registry+https://github.com/rust-lang/crates.io-index" 1205 + checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" 1206 + 1207 + [[package]] 543 1208 name = "signal-hook-registry" 544 1209 version = "1.4.2" 545 1210 source = "registry+https://github.com/rust-lang/crates.io-index" 546 1211 checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 547 1212 dependencies = [ 548 1213 "libc", 1214 + ] 1215 + 1216 + [[package]] 1217 + name = "slab" 1218 + version = "0.4.9" 1219 + source = "registry+https://github.com/rust-lang/crates.io-index" 1220 + checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 1221 + dependencies = [ 1222 + "autocfg", 549 1223 ] 550 1224 551 1225 [[package]] ··· 582 1256 ] 583 1257 584 1258 [[package]] 1259 + name = "tempfile" 1260 + version = "3.15.0" 1261 + source = "registry+https://github.com/rust-lang/crates.io-index" 1262 + checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" 1263 + dependencies = [ 1264 + "cfg-if", 1265 + "fastrand", 1266 + "getrandom", 1267 + "once_cell", 1268 + "rustix", 1269 + "windows-sys 0.59.0", 1270 + ] 1271 + 1272 + [[package]] 585 1273 name = "thiserror" 586 1274 version = "2.0.11" 587 1275 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 638 1326 "proc-macro2", 639 1327 "quote", 640 1328 "syn", 1329 + ] 1330 + 1331 + [[package]] 1332 + name = "tokio-native-tls" 1333 + version = "0.3.1" 1334 + source = "registry+https://github.com/rust-lang/crates.io-index" 1335 + checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1336 + dependencies = [ 1337 + "native-tls", 1338 + "tokio", 1339 + ] 1340 + 1341 + [[package]] 1342 + name = "tokio-tungstenite" 1343 + version = "0.26.1" 1344 + source = "registry+https://github.com/rust-lang/crates.io-index" 1345 + checksum = "be4bf6fecd69fcdede0ec680aaf474cdab988f9de6bc73d3758f0160e3b7025a" 1346 + dependencies = [ 1347 + "futures-util", 1348 + "log", 1349 + "native-tls", 1350 + "tokio", 1351 + "tokio-native-tls", 1352 + "tungstenite", 641 1353 ] 642 1354 643 1355 [[package]] ··· 732 1444 ] 733 1445 734 1446 [[package]] 1447 + name = "tungstenite" 1448 + version = "0.26.1" 1449 + source = "registry+https://github.com/rust-lang/crates.io-index" 1450 + checksum = "413083a99c579593656008130e29255e54dcaae495be556cc26888f211648c24" 1451 + dependencies = [ 1452 + "byteorder", 1453 + "bytes", 1454 + "data-encoding", 1455 + "http", 1456 + "httparse", 1457 + "log", 1458 + "native-tls", 1459 + "rand", 1460 + "sha1", 1461 + "thiserror", 1462 + "utf-8", 1463 + ] 1464 + 1465 + [[package]] 1466 + name = "typenum" 1467 + version = "1.17.0" 1468 + source = "registry+https://github.com/rust-lang/crates.io-index" 1469 + checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 1470 + 1471 + [[package]] 735 1472 name = "uncased" 736 1473 version = "0.9.10" 737 1474 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 747 1484 checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" 748 1485 749 1486 [[package]] 1487 + name = "unsigned-varint" 1488 + version = "0.8.0" 1489 + source = "registry+https://github.com/rust-lang/crates.io-index" 1490 + checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06" 1491 + 1492 + [[package]] 1493 + name = "utf-8" 1494 + version = "0.7.6" 1495 + source = "registry+https://github.com/rust-lang/crates.io-index" 1496 + checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" 1497 + 1498 + [[package]] 750 1499 name = "utf8parse" 751 1500 version = "0.2.2" 752 1501 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 759 1508 checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" 760 1509 761 1510 [[package]] 1511 + name = "vcpkg" 1512 + version = "0.2.15" 1513 + source = "registry+https://github.com/rust-lang/crates.io-index" 1514 + checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1515 + 1516 + [[package]] 762 1517 name = "version_check" 763 1518 version = "0.9.5" 764 1519 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 781 1536 checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 782 1537 783 1538 [[package]] 1539 + name = "wasm-bindgen" 1540 + version = "0.2.100" 1541 + source = "registry+https://github.com/rust-lang/crates.io-index" 1542 + checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" 1543 + dependencies = [ 1544 + "cfg-if", 1545 + "once_cell", 1546 + "rustversion", 1547 + "wasm-bindgen-macro", 1548 + ] 1549 + 1550 + [[package]] 1551 + name = "wasm-bindgen-backend" 1552 + version = "0.2.100" 1553 + source = "registry+https://github.com/rust-lang/crates.io-index" 1554 + checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" 1555 + dependencies = [ 1556 + "bumpalo", 1557 + "log", 1558 + "proc-macro2", 1559 + "quote", 1560 + "syn", 1561 + "wasm-bindgen-shared", 1562 + ] 1563 + 1564 + [[package]] 1565 + name = "wasm-bindgen-macro" 1566 + version = "0.2.100" 1567 + source = "registry+https://github.com/rust-lang/crates.io-index" 1568 + checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" 1569 + dependencies = [ 1570 + "quote", 1571 + "wasm-bindgen-macro-support", 1572 + ] 1573 + 1574 + [[package]] 1575 + name = "wasm-bindgen-macro-support" 1576 + version = "0.2.100" 1577 + source = "registry+https://github.com/rust-lang/crates.io-index" 1578 + checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" 1579 + dependencies = [ 1580 + "proc-macro2", 1581 + "quote", 1582 + "syn", 1583 + "wasm-bindgen-backend", 1584 + "wasm-bindgen-shared", 1585 + ] 1586 + 1587 + [[package]] 1588 + name = "wasm-bindgen-shared" 1589 + version = "0.2.100" 1590 + source = "registry+https://github.com/rust-lang/crates.io-index" 1591 + checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" 1592 + dependencies = [ 1593 + "unicode-ident", 1594 + ] 1595 + 1596 + [[package]] 784 1597 name = "winapi" 785 1598 version = "0.3.9" 786 1599 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 810 1623 version = "0.4.0" 811 1624 source = "registry+https://github.com/rust-lang/crates.io-index" 812 1625 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1626 + 1627 + [[package]] 1628 + name = "windows-core" 1629 + version = "0.52.0" 1630 + source = "registry+https://github.com/rust-lang/crates.io-index" 1631 + checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" 1632 + dependencies = [ 1633 + "windows-targets", 1634 + ] 813 1635 814 1636 [[package]] 815 1637 name = "windows-sys" ··· 907 1729 version = "1.0.1" 908 1730 source = "registry+https://github.com/rust-lang/crates.io-index" 909 1731 checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" 1732 + 1733 + [[package]] 1734 + name = "zerocopy" 1735 + version = "0.7.35" 1736 + source = "registry+https://github.com/rust-lang/crates.io-index" 1737 + checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" 1738 + dependencies = [ 1739 + "byteorder", 1740 + "zerocopy-derive", 1741 + ] 1742 + 1743 + [[package]] 1744 + name = "zerocopy-derive" 1745 + version = "0.7.35" 1746 + source = "registry+https://github.com/rust-lang/crates.io-index" 1747 + checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" 1748 + dependencies = [ 1749 + "proc-macro2", 1750 + "quote", 1751 + "syn", 1752 + ]
+7
consumer/Cargo.toml
··· 4 4 edition = "2021" 5 5 6 6 [dependencies] 7 + chrono = { version = "0.4.39", features = ["serde"] } 8 + ciborium = "0.2.2" 7 9 eyre = "0.6.12" 8 10 figment = { version = "0.10.19", features = ["env", "toml"] } 11 + futures = "0.3.31" 12 + ipld-core = "0.4.1" 9 13 serde = { version = "1.0.217", features = ["derive"] } 14 + serde_bytes = "0.11" 15 + serde_ipld_dagcbor = "0.6.1" 10 16 tokio = { version = "1.42.0", features = ["full"] } 17 + tokio-tungstenite = { version = "0.26.1", features = ["native-tls"] } 11 18 tracing = "0.1.40" 12 19 tracing-subscriber = "0.3.18"
+129
consumer/src/firehose/mod.rs
··· 1 + use futures::stream::SplitStream; 2 + use futures::StreamExt; 3 + use std::io::Cursor; 4 + use tokio::net::TcpStream; 5 + use tokio_tungstenite::tungstenite::client::IntoClientRequest; 6 + use tokio_tungstenite::tungstenite::http::header::USER_AGENT; 7 + use tokio_tungstenite::tungstenite::Message; 8 + use tokio_tungstenite::{MaybeTlsStream, WebSocketStream}; 9 + pub use types::*; 10 + 11 + pub mod types; 12 + 13 + pub struct FirehoseConsumer { 14 + seq: u64, 15 + stream: SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>, 16 + } 17 + 18 + impl FirehoseConsumer { 19 + pub async fn new_relay(url: &str, start_cursor: Option<u64>) -> eyre::Result<Self> { 20 + let cursor = start_cursor.unwrap_or(0); 21 + let mut request = format!("{url}/xrpc/com.atproto.sync.subscribeRepos?cursor={cursor}") 22 + .into_client_request()?; 23 + request 24 + .headers_mut() 25 + .insert(USER_AGENT, "parakeet".parse()?); 26 + 27 + let (wss, _) = tokio_tungstenite::connect_async(request).await?; 28 + let (_, stream) = wss.split(); 29 + 30 + Ok(FirehoseConsumer { 31 + seq: cursor, 32 + stream, 33 + }) 34 + } 35 + 36 + pub async fn new_labeler(url: &str, start_cursor: Option<u64>) -> eyre::Result<Self> { 37 + let cursor = start_cursor.unwrap_or(0); 38 + let mut request = format!("{url}/xrpc/com.atproto.label.subscribeLabels?cursor={cursor}") 39 + .into_client_request()?; 40 + request 41 + .headers_mut() 42 + .insert(USER_AGENT, "parakeet".parse()?); 43 + 44 + let (wss, _) = tokio_tungstenite::connect_async(request).await?; 45 + let (_, stream) = wss.split(); 46 + 47 + Ok(FirehoseConsumer { 48 + seq: cursor, 49 + stream, 50 + }) 51 + } 52 + 53 + pub fn current_seq(&self) -> u64 { 54 + self.seq 55 + } 56 + 57 + pub async fn drive(&mut self) -> eyre::Result<FirehoseOutput> { 58 + let Some(message) = self.stream.next().await.transpose()? else { 59 + return Ok(FirehoseOutput::Close); 60 + }; 61 + 62 + match message { 63 + Message::Binary(data) => { 64 + tracing::trace!("Message with length {}", data.len()); 65 + 66 + let mut reader = Cursor::new(data); 67 + 68 + let header: AtpEventStreamHeader = ciborium::from_reader(&mut reader)?; 69 + 70 + if header.op == -1 { 71 + // deal with error 72 + let error = serde_ipld_dagcbor::from_reader(&mut reader)?; 73 + return Ok(FirehoseOutput::Error(error)); 74 + } 75 + 76 + if let Some(ty) = header.t { 77 + let event = match ty.as_str() { 78 + "#identity" | "#handle" => { 79 + let event = serde_ipld_dagcbor::from_reader(&mut reader)?; 80 + FirehoseEvent::Identity(event) 81 + } 82 + "#account" => { 83 + let event = serde_ipld_dagcbor::from_reader(&mut reader)?; 84 + FirehoseEvent::Account(event) 85 + } 86 + "#commit" => { 87 + let event: AtpCommitEvent = 88 + serde_ipld_dagcbor::from_reader(&mut reader)?; 89 + 90 + // increment the seq 91 + if self.seq < event.seq { 92 + self.seq = event.seq; 93 + } else { 94 + tracing::error!("Event sequence was not greater than previous seq, exiting. {} <= {}", event.seq, self.seq); 95 + return Ok(FirehoseOutput::Close); 96 + } 97 + 98 + FirehoseEvent::Commit(event) 99 + } 100 + "#labels" => { 101 + let event: AtpLabelEvent = 102 + serde_ipld_dagcbor::from_reader(&mut reader)?; 103 + 104 + // increment the seq 105 + if self.seq < event.seq { 106 + self.seq = event.seq; 107 + } else { 108 + tracing::error!("Event sequence was not greater than previous seq, exiting. {} <= {}", event.seq, self.seq); 109 + return Ok(FirehoseOutput::Close); 110 + } 111 + 112 + FirehoseEvent::Label(event) 113 + } 114 + _ => { 115 + tracing::warn!("unknown event type {ty}"); 116 + return Ok(FirehoseOutput::Continue); 117 + } 118 + }; 119 + 120 + return Ok(FirehoseOutput::Event(event)); 121 + } 122 + } 123 + Message::Close(_) => return Ok(FirehoseOutput::Close), 124 + _ => {} 125 + } 126 + 127 + Ok(FirehoseOutput::Continue) 128 + } 129 + }
+110
consumer/src/firehose/types.rs
··· 1 + use chrono::prelude::*; 2 + use ipld_core::cid::Cid; 3 + use serde::Deserialize; 4 + use serde_bytes::ByteBuf; 5 + 6 + #[derive(Debug)] 7 + pub enum FirehoseOutput { 8 + Close, 9 + Event(FirehoseEvent), 10 + Error(AtpEventStreamError), 11 + Continue, 12 + } 13 + 14 + #[derive(Debug, Deserialize)] 15 + pub struct AtpEventStreamHeader { 16 + pub op: i32, 17 + pub t: Option<String>, 18 + } 19 + 20 + #[derive(Debug, Deserialize)] 21 + pub struct AtpEventStreamError { 22 + pub error: String, 23 + pub message: Option<String>, 24 + } 25 + 26 + #[derive(Debug)] 27 + pub enum FirehoseEvent { 28 + Identity(AtpIdentityEvent), 29 + Account(AtpAccountEvent), 30 + Commit(AtpCommitEvent), 31 + Label(AtpLabelEvent), 32 + } 33 + 34 + #[derive(Debug, Deserialize)] 35 + pub struct AtpIdentityEvent { 36 + pub seq: u64, 37 + pub did: String, 38 + pub time: DateTime<Utc>, 39 + pub handle: Option<String>, 40 + } 41 + 42 + #[derive(Debug, Deserialize)] 43 + #[serde(rename_all = "lowercase")] 44 + pub enum AtpAccountStatus { 45 + Takendown, 46 + Suspended, 47 + Deleted, 48 + Deactivated, 49 + } 50 + 51 + impl AtpAccountStatus { 52 + pub fn as_str(&self) -> &'static str { 53 + match self { 54 + AtpAccountStatus::Takendown => "takendown", 55 + AtpAccountStatus::Suspended => "suspended", 56 + AtpAccountStatus::Deleted => "deleted", 57 + AtpAccountStatus::Deactivated => "deactivated", 58 + } 59 + } 60 + } 61 + 62 + #[derive(Debug, Deserialize)] 63 + pub struct AtpAccountEvent { 64 + pub seq: u64, 65 + pub did: String, 66 + pub time: DateTime<Utc>, 67 + pub active: bool, 68 + pub status: Option<AtpAccountStatus>, 69 + } 70 + 71 + #[derive(Debug, Deserialize)] 72 + pub struct AtpCommitEvent { 73 + pub seq: u64, 74 + pub repo: String, 75 + pub time: DateTime<Utc>, 76 + pub rev: String, 77 + pub since: Option<String>, 78 + pub commit: Cid, 79 + #[serde(rename = "tooBig")] 80 + pub too_big: bool, 81 + pub blocks: ByteBuf, 82 + pub ops: Vec<CommitOp>, 83 + pub blobs: Vec<Cid>, 84 + } 85 + 86 + #[derive(Debug, Deserialize)] 87 + pub struct CommitOp { 88 + pub action: String, 89 + pub cid: Option<Cid>, 90 + pub path: String, 91 + } 92 + 93 + #[derive(Debug, Deserialize)] 94 + pub struct AtpLabel { 95 + pub ver: i32, 96 + pub src: String, 97 + pub uri: String, 98 + pub cid: Option<String>, 99 + pub val: String, 100 + pub neg: Option<bool>, 101 + pub cts: DateTime<Utc>, 102 + pub exp: Option<DateTime<Utc>>, 103 + pub sig: Option<ByteBuf>, 104 + } 105 + 106 + #[derive(Debug, Deserialize)] 107 + pub struct AtpLabelEvent { 108 + pub seq: u64, 109 + pub labels: Vec<AtpLabel>, 110 + }
+1
consumer/src/main.rs
··· 1 1 mod config; 2 + mod firehose; 2 3 3 4 #[tokio::main] 4 5 async fn main() -> eyre::Result<()> {