Live video on the AT Protocol
fork

Configure Feed

Select the types of activity you want to include in your feed.

replace key with the new public_key make node_addr more self-contained (own error type)

+3482 -214
+4 -2
Makefile
··· 291 291 EXT=so; \ 292 292 if [ "$(BUILDOS)" = "darwin" ]; then EXT=dylib; fi; \ 293 293 uniffi-bindgen-go --out-dir pkg/iroh/generated --library ./target/debug/libiroh_streamplace.$$EXT \ 294 - && cp ./target/debug/libiroh_streamplace.$$EXT $(BUILDDIR)/rust/iroh-streamplace/libiroh_streamplace.$$EXT \ 295 - && cp ./target/debug/libiroh_streamplace.$$EXT $(BUILDDIR)/lib/libiroh_streamplace.$$EXT 294 + && mkdir -p $(BUILDDIR)/rust/iroh-streamplace/ \ 295 + && mkdir -p $(BUILDDIR)/lib/ \ 296 + && cp ./target/debug/libiroh_streamplace.$$EXT $(BUILDDIR)/rust/iroh-streamplace/ \ 297 + && cp ./target/debug/libiroh_streamplace.$$EXT $(BUILDDIR)/lib/ 296 298 297 299 .PHONY: dev-test 298 300 dev-test:
+2976 -69
pkg/iroh/generated/iroh_streamplace/iroh_streamplace.go
··· 6 6 import ( 7 7 "bytes" 8 8 "encoding/binary" 9 + "errors" 9 10 "fmt" 10 11 "io" 11 12 "math" ··· 13 14 "runtime/cgo" 14 15 "sync" 15 16 "sync/atomic" 17 + "time" 16 18 "unsafe" 17 19 ) 18 20 ··· 335 337 func init() { 336 338 337 339 FfiConverterDataHandlerINSTANCE.register() 340 + FfiConverterDataHandlerOldINSTANCE.register() 338 341 FfiConverterGoSignerINSTANCE.register() 339 342 uniffiCheckChecksums() 340 343 } ··· 370 373 } 371 374 { 372 375 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 376 + return C.uniffi_iroh_streamplace_checksum_func_subscribe_item_debug() 377 + }) 378 + if checksum != 8233 { 379 + // If this happens try cleaning and rebuilding your project 380 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_func_subscribe_item_debug: UniFFI API checksum mismatch") 381 + } 382 + } 383 + { 384 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 373 385 return C.uniffi_iroh_streamplace_checksum_method_datahandler_handle_data() 374 386 }) 375 387 if checksum != 27893 { ··· 379 391 } 380 392 { 381 393 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 394 + return C.uniffi_iroh_streamplace_checksum_method_datahandlerold_handle_data() 395 + }) 396 + if checksum != 20343 { 397 + // If this happens try cleaning and rebuilding your project 398 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_datahandlerold_handle_data: UniFFI API checksum mismatch") 399 + } 400 + } 401 + { 402 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 403 + return C.uniffi_iroh_streamplace_checksum_method_db_iter_with_opts() 404 + }) 405 + if checksum != 3815 { 406 + // If this happens try cleaning and rebuilding your project 407 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_db_iter_with_opts: UniFFI API checksum mismatch") 408 + } 409 + } 410 + { 411 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 412 + return C.uniffi_iroh_streamplace_checksum_method_db_subscribe() 413 + }) 414 + if checksum != 415 { 415 + // If this happens try cleaning and rebuilding your project 416 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_db_subscribe: UniFFI API checksum mismatch") 417 + } 418 + } 419 + { 420 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 421 + return C.uniffi_iroh_streamplace_checksum_method_db_subscribe_with_opts() 422 + }) 423 + if checksum != 17612 { 424 + // If this happens try cleaning and rebuilding your project 425 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_db_subscribe_with_opts: UniFFI API checksum mismatch") 426 + } 427 + } 428 + { 429 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 430 + return C.uniffi_iroh_streamplace_checksum_method_db_write() 431 + }) 432 + if checksum != 5247 { 433 + // If this happens try cleaning and rebuilding your project 434 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_db_write: UniFFI API checksum mismatch") 435 + } 436 + } 437 + { 438 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 382 439 return C.uniffi_iroh_streamplace_checksum_method_endpoint_node_addr() 383 440 }) 384 441 if checksum != 17254 { ··· 388 445 } 389 446 { 390 447 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 448 + return C.uniffi_iroh_streamplace_checksum_method_filter_global() 449 + }) 450 + if checksum != 47323 { 451 + // If this happens try cleaning and rebuilding your project 452 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_filter_global: UniFFI API checksum mismatch") 453 + } 454 + } 455 + { 456 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 457 + return C.uniffi_iroh_streamplace_checksum_method_filter_scope() 458 + }) 459 + if checksum != 23022 { 460 + // If this happens try cleaning and rebuilding your project 461 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_filter_scope: UniFFI API checksum mismatch") 462 + } 463 + } 464 + { 465 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 466 + return C.uniffi_iroh_streamplace_checksum_method_filter_scopes() 467 + }) 468 + if checksum != 39037 { 469 + // If this happens try cleaning and rebuilding your project 470 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_filter_scopes: UniFFI API checksum mismatch") 471 + } 472 + } 473 + { 474 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 475 + return C.uniffi_iroh_streamplace_checksum_method_filter_stream() 476 + }) 477 + if checksum != 37766 { 478 + // If this happens try cleaning and rebuilding your project 479 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_filter_stream: UniFFI API checksum mismatch") 480 + } 481 + } 482 + { 483 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 484 + return C.uniffi_iroh_streamplace_checksum_method_filter_time_from() 485 + }) 486 + if checksum != 62275 { 487 + // If this happens try cleaning and rebuilding your project 488 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_filter_time_from: UniFFI API checksum mismatch") 489 + } 490 + } 491 + { 492 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 493 + return C.uniffi_iroh_streamplace_checksum_method_filter_time_range() 494 + }) 495 + if checksum != 2045 { 496 + // If this happens try cleaning and rebuilding your project 497 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_filter_time_range: UniFFI API checksum mismatch") 498 + } 499 + } 500 + { 501 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 502 + return C.uniffi_iroh_streamplace_checksum_method_filter_timestamps() 503 + }) 504 + if checksum != 27584 { 505 + // If this happens try cleaning and rebuilding your project 506 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_filter_timestamps: UniFFI API checksum mismatch") 507 + } 508 + } 509 + { 510 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 391 511 return C.uniffi_iroh_streamplace_checksum_method_gosigner_sign() 392 512 }) 393 513 if checksum != 50597 { ··· 397 517 } 398 518 { 399 519 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 520 + return C.uniffi_iroh_streamplace_checksum_method_node_db() 521 + }) 522 + if checksum != 39096 { 523 + // If this happens try cleaning and rebuilding your project 524 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_db: UniFFI API checksum mismatch") 525 + } 526 + } 527 + { 528 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 529 + return C.uniffi_iroh_streamplace_checksum_method_node_join_peers() 530 + }) 531 + if checksum != 56647 { 532 + // If this happens try cleaning and rebuilding your project 533 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_join_peers: UniFFI API checksum mismatch") 534 + } 535 + } 536 + { 537 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 538 + return C.uniffi_iroh_streamplace_checksum_method_node_node_id() 539 + }) 540 + if checksum != 55009 { 541 + // If this happens try cleaning and rebuilding your project 542 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_node_id: UniFFI API checksum mismatch") 543 + } 544 + } 545 + { 546 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 547 + return C.uniffi_iroh_streamplace_checksum_method_node_node_scope() 548 + }) 549 + if checksum != 16912 { 550 + // If this happens try cleaning and rebuilding your project 551 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_node_scope: UniFFI API checksum mismatch") 552 + } 553 + } 554 + { 555 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 556 + return C.uniffi_iroh_streamplace_checksum_method_node_send_segment() 557 + }) 558 + if checksum != 18989 { 559 + // If this happens try cleaning and rebuilding your project 560 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_send_segment: UniFFI API checksum mismatch") 561 + } 562 + } 563 + { 564 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 565 + return C.uniffi_iroh_streamplace_checksum_method_node_subscribe() 566 + }) 567 + if checksum != 17951 { 568 + // If this happens try cleaning and rebuilding your project 569 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_subscribe: UniFFI API checksum mismatch") 570 + } 571 + } 572 + { 573 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 574 + return C.uniffi_iroh_streamplace_checksum_method_node_ticket() 575 + }) 576 + if checksum != 37020 { 577 + // If this happens try cleaning and rebuilding your project 578 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_ticket: UniFFI API checksum mismatch") 579 + } 580 + } 581 + { 582 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 583 + return C.uniffi_iroh_streamplace_checksum_method_node_unsubscribe() 584 + }) 585 + if checksum != 35396 { 586 + // If this happens try cleaning and rebuilding your project 587 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_node_unsubscribe: UniFFI API checksum mismatch") 588 + } 589 + } 590 + { 591 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 400 592 return C.uniffi_iroh_streamplace_checksum_method_nodeaddr_direct_addresses() 401 593 }) 402 594 if checksum != 17536 { ··· 417 609 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 418 610 return C.uniffi_iroh_streamplace_checksum_method_nodeaddr_node_id() 419 611 }) 420 - if checksum != 35476 { 612 + if checksum != 22953 { 421 613 // If this happens try cleaning and rebuilding your project 422 614 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_nodeaddr_node_id: UniFFI API checksum mismatch") 423 615 } ··· 429 621 if checksum != 18967 { 430 622 // If this happens try cleaning and rebuilding your project 431 623 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_nodeaddr_relay_url: UniFFI API checksum mismatch") 624 + } 625 + } 626 + { 627 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 628 + return C.uniffi_iroh_streamplace_checksum_method_publickey_as_vec() 629 + }) 630 + if checksum != 32346 { 631 + // If this happens try cleaning and rebuilding your project 632 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickey_as_vec: UniFFI API checksum mismatch") 432 633 } 433 634 } 434 635 { ··· 451 652 } 452 653 { 453 654 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 454 - return C.uniffi_iroh_streamplace_checksum_method_publickey_to_bytes() 655 + return C.uniffi_iroh_streamplace_checksum_method_publickeyold_equal() 455 656 }) 456 - if checksum != 8223 { 657 + if checksum != 35079 { 457 658 // If this happens try cleaning and rebuilding your project 458 - panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickey_to_bytes: UniFFI API checksum mismatch") 659 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickeyold_equal: UniFFI API checksum mismatch") 660 + } 661 + } 662 + { 663 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 664 + return C.uniffi_iroh_streamplace_checksum_method_publickeyold_fmt_short() 665 + }) 666 + if checksum != 26426 { 667 + // If this happens try cleaning and rebuilding your project 668 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickeyold_fmt_short: UniFFI API checksum mismatch") 669 + } 670 + } 671 + { 672 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 673 + return C.uniffi_iroh_streamplace_checksum_method_publickeyold_to_bytes() 674 + }) 675 + if checksum != 41746 { 676 + // If this happens try cleaning and rebuilding your project 677 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_publickeyold_to_bytes: UniFFI API checksum mismatch") 459 678 } 460 679 } 461 680 { ··· 471 690 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 472 691 return C.uniffi_iroh_streamplace_checksum_method_receiver_subscribe() 473 692 }) 474 - if checksum != 24145 { 693 + if checksum != 46188 { 475 694 // If this happens try cleaning and rebuilding your project 476 695 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_receiver_subscribe: UniFFI API checksum mismatch") 477 696 } ··· 480 699 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 481 700 return C.uniffi_iroh_streamplace_checksum_method_receiver_unsubscribe() 482 701 }) 483 - if checksum != 21760 { 702 + if checksum != 7879 { 484 703 // If this happens try cleaning and rebuilding your project 485 704 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_receiver_unsubscribe: UniFFI API checksum mismatch") 486 705 } ··· 505 724 } 506 725 { 507 726 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 727 + return C.uniffi_iroh_streamplace_checksum_method_subscriberesponse_next_raw() 728 + }) 729 + if checksum != 55650 { 730 + // If this happens try cleaning and rebuilding your project 731 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_subscriberesponse_next_raw: UniFFI API checksum mismatch") 732 + } 733 + } 734 + { 735 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 736 + return C.uniffi_iroh_streamplace_checksum_method_writescope_put() 737 + }) 738 + if checksum != 50543 { 739 + // If this happens try cleaning and rebuilding your project 740 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_writescope_put: UniFFI API checksum mismatch") 741 + } 742 + } 743 + { 744 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 508 745 return C.uniffi_iroh_streamplace_checksum_constructor_endpoint_new() 509 746 }) 510 747 if checksum != 60672 { ··· 514 751 } 515 752 { 516 753 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 754 + return C.uniffi_iroh_streamplace_checksum_constructor_filter_new() 755 + }) 756 + if checksum != 5241 { 757 + // If this happens try cleaning and rebuilding your project 758 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_filter_new: UniFFI API checksum mismatch") 759 + } 760 + } 761 + { 762 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 763 + return C.uniffi_iroh_streamplace_checksum_constructor_node_forwarder() 764 + }) 765 + if checksum != 7334 { 766 + // If this happens try cleaning and rebuilding your project 767 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_node_forwarder: UniFFI API checksum mismatch") 768 + } 769 + } 770 + { 771 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 772 + return C.uniffi_iroh_streamplace_checksum_constructor_node_receiver() 773 + }) 774 + if checksum != 33844 { 775 + // If this happens try cleaning and rebuilding your project 776 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_node_receiver: UniFFI API checksum mismatch") 777 + } 778 + } 779 + { 780 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 781 + return C.uniffi_iroh_streamplace_checksum_constructor_node_sender() 782 + }) 783 + if checksum != 44785 { 784 + // If this happens try cleaning and rebuilding your project 785 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_node_sender: UniFFI API checksum mismatch") 786 + } 787 + } 788 + { 789 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 517 790 return C.uniffi_iroh_streamplace_checksum_constructor_nodeaddr_new() 518 791 }) 519 - if checksum != 28044 { 792 + if checksum != 56594 { 520 793 // If this happens try cleaning and rebuilding your project 521 794 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_nodeaddr_new: UniFFI API checksum mismatch") 522 795 } ··· 525 798 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 526 799 return C.uniffi_iroh_streamplace_checksum_constructor_publickey_from_bytes() 527 800 }) 528 - if checksum != 54187 { 801 + if checksum != 57602 { 529 802 // If this happens try cleaning and rebuilding your project 530 803 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_publickey_from_bytes: UniFFI API checksum mismatch") 531 804 } ··· 534 807 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 535 808 return C.uniffi_iroh_streamplace_checksum_constructor_publickey_from_string() 536 809 }) 537 - if checksum != 62773 { 810 + if checksum != 45922 { 538 811 // If this happens try cleaning and rebuilding your project 539 812 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_publickey_from_string: UniFFI API checksum mismatch") 540 813 } 541 814 } 542 815 { 543 816 checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 817 + return C.uniffi_iroh_streamplace_checksum_constructor_publickeyold_from_bytes() 818 + }) 819 + if checksum != 40751 { 820 + // If this happens try cleaning and rebuilding your project 821 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_publickeyold_from_bytes: UniFFI API checksum mismatch") 822 + } 823 + } 824 + { 825 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 826 + return C.uniffi_iroh_streamplace_checksum_constructor_publickeyold_from_string() 827 + }) 828 + if checksum != 54251 { 829 + // If this happens try cleaning and rebuilding your project 830 + panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_publickeyold_from_string: UniFFI API checksum mismatch") 831 + } 832 + } 833 + { 834 + checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t { 544 835 return C.uniffi_iroh_streamplace_checksum_constructor_receiver_new() 545 836 }) 546 - if checksum != 35153 { 837 + if checksum != 18072 { 547 838 // If this happens try cleaning and rebuilding your project 548 839 panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_constructor_receiver_new: UniFFI API checksum mismatch") 549 840 } ··· 559 850 } 560 851 } 561 852 853 + type FfiConverterUint64 struct{} 854 + 855 + var FfiConverterUint64INSTANCE = FfiConverterUint64{} 856 + 857 + func (FfiConverterUint64) Lower(value uint64) C.uint64_t { 858 + return C.uint64_t(value) 859 + } 860 + 861 + func (FfiConverterUint64) Write(writer io.Writer, value uint64) { 862 + writeUint64(writer, value) 863 + } 864 + 865 + func (FfiConverterUint64) Lift(value C.uint64_t) uint64 { 866 + return uint64(value) 867 + } 868 + 869 + func (FfiConverterUint64) Read(reader io.Reader) uint64 { 870 + return readUint64(reader) 871 + } 872 + 873 + type FfiDestroyerUint64 struct{} 874 + 875 + func (FfiDestroyerUint64) Destroy(_ uint64) {} 876 + 562 877 type FfiConverterBool struct{} 563 878 564 879 var FfiConverterBoolINSTANCE = FfiConverterBool{} ··· 608 923 length := readInt32(reader) 609 924 buffer := make([]byte, length) 610 925 read_length, err := reader.Read(buffer) 611 - if err != nil { 926 + if err != nil && err != io.EOF { 612 927 panic(err) 613 928 } 614 929 if read_length != int(length) { ··· 671 986 length := readInt32(reader) 672 987 buffer := make([]byte, length) 673 988 read_length, err := reader.Read(buffer) 674 - if err != nil { 989 + if err != nil && err != io.EOF { 675 990 panic(err) 676 991 } 677 992 if read_length != int(length) { ··· 684 999 685 1000 func (FfiDestroyerBytes) Destroy(_ []byte) {} 686 1001 1002 + // FfiConverterDuration converts between uniffi duration and Go duration. 1003 + type FfiConverterDuration struct{} 1004 + 1005 + var FfiConverterDurationINSTANCE = FfiConverterDuration{} 1006 + 1007 + func (c FfiConverterDuration) Lift(rb RustBufferI) time.Duration { 1008 + return LiftFromRustBuffer[time.Duration](c, rb) 1009 + } 1010 + 1011 + func (c FfiConverterDuration) Read(reader io.Reader) time.Duration { 1012 + sec := readUint64(reader) 1013 + nsec := readUint32(reader) 1014 + return time.Duration(sec*1_000_000_000 + uint64(nsec)) 1015 + } 1016 + 1017 + func (c FfiConverterDuration) Lower(value time.Duration) C.RustBuffer { 1018 + return LowerIntoRustBuffer[time.Duration](c, value) 1019 + } 1020 + 1021 + func (c FfiConverterDuration) Write(writer io.Writer, value time.Duration) { 1022 + if value.Nanoseconds() < 0 { 1023 + // Rust does not support negative durations: 1024 + // https://www.reddit.com/r/rust/comments/ljl55u/why_rusts_duration_not_supporting_negative_values/ 1025 + // This panic is very bad, because it depends on user input, and in Go user input related 1026 + // error are supposed to be returned as errors, and not cause panics. However, with the 1027 + // current architecture, its not possible to return an error from here, so panic is used as 1028 + // the only other option to signal an error. 1029 + panic("negative duration is not allowed") 1030 + } 1031 + 1032 + writeUint64(writer, uint64(value)/1_000_000_000) 1033 + writeUint32(writer, uint32(uint64(value)%1_000_000_000)) 1034 + } 1035 + 1036 + type FfiDestroyerDuration struct{} 1037 + 1038 + func (FfiDestroyerDuration) Destroy(_ time.Duration) {} 1039 + 687 1040 // Below is an implementation of synchronization requirements outlined in the link. 688 1041 // https://github.com/mozilla/uniffi-rs/blob/0dc031132d9493ca812c3af6e7dd60ad2ea95bf0/uniffi_bindgen/src/bindings/kotlin/templates/ObjectRuntime.kt#L31 689 1042 ··· 747 1100 }) 748 1101 } 749 1102 1103 + // DataHandler trait that is exported to go for receiving data callbacks. 750 1104 type DataHandler interface { 751 1105 HandleData(topic string, data []byte) 752 1106 } 1107 + 1108 + // DataHandler trait that is exported to go for receiving data callbacks. 753 1109 type DataHandlerImpl struct { 754 1110 ffiObject FfiObject 755 1111 } ··· 757 1113 func (_self *DataHandlerImpl) HandleData(topic string, data []byte) { 758 1114 _pointer := _self.ffiObject.incrementPointer("DataHandler") 759 1115 defer _self.ffiObject.decrementPointer() 760 - uniffiRustCallAsync[struct{}]( 1116 + uniffiRustCallAsync[error]( 761 1117 nil, 762 1118 // completeFn 763 1119 func(handle C.uint64_t, status *C.RustCallStatus) struct{} { ··· 940 1296 C.uniffi_iroh_streamplace_fn_init_callback_vtable_datahandler(&UniffiVTableCallbackInterfaceDataHandlerINSTANCE) 941 1297 } 942 1298 1299 + type DataHandlerOld interface { 1300 + HandleData(topic string, data []byte) 1301 + } 1302 + type DataHandlerOldImpl struct { 1303 + ffiObject FfiObject 1304 + } 1305 + 1306 + func (_self *DataHandlerOldImpl) HandleData(topic string, data []byte) { 1307 + _pointer := _self.ffiObject.incrementPointer("DataHandlerOld") 1308 + defer _self.ffiObject.decrementPointer() 1309 + uniffiRustCallAsync[error]( 1310 + nil, 1311 + // completeFn 1312 + func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 1313 + C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 1314 + return struct{}{} 1315 + }, 1316 + // liftFn 1317 + func(_ struct{}) struct{} { return struct{}{} }, 1318 + C.uniffi_iroh_streamplace_fn_method_datahandlerold_handle_data( 1319 + _pointer, FfiConverterStringINSTANCE.Lower(topic), FfiConverterBytesINSTANCE.Lower(data)), 1320 + // pollFn 1321 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1322 + C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 1323 + }, 1324 + // freeFn 1325 + func(handle C.uint64_t) { 1326 + C.ffi_iroh_streamplace_rust_future_free_void(handle) 1327 + }, 1328 + ) 1329 + 1330 + } 1331 + func (object *DataHandlerOldImpl) Destroy() { 1332 + runtime.SetFinalizer(object, nil) 1333 + object.ffiObject.destroy() 1334 + } 1335 + 1336 + type FfiConverterDataHandlerOld struct { 1337 + handleMap *concurrentHandleMap[DataHandlerOld] 1338 + } 1339 + 1340 + var FfiConverterDataHandlerOldINSTANCE = FfiConverterDataHandlerOld{ 1341 + handleMap: newConcurrentHandleMap[DataHandlerOld](), 1342 + } 1343 + 1344 + func (c FfiConverterDataHandlerOld) Lift(pointer unsafe.Pointer) DataHandlerOld { 1345 + result := &DataHandlerOldImpl{ 1346 + newFfiObject( 1347 + pointer, 1348 + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 1349 + return C.uniffi_iroh_streamplace_fn_clone_datahandlerold(pointer, status) 1350 + }, 1351 + func(pointer unsafe.Pointer, status *C.RustCallStatus) { 1352 + C.uniffi_iroh_streamplace_fn_free_datahandlerold(pointer, status) 1353 + }, 1354 + ), 1355 + } 1356 + runtime.SetFinalizer(result, (*DataHandlerOldImpl).Destroy) 1357 + return result 1358 + } 1359 + 1360 + func (c FfiConverterDataHandlerOld) Read(reader io.Reader) DataHandlerOld { 1361 + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 1362 + } 1363 + 1364 + func (c FfiConverterDataHandlerOld) Lower(value DataHandlerOld) unsafe.Pointer { 1365 + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 1366 + // because the pointer will be decremented immediately after this function returns, 1367 + // and someone will be left holding onto a non-locked pointer. 1368 + pointer := unsafe.Pointer(uintptr(c.handleMap.insert(value))) 1369 + return pointer 1370 + 1371 + } 1372 + 1373 + func (c FfiConverterDataHandlerOld) Write(writer io.Writer, value DataHandlerOld) { 1374 + writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1375 + } 1376 + 1377 + type FfiDestroyerDataHandlerOld struct{} 1378 + 1379 + func (_ FfiDestroyerDataHandlerOld) Destroy(value DataHandlerOld) { 1380 + if val, ok := value.(*DataHandlerOldImpl); ok { 1381 + val.Destroy() 1382 + } else { 1383 + panic("Expected *DataHandlerOldImpl") 1384 + } 1385 + } 1386 + 1387 + //export iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldMethod0 1388 + func iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldMethod0(uniffiHandle C.uint64_t, topic C.RustBuffer, data C.RustBuffer, uniffiFutureCallback C.UniffiForeignFutureCompleteVoid, uniffiCallbackData C.uint64_t, uniffiOutReturn *C.UniffiForeignFuture) { 1389 + handle := uint64(uniffiHandle) 1390 + uniffiObj, ok := FfiConverterDataHandlerOldINSTANCE.handleMap.tryGet(handle) 1391 + if !ok { 1392 + panic(fmt.Errorf("no callback in handle map: %d", handle)) 1393 + } 1394 + 1395 + result := make(chan C.UniffiForeignFutureStructVoid, 1) 1396 + cancel := make(chan struct{}, 1) 1397 + guardHandle := cgo.NewHandle(cancel) 1398 + *uniffiOutReturn = C.UniffiForeignFuture{ 1399 + handle: C.uint64_t(guardHandle), 1400 + free: C.UniffiForeignFutureFree(C.iroh_streamplace_uniffiFreeGorutine), 1401 + } 1402 + 1403 + // Wait for compleation or cancel 1404 + go func() { 1405 + select { 1406 + case <-cancel: 1407 + case res := <-result: 1408 + C.call_UniffiForeignFutureCompleteVoid(uniffiFutureCallback, uniffiCallbackData, res) 1409 + } 1410 + }() 1411 + 1412 + // Eval callback asynchroniously 1413 + go func() { 1414 + asyncResult := &C.UniffiForeignFutureStructVoid{} 1415 + defer func() { 1416 + result <- *asyncResult 1417 + }() 1418 + 1419 + uniffiObj.HandleData( 1420 + FfiConverterStringINSTANCE.Lift(GoRustBuffer{ 1421 + inner: topic, 1422 + }), 1423 + FfiConverterBytesINSTANCE.Lift(GoRustBuffer{ 1424 + inner: data, 1425 + }), 1426 + ) 1427 + 1428 + }() 1429 + } 1430 + 1431 + var UniffiVTableCallbackInterfaceDataHandlerOldINSTANCE = C.UniffiVTableCallbackInterfaceDataHandlerOld{ 1432 + handleData: (C.UniffiCallbackInterfaceDataHandlerOldMethod0)(C.iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldMethod0), 1433 + 1434 + uniffiFree: (C.UniffiCallbackInterfaceFree)(C.iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldFree), 1435 + } 1436 + 1437 + //export iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldFree 1438 + func iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldFree(handle C.uint64_t) { 1439 + FfiConverterDataHandlerOldINSTANCE.handleMap.remove(uint64(handle)) 1440 + } 1441 + 1442 + func (c FfiConverterDataHandlerOld) register() { 1443 + C.uniffi_iroh_streamplace_fn_init_callback_vtable_datahandlerold(&UniffiVTableCallbackInterfaceDataHandlerOldINSTANCE) 1444 + } 1445 + 1446 + // Iroh-streamplace specific metadata database. 1447 + type DbInterface interface { 1448 + IterWithOpts(filter *Filter) ([]Entry, error) 1449 + Subscribe(filter *Filter) *SubscribeResponse 1450 + // Subscribe with options. 1451 + SubscribeWithOpts(opts SubscribeOpts) *SubscribeResponse 1452 + Write(secret []byte) (*WriteScope, error) 1453 + } 1454 + 1455 + // Iroh-streamplace specific metadata database. 1456 + type Db struct { 1457 + ffiObject FfiObject 1458 + } 1459 + 1460 + func (_self *Db) IterWithOpts(filter *Filter) ([]Entry, error) { 1461 + _pointer := _self.ffiObject.incrementPointer("*Db") 1462 + defer _self.ffiObject.decrementPointer() 1463 + res, err := uniffiRustCallAsync[SubscribeNextError]( 1464 + FfiConverterSubscribeNextErrorINSTANCE, 1465 + // completeFn 1466 + func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI { 1467 + res := C.ffi_iroh_streamplace_rust_future_complete_rust_buffer(handle, status) 1468 + return GoRustBuffer{ 1469 + inner: res, 1470 + } 1471 + }, 1472 + // liftFn 1473 + func(ffi RustBufferI) []Entry { 1474 + return FfiConverterSequenceEntryINSTANCE.Lift(ffi) 1475 + }, 1476 + C.uniffi_iroh_streamplace_fn_method_db_iter_with_opts( 1477 + _pointer, FfiConverterFilterINSTANCE.Lower(filter)), 1478 + // pollFn 1479 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1480 + C.ffi_iroh_streamplace_rust_future_poll_rust_buffer(handle, continuation, data) 1481 + }, 1482 + // freeFn 1483 + func(handle C.uint64_t) { 1484 + C.ffi_iroh_streamplace_rust_future_free_rust_buffer(handle) 1485 + }, 1486 + ) 1487 + 1488 + return res, err 1489 + } 1490 + 1491 + func (_self *Db) Subscribe(filter *Filter) *SubscribeResponse { 1492 + _pointer := _self.ffiObject.incrementPointer("*Db") 1493 + defer _self.ffiObject.decrementPointer() 1494 + return FfiConverterSubscribeResponseINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1495 + return C.uniffi_iroh_streamplace_fn_method_db_subscribe( 1496 + _pointer, FfiConverterFilterINSTANCE.Lower(filter), _uniffiStatus) 1497 + })) 1498 + } 1499 + 1500 + // Subscribe with options. 1501 + func (_self *Db) SubscribeWithOpts(opts SubscribeOpts) *SubscribeResponse { 1502 + _pointer := _self.ffiObject.incrementPointer("*Db") 1503 + defer _self.ffiObject.decrementPointer() 1504 + return FfiConverterSubscribeResponseINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1505 + return C.uniffi_iroh_streamplace_fn_method_db_subscribe_with_opts( 1506 + _pointer, FfiConverterSubscribeOptsINSTANCE.Lower(opts), _uniffiStatus) 1507 + })) 1508 + } 1509 + 1510 + func (_self *Db) Write(secret []byte) (*WriteScope, error) { 1511 + _pointer := _self.ffiObject.incrementPointer("*Db") 1512 + defer _self.ffiObject.decrementPointer() 1513 + _uniffiRV, _uniffiErr := rustCallWithError[WriteError](FfiConverterWriteError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1514 + return C.uniffi_iroh_streamplace_fn_method_db_write( 1515 + _pointer, FfiConverterBytesINSTANCE.Lower(secret), _uniffiStatus) 1516 + }) 1517 + if _uniffiErr != nil { 1518 + var _uniffiDefaultValue *WriteScope 1519 + return _uniffiDefaultValue, _uniffiErr 1520 + } else { 1521 + return FfiConverterWriteScopeINSTANCE.Lift(_uniffiRV), nil 1522 + } 1523 + } 1524 + func (object *Db) Destroy() { 1525 + runtime.SetFinalizer(object, nil) 1526 + object.ffiObject.destroy() 1527 + } 1528 + 1529 + type FfiConverterDb struct{} 1530 + 1531 + var FfiConverterDbINSTANCE = FfiConverterDb{} 1532 + 1533 + func (c FfiConverterDb) Lift(pointer unsafe.Pointer) *Db { 1534 + result := &Db{ 1535 + newFfiObject( 1536 + pointer, 1537 + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 1538 + return C.uniffi_iroh_streamplace_fn_clone_db(pointer, status) 1539 + }, 1540 + func(pointer unsafe.Pointer, status *C.RustCallStatus) { 1541 + C.uniffi_iroh_streamplace_fn_free_db(pointer, status) 1542 + }, 1543 + ), 1544 + } 1545 + runtime.SetFinalizer(result, (*Db).Destroy) 1546 + return result 1547 + } 1548 + 1549 + func (c FfiConverterDb) Read(reader io.Reader) *Db { 1550 + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 1551 + } 1552 + 1553 + func (c FfiConverterDb) Lower(value *Db) unsafe.Pointer { 1554 + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 1555 + // because the pointer will be decremented immediately after this function returns, 1556 + // and someone will be left holding onto a non-locked pointer. 1557 + pointer := value.ffiObject.incrementPointer("*Db") 1558 + defer value.ffiObject.decrementPointer() 1559 + return pointer 1560 + 1561 + } 1562 + 1563 + func (c FfiConverterDb) Write(writer io.Writer, value *Db) { 1564 + writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1565 + } 1566 + 1567 + type FfiDestroyerDb struct{} 1568 + 1569 + func (_ FfiDestroyerDb) Destroy(value *Db) { 1570 + value.Destroy() 1571 + } 1572 + 943 1573 type EndpointInterface interface { 944 1574 NodeAddr() *NodeAddr 945 1575 } ··· 948 1578 } 949 1579 950 1580 // Create a new endpoint. 951 - func NewEndpoint() (*Endpoint, *Error) { 1581 + func NewEndpoint() (*Endpoint, error) { 952 1582 res, err := uniffiRustCallAsync[Error]( 953 1583 FfiConverterErrorINSTANCE, 954 1584 // completeFn ··· 977 1607 func (_self *Endpoint) NodeAddr() *NodeAddr { 978 1608 _pointer := _self.ffiObject.incrementPointer("*Endpoint") 979 1609 defer _self.ffiObject.decrementPointer() 980 - res, _ := uniffiRustCallAsync[struct{}]( 1610 + res, _ := uniffiRustCallAsync[error]( 981 1611 nil, 982 1612 // completeFn 983 1613 func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { ··· 1051 1681 value.Destroy() 1052 1682 } 1053 1683 1684 + // A filter for subscriptions and iteration. 1685 + type FilterInterface interface { 1686 + // Restrict to the global namespace, no per stream data. 1687 + Global() *Filter 1688 + // Restrict to a single scope. 1689 + Scope(scope *PublicKey) *Filter 1690 + // Restrict to a set of scopes. 1691 + Scopes(scopes []*PublicKey) *Filter 1692 + // Restrict to one specific stream, no global data. 1693 + Stream(stream []byte) *Filter 1694 + // Restrict to a time range starting at min, unbounded at the top. 1695 + TimeFrom(min uint64) *Filter 1696 + // Restrict to a time range given in nanoseconds since unix epoch. 1697 + TimeRange(min uint64, max uint64) *Filter 1698 + // Restrict to a time range. 1699 + Timestamps(min TimeBound, max TimeBound) *Filter 1700 + } 1701 + 1702 + // A filter for subscriptions and iteration. 1703 + type Filter struct { 1704 + ffiObject FfiObject 1705 + } 1706 + 1707 + // Creates a new filter that matches everything. 1708 + func NewFilter() *Filter { 1709 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1710 + return C.uniffi_iroh_streamplace_fn_constructor_filter_new(_uniffiStatus) 1711 + })) 1712 + } 1713 + 1714 + // Restrict to the global namespace, no per stream data. 1715 + func (_self *Filter) Global() *Filter { 1716 + _pointer := _self.ffiObject.incrementPointer("*Filter") 1717 + defer _self.ffiObject.decrementPointer() 1718 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1719 + return C.uniffi_iroh_streamplace_fn_method_filter_global( 1720 + _pointer, _uniffiStatus) 1721 + })) 1722 + } 1723 + 1724 + // Restrict to a single scope. 1725 + func (_self *Filter) Scope(scope *PublicKey) *Filter { 1726 + _pointer := _self.ffiObject.incrementPointer("*Filter") 1727 + defer _self.ffiObject.decrementPointer() 1728 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1729 + return C.uniffi_iroh_streamplace_fn_method_filter_scope( 1730 + _pointer, FfiConverterPublicKeyINSTANCE.Lower(scope), _uniffiStatus) 1731 + })) 1732 + } 1733 + 1734 + // Restrict to a set of scopes. 1735 + func (_self *Filter) Scopes(scopes []*PublicKey) *Filter { 1736 + _pointer := _self.ffiObject.incrementPointer("*Filter") 1737 + defer _self.ffiObject.decrementPointer() 1738 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1739 + return C.uniffi_iroh_streamplace_fn_method_filter_scopes( 1740 + _pointer, FfiConverterSequencePublicKeyINSTANCE.Lower(scopes), _uniffiStatus) 1741 + })) 1742 + } 1743 + 1744 + // Restrict to one specific stream, no global data. 1745 + func (_self *Filter) Stream(stream []byte) *Filter { 1746 + _pointer := _self.ffiObject.incrementPointer("*Filter") 1747 + defer _self.ffiObject.decrementPointer() 1748 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1749 + return C.uniffi_iroh_streamplace_fn_method_filter_stream( 1750 + _pointer, FfiConverterBytesINSTANCE.Lower(stream), _uniffiStatus) 1751 + })) 1752 + } 1753 + 1754 + // Restrict to a time range starting at min, unbounded at the top. 1755 + func (_self *Filter) TimeFrom(min uint64) *Filter { 1756 + _pointer := _self.ffiObject.incrementPointer("*Filter") 1757 + defer _self.ffiObject.decrementPointer() 1758 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1759 + return C.uniffi_iroh_streamplace_fn_method_filter_time_from( 1760 + _pointer, FfiConverterUint64INSTANCE.Lower(min), _uniffiStatus) 1761 + })) 1762 + } 1763 + 1764 + // Restrict to a time range given in nanoseconds since unix epoch. 1765 + func (_self *Filter) TimeRange(min uint64, max uint64) *Filter { 1766 + _pointer := _self.ffiObject.incrementPointer("*Filter") 1767 + defer _self.ffiObject.decrementPointer() 1768 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1769 + return C.uniffi_iroh_streamplace_fn_method_filter_time_range( 1770 + _pointer, FfiConverterUint64INSTANCE.Lower(min), FfiConverterUint64INSTANCE.Lower(max), _uniffiStatus) 1771 + })) 1772 + } 1773 + 1774 + // Restrict to a time range. 1775 + func (_self *Filter) Timestamps(min TimeBound, max TimeBound) *Filter { 1776 + _pointer := _self.ffiObject.incrementPointer("*Filter") 1777 + defer _self.ffiObject.decrementPointer() 1778 + return FfiConverterFilterINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1779 + return C.uniffi_iroh_streamplace_fn_method_filter_timestamps( 1780 + _pointer, FfiConverterTimeBoundINSTANCE.Lower(min), FfiConverterTimeBoundINSTANCE.Lower(max), _uniffiStatus) 1781 + })) 1782 + } 1783 + func (object *Filter) Destroy() { 1784 + runtime.SetFinalizer(object, nil) 1785 + object.ffiObject.destroy() 1786 + } 1787 + 1788 + type FfiConverterFilter struct{} 1789 + 1790 + var FfiConverterFilterINSTANCE = FfiConverterFilter{} 1791 + 1792 + func (c FfiConverterFilter) Lift(pointer unsafe.Pointer) *Filter { 1793 + result := &Filter{ 1794 + newFfiObject( 1795 + pointer, 1796 + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 1797 + return C.uniffi_iroh_streamplace_fn_clone_filter(pointer, status) 1798 + }, 1799 + func(pointer unsafe.Pointer, status *C.RustCallStatus) { 1800 + C.uniffi_iroh_streamplace_fn_free_filter(pointer, status) 1801 + }, 1802 + ), 1803 + } 1804 + runtime.SetFinalizer(result, (*Filter).Destroy) 1805 + return result 1806 + } 1807 + 1808 + func (c FfiConverterFilter) Read(reader io.Reader) *Filter { 1809 + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 1810 + } 1811 + 1812 + func (c FfiConverterFilter) Lower(value *Filter) unsafe.Pointer { 1813 + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 1814 + // because the pointer will be decremented immediately after this function returns, 1815 + // and someone will be left holding onto a non-locked pointer. 1816 + pointer := value.ffiObject.incrementPointer("*Filter") 1817 + defer value.ffiObject.decrementPointer() 1818 + return pointer 1819 + 1820 + } 1821 + 1822 + func (c FfiConverterFilter) Write(writer io.Writer, value *Filter) { 1823 + writeUint64(writer, uint64(uintptr(c.Lower(value)))) 1824 + } 1825 + 1826 + type FfiDestroyerFilter struct{} 1827 + 1828 + func (_ FfiDestroyerFilter) Destroy(value *Filter) { 1829 + value.Destroy() 1830 + } 1831 + 1054 1832 type GoSigner interface { 1055 - Sign(data []byte) ([]byte, *SpError) 1833 + Sign(data []byte) ([]byte, error) 1056 1834 } 1057 1835 type GoSignerImpl struct { 1058 1836 ffiObject FfiObject 1059 1837 } 1060 1838 1061 - func (_self *GoSignerImpl) Sign(data []byte) ([]byte, *SpError) { 1839 + func (_self *GoSignerImpl) Sign(data []byte) ([]byte, error) { 1062 1840 _pointer := _self.ffiObject.incrementPointer("GoSigner") 1063 1841 defer _self.ffiObject.decrementPointer() 1064 1842 _uniffiRV, _uniffiErr := rustCallWithError[SpError](FfiConverterSpError{}, func(_uniffiStatus *C.RustCallStatus) RustBufferI { ··· 1071 1849 var _uniffiDefaultValue []byte 1072 1850 return _uniffiDefaultValue, _uniffiErr 1073 1851 } else { 1074 - return FfiConverterBytesINSTANCE.Lift(_uniffiRV), _uniffiErr 1852 + return FfiConverterBytesINSTANCE.Lift(_uniffiRV), nil 1075 1853 } 1076 1854 } 1077 1855 func (object *GoSignerImpl) Destroy() { ··· 1146 1924 ) 1147 1925 1148 1926 if err != nil { 1149 - // The only way to bypass an unexpected error is to bypass pointer to an empty 1150 - // instance of the error 1151 - if err.err == nil { 1927 + var actualError *SpError 1928 + if errors.As(err, &actualError) { 1929 + *callStatus = C.RustCallStatus{ 1930 + code: C.int8_t(uniffiCallbackResultError), 1931 + errorBuf: FfiConverterSpErrorINSTANCE.Lower(actualError), 1932 + } 1933 + } else { 1152 1934 *callStatus = C.RustCallStatus{ 1153 1935 code: C.int8_t(uniffiCallbackUnexpectedResultError), 1154 1936 } 1155 - return 1156 - } 1157 - 1158 - *callStatus = C.RustCallStatus{ 1159 - code: C.int8_t(uniffiCallbackResultError), 1160 - errorBuf: FfiConverterSpErrorINSTANCE.Lower(err), 1161 1937 } 1162 1938 return 1163 1939 } ··· 1180 1956 C.uniffi_iroh_streamplace_fn_init_callback_vtable_gosigner(&UniffiVTableCallbackInterfaceGoSignerINSTANCE) 1181 1957 } 1182 1958 1959 + // Iroh-streamplace node that can send, forward or receive stream segments. 1960 + type NodeInterface interface { 1961 + // Get a handle to the db to watch for changes locally or globally. 1962 + Db() *Db 1963 + // Join peers by their node tickets. 1964 + JoinPeers(peers []string) error 1965 + // Get this node's node ID. 1966 + NodeId() (*PublicKey, error) 1967 + // Get a handle to the write scope for this node. 1968 + // 1969 + // This is equivalent to calling `db.write(...)` with the secret key used to create the node. 1970 + NodeScope() *WriteScope 1971 + // Send a segment to all subscribers of the given stream. 1972 + SendSegment(key string, data []byte) error 1973 + // Subscribe to updates for a given stream from a remote node. 1974 + Subscribe(key string, remoteId *PublicKey) error 1975 + // Get this node's ticket. 1976 + Ticket() (string, error) 1977 + // Unsubscribe from updates for a given stream from a remote node. 1978 + Unsubscribe(key string, remoteId *PublicKey) error 1979 + } 1980 + 1981 + // Iroh-streamplace node that can send, forward or receive stream segments. 1982 + type Node struct { 1983 + ffiObject FfiObject 1984 + } 1985 + 1986 + func NodeForwarder(config Config) (*Node, error) { 1987 + res, err := uniffiRustCallAsync[CreateError]( 1988 + FfiConverterCreateErrorINSTANCE, 1989 + // completeFn 1990 + func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 1991 + res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 1992 + return res 1993 + }, 1994 + // liftFn 1995 + func(ffi unsafe.Pointer) *Node { 1996 + return FfiConverterNodeINSTANCE.Lift(ffi) 1997 + }, 1998 + C.uniffi_iroh_streamplace_fn_constructor_node_forwarder(FfiConverterConfigINSTANCE.Lower(config)), 1999 + // pollFn 2000 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2001 + C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 2002 + }, 2003 + // freeFn 2004 + func(handle C.uint64_t) { 2005 + C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 2006 + }, 2007 + ) 2008 + 2009 + return res, err 2010 + } 2011 + 2012 + func NodeReceiver(config Config, handler DataHandler) (*Node, error) { 2013 + res, err := uniffiRustCallAsync[CreateError]( 2014 + FfiConverterCreateErrorINSTANCE, 2015 + // completeFn 2016 + func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 2017 + res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 2018 + return res 2019 + }, 2020 + // liftFn 2021 + func(ffi unsafe.Pointer) *Node { 2022 + return FfiConverterNodeINSTANCE.Lift(ffi) 2023 + }, 2024 + C.uniffi_iroh_streamplace_fn_constructor_node_receiver(FfiConverterConfigINSTANCE.Lower(config), FfiConverterDataHandlerINSTANCE.Lower(handler)), 2025 + // pollFn 2026 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2027 + C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 2028 + }, 2029 + // freeFn 2030 + func(handle C.uint64_t) { 2031 + C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 2032 + }, 2033 + ) 2034 + 2035 + return res, err 2036 + } 2037 + 2038 + // Create a new streamplace client node. 2039 + func NodeSender(config Config) (*Node, error) { 2040 + res, err := uniffiRustCallAsync[CreateError]( 2041 + FfiConverterCreateErrorINSTANCE, 2042 + // completeFn 2043 + func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 2044 + res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 2045 + return res 2046 + }, 2047 + // liftFn 2048 + func(ffi unsafe.Pointer) *Node { 2049 + return FfiConverterNodeINSTANCE.Lift(ffi) 2050 + }, 2051 + C.uniffi_iroh_streamplace_fn_constructor_node_sender(FfiConverterConfigINSTANCE.Lower(config)), 2052 + // pollFn 2053 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2054 + C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 2055 + }, 2056 + // freeFn 2057 + func(handle C.uint64_t) { 2058 + C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 2059 + }, 2060 + ) 2061 + 2062 + return res, err 2063 + } 2064 + 2065 + // Get a handle to the db to watch for changes locally or globally. 2066 + func (_self *Node) Db() *Db { 2067 + _pointer := _self.ffiObject.incrementPointer("*Node") 2068 + defer _self.ffiObject.decrementPointer() 2069 + return FfiConverterDbINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 2070 + return C.uniffi_iroh_streamplace_fn_method_node_db( 2071 + _pointer, _uniffiStatus) 2072 + })) 2073 + } 2074 + 2075 + // Join peers by their node tickets. 2076 + func (_self *Node) JoinPeers(peers []string) error { 2077 + _pointer := _self.ffiObject.incrementPointer("*Node") 2078 + defer _self.ffiObject.decrementPointer() 2079 + _, err := uniffiRustCallAsync[JoinPeersError]( 2080 + FfiConverterJoinPeersErrorINSTANCE, 2081 + // completeFn 2082 + func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 2083 + C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 2084 + return struct{}{} 2085 + }, 2086 + // liftFn 2087 + func(_ struct{}) struct{} { return struct{}{} }, 2088 + C.uniffi_iroh_streamplace_fn_method_node_join_peers( 2089 + _pointer, FfiConverterSequenceStringINSTANCE.Lower(peers)), 2090 + // pollFn 2091 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2092 + C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 2093 + }, 2094 + // freeFn 2095 + func(handle C.uint64_t) { 2096 + C.ffi_iroh_streamplace_rust_future_free_void(handle) 2097 + }, 2098 + ) 2099 + 2100 + return err 2101 + } 2102 + 2103 + // Get this node's node ID. 2104 + func (_self *Node) NodeId() (*PublicKey, error) { 2105 + _pointer := _self.ffiObject.incrementPointer("*Node") 2106 + defer _self.ffiObject.decrementPointer() 2107 + res, err := uniffiRustCallAsync[PutError]( 2108 + FfiConverterPutErrorINSTANCE, 2109 + // completeFn 2110 + func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { 2111 + res := C.ffi_iroh_streamplace_rust_future_complete_pointer(handle, status) 2112 + return res 2113 + }, 2114 + // liftFn 2115 + func(ffi unsafe.Pointer) *PublicKey { 2116 + return FfiConverterPublicKeyINSTANCE.Lift(ffi) 2117 + }, 2118 + C.uniffi_iroh_streamplace_fn_method_node_node_id( 2119 + _pointer), 2120 + // pollFn 2121 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2122 + C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) 2123 + }, 2124 + // freeFn 2125 + func(handle C.uint64_t) { 2126 + C.ffi_iroh_streamplace_rust_future_free_pointer(handle) 2127 + }, 2128 + ) 2129 + 2130 + return res, err 2131 + } 2132 + 2133 + // Get a handle to the write scope for this node. 2134 + // 2135 + // This is equivalent to calling `db.write(...)` with the secret key used to create the node. 2136 + func (_self *Node) NodeScope() *WriteScope { 2137 + _pointer := _self.ffiObject.incrementPointer("*Node") 2138 + defer _self.ffiObject.decrementPointer() 2139 + return FfiConverterWriteScopeINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 2140 + return C.uniffi_iroh_streamplace_fn_method_node_node_scope( 2141 + _pointer, _uniffiStatus) 2142 + })) 2143 + } 2144 + 2145 + // Send a segment to all subscribers of the given stream. 2146 + func (_self *Node) SendSegment(key string, data []byte) error { 2147 + _pointer := _self.ffiObject.incrementPointer("*Node") 2148 + defer _self.ffiObject.decrementPointer() 2149 + _, err := uniffiRustCallAsync[PutError]( 2150 + FfiConverterPutErrorINSTANCE, 2151 + // completeFn 2152 + func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 2153 + C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 2154 + return struct{}{} 2155 + }, 2156 + // liftFn 2157 + func(_ struct{}) struct{} { return struct{}{} }, 2158 + C.uniffi_iroh_streamplace_fn_method_node_send_segment( 2159 + _pointer, FfiConverterStringINSTANCE.Lower(key), FfiConverterBytesINSTANCE.Lower(data)), 2160 + // pollFn 2161 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2162 + C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 2163 + }, 2164 + // freeFn 2165 + func(handle C.uint64_t) { 2166 + C.ffi_iroh_streamplace_rust_future_free_void(handle) 2167 + }, 2168 + ) 2169 + 2170 + return err 2171 + } 2172 + 2173 + // Subscribe to updates for a given stream from a remote node. 2174 + func (_self *Node) Subscribe(key string, remoteId *PublicKey) error { 2175 + _pointer := _self.ffiObject.incrementPointer("*Node") 2176 + defer _self.ffiObject.decrementPointer() 2177 + _, err := uniffiRustCallAsync[PutError]( 2178 + FfiConverterPutErrorINSTANCE, 2179 + // completeFn 2180 + func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 2181 + C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 2182 + return struct{}{} 2183 + }, 2184 + // liftFn 2185 + func(_ struct{}) struct{} { return struct{}{} }, 2186 + C.uniffi_iroh_streamplace_fn_method_node_subscribe( 2187 + _pointer, FfiConverterStringINSTANCE.Lower(key), FfiConverterPublicKeyINSTANCE.Lower(remoteId)), 2188 + // pollFn 2189 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2190 + C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 2191 + }, 2192 + // freeFn 2193 + func(handle C.uint64_t) { 2194 + C.ffi_iroh_streamplace_rust_future_free_void(handle) 2195 + }, 2196 + ) 2197 + 2198 + return err 2199 + } 2200 + 2201 + // Get this node's ticket. 2202 + func (_self *Node) Ticket() (string, error) { 2203 + _pointer := _self.ffiObject.incrementPointer("*Node") 2204 + defer _self.ffiObject.decrementPointer() 2205 + res, err := uniffiRustCallAsync[PutError]( 2206 + FfiConverterPutErrorINSTANCE, 2207 + // completeFn 2208 + func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI { 2209 + res := C.ffi_iroh_streamplace_rust_future_complete_rust_buffer(handle, status) 2210 + return GoRustBuffer{ 2211 + inner: res, 2212 + } 2213 + }, 2214 + // liftFn 2215 + func(ffi RustBufferI) string { 2216 + return FfiConverterStringINSTANCE.Lift(ffi) 2217 + }, 2218 + C.uniffi_iroh_streamplace_fn_method_node_ticket( 2219 + _pointer), 2220 + // pollFn 2221 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2222 + C.ffi_iroh_streamplace_rust_future_poll_rust_buffer(handle, continuation, data) 2223 + }, 2224 + // freeFn 2225 + func(handle C.uint64_t) { 2226 + C.ffi_iroh_streamplace_rust_future_free_rust_buffer(handle) 2227 + }, 2228 + ) 2229 + 2230 + return res, err 2231 + } 2232 + 2233 + // Unsubscribe from updates for a given stream from a remote node. 2234 + func (_self *Node) Unsubscribe(key string, remoteId *PublicKey) error { 2235 + _pointer := _self.ffiObject.incrementPointer("*Node") 2236 + defer _self.ffiObject.decrementPointer() 2237 + _, err := uniffiRustCallAsync[PutError]( 2238 + FfiConverterPutErrorINSTANCE, 2239 + // completeFn 2240 + func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 2241 + C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 2242 + return struct{}{} 2243 + }, 2244 + // liftFn 2245 + func(_ struct{}) struct{} { return struct{}{} }, 2246 + C.uniffi_iroh_streamplace_fn_method_node_unsubscribe( 2247 + _pointer, FfiConverterStringINSTANCE.Lower(key), FfiConverterPublicKeyINSTANCE.Lower(remoteId)), 2248 + // pollFn 2249 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 2250 + C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 2251 + }, 2252 + // freeFn 2253 + func(handle C.uint64_t) { 2254 + C.ffi_iroh_streamplace_rust_future_free_void(handle) 2255 + }, 2256 + ) 2257 + 2258 + return err 2259 + } 2260 + func (object *Node) Destroy() { 2261 + runtime.SetFinalizer(object, nil) 2262 + object.ffiObject.destroy() 2263 + } 2264 + 2265 + type FfiConverterNode struct{} 2266 + 2267 + var FfiConverterNodeINSTANCE = FfiConverterNode{} 2268 + 2269 + func (c FfiConverterNode) Lift(pointer unsafe.Pointer) *Node { 2270 + result := &Node{ 2271 + newFfiObject( 2272 + pointer, 2273 + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 2274 + return C.uniffi_iroh_streamplace_fn_clone_node(pointer, status) 2275 + }, 2276 + func(pointer unsafe.Pointer, status *C.RustCallStatus) { 2277 + C.uniffi_iroh_streamplace_fn_free_node(pointer, status) 2278 + }, 2279 + ), 2280 + } 2281 + runtime.SetFinalizer(result, (*Node).Destroy) 2282 + return result 2283 + } 2284 + 2285 + func (c FfiConverterNode) Read(reader io.Reader) *Node { 2286 + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 2287 + } 2288 + 2289 + func (c FfiConverterNode) Lower(value *Node) unsafe.Pointer { 2290 + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 2291 + // because the pointer will be decremented immediately after this function returns, 2292 + // and someone will be left holding onto a non-locked pointer. 2293 + pointer := value.ffiObject.incrementPointer("*Node") 2294 + defer value.ffiObject.decrementPointer() 2295 + return pointer 2296 + 2297 + } 2298 + 2299 + func (c FfiConverterNode) Write(writer io.Writer, value *Node) { 2300 + writeUint64(writer, uint64(uintptr(c.Lower(value)))) 2301 + } 2302 + 2303 + type FfiDestroyerNode struct{} 2304 + 2305 + func (_ FfiDestroyerNode) Destroy(value *Node) { 2306 + value.Destroy() 2307 + } 2308 + 1183 2309 // A peer and it's addressing information. 1184 2310 type NodeAddrInterface interface { 1185 2311 // Get the direct addresses of this peer. 1186 2312 DirectAddresses() []string 1187 2313 // Returns true if both NodeAddr's have the same values 1188 2314 Equal(other *NodeAddr) bool 1189 - NodeId() *PublicKey 2315 + NodeId() *PublicKeyOld 1190 2316 // Get the home relay URL for this peer 1191 2317 RelayUrl() *string 1192 2318 } ··· 1197 2323 } 1198 2324 1199 2325 // Create a new [`NodeAddr`] with empty [`AddrInfo`]. 1200 - func NewNodeAddr(nodeId *PublicKey, derpUrl *string, addresses []string) *NodeAddr { 2326 + func NewNodeAddr(nodeId *PublicKeyOld, derpUrl *string, addresses []string) *NodeAddr { 1201 2327 return FfiConverterNodeAddrINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1202 - return C.uniffi_iroh_streamplace_fn_constructor_nodeaddr_new(FfiConverterPublicKeyINSTANCE.Lower(nodeId), FfiConverterOptionalStringINSTANCE.Lower(derpUrl), FfiConverterSequenceStringINSTANCE.Lower(addresses), _uniffiStatus) 2328 + return C.uniffi_iroh_streamplace_fn_constructor_nodeaddr_new(FfiConverterPublicKeyOldINSTANCE.Lower(nodeId), FfiConverterOptionalStringINSTANCE.Lower(derpUrl), FfiConverterSequenceStringINSTANCE.Lower(addresses), _uniffiStatus) 1203 2329 })) 1204 2330 } 1205 2331 ··· 1225 2351 })) 1226 2352 } 1227 2353 1228 - func (_self *NodeAddr) NodeId() *PublicKey { 2354 + func (_self *NodeAddr) NodeId() *PublicKeyOld { 1229 2355 _pointer := _self.ffiObject.incrementPointer("*NodeAddr") 1230 2356 defer _self.ffiObject.decrementPointer() 1231 - return FfiConverterPublicKeyINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 2357 + return FfiConverterPublicKeyOldINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1232 2358 return C.uniffi_iroh_streamplace_fn_method_nodeaddr_node_id( 1233 2359 _pointer, _uniffiStatus) 1234 2360 })) ··· 1299 2425 // The key itself is just a 32 byte array, but a key has associated crypto 1300 2426 // information that is cached for performance reasons. 1301 2427 type PublicKeyInterface interface { 2428 + // Express the PublicKey as a byte array 2429 + AsVec() []byte 1302 2430 // Returns true if the PublicKeys are equal 1303 2431 Equal(other *PublicKey) bool 1304 2432 // Convert to a base32 string limited to the first 10 bytes for a friendly string 1305 2433 // representation of the key. 1306 2434 FmtShort() string 1307 - // Express the PublicKey as a byte array 1308 - ToBytes() []byte 1309 2435 } 1310 2436 1311 2437 // A public key. ··· 1317 2443 } 1318 2444 1319 2445 // Make a PublicKey from byte array 1320 - func PublicKeyFromBytes(bytes []byte) (*PublicKey, *Error) { 1321 - _uniffiRV, _uniffiErr := rustCallWithError[Error](FfiConverterError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 2446 + func PublicKeyFromBytes(bytes []byte) (*PublicKey, error) { 2447 + _uniffiRV, _uniffiErr := rustCallWithError[PublicKeyError](FfiConverterPublicKeyError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1322 2448 return C.uniffi_iroh_streamplace_fn_constructor_publickey_from_bytes(FfiConverterBytesINSTANCE.Lower(bytes), _uniffiStatus) 1323 2449 }) 1324 2450 if _uniffiErr != nil { 1325 2451 var _uniffiDefaultValue *PublicKey 1326 2452 return _uniffiDefaultValue, _uniffiErr 1327 2453 } else { 1328 - return FfiConverterPublicKeyINSTANCE.Lift(_uniffiRV), _uniffiErr 2454 + return FfiConverterPublicKeyINSTANCE.Lift(_uniffiRV), nil 1329 2455 } 1330 2456 } 1331 2457 1332 2458 // Make a PublicKey from base32 string 1333 - func PublicKeyFromString(s string) (*PublicKey, *Error) { 1334 - _uniffiRV, _uniffiErr := rustCallWithError[Error](FfiConverterError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 2459 + func PublicKeyFromString(s string) (*PublicKey, error) { 2460 + _uniffiRV, _uniffiErr := rustCallWithError[PublicKeyError](FfiConverterPublicKeyError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 1335 2461 return C.uniffi_iroh_streamplace_fn_constructor_publickey_from_string(FfiConverterStringINSTANCE.Lower(s), _uniffiStatus) 1336 2462 }) 1337 2463 if _uniffiErr != nil { 1338 2464 var _uniffiDefaultValue *PublicKey 1339 2465 return _uniffiDefaultValue, _uniffiErr 1340 2466 } else { 1341 - return FfiConverterPublicKeyINSTANCE.Lift(_uniffiRV), _uniffiErr 2467 + return FfiConverterPublicKeyINSTANCE.Lift(_uniffiRV), nil 1342 2468 } 1343 2469 } 1344 2470 2471 + // Express the PublicKey as a byte array 2472 + func (_self *PublicKey) AsVec() []byte { 2473 + _pointer := _self.ffiObject.incrementPointer("*PublicKey") 2474 + defer _self.ffiObject.decrementPointer() 2475 + return FfiConverterBytesINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 2476 + return GoRustBuffer{ 2477 + inner: C.uniffi_iroh_streamplace_fn_method_publickey_as_vec( 2478 + _pointer, _uniffiStatus), 2479 + } 2480 + })) 2481 + } 2482 + 1345 2483 // Returns true if the PublicKeys are equal 1346 2484 func (_self *PublicKey) Equal(other *PublicKey) bool { 1347 2485 _pointer := _self.ffiObject.incrementPointer("*PublicKey") ··· 1360 2498 return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 1361 2499 return GoRustBuffer{ 1362 2500 inner: C.uniffi_iroh_streamplace_fn_method_publickey_fmt_short( 1363 - _pointer, _uniffiStatus), 1364 - } 1365 - })) 1366 - } 1367 - 1368 - // Express the PublicKey as a byte array 1369 - func (_self *PublicKey) ToBytes() []byte { 1370 - _pointer := _self.ffiObject.incrementPointer("*PublicKey") 1371 - defer _self.ffiObject.decrementPointer() 1372 - return FfiConverterBytesINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 1373 - return GoRustBuffer{ 1374 - inner: C.uniffi_iroh_streamplace_fn_method_publickey_to_bytes( 1375 2501 _pointer, _uniffiStatus), 1376 2502 } 1377 2503 })) ··· 1437 2563 value.Destroy() 1438 2564 } 1439 2565 2566 + // A public key. 2567 + // 2568 + // The key itself is just a 32 byte array, but a key has associated crypto 2569 + // information that is cached for performance reasons. 2570 + type PublicKeyOldInterface interface { 2571 + // Returns true if the PublicKeys are equal 2572 + Equal(other *PublicKeyOld) bool 2573 + // Convert to a base32 string limited to the first 10 bytes for a friendly string 2574 + // representation of the key. 2575 + FmtShort() string 2576 + // Express the PublicKey as a byte array 2577 + ToBytes() []byte 2578 + } 2579 + 2580 + // A public key. 2581 + // 2582 + // The key itself is just a 32 byte array, but a key has associated crypto 2583 + // information that is cached for performance reasons. 2584 + type PublicKeyOld struct { 2585 + ffiObject FfiObject 2586 + } 2587 + 2588 + // Make a PublicKey from byte array 2589 + func PublicKeyOldFromBytes(bytes []byte) (*PublicKeyOld, error) { 2590 + _uniffiRV, _uniffiErr := rustCallWithError[Error](FfiConverterError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 2591 + return C.uniffi_iroh_streamplace_fn_constructor_publickeyold_from_bytes(FfiConverterBytesINSTANCE.Lower(bytes), _uniffiStatus) 2592 + }) 2593 + if _uniffiErr != nil { 2594 + var _uniffiDefaultValue *PublicKeyOld 2595 + return _uniffiDefaultValue, _uniffiErr 2596 + } else { 2597 + return FfiConverterPublicKeyOldINSTANCE.Lift(_uniffiRV), nil 2598 + } 2599 + } 2600 + 2601 + // Make a PublicKey from base32 string 2602 + func PublicKeyOldFromString(s string) (*PublicKeyOld, error) { 2603 + _uniffiRV, _uniffiErr := rustCallWithError[Error](FfiConverterError{}, func(_uniffiStatus *C.RustCallStatus) unsafe.Pointer { 2604 + return C.uniffi_iroh_streamplace_fn_constructor_publickeyold_from_string(FfiConverterStringINSTANCE.Lower(s), _uniffiStatus) 2605 + }) 2606 + if _uniffiErr != nil { 2607 + var _uniffiDefaultValue *PublicKeyOld 2608 + return _uniffiDefaultValue, _uniffiErr 2609 + } else { 2610 + return FfiConverterPublicKeyOldINSTANCE.Lift(_uniffiRV), nil 2611 + } 2612 + } 2613 + 2614 + // Returns true if the PublicKeys are equal 2615 + func (_self *PublicKeyOld) Equal(other *PublicKeyOld) bool { 2616 + _pointer := _self.ffiObject.incrementPointer("*PublicKeyOld") 2617 + defer _self.ffiObject.decrementPointer() 2618 + return FfiConverterBoolINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) C.int8_t { 2619 + return C.uniffi_iroh_streamplace_fn_method_publickeyold_equal( 2620 + _pointer, FfiConverterPublicKeyOldINSTANCE.Lower(other), _uniffiStatus) 2621 + })) 2622 + } 2623 + 2624 + // Convert to a base32 string limited to the first 10 bytes for a friendly string 2625 + // representation of the key. 2626 + func (_self *PublicKeyOld) FmtShort() string { 2627 + _pointer := _self.ffiObject.incrementPointer("*PublicKeyOld") 2628 + defer _self.ffiObject.decrementPointer() 2629 + return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 2630 + return GoRustBuffer{ 2631 + inner: C.uniffi_iroh_streamplace_fn_method_publickeyold_fmt_short( 2632 + _pointer, _uniffiStatus), 2633 + } 2634 + })) 2635 + } 2636 + 2637 + // Express the PublicKey as a byte array 2638 + func (_self *PublicKeyOld) ToBytes() []byte { 2639 + _pointer := _self.ffiObject.incrementPointer("*PublicKeyOld") 2640 + defer _self.ffiObject.decrementPointer() 2641 + return FfiConverterBytesINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 2642 + return GoRustBuffer{ 2643 + inner: C.uniffi_iroh_streamplace_fn_method_publickeyold_to_bytes( 2644 + _pointer, _uniffiStatus), 2645 + } 2646 + })) 2647 + } 2648 + 2649 + func (_self *PublicKeyOld) String() string { 2650 + _pointer := _self.ffiObject.incrementPointer("*PublicKeyOld") 2651 + defer _self.ffiObject.decrementPointer() 2652 + return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 2653 + return GoRustBuffer{ 2654 + inner: C.uniffi_iroh_streamplace_fn_method_publickeyold_uniffi_trait_display( 2655 + _pointer, _uniffiStatus), 2656 + } 2657 + })) 2658 + } 2659 + 2660 + func (object *PublicKeyOld) Destroy() { 2661 + runtime.SetFinalizer(object, nil) 2662 + object.ffiObject.destroy() 2663 + } 2664 + 2665 + type FfiConverterPublicKeyOld struct{} 2666 + 2667 + var FfiConverterPublicKeyOldINSTANCE = FfiConverterPublicKeyOld{} 2668 + 2669 + func (c FfiConverterPublicKeyOld) Lift(pointer unsafe.Pointer) *PublicKeyOld { 2670 + result := &PublicKeyOld{ 2671 + newFfiObject( 2672 + pointer, 2673 + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 2674 + return C.uniffi_iroh_streamplace_fn_clone_publickeyold(pointer, status) 2675 + }, 2676 + func(pointer unsafe.Pointer, status *C.RustCallStatus) { 2677 + C.uniffi_iroh_streamplace_fn_free_publickeyold(pointer, status) 2678 + }, 2679 + ), 2680 + } 2681 + runtime.SetFinalizer(result, (*PublicKeyOld).Destroy) 2682 + return result 2683 + } 2684 + 2685 + func (c FfiConverterPublicKeyOld) Read(reader io.Reader) *PublicKeyOld { 2686 + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 2687 + } 2688 + 2689 + func (c FfiConverterPublicKeyOld) Lower(value *PublicKeyOld) unsafe.Pointer { 2690 + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 2691 + // because the pointer will be decremented immediately after this function returns, 2692 + // and someone will be left holding onto a non-locked pointer. 2693 + pointer := value.ffiObject.incrementPointer("*PublicKeyOld") 2694 + defer value.ffiObject.decrementPointer() 2695 + return pointer 2696 + 2697 + } 2698 + 2699 + func (c FfiConverterPublicKeyOld) Write(writer io.Writer, value *PublicKeyOld) { 2700 + writeUint64(writer, uint64(uintptr(c.Lower(value)))) 2701 + } 2702 + 2703 + type FfiDestroyerPublicKeyOld struct{} 2704 + 2705 + func (_ FfiDestroyerPublicKeyOld) Destroy(value *PublicKeyOld) { 2706 + value.Destroy() 2707 + } 2708 + 1440 2709 type ReceiverInterface interface { 1441 2710 NodeAddr() *NodeAddr 1442 2711 // Subscribe to the given topic on the remote. 1443 - Subscribe(remoteId *PublicKey, topic string) *Error 2712 + Subscribe(remoteId *PublicKeyOld, topic string) error 1444 2713 // Unsubscribe from this topic on the remote. 1445 - Unsubscribe(remoteId *PublicKey, topic string) *Error 2714 + Unsubscribe(remoteId *PublicKeyOld, topic string) error 1446 2715 } 1447 2716 type Receiver struct { 1448 2717 ffiObject FfiObject 1449 2718 } 1450 2719 1451 2720 // Create a new receiver. 1452 - func NewReceiver(endpoint *Endpoint, handler DataHandler) (*Receiver, *Error) { 2721 + func NewReceiver(endpoint *Endpoint, handler DataHandlerOld) (*Receiver, error) { 1453 2722 res, err := uniffiRustCallAsync[Error]( 1454 2723 FfiConverterErrorINSTANCE, 1455 2724 // completeFn ··· 1461 2730 func(ffi unsafe.Pointer) *Receiver { 1462 2731 return FfiConverterReceiverINSTANCE.Lift(ffi) 1463 2732 }, 1464 - C.uniffi_iroh_streamplace_fn_constructor_receiver_new(FfiConverterEndpointINSTANCE.Lower(endpoint), FfiConverterDataHandlerINSTANCE.Lower(handler)), 2733 + C.uniffi_iroh_streamplace_fn_constructor_receiver_new(FfiConverterEndpointINSTANCE.Lower(endpoint), FfiConverterDataHandlerOldINSTANCE.Lower(handler)), 1465 2734 // pollFn 1466 2735 func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1467 2736 C.ffi_iroh_streamplace_rust_future_poll_pointer(handle, continuation, data) ··· 1478 2747 func (_self *Receiver) NodeAddr() *NodeAddr { 1479 2748 _pointer := _self.ffiObject.incrementPointer("*Receiver") 1480 2749 defer _self.ffiObject.decrementPointer() 1481 - res, _ := uniffiRustCallAsync[struct{}]( 2750 + res, _ := uniffiRustCallAsync[error]( 1482 2751 nil, 1483 2752 // completeFn 1484 2753 func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { ··· 1505 2774 } 1506 2775 1507 2776 // Subscribe to the given topic on the remote. 1508 - func (_self *Receiver) Subscribe(remoteId *PublicKey, topic string) *Error { 2777 + func (_self *Receiver) Subscribe(remoteId *PublicKeyOld, topic string) error { 1509 2778 _pointer := _self.ffiObject.incrementPointer("*Receiver") 1510 2779 defer _self.ffiObject.decrementPointer() 1511 2780 _, err := uniffiRustCallAsync[Error]( ··· 1518 2787 // liftFn 1519 2788 func(_ struct{}) struct{} { return struct{}{} }, 1520 2789 C.uniffi_iroh_streamplace_fn_method_receiver_subscribe( 1521 - _pointer, FfiConverterPublicKeyINSTANCE.Lower(remoteId), FfiConverterStringINSTANCE.Lower(topic)), 2790 + _pointer, FfiConverterPublicKeyOldINSTANCE.Lower(remoteId), FfiConverterStringINSTANCE.Lower(topic)), 1522 2791 // pollFn 1523 2792 func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1524 2793 C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) ··· 1533 2802 } 1534 2803 1535 2804 // Unsubscribe from this topic on the remote. 1536 - func (_self *Receiver) Unsubscribe(remoteId *PublicKey, topic string) *Error { 2805 + func (_self *Receiver) Unsubscribe(remoteId *PublicKeyOld, topic string) error { 1537 2806 _pointer := _self.ffiObject.incrementPointer("*Receiver") 1538 2807 defer _self.ffiObject.decrementPointer() 1539 2808 _, err := uniffiRustCallAsync[Error]( ··· 1546 2815 // liftFn 1547 2816 func(_ struct{}) struct{} { return struct{}{} }, 1548 2817 C.uniffi_iroh_streamplace_fn_method_receiver_unsubscribe( 1549 - _pointer, FfiConverterPublicKeyINSTANCE.Lower(remoteId), FfiConverterStringINSTANCE.Lower(topic)), 2818 + _pointer, FfiConverterPublicKeyOldINSTANCE.Lower(remoteId), FfiConverterStringINSTANCE.Lower(topic)), 1550 2819 // pollFn 1551 2820 func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 1552 2821 C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) ··· 1611 2880 type SenderInterface interface { 1612 2881 NodeAddr() *NodeAddr 1613 2882 // Sends the given data to all subscribers that have subscribed to this `key`. 1614 - Send(key string, data []byte) *Error 2883 + Send(key string, data []byte) error 1615 2884 } 1616 2885 type Sender struct { 1617 2886 ffiObject FfiObject 1618 2887 } 1619 2888 1620 2889 // Create a new sender. 1621 - func NewSender(endpoint *Endpoint) (*Sender, *Error) { 2890 + func NewSender(endpoint *Endpoint) (*Sender, error) { 1622 2891 res, err := uniffiRustCallAsync[Error]( 1623 2892 FfiConverterErrorINSTANCE, 1624 2893 // completeFn ··· 1647 2916 func (_self *Sender) NodeAddr() *NodeAddr { 1648 2917 _pointer := _self.ffiObject.incrementPointer("*Sender") 1649 2918 defer _self.ffiObject.decrementPointer() 1650 - res, _ := uniffiRustCallAsync[struct{}]( 2919 + res, _ := uniffiRustCallAsync[error]( 1651 2920 nil, 1652 2921 // completeFn 1653 2922 func(handle C.uint64_t, status *C.RustCallStatus) unsafe.Pointer { ··· 1674 2943 } 1675 2944 1676 2945 // Sends the given data to all subscribers that have subscribed to this `key`. 1677 - func (_self *Sender) Send(key string, data []byte) *Error { 2946 + func (_self *Sender) Send(key string, data []byte) error { 1678 2947 _pointer := _self.ffiObject.incrementPointer("*Sender") 1679 2948 defer _self.ffiObject.decrementPointer() 1680 2949 _, err := uniffiRustCallAsync[Error]( ··· 1749 3018 value.Destroy() 1750 3019 } 1751 3020 3021 + // A response to a subscribe request. 3022 + // 3023 + // This can be used as a stream of [`SubscribeItem`]s. 3024 + type SubscribeResponseInterface interface { 3025 + NextRaw() (*SubscribeItem, error) 3026 + } 3027 + 3028 + // A response to a subscribe request. 3029 + // 3030 + // This can be used as a stream of [`SubscribeItem`]s. 3031 + type SubscribeResponse struct { 3032 + ffiObject FfiObject 3033 + } 3034 + 3035 + func (_self *SubscribeResponse) NextRaw() (*SubscribeItem, error) { 3036 + _pointer := _self.ffiObject.incrementPointer("*SubscribeResponse") 3037 + defer _self.ffiObject.decrementPointer() 3038 + res, err := uniffiRustCallAsync[SubscribeNextError]( 3039 + FfiConverterSubscribeNextErrorINSTANCE, 3040 + // completeFn 3041 + func(handle C.uint64_t, status *C.RustCallStatus) RustBufferI { 3042 + res := C.ffi_iroh_streamplace_rust_future_complete_rust_buffer(handle, status) 3043 + return GoRustBuffer{ 3044 + inner: res, 3045 + } 3046 + }, 3047 + // liftFn 3048 + func(ffi RustBufferI) *SubscribeItem { 3049 + return FfiConverterOptionalSubscribeItemINSTANCE.Lift(ffi) 3050 + }, 3051 + C.uniffi_iroh_streamplace_fn_method_subscriberesponse_next_raw( 3052 + _pointer), 3053 + // pollFn 3054 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 3055 + C.ffi_iroh_streamplace_rust_future_poll_rust_buffer(handle, continuation, data) 3056 + }, 3057 + // freeFn 3058 + func(handle C.uint64_t) { 3059 + C.ffi_iroh_streamplace_rust_future_free_rust_buffer(handle) 3060 + }, 3061 + ) 3062 + 3063 + return res, err 3064 + } 3065 + 3066 + func (_self *SubscribeResponse) DebugString() string { 3067 + _pointer := _self.ffiObject.incrementPointer("*SubscribeResponse") 3068 + defer _self.ffiObject.decrementPointer() 3069 + return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 3070 + return GoRustBuffer{ 3071 + inner: C.uniffi_iroh_streamplace_fn_method_subscriberesponse_uniffi_trait_debug( 3072 + _pointer, _uniffiStatus), 3073 + } 3074 + })) 3075 + } 3076 + 3077 + func (object *SubscribeResponse) Destroy() { 3078 + runtime.SetFinalizer(object, nil) 3079 + object.ffiObject.destroy() 3080 + } 3081 + 3082 + type FfiConverterSubscribeResponse struct{} 3083 + 3084 + var FfiConverterSubscribeResponseINSTANCE = FfiConverterSubscribeResponse{} 3085 + 3086 + func (c FfiConverterSubscribeResponse) Lift(pointer unsafe.Pointer) *SubscribeResponse { 3087 + result := &SubscribeResponse{ 3088 + newFfiObject( 3089 + pointer, 3090 + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 3091 + return C.uniffi_iroh_streamplace_fn_clone_subscriberesponse(pointer, status) 3092 + }, 3093 + func(pointer unsafe.Pointer, status *C.RustCallStatus) { 3094 + C.uniffi_iroh_streamplace_fn_free_subscriberesponse(pointer, status) 3095 + }, 3096 + ), 3097 + } 3098 + runtime.SetFinalizer(result, (*SubscribeResponse).Destroy) 3099 + return result 3100 + } 3101 + 3102 + func (c FfiConverterSubscribeResponse) Read(reader io.Reader) *SubscribeResponse { 3103 + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 3104 + } 3105 + 3106 + func (c FfiConverterSubscribeResponse) Lower(value *SubscribeResponse) unsafe.Pointer { 3107 + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 3108 + // because the pointer will be decremented immediately after this function returns, 3109 + // and someone will be left holding onto a non-locked pointer. 3110 + pointer := value.ffiObject.incrementPointer("*SubscribeResponse") 3111 + defer value.ffiObject.decrementPointer() 3112 + return pointer 3113 + 3114 + } 3115 + 3116 + func (c FfiConverterSubscribeResponse) Write(writer io.Writer, value *SubscribeResponse) { 3117 + writeUint64(writer, uint64(uintptr(c.Lower(value)))) 3118 + } 3119 + 3120 + type FfiDestroyerSubscribeResponse struct{} 3121 + 3122 + func (_ FfiDestroyerSubscribeResponse) Destroy(value *SubscribeResponse) { 3123 + value.Destroy() 3124 + } 3125 + 3126 + // A write scope that can be used to put values into the database. 3127 + // 3128 + // The default write scope is available from the [`Node::node_scope`] method. 3129 + type WriteScopeInterface interface { 3130 + Put(stream *[]byte, key []byte, value []byte) error 3131 + } 3132 + 3133 + // A write scope that can be used to put values into the database. 3134 + // 3135 + // The default write scope is available from the [`Node::node_scope`] method. 3136 + type WriteScope struct { 3137 + ffiObject FfiObject 3138 + } 3139 + 3140 + func (_self *WriteScope) Put(stream *[]byte, key []byte, value []byte) error { 3141 + _pointer := _self.ffiObject.incrementPointer("*WriteScope") 3142 + defer _self.ffiObject.decrementPointer() 3143 + _, err := uniffiRustCallAsync[PutError]( 3144 + FfiConverterPutErrorINSTANCE, 3145 + // completeFn 3146 + func(handle C.uint64_t, status *C.RustCallStatus) struct{} { 3147 + C.ffi_iroh_streamplace_rust_future_complete_void(handle, status) 3148 + return struct{}{} 3149 + }, 3150 + // liftFn 3151 + func(_ struct{}) struct{} { return struct{}{} }, 3152 + C.uniffi_iroh_streamplace_fn_method_writescope_put( 3153 + _pointer, FfiConverterOptionalBytesINSTANCE.Lower(stream), FfiConverterBytesINSTANCE.Lower(key), FfiConverterBytesINSTANCE.Lower(value)), 3154 + // pollFn 3155 + func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) { 3156 + C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data) 3157 + }, 3158 + // freeFn 3159 + func(handle C.uint64_t) { 3160 + C.ffi_iroh_streamplace_rust_future_free_void(handle) 3161 + }, 3162 + ) 3163 + 3164 + return err 3165 + } 3166 + func (object *WriteScope) Destroy() { 3167 + runtime.SetFinalizer(object, nil) 3168 + object.ffiObject.destroy() 3169 + } 3170 + 3171 + type FfiConverterWriteScope struct{} 3172 + 3173 + var FfiConverterWriteScopeINSTANCE = FfiConverterWriteScope{} 3174 + 3175 + func (c FfiConverterWriteScope) Lift(pointer unsafe.Pointer) *WriteScope { 3176 + result := &WriteScope{ 3177 + newFfiObject( 3178 + pointer, 3179 + func(pointer unsafe.Pointer, status *C.RustCallStatus) unsafe.Pointer { 3180 + return C.uniffi_iroh_streamplace_fn_clone_writescope(pointer, status) 3181 + }, 3182 + func(pointer unsafe.Pointer, status *C.RustCallStatus) { 3183 + C.uniffi_iroh_streamplace_fn_free_writescope(pointer, status) 3184 + }, 3185 + ), 3186 + } 3187 + runtime.SetFinalizer(result, (*WriteScope).Destroy) 3188 + return result 3189 + } 3190 + 3191 + func (c FfiConverterWriteScope) Read(reader io.Reader) *WriteScope { 3192 + return c.Lift(unsafe.Pointer(uintptr(readUint64(reader)))) 3193 + } 3194 + 3195 + func (c FfiConverterWriteScope) Lower(value *WriteScope) unsafe.Pointer { 3196 + // TODO: this is bad - all synchronization from ObjectRuntime.go is discarded here, 3197 + // because the pointer will be decremented immediately after this function returns, 3198 + // and someone will be left holding onto a non-locked pointer. 3199 + pointer := value.ffiObject.incrementPointer("*WriteScope") 3200 + defer value.ffiObject.decrementPointer() 3201 + return pointer 3202 + 3203 + } 3204 + 3205 + func (c FfiConverterWriteScope) Write(writer io.Writer, value *WriteScope) { 3206 + writeUint64(writer, uint64(uintptr(c.Lower(value)))) 3207 + } 3208 + 3209 + type FfiDestroyerWriteScope struct{} 3210 + 3211 + func (_ FfiDestroyerWriteScope) Destroy(value *WriteScope) { 3212 + value.Destroy() 3213 + } 3214 + 3215 + // Configuration for an iroh-streamplace node. 3216 + type Config struct { 3217 + // An Ed25519 secret key as a 32 byte array. 3218 + Key []byte 3219 + // The gossip topic to use. Must be 32 bytes. 3220 + // 3221 + // You can use e.g. a BLAKE3 hash of a topic string here. This can be used 3222 + // as a cheap way to have a shared secret - nodes that do not know the topic 3223 + // cannot connect to the swarm. 3224 + Topic []byte 3225 + // Maximum duration to wait for sending a stream piece to a peer. 3226 + MaxSendDuration time.Duration 3227 + // Disable using relays, for tests. 3228 + DisableRelay bool 3229 + } 3230 + 3231 + func (r *Config) Destroy() { 3232 + FfiDestroyerBytes{}.Destroy(r.Key) 3233 + FfiDestroyerBytes{}.Destroy(r.Topic) 3234 + FfiDestroyerDuration{}.Destroy(r.MaxSendDuration) 3235 + FfiDestroyerBool{}.Destroy(r.DisableRelay) 3236 + } 3237 + 3238 + type FfiConverterConfig struct{} 3239 + 3240 + var FfiConverterConfigINSTANCE = FfiConverterConfig{} 3241 + 3242 + func (c FfiConverterConfig) Lift(rb RustBufferI) Config { 3243 + return LiftFromRustBuffer[Config](c, rb) 3244 + } 3245 + 3246 + func (c FfiConverterConfig) Read(reader io.Reader) Config { 3247 + return Config{ 3248 + FfiConverterBytesINSTANCE.Read(reader), 3249 + FfiConverterBytesINSTANCE.Read(reader), 3250 + FfiConverterDurationINSTANCE.Read(reader), 3251 + FfiConverterBoolINSTANCE.Read(reader), 3252 + } 3253 + } 3254 + 3255 + func (c FfiConverterConfig) Lower(value Config) C.RustBuffer { 3256 + return LowerIntoRustBuffer[Config](c, value) 3257 + } 3258 + 3259 + func (c FfiConverterConfig) Write(writer io.Writer, value Config) { 3260 + FfiConverterBytesINSTANCE.Write(writer, value.Key) 3261 + FfiConverterBytesINSTANCE.Write(writer, value.Topic) 3262 + FfiConverterDurationINSTANCE.Write(writer, value.MaxSendDuration) 3263 + FfiConverterBoolINSTANCE.Write(writer, value.DisableRelay) 3264 + } 3265 + 3266 + type FfiDestroyerConfig struct{} 3267 + 3268 + func (_ FfiDestroyerConfig) Destroy(value Config) { 3269 + value.Destroy() 3270 + } 3271 + 3272 + // An entry returned from the database. 3273 + type Entry struct { 3274 + Scope *PublicKey 3275 + Stream *[]byte 3276 + Key []byte 3277 + Value []byte 3278 + Timestamp uint64 3279 + } 3280 + 3281 + func (r *Entry) Destroy() { 3282 + FfiDestroyerPublicKey{}.Destroy(r.Scope) 3283 + FfiDestroyerOptionalBytes{}.Destroy(r.Stream) 3284 + FfiDestroyerBytes{}.Destroy(r.Key) 3285 + FfiDestroyerBytes{}.Destroy(r.Value) 3286 + FfiDestroyerUint64{}.Destroy(r.Timestamp) 3287 + } 3288 + 3289 + type FfiConverterEntry struct{} 3290 + 3291 + var FfiConverterEntryINSTANCE = FfiConverterEntry{} 3292 + 3293 + func (c FfiConverterEntry) Lift(rb RustBufferI) Entry { 3294 + return LiftFromRustBuffer[Entry](c, rb) 3295 + } 3296 + 3297 + func (c FfiConverterEntry) Read(reader io.Reader) Entry { 3298 + return Entry{ 3299 + FfiConverterPublicKeyINSTANCE.Read(reader), 3300 + FfiConverterOptionalBytesINSTANCE.Read(reader), 3301 + FfiConverterBytesINSTANCE.Read(reader), 3302 + FfiConverterBytesINSTANCE.Read(reader), 3303 + FfiConverterUint64INSTANCE.Read(reader), 3304 + } 3305 + } 3306 + 3307 + func (c FfiConverterEntry) Lower(value Entry) C.RustBuffer { 3308 + return LowerIntoRustBuffer[Entry](c, value) 3309 + } 3310 + 3311 + func (c FfiConverterEntry) Write(writer io.Writer, value Entry) { 3312 + FfiConverterPublicKeyINSTANCE.Write(writer, value.Scope) 3313 + FfiConverterOptionalBytesINSTANCE.Write(writer, value.Stream) 3314 + FfiConverterBytesINSTANCE.Write(writer, value.Key) 3315 + FfiConverterBytesINSTANCE.Write(writer, value.Value) 3316 + FfiConverterUint64INSTANCE.Write(writer, value.Timestamp) 3317 + } 3318 + 3319 + type FfiDestroyerEntry struct{} 3320 + 3321 + func (_ FfiDestroyerEntry) Destroy(value Entry) { 3322 + value.Destroy() 3323 + } 3324 + 3325 + // Options for subscribing. 3326 + // 3327 + // `filter` specifies what to subscribe to. 3328 + // `mode` specifies whether to get current items, new items, or both. 3329 + type SubscribeOpts struct { 3330 + Filter *Filter 3331 + Mode SubscribeMode 3332 + } 3333 + 3334 + func (r *SubscribeOpts) Destroy() { 3335 + FfiDestroyerFilter{}.Destroy(r.Filter) 3336 + FfiDestroyerSubscribeMode{}.Destroy(r.Mode) 3337 + } 3338 + 3339 + type FfiConverterSubscribeOpts struct{} 3340 + 3341 + var FfiConverterSubscribeOptsINSTANCE = FfiConverterSubscribeOpts{} 3342 + 3343 + func (c FfiConverterSubscribeOpts) Lift(rb RustBufferI) SubscribeOpts { 3344 + return LiftFromRustBuffer[SubscribeOpts](c, rb) 3345 + } 3346 + 3347 + func (c FfiConverterSubscribeOpts) Read(reader io.Reader) SubscribeOpts { 3348 + return SubscribeOpts{ 3349 + FfiConverterFilterINSTANCE.Read(reader), 3350 + FfiConverterSubscribeModeINSTANCE.Read(reader), 3351 + } 3352 + } 3353 + 3354 + func (c FfiConverterSubscribeOpts) Lower(value SubscribeOpts) C.RustBuffer { 3355 + return LowerIntoRustBuffer[SubscribeOpts](c, value) 3356 + } 3357 + 3358 + func (c FfiConverterSubscribeOpts) Write(writer io.Writer, value SubscribeOpts) { 3359 + FfiConverterFilterINSTANCE.Write(writer, value.Filter) 3360 + FfiConverterSubscribeModeINSTANCE.Write(writer, value.Mode) 3361 + } 3362 + 3363 + type FfiDestroyerSubscribeOpts struct{} 3364 + 3365 + func (_ FfiDestroyerSubscribeOpts) Destroy(value SubscribeOpts) { 3366 + value.Destroy() 3367 + } 3368 + 3369 + // Error creating a new database node. 3370 + type CreateError struct { 3371 + err error 3372 + } 3373 + 3374 + // Convience method to turn *CreateError into error 3375 + // Avoiding treating nil pointer as non nil error interface 3376 + func (err *CreateError) AsError() error { 3377 + if err == nil { 3378 + return nil 3379 + } else { 3380 + return err 3381 + } 3382 + } 3383 + 3384 + func (err CreateError) Error() string { 3385 + return fmt.Sprintf("CreateError: %s", err.err.Error()) 3386 + } 3387 + 3388 + func (err CreateError) Unwrap() error { 3389 + return err.err 3390 + } 3391 + 3392 + // Err* are used for checking error type with `errors.Is` 3393 + var ErrCreateErrorPrivateKey = fmt.Errorf("CreateErrorPrivateKey") 3394 + var ErrCreateErrorTopic = fmt.Errorf("CreateErrorTopic") 3395 + var ErrCreateErrorBind = fmt.Errorf("CreateErrorBind") 3396 + var ErrCreateErrorSubscribe = fmt.Errorf("CreateErrorSubscribe") 3397 + 3398 + // Variant structs 3399 + // The provided private key is invalid (not 32 bytes). 3400 + type CreateErrorPrivateKey struct { 3401 + Size uint64 3402 + } 3403 + 3404 + // The provided private key is invalid (not 32 bytes). 3405 + func NewCreateErrorPrivateKey( 3406 + size uint64, 3407 + ) *CreateError { 3408 + return &CreateError{err: &CreateErrorPrivateKey{ 3409 + Size: size}} 3410 + } 3411 + 3412 + func (e CreateErrorPrivateKey) destroy() { 3413 + FfiDestroyerUint64{}.Destroy(e.Size) 3414 + } 3415 + 3416 + func (err CreateErrorPrivateKey) Error() string { 3417 + return fmt.Sprint("PrivateKey", 3418 + ": ", 3419 + 3420 + "Size=", 3421 + err.Size, 3422 + ) 3423 + } 3424 + 3425 + func (self CreateErrorPrivateKey) Is(target error) bool { 3426 + return target == ErrCreateErrorPrivateKey 3427 + } 3428 + 3429 + // The provided gossip topic is invalid (not 32 bytes). 3430 + type CreateErrorTopic struct { 3431 + Size uint64 3432 + } 3433 + 3434 + // The provided gossip topic is invalid (not 32 bytes). 3435 + func NewCreateErrorTopic( 3436 + size uint64, 3437 + ) *CreateError { 3438 + return &CreateError{err: &CreateErrorTopic{ 3439 + Size: size}} 3440 + } 3441 + 3442 + func (e CreateErrorTopic) destroy() { 3443 + FfiDestroyerUint64{}.Destroy(e.Size) 3444 + } 3445 + 3446 + func (err CreateErrorTopic) Error() string { 3447 + return fmt.Sprint("Topic", 3448 + ": ", 3449 + 3450 + "Size=", 3451 + err.Size, 3452 + ) 3453 + } 3454 + 3455 + func (self CreateErrorTopic) Is(target error) bool { 3456 + return target == ErrCreateErrorTopic 3457 + } 3458 + 3459 + // Failed to bind the iroh endpoint. 3460 + type CreateErrorBind struct { 3461 + Message string 3462 + } 3463 + 3464 + // Failed to bind the iroh endpoint. 3465 + func NewCreateErrorBind( 3466 + message string, 3467 + ) *CreateError { 3468 + return &CreateError{err: &CreateErrorBind{ 3469 + Message: message}} 3470 + } 3471 + 3472 + func (e CreateErrorBind) destroy() { 3473 + FfiDestroyerString{}.Destroy(e.Message) 3474 + } 3475 + 3476 + func (err CreateErrorBind) Error() string { 3477 + return fmt.Sprint("Bind", 3478 + ": ", 3479 + 3480 + "Message=", 3481 + err.Message, 3482 + ) 3483 + } 3484 + 3485 + func (self CreateErrorBind) Is(target error) bool { 3486 + return target == ErrCreateErrorBind 3487 + } 3488 + 3489 + // Failed to subscribe to the gossip topic. 3490 + type CreateErrorSubscribe struct { 3491 + Message string 3492 + } 3493 + 3494 + // Failed to subscribe to the gossip topic. 3495 + func NewCreateErrorSubscribe( 3496 + message string, 3497 + ) *CreateError { 3498 + return &CreateError{err: &CreateErrorSubscribe{ 3499 + Message: message}} 3500 + } 3501 + 3502 + func (e CreateErrorSubscribe) destroy() { 3503 + FfiDestroyerString{}.Destroy(e.Message) 3504 + } 3505 + 3506 + func (err CreateErrorSubscribe) Error() string { 3507 + return fmt.Sprint("Subscribe", 3508 + ": ", 3509 + 3510 + "Message=", 3511 + err.Message, 3512 + ) 3513 + } 3514 + 3515 + func (self CreateErrorSubscribe) Is(target error) bool { 3516 + return target == ErrCreateErrorSubscribe 3517 + } 3518 + 3519 + type FfiConverterCreateError struct{} 3520 + 3521 + var FfiConverterCreateErrorINSTANCE = FfiConverterCreateError{} 3522 + 3523 + func (c FfiConverterCreateError) Lift(eb RustBufferI) *CreateError { 3524 + return LiftFromRustBuffer[*CreateError](c, eb) 3525 + } 3526 + 3527 + func (c FfiConverterCreateError) Lower(value *CreateError) C.RustBuffer { 3528 + return LowerIntoRustBuffer[*CreateError](c, value) 3529 + } 3530 + 3531 + func (c FfiConverterCreateError) Read(reader io.Reader) *CreateError { 3532 + errorID := readUint32(reader) 3533 + 3534 + switch errorID { 3535 + case 1: 3536 + return &CreateError{&CreateErrorPrivateKey{ 3537 + Size: FfiConverterUint64INSTANCE.Read(reader), 3538 + }} 3539 + case 2: 3540 + return &CreateError{&CreateErrorTopic{ 3541 + Size: FfiConverterUint64INSTANCE.Read(reader), 3542 + }} 3543 + case 3: 3544 + return &CreateError{&CreateErrorBind{ 3545 + Message: FfiConverterStringINSTANCE.Read(reader), 3546 + }} 3547 + case 4: 3548 + return &CreateError{&CreateErrorSubscribe{ 3549 + Message: FfiConverterStringINSTANCE.Read(reader), 3550 + }} 3551 + default: 3552 + panic(fmt.Sprintf("Unknown error code %d in FfiConverterCreateError.Read()", errorID)) 3553 + } 3554 + } 3555 + 3556 + func (c FfiConverterCreateError) Write(writer io.Writer, value *CreateError) { 3557 + switch variantValue := value.err.(type) { 3558 + case *CreateErrorPrivateKey: 3559 + writeInt32(writer, 1) 3560 + FfiConverterUint64INSTANCE.Write(writer, variantValue.Size) 3561 + case *CreateErrorTopic: 3562 + writeInt32(writer, 2) 3563 + FfiConverterUint64INSTANCE.Write(writer, variantValue.Size) 3564 + case *CreateErrorBind: 3565 + writeInt32(writer, 3) 3566 + FfiConverterStringINSTANCE.Write(writer, variantValue.Message) 3567 + case *CreateErrorSubscribe: 3568 + writeInt32(writer, 4) 3569 + FfiConverterStringINSTANCE.Write(writer, variantValue.Message) 3570 + default: 3571 + _ = variantValue 3572 + panic(fmt.Sprintf("invalid error value `%v` in FfiConverterCreateError.Write", value)) 3573 + } 3574 + } 3575 + 3576 + type FfiDestroyerCreateError struct{} 3577 + 3578 + func (_ FfiDestroyerCreateError) Destroy(value *CreateError) { 3579 + switch variantValue := value.err.(type) { 3580 + case CreateErrorPrivateKey: 3581 + variantValue.destroy() 3582 + case CreateErrorTopic: 3583 + variantValue.destroy() 3584 + case CreateErrorBind: 3585 + variantValue.destroy() 3586 + case CreateErrorSubscribe: 3587 + variantValue.destroy() 3588 + default: 3589 + _ = variantValue 3590 + panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerCreateError.Destroy", value)) 3591 + } 3592 + } 3593 + 1752 3594 // An Error. 1753 3595 type Error struct { 1754 3596 err error ··· 1998 3840 } 1999 3841 } 2000 3842 3843 + // Error joining peers. 3844 + type JoinPeersError struct { 3845 + err error 3846 + } 3847 + 3848 + // Convience method to turn *JoinPeersError into error 3849 + // Avoiding treating nil pointer as non nil error interface 3850 + func (err *JoinPeersError) AsError() error { 3851 + if err == nil { 3852 + return nil 3853 + } else { 3854 + return err 3855 + } 3856 + } 3857 + 3858 + func (err JoinPeersError) Error() string { 3859 + return fmt.Sprintf("JoinPeersError: %s", err.err.Error()) 3860 + } 3861 + 3862 + func (err JoinPeersError) Unwrap() error { 3863 + return err.err 3864 + } 3865 + 3866 + // Err* are used for checking error type with `errors.Is` 3867 + var ErrJoinPeersErrorTicket = fmt.Errorf("JoinPeersErrorTicket") 3868 + var ErrJoinPeersErrorIrpc = fmt.Errorf("JoinPeersErrorIrpc") 3869 + 3870 + // Variant structs 3871 + // Failed to parse a provided iroh node ticket. 3872 + type JoinPeersErrorTicket struct { 3873 + Message string 3874 + } 3875 + 3876 + // Failed to parse a provided iroh node ticket. 3877 + func NewJoinPeersErrorTicket( 3878 + message string, 3879 + ) *JoinPeersError { 3880 + return &JoinPeersError{err: &JoinPeersErrorTicket{ 3881 + Message: message}} 3882 + } 3883 + 3884 + func (e JoinPeersErrorTicket) destroy() { 3885 + FfiDestroyerString{}.Destroy(e.Message) 3886 + } 3887 + 3888 + func (err JoinPeersErrorTicket) Error() string { 3889 + return fmt.Sprint("Ticket", 3890 + ": ", 3891 + 3892 + "Message=", 3893 + err.Message, 3894 + ) 3895 + } 3896 + 3897 + func (self JoinPeersErrorTicket) Is(target error) bool { 3898 + return target == ErrJoinPeersErrorTicket 3899 + } 3900 + 3901 + // Error during the join peers operation. 3902 + type JoinPeersErrorIrpc struct { 3903 + Message string 3904 + } 3905 + 3906 + // Error during the join peers operation. 3907 + func NewJoinPeersErrorIrpc( 3908 + message string, 3909 + ) *JoinPeersError { 3910 + return &JoinPeersError{err: &JoinPeersErrorIrpc{ 3911 + Message: message}} 3912 + } 3913 + 3914 + func (e JoinPeersErrorIrpc) destroy() { 3915 + FfiDestroyerString{}.Destroy(e.Message) 3916 + } 3917 + 3918 + func (err JoinPeersErrorIrpc) Error() string { 3919 + return fmt.Sprint("Irpc", 3920 + ": ", 3921 + 3922 + "Message=", 3923 + err.Message, 3924 + ) 3925 + } 3926 + 3927 + func (self JoinPeersErrorIrpc) Is(target error) bool { 3928 + return target == ErrJoinPeersErrorIrpc 3929 + } 3930 + 3931 + type FfiConverterJoinPeersError struct{} 3932 + 3933 + var FfiConverterJoinPeersErrorINSTANCE = FfiConverterJoinPeersError{} 3934 + 3935 + func (c FfiConverterJoinPeersError) Lift(eb RustBufferI) *JoinPeersError { 3936 + return LiftFromRustBuffer[*JoinPeersError](c, eb) 3937 + } 3938 + 3939 + func (c FfiConverterJoinPeersError) Lower(value *JoinPeersError) C.RustBuffer { 3940 + return LowerIntoRustBuffer[*JoinPeersError](c, value) 3941 + } 3942 + 3943 + func (c FfiConverterJoinPeersError) Read(reader io.Reader) *JoinPeersError { 3944 + errorID := readUint32(reader) 3945 + 3946 + switch errorID { 3947 + case 1: 3948 + return &JoinPeersError{&JoinPeersErrorTicket{ 3949 + Message: FfiConverterStringINSTANCE.Read(reader), 3950 + }} 3951 + case 2: 3952 + return &JoinPeersError{&JoinPeersErrorIrpc{ 3953 + Message: FfiConverterStringINSTANCE.Read(reader), 3954 + }} 3955 + default: 3956 + panic(fmt.Sprintf("Unknown error code %d in FfiConverterJoinPeersError.Read()", errorID)) 3957 + } 3958 + } 3959 + 3960 + func (c FfiConverterJoinPeersError) Write(writer io.Writer, value *JoinPeersError) { 3961 + switch variantValue := value.err.(type) { 3962 + case *JoinPeersErrorTicket: 3963 + writeInt32(writer, 1) 3964 + FfiConverterStringINSTANCE.Write(writer, variantValue.Message) 3965 + case *JoinPeersErrorIrpc: 3966 + writeInt32(writer, 2) 3967 + FfiConverterStringINSTANCE.Write(writer, variantValue.Message) 3968 + default: 3969 + _ = variantValue 3970 + panic(fmt.Sprintf("invalid error value `%v` in FfiConverterJoinPeersError.Write", value)) 3971 + } 3972 + } 3973 + 3974 + type FfiDestroyerJoinPeersError struct{} 3975 + 3976 + func (_ FfiDestroyerJoinPeersError) Destroy(value *JoinPeersError) { 3977 + switch variantValue := value.err.(type) { 3978 + case JoinPeersErrorTicket: 3979 + variantValue.destroy() 3980 + case JoinPeersErrorIrpc: 3981 + variantValue.destroy() 3982 + default: 3983 + _ = variantValue 3984 + panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerJoinPeersError.Destroy", value)) 3985 + } 3986 + } 3987 + 3988 + type PublicKeyError struct { 3989 + err error 3990 + } 3991 + 3992 + // Convience method to turn *PublicKeyError into error 3993 + // Avoiding treating nil pointer as non nil error interface 3994 + func (err *PublicKeyError) AsError() error { 3995 + if err == nil { 3996 + return nil 3997 + } else { 3998 + return err 3999 + } 4000 + } 4001 + 4002 + func (err PublicKeyError) Error() string { 4003 + return fmt.Sprintf("PublicKeyError: %s", err.err.Error()) 4004 + } 4005 + 4006 + func (err PublicKeyError) Unwrap() error { 4007 + return err.err 4008 + } 4009 + 4010 + // Err* are used for checking error type with `errors.Is` 4011 + var ErrPublicKeyErrorLength = fmt.Errorf("PublicKeyErrorLength") 4012 + var ErrPublicKeyErrorInvalid = fmt.Errorf("PublicKeyErrorInvalid") 4013 + 4014 + // Variant structs 4015 + type PublicKeyErrorLength struct { 4016 + Size uint64 4017 + } 4018 + 4019 + func NewPublicKeyErrorLength( 4020 + size uint64, 4021 + ) *PublicKeyError { 4022 + return &PublicKeyError{err: &PublicKeyErrorLength{ 4023 + Size: size}} 4024 + } 4025 + 4026 + func (e PublicKeyErrorLength) destroy() { 4027 + FfiDestroyerUint64{}.Destroy(e.Size) 4028 + } 4029 + 4030 + func (err PublicKeyErrorLength) Error() string { 4031 + return fmt.Sprint("Length", 4032 + ": ", 4033 + 4034 + "Size=", 4035 + err.Size, 4036 + ) 4037 + } 4038 + 4039 + func (self PublicKeyErrorLength) Is(target error) bool { 4040 + return target == ErrPublicKeyErrorLength 4041 + } 4042 + 4043 + type PublicKeyErrorInvalid struct { 4044 + Message string 4045 + } 4046 + 4047 + func NewPublicKeyErrorInvalid( 4048 + message string, 4049 + ) *PublicKeyError { 4050 + return &PublicKeyError{err: &PublicKeyErrorInvalid{ 4051 + Message: message}} 4052 + } 4053 + 4054 + func (e PublicKeyErrorInvalid) destroy() { 4055 + FfiDestroyerString{}.Destroy(e.Message) 4056 + } 4057 + 4058 + func (err PublicKeyErrorInvalid) Error() string { 4059 + return fmt.Sprint("Invalid", 4060 + ": ", 4061 + 4062 + "Message=", 4063 + err.Message, 4064 + ) 4065 + } 4066 + 4067 + func (self PublicKeyErrorInvalid) Is(target error) bool { 4068 + return target == ErrPublicKeyErrorInvalid 4069 + } 4070 + 4071 + type FfiConverterPublicKeyError struct{} 4072 + 4073 + var FfiConverterPublicKeyErrorINSTANCE = FfiConverterPublicKeyError{} 4074 + 4075 + func (c FfiConverterPublicKeyError) Lift(eb RustBufferI) *PublicKeyError { 4076 + return LiftFromRustBuffer[*PublicKeyError](c, eb) 4077 + } 4078 + 4079 + func (c FfiConverterPublicKeyError) Lower(value *PublicKeyError) C.RustBuffer { 4080 + return LowerIntoRustBuffer[*PublicKeyError](c, value) 4081 + } 4082 + 4083 + func (c FfiConverterPublicKeyError) Read(reader io.Reader) *PublicKeyError { 4084 + errorID := readUint32(reader) 4085 + 4086 + switch errorID { 4087 + case 1: 4088 + return &PublicKeyError{&PublicKeyErrorLength{ 4089 + Size: FfiConverterUint64INSTANCE.Read(reader), 4090 + }} 4091 + case 2: 4092 + return &PublicKeyError{&PublicKeyErrorInvalid{ 4093 + Message: FfiConverterStringINSTANCE.Read(reader), 4094 + }} 4095 + default: 4096 + panic(fmt.Sprintf("Unknown error code %d in FfiConverterPublicKeyError.Read()", errorID)) 4097 + } 4098 + } 4099 + 4100 + func (c FfiConverterPublicKeyError) Write(writer io.Writer, value *PublicKeyError) { 4101 + switch variantValue := value.err.(type) { 4102 + case *PublicKeyErrorLength: 4103 + writeInt32(writer, 1) 4104 + FfiConverterUint64INSTANCE.Write(writer, variantValue.Size) 4105 + case *PublicKeyErrorInvalid: 4106 + writeInt32(writer, 2) 4107 + FfiConverterStringINSTANCE.Write(writer, variantValue.Message) 4108 + default: 4109 + _ = variantValue 4110 + panic(fmt.Sprintf("invalid error value `%v` in FfiConverterPublicKeyError.Write", value)) 4111 + } 4112 + } 4113 + 4114 + type FfiDestroyerPublicKeyError struct{} 4115 + 4116 + func (_ FfiDestroyerPublicKeyError) Destroy(value *PublicKeyError) { 4117 + switch variantValue := value.err.(type) { 4118 + case PublicKeyErrorLength: 4119 + variantValue.destroy() 4120 + case PublicKeyErrorInvalid: 4121 + variantValue.destroy() 4122 + default: 4123 + _ = variantValue 4124 + panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerPublicKeyError.Destroy", value)) 4125 + } 4126 + } 4127 + 4128 + // Error putting a value into the database. 4129 + type PutError struct { 4130 + err error 4131 + } 4132 + 4133 + // Convience method to turn *PutError into error 4134 + // Avoiding treating nil pointer as non nil error interface 4135 + func (err *PutError) AsError() error { 4136 + if err == nil { 4137 + return nil 4138 + } else { 4139 + return err 4140 + } 4141 + } 4142 + 4143 + func (err PutError) Error() string { 4144 + return fmt.Sprintf("PutError: %s", err.err.Error()) 4145 + } 4146 + 4147 + func (err PutError) Unwrap() error { 4148 + return err.err 4149 + } 4150 + 4151 + // Err* are used for checking error type with `errors.Is` 4152 + var ErrPutErrorIrpc = fmt.Errorf("PutErrorIrpc") 4153 + 4154 + // Variant structs 4155 + // Error during the put operation. 4156 + type PutErrorIrpc struct { 4157 + Message string 4158 + } 4159 + 4160 + // Error during the put operation. 4161 + func NewPutErrorIrpc( 4162 + message string, 4163 + ) *PutError { 4164 + return &PutError{err: &PutErrorIrpc{ 4165 + Message: message}} 4166 + } 4167 + 4168 + func (e PutErrorIrpc) destroy() { 4169 + FfiDestroyerString{}.Destroy(e.Message) 4170 + } 4171 + 4172 + func (err PutErrorIrpc) Error() string { 4173 + return fmt.Sprint("Irpc", 4174 + ": ", 4175 + 4176 + "Message=", 4177 + err.Message, 4178 + ) 4179 + } 4180 + 4181 + func (self PutErrorIrpc) Is(target error) bool { 4182 + return target == ErrPutErrorIrpc 4183 + } 4184 + 4185 + type FfiConverterPutError struct{} 4186 + 4187 + var FfiConverterPutErrorINSTANCE = FfiConverterPutError{} 4188 + 4189 + func (c FfiConverterPutError) Lift(eb RustBufferI) *PutError { 4190 + return LiftFromRustBuffer[*PutError](c, eb) 4191 + } 4192 + 4193 + func (c FfiConverterPutError) Lower(value *PutError) C.RustBuffer { 4194 + return LowerIntoRustBuffer[*PutError](c, value) 4195 + } 4196 + 4197 + func (c FfiConverterPutError) Read(reader io.Reader) *PutError { 4198 + errorID := readUint32(reader) 4199 + 4200 + switch errorID { 4201 + case 1: 4202 + return &PutError{&PutErrorIrpc{ 4203 + Message: FfiConverterStringINSTANCE.Read(reader), 4204 + }} 4205 + default: 4206 + panic(fmt.Sprintf("Unknown error code %d in FfiConverterPutError.Read()", errorID)) 4207 + } 4208 + } 4209 + 4210 + func (c FfiConverterPutError) Write(writer io.Writer, value *PutError) { 4211 + switch variantValue := value.err.(type) { 4212 + case *PutErrorIrpc: 4213 + writeInt32(writer, 1) 4214 + FfiConverterStringINSTANCE.Write(writer, variantValue.Message) 4215 + default: 4216 + _ = variantValue 4217 + panic(fmt.Sprintf("invalid error value `%v` in FfiConverterPutError.Write", value)) 4218 + } 4219 + } 4220 + 4221 + type FfiDestroyerPutError struct{} 4222 + 4223 + func (_ FfiDestroyerPutError) Destroy(value *PutError) { 4224 + switch variantValue := value.err.(type) { 4225 + case PutErrorIrpc: 4226 + variantValue.destroy() 4227 + default: 4228 + _ = variantValue 4229 + panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerPutError.Destroy", value)) 4230 + } 4231 + } 4232 + 2001 4233 type SpError struct { 2002 4234 err error 2003 4235 } ··· 2116 4348 } 2117 4349 } 2118 4350 4351 + type StreamFilter interface { 4352 + Destroy() 4353 + } 4354 + type StreamFilterAll struct { 4355 + } 4356 + 4357 + func (e StreamFilterAll) Destroy() { 4358 + } 4359 + 4360 + type StreamFilterGlobal struct { 4361 + } 4362 + 4363 + func (e StreamFilterGlobal) Destroy() { 4364 + } 4365 + 4366 + type StreamFilterStream struct { 4367 + Field0 []byte 4368 + } 4369 + 4370 + func (e StreamFilterStream) Destroy() { 4371 + FfiDestroyerBytes{}.Destroy(e.Field0) 4372 + } 4373 + 4374 + type FfiConverterStreamFilter struct{} 4375 + 4376 + var FfiConverterStreamFilterINSTANCE = FfiConverterStreamFilter{} 4377 + 4378 + func (c FfiConverterStreamFilter) Lift(rb RustBufferI) StreamFilter { 4379 + return LiftFromRustBuffer[StreamFilter](c, rb) 4380 + } 4381 + 4382 + func (c FfiConverterStreamFilter) Lower(value StreamFilter) C.RustBuffer { 4383 + return LowerIntoRustBuffer[StreamFilter](c, value) 4384 + } 4385 + func (FfiConverterStreamFilter) Read(reader io.Reader) StreamFilter { 4386 + id := readInt32(reader) 4387 + switch id { 4388 + case 1: 4389 + return StreamFilterAll{} 4390 + case 2: 4391 + return StreamFilterGlobal{} 4392 + case 3: 4393 + return StreamFilterStream{ 4394 + FfiConverterBytesINSTANCE.Read(reader), 4395 + } 4396 + default: 4397 + panic(fmt.Sprintf("invalid enum value %v in FfiConverterStreamFilter.Read()", id)) 4398 + } 4399 + } 4400 + 4401 + func (FfiConverterStreamFilter) Write(writer io.Writer, value StreamFilter) { 4402 + switch variant_value := value.(type) { 4403 + case StreamFilterAll: 4404 + writeInt32(writer, 1) 4405 + case StreamFilterGlobal: 4406 + writeInt32(writer, 2) 4407 + case StreamFilterStream: 4408 + writeInt32(writer, 3) 4409 + FfiConverterBytesINSTANCE.Write(writer, variant_value.Field0) 4410 + default: 4411 + _ = variant_value 4412 + panic(fmt.Sprintf("invalid enum value `%v` in FfiConverterStreamFilter.Write", value)) 4413 + } 4414 + } 4415 + 4416 + type FfiDestroyerStreamFilter struct{} 4417 + 4418 + func (_ FfiDestroyerStreamFilter) Destroy(value StreamFilter) { 4419 + value.Destroy() 4420 + } 4421 + 4422 + // An item returned from a subscription. 4423 + type SubscribeItem interface { 4424 + Destroy() 4425 + } 4426 + type SubscribeItemEntry struct { 4427 + Scope *PublicKey 4428 + Stream *[]byte 4429 + Key []byte 4430 + Value []byte 4431 + Timestamp uint64 4432 + } 4433 + 4434 + func (e SubscribeItemEntry) Destroy() { 4435 + FfiDestroyerPublicKey{}.Destroy(e.Scope) 4436 + FfiDestroyerOptionalBytes{}.Destroy(e.Stream) 4437 + FfiDestroyerBytes{}.Destroy(e.Key) 4438 + FfiDestroyerBytes{}.Destroy(e.Value) 4439 + FfiDestroyerUint64{}.Destroy(e.Timestamp) 4440 + } 4441 + 4442 + type SubscribeItemCurrentDone struct { 4443 + } 4444 + 4445 + func (e SubscribeItemCurrentDone) Destroy() { 4446 + } 4447 + 4448 + type SubscribeItemExpired struct { 4449 + Scope *PublicKey 4450 + Stream *[]byte 4451 + Key []byte 4452 + Timestamp uint64 4453 + } 4454 + 4455 + func (e SubscribeItemExpired) Destroy() { 4456 + FfiDestroyerPublicKey{}.Destroy(e.Scope) 4457 + FfiDestroyerOptionalBytes{}.Destroy(e.Stream) 4458 + FfiDestroyerBytes{}.Destroy(e.Key) 4459 + FfiDestroyerUint64{}.Destroy(e.Timestamp) 4460 + } 4461 + 4462 + type SubscribeItemOther struct { 4463 + } 4464 + 4465 + func (e SubscribeItemOther) Destroy() { 4466 + } 4467 + 4468 + type FfiConverterSubscribeItem struct{} 4469 + 4470 + var FfiConverterSubscribeItemINSTANCE = FfiConverterSubscribeItem{} 4471 + 4472 + func (c FfiConverterSubscribeItem) Lift(rb RustBufferI) SubscribeItem { 4473 + return LiftFromRustBuffer[SubscribeItem](c, rb) 4474 + } 4475 + 4476 + func (c FfiConverterSubscribeItem) Lower(value SubscribeItem) C.RustBuffer { 4477 + return LowerIntoRustBuffer[SubscribeItem](c, value) 4478 + } 4479 + func (FfiConverterSubscribeItem) Read(reader io.Reader) SubscribeItem { 4480 + id := readInt32(reader) 4481 + switch id { 4482 + case 1: 4483 + return SubscribeItemEntry{ 4484 + FfiConverterPublicKeyINSTANCE.Read(reader), 4485 + FfiConverterOptionalBytesINSTANCE.Read(reader), 4486 + FfiConverterBytesINSTANCE.Read(reader), 4487 + FfiConverterBytesINSTANCE.Read(reader), 4488 + FfiConverterUint64INSTANCE.Read(reader), 4489 + } 4490 + case 2: 4491 + return SubscribeItemCurrentDone{} 4492 + case 3: 4493 + return SubscribeItemExpired{ 4494 + FfiConverterPublicKeyINSTANCE.Read(reader), 4495 + FfiConverterOptionalBytesINSTANCE.Read(reader), 4496 + FfiConverterBytesINSTANCE.Read(reader), 4497 + FfiConverterUint64INSTANCE.Read(reader), 4498 + } 4499 + case 4: 4500 + return SubscribeItemOther{} 4501 + default: 4502 + panic(fmt.Sprintf("invalid enum value %v in FfiConverterSubscribeItem.Read()", id)) 4503 + } 4504 + } 4505 + 4506 + func (FfiConverterSubscribeItem) Write(writer io.Writer, value SubscribeItem) { 4507 + switch variant_value := value.(type) { 4508 + case SubscribeItemEntry: 4509 + writeInt32(writer, 1) 4510 + FfiConverterPublicKeyINSTANCE.Write(writer, variant_value.Scope) 4511 + FfiConverterOptionalBytesINSTANCE.Write(writer, variant_value.Stream) 4512 + FfiConverterBytesINSTANCE.Write(writer, variant_value.Key) 4513 + FfiConverterBytesINSTANCE.Write(writer, variant_value.Value) 4514 + FfiConverterUint64INSTANCE.Write(writer, variant_value.Timestamp) 4515 + case SubscribeItemCurrentDone: 4516 + writeInt32(writer, 2) 4517 + case SubscribeItemExpired: 4518 + writeInt32(writer, 3) 4519 + FfiConverterPublicKeyINSTANCE.Write(writer, variant_value.Scope) 4520 + FfiConverterOptionalBytesINSTANCE.Write(writer, variant_value.Stream) 4521 + FfiConverterBytesINSTANCE.Write(writer, variant_value.Key) 4522 + FfiConverterUint64INSTANCE.Write(writer, variant_value.Timestamp) 4523 + case SubscribeItemOther: 4524 + writeInt32(writer, 4) 4525 + default: 4526 + _ = variant_value 4527 + panic(fmt.Sprintf("invalid enum value `%v` in FfiConverterSubscribeItem.Write", value)) 4528 + } 4529 + } 4530 + 4531 + type FfiDestroyerSubscribeItem struct{} 4532 + 4533 + func (_ FfiDestroyerSubscribeItem) Destroy(value SubscribeItem) { 4534 + value.Destroy() 4535 + } 4536 + 4537 + // Subscription mode for key-value subscriptions. 4538 + type SubscribeMode uint 4539 + 4540 + const ( 4541 + SubscribeModeCurrent SubscribeMode = 1 4542 + SubscribeModeFuture SubscribeMode = 2 4543 + SubscribeModeBoth SubscribeMode = 3 4544 + ) 4545 + 4546 + type FfiConverterSubscribeMode struct{} 4547 + 4548 + var FfiConverterSubscribeModeINSTANCE = FfiConverterSubscribeMode{} 4549 + 4550 + func (c FfiConverterSubscribeMode) Lift(rb RustBufferI) SubscribeMode { 4551 + return LiftFromRustBuffer[SubscribeMode](c, rb) 4552 + } 4553 + 4554 + func (c FfiConverterSubscribeMode) Lower(value SubscribeMode) C.RustBuffer { 4555 + return LowerIntoRustBuffer[SubscribeMode](c, value) 4556 + } 4557 + func (FfiConverterSubscribeMode) Read(reader io.Reader) SubscribeMode { 4558 + id := readInt32(reader) 4559 + return SubscribeMode(id) 4560 + } 4561 + 4562 + func (FfiConverterSubscribeMode) Write(writer io.Writer, value SubscribeMode) { 4563 + writeInt32(writer, int32(value)) 4564 + } 4565 + 4566 + type FfiDestroyerSubscribeMode struct{} 4567 + 4568 + func (_ FfiDestroyerSubscribeMode) Destroy(value SubscribeMode) { 4569 + } 4570 + 4571 + // Error getting the next item from a subscription. 4572 + type SubscribeNextError struct { 4573 + err error 4574 + } 4575 + 4576 + // Convience method to turn *SubscribeNextError into error 4577 + // Avoiding treating nil pointer as non nil error interface 4578 + func (err *SubscribeNextError) AsError() error { 4579 + if err == nil { 4580 + return nil 4581 + } else { 4582 + return err 4583 + } 4584 + } 4585 + 4586 + func (err SubscribeNextError) Error() string { 4587 + return fmt.Sprintf("SubscribeNextError: %s", err.err.Error()) 4588 + } 4589 + 4590 + func (err SubscribeNextError) Unwrap() error { 4591 + return err.err 4592 + } 4593 + 4594 + // Err* are used for checking error type with `errors.Is` 4595 + var ErrSubscribeNextErrorIrpc = fmt.Errorf("SubscribeNextErrorIrpc") 4596 + 4597 + // Variant structs 4598 + // Error during the subscribe next operation. 4599 + type SubscribeNextErrorIrpc struct { 4600 + Message string 4601 + } 4602 + 4603 + // Error during the subscribe next operation. 4604 + func NewSubscribeNextErrorIrpc( 4605 + message string, 4606 + ) *SubscribeNextError { 4607 + return &SubscribeNextError{err: &SubscribeNextErrorIrpc{ 4608 + Message: message}} 4609 + } 4610 + 4611 + func (e SubscribeNextErrorIrpc) destroy() { 4612 + FfiDestroyerString{}.Destroy(e.Message) 4613 + } 4614 + 4615 + func (err SubscribeNextErrorIrpc) Error() string { 4616 + return fmt.Sprint("Irpc", 4617 + ": ", 4618 + 4619 + "Message=", 4620 + err.Message, 4621 + ) 4622 + } 4623 + 4624 + func (self SubscribeNextErrorIrpc) Is(target error) bool { 4625 + return target == ErrSubscribeNextErrorIrpc 4626 + } 4627 + 4628 + type FfiConverterSubscribeNextError struct{} 4629 + 4630 + var FfiConverterSubscribeNextErrorINSTANCE = FfiConverterSubscribeNextError{} 4631 + 4632 + func (c FfiConverterSubscribeNextError) Lift(eb RustBufferI) *SubscribeNextError { 4633 + return LiftFromRustBuffer[*SubscribeNextError](c, eb) 4634 + } 4635 + 4636 + func (c FfiConverterSubscribeNextError) Lower(value *SubscribeNextError) C.RustBuffer { 4637 + return LowerIntoRustBuffer[*SubscribeNextError](c, value) 4638 + } 4639 + 4640 + func (c FfiConverterSubscribeNextError) Read(reader io.Reader) *SubscribeNextError { 4641 + errorID := readUint32(reader) 4642 + 4643 + switch errorID { 4644 + case 1: 4645 + return &SubscribeNextError{&SubscribeNextErrorIrpc{ 4646 + Message: FfiConverterStringINSTANCE.Read(reader), 4647 + }} 4648 + default: 4649 + panic(fmt.Sprintf("Unknown error code %d in FfiConverterSubscribeNextError.Read()", errorID)) 4650 + } 4651 + } 4652 + 4653 + func (c FfiConverterSubscribeNextError) Write(writer io.Writer, value *SubscribeNextError) { 4654 + switch variantValue := value.err.(type) { 4655 + case *SubscribeNextErrorIrpc: 4656 + writeInt32(writer, 1) 4657 + FfiConverterStringINSTANCE.Write(writer, variantValue.Message) 4658 + default: 4659 + _ = variantValue 4660 + panic(fmt.Sprintf("invalid error value `%v` in FfiConverterSubscribeNextError.Write", value)) 4661 + } 4662 + } 4663 + 4664 + type FfiDestroyerSubscribeNextError struct{} 4665 + 4666 + func (_ FfiDestroyerSubscribeNextError) Destroy(value *SubscribeNextError) { 4667 + switch variantValue := value.err.(type) { 4668 + case SubscribeNextErrorIrpc: 4669 + variantValue.destroy() 4670 + default: 4671 + _ = variantValue 4672 + panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerSubscribeNextError.Destroy", value)) 4673 + } 4674 + } 4675 + 4676 + // A bound on time for filtering. 4677 + type TimeBound interface { 4678 + Destroy() 4679 + } 4680 + type TimeBoundUnbounded struct { 4681 + } 4682 + 4683 + func (e TimeBoundUnbounded) Destroy() { 4684 + } 4685 + 4686 + type TimeBoundIncluded struct { 4687 + Field0 uint64 4688 + } 4689 + 4690 + func (e TimeBoundIncluded) Destroy() { 4691 + FfiDestroyerUint64{}.Destroy(e.Field0) 4692 + } 4693 + 4694 + type TimeBoundExcluded struct { 4695 + Field0 uint64 4696 + } 4697 + 4698 + func (e TimeBoundExcluded) Destroy() { 4699 + FfiDestroyerUint64{}.Destroy(e.Field0) 4700 + } 4701 + 4702 + type FfiConverterTimeBound struct{} 4703 + 4704 + var FfiConverterTimeBoundINSTANCE = FfiConverterTimeBound{} 4705 + 4706 + func (c FfiConverterTimeBound) Lift(rb RustBufferI) TimeBound { 4707 + return LiftFromRustBuffer[TimeBound](c, rb) 4708 + } 4709 + 4710 + func (c FfiConverterTimeBound) Lower(value TimeBound) C.RustBuffer { 4711 + return LowerIntoRustBuffer[TimeBound](c, value) 4712 + } 4713 + func (FfiConverterTimeBound) Read(reader io.Reader) TimeBound { 4714 + id := readInt32(reader) 4715 + switch id { 4716 + case 1: 4717 + return TimeBoundUnbounded{} 4718 + case 2: 4719 + return TimeBoundIncluded{ 4720 + FfiConverterUint64INSTANCE.Read(reader), 4721 + } 4722 + case 3: 4723 + return TimeBoundExcluded{ 4724 + FfiConverterUint64INSTANCE.Read(reader), 4725 + } 4726 + default: 4727 + panic(fmt.Sprintf("invalid enum value %v in FfiConverterTimeBound.Read()", id)) 4728 + } 4729 + } 4730 + 4731 + func (FfiConverterTimeBound) Write(writer io.Writer, value TimeBound) { 4732 + switch variant_value := value.(type) { 4733 + case TimeBoundUnbounded: 4734 + writeInt32(writer, 1) 4735 + case TimeBoundIncluded: 4736 + writeInt32(writer, 2) 4737 + FfiConverterUint64INSTANCE.Write(writer, variant_value.Field0) 4738 + case TimeBoundExcluded: 4739 + writeInt32(writer, 3) 4740 + FfiConverterUint64INSTANCE.Write(writer, variant_value.Field0) 4741 + default: 4742 + _ = variant_value 4743 + panic(fmt.Sprintf("invalid enum value `%v` in FfiConverterTimeBound.Write", value)) 4744 + } 4745 + } 4746 + 4747 + type FfiDestroyerTimeBound struct{} 4748 + 4749 + func (_ FfiDestroyerTimeBound) Destroy(value TimeBound) { 4750 + value.Destroy() 4751 + } 4752 + 4753 + // Error getting the next item from a subscription. 4754 + type WriteError struct { 4755 + err error 4756 + } 4757 + 4758 + // Convience method to turn *WriteError into error 4759 + // Avoiding treating nil pointer as non nil error interface 4760 + func (err *WriteError) AsError() error { 4761 + if err == nil { 4762 + return nil 4763 + } else { 4764 + return err 4765 + } 4766 + } 4767 + 4768 + func (err WriteError) Error() string { 4769 + return fmt.Sprintf("WriteError: %s", err.err.Error()) 4770 + } 4771 + 4772 + func (err WriteError) Unwrap() error { 4773 + return err.err 4774 + } 4775 + 4776 + // Err* are used for checking error type with `errors.Is` 4777 + var ErrWriteErrorPrivateKeySize = fmt.Errorf("WriteErrorPrivateKeySize") 4778 + 4779 + // Variant structs 4780 + // The provided private key is invalid (not 32 bytes). 4781 + type WriteErrorPrivateKeySize struct { 4782 + Size uint64 4783 + } 4784 + 4785 + // The provided private key is invalid (not 32 bytes). 4786 + func NewWriteErrorPrivateKeySize( 4787 + size uint64, 4788 + ) *WriteError { 4789 + return &WriteError{err: &WriteErrorPrivateKeySize{ 4790 + Size: size}} 4791 + } 4792 + 4793 + func (e WriteErrorPrivateKeySize) destroy() { 4794 + FfiDestroyerUint64{}.Destroy(e.Size) 4795 + } 4796 + 4797 + func (err WriteErrorPrivateKeySize) Error() string { 4798 + return fmt.Sprint("PrivateKeySize", 4799 + ": ", 4800 + 4801 + "Size=", 4802 + err.Size, 4803 + ) 4804 + } 4805 + 4806 + func (self WriteErrorPrivateKeySize) Is(target error) bool { 4807 + return target == ErrWriteErrorPrivateKeySize 4808 + } 4809 + 4810 + type FfiConverterWriteError struct{} 4811 + 4812 + var FfiConverterWriteErrorINSTANCE = FfiConverterWriteError{} 4813 + 4814 + func (c FfiConverterWriteError) Lift(eb RustBufferI) *WriteError { 4815 + return LiftFromRustBuffer[*WriteError](c, eb) 4816 + } 4817 + 4818 + func (c FfiConverterWriteError) Lower(value *WriteError) C.RustBuffer { 4819 + return LowerIntoRustBuffer[*WriteError](c, value) 4820 + } 4821 + 4822 + func (c FfiConverterWriteError) Read(reader io.Reader) *WriteError { 4823 + errorID := readUint32(reader) 4824 + 4825 + switch errorID { 4826 + case 1: 4827 + return &WriteError{&WriteErrorPrivateKeySize{ 4828 + Size: FfiConverterUint64INSTANCE.Read(reader), 4829 + }} 4830 + default: 4831 + panic(fmt.Sprintf("Unknown error code %d in FfiConverterWriteError.Read()", errorID)) 4832 + } 4833 + } 4834 + 4835 + func (c FfiConverterWriteError) Write(writer io.Writer, value *WriteError) { 4836 + switch variantValue := value.err.(type) { 4837 + case *WriteErrorPrivateKeySize: 4838 + writeInt32(writer, 1) 4839 + FfiConverterUint64INSTANCE.Write(writer, variantValue.Size) 4840 + default: 4841 + _ = variantValue 4842 + panic(fmt.Sprintf("invalid error value `%v` in FfiConverterWriteError.Write", value)) 4843 + } 4844 + } 4845 + 4846 + type FfiDestroyerWriteError struct{} 4847 + 4848 + func (_ FfiDestroyerWriteError) Destroy(value *WriteError) { 4849 + switch variantValue := value.err.(type) { 4850 + case WriteErrorPrivateKeySize: 4851 + variantValue.destroy() 4852 + default: 4853 + _ = variantValue 4854 + panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerWriteError.Destroy", value)) 4855 + } 4856 + } 4857 + 2119 4858 type FfiConverterOptionalString struct{} 2120 4859 2121 4860 var FfiConverterOptionalStringINSTANCE = FfiConverterOptionalString{} ··· 2153 4892 } 2154 4893 } 2155 4894 4895 + type FfiConverterOptionalBytes struct{} 4896 + 4897 + var FfiConverterOptionalBytesINSTANCE = FfiConverterOptionalBytes{} 4898 + 4899 + func (c FfiConverterOptionalBytes) Lift(rb RustBufferI) *[]byte { 4900 + return LiftFromRustBuffer[*[]byte](c, rb) 4901 + } 4902 + 4903 + func (_ FfiConverterOptionalBytes) Read(reader io.Reader) *[]byte { 4904 + if readInt8(reader) == 0 { 4905 + return nil 4906 + } 4907 + temp := FfiConverterBytesINSTANCE.Read(reader) 4908 + return &temp 4909 + } 4910 + 4911 + func (c FfiConverterOptionalBytes) Lower(value *[]byte) C.RustBuffer { 4912 + return LowerIntoRustBuffer[*[]byte](c, value) 4913 + } 4914 + 4915 + func (_ FfiConverterOptionalBytes) Write(writer io.Writer, value *[]byte) { 4916 + if value == nil { 4917 + writeInt8(writer, 0) 4918 + } else { 4919 + writeInt8(writer, 1) 4920 + FfiConverterBytesINSTANCE.Write(writer, *value) 4921 + } 4922 + } 4923 + 4924 + type FfiDestroyerOptionalBytes struct{} 4925 + 4926 + func (_ FfiDestroyerOptionalBytes) Destroy(value *[]byte) { 4927 + if value != nil { 4928 + FfiDestroyerBytes{}.Destroy(*value) 4929 + } 4930 + } 4931 + 4932 + type FfiConverterOptionalSubscribeItem struct{} 4933 + 4934 + var FfiConverterOptionalSubscribeItemINSTANCE = FfiConverterOptionalSubscribeItem{} 4935 + 4936 + func (c FfiConverterOptionalSubscribeItem) Lift(rb RustBufferI) *SubscribeItem { 4937 + return LiftFromRustBuffer[*SubscribeItem](c, rb) 4938 + } 4939 + 4940 + func (_ FfiConverterOptionalSubscribeItem) Read(reader io.Reader) *SubscribeItem { 4941 + if readInt8(reader) == 0 { 4942 + return nil 4943 + } 4944 + temp := FfiConverterSubscribeItemINSTANCE.Read(reader) 4945 + return &temp 4946 + } 4947 + 4948 + func (c FfiConverterOptionalSubscribeItem) Lower(value *SubscribeItem) C.RustBuffer { 4949 + return LowerIntoRustBuffer[*SubscribeItem](c, value) 4950 + } 4951 + 4952 + func (_ FfiConverterOptionalSubscribeItem) Write(writer io.Writer, value *SubscribeItem) { 4953 + if value == nil { 4954 + writeInt8(writer, 0) 4955 + } else { 4956 + writeInt8(writer, 1) 4957 + FfiConverterSubscribeItemINSTANCE.Write(writer, *value) 4958 + } 4959 + } 4960 + 4961 + type FfiDestroyerOptionalSubscribeItem struct{} 4962 + 4963 + func (_ FfiDestroyerOptionalSubscribeItem) Destroy(value *SubscribeItem) { 4964 + if value != nil { 4965 + FfiDestroyerSubscribeItem{}.Destroy(*value) 4966 + } 4967 + } 4968 + 2156 4969 type FfiConverterSequenceString struct{} 2157 4970 2158 4971 var FfiConverterSequenceStringINSTANCE = FfiConverterSequenceString{} ··· 2196 5009 } 2197 5010 } 2198 5011 5012 + type FfiConverterSequencePublicKey struct{} 5013 + 5014 + var FfiConverterSequencePublicKeyINSTANCE = FfiConverterSequencePublicKey{} 5015 + 5016 + func (c FfiConverterSequencePublicKey) Lift(rb RustBufferI) []*PublicKey { 5017 + return LiftFromRustBuffer[[]*PublicKey](c, rb) 5018 + } 5019 + 5020 + func (c FfiConverterSequencePublicKey) Read(reader io.Reader) []*PublicKey { 5021 + length := readInt32(reader) 5022 + if length == 0 { 5023 + return nil 5024 + } 5025 + result := make([]*PublicKey, 0, length) 5026 + for i := int32(0); i < length; i++ { 5027 + result = append(result, FfiConverterPublicKeyINSTANCE.Read(reader)) 5028 + } 5029 + return result 5030 + } 5031 + 5032 + func (c FfiConverterSequencePublicKey) Lower(value []*PublicKey) C.RustBuffer { 5033 + return LowerIntoRustBuffer[[]*PublicKey](c, value) 5034 + } 5035 + 5036 + func (c FfiConverterSequencePublicKey) Write(writer io.Writer, value []*PublicKey) { 5037 + if len(value) > math.MaxInt32 { 5038 + panic("[]*PublicKey is too large to fit into Int32") 5039 + } 5040 + 5041 + writeInt32(writer, int32(len(value))) 5042 + for _, item := range value { 5043 + FfiConverterPublicKeyINSTANCE.Write(writer, item) 5044 + } 5045 + } 5046 + 5047 + type FfiDestroyerSequencePublicKey struct{} 5048 + 5049 + func (FfiDestroyerSequencePublicKey) Destroy(sequence []*PublicKey) { 5050 + for _, value := range sequence { 5051 + FfiDestroyerPublicKey{}.Destroy(value) 5052 + } 5053 + } 5054 + 5055 + type FfiConverterSequenceEntry struct{} 5056 + 5057 + var FfiConverterSequenceEntryINSTANCE = FfiConverterSequenceEntry{} 5058 + 5059 + func (c FfiConverterSequenceEntry) Lift(rb RustBufferI) []Entry { 5060 + return LiftFromRustBuffer[[]Entry](c, rb) 5061 + } 5062 + 5063 + func (c FfiConverterSequenceEntry) Read(reader io.Reader) []Entry { 5064 + length := readInt32(reader) 5065 + if length == 0 { 5066 + return nil 5067 + } 5068 + result := make([]Entry, 0, length) 5069 + for i := int32(0); i < length; i++ { 5070 + result = append(result, FfiConverterEntryINSTANCE.Read(reader)) 5071 + } 5072 + return result 5073 + } 5074 + 5075 + func (c FfiConverterSequenceEntry) Lower(value []Entry) C.RustBuffer { 5076 + return LowerIntoRustBuffer[[]Entry](c, value) 5077 + } 5078 + 5079 + func (c FfiConverterSequenceEntry) Write(writer io.Writer, value []Entry) { 5080 + if len(value) > math.MaxInt32 { 5081 + panic("[]Entry is too large to fit into Int32") 5082 + } 5083 + 5084 + writeInt32(writer, int32(len(value))) 5085 + for _, item := range value { 5086 + FfiConverterEntryINSTANCE.Write(writer, item) 5087 + } 5088 + } 5089 + 5090 + type FfiDestroyerSequenceEntry struct{} 5091 + 5092 + func (FfiDestroyerSequenceEntry) Destroy(sequence []Entry) { 5093 + for _, value := range sequence { 5094 + FfiDestroyerEntry{}.Destroy(value) 5095 + } 5096 + } 5097 + 2199 5098 const ( 2200 5099 uniffiRustFuturePollReady int8 = 0 2201 5100 uniffiRustFuturePollMaybeReady int8 = 1 ··· 2259 5158 guard <- struct{}{} 2260 5159 } 2261 5160 2262 - func GetManifestAndCert(data []byte) (string, *SpError) { 5161 + func GetManifestAndCert(data []byte) (string, error) { 2263 5162 _uniffiRV, _uniffiErr := rustCallWithError[SpError](FfiConverterSpError{}, func(_uniffiStatus *C.RustCallStatus) RustBufferI { 2264 5163 return GoRustBuffer{ 2265 5164 inner: C.uniffi_iroh_streamplace_fn_func_get_manifest_and_cert(FfiConverterBytesINSTANCE.Lower(data), _uniffiStatus), ··· 2269 5168 var _uniffiDefaultValue string 2270 5169 return _uniffiDefaultValue, _uniffiErr 2271 5170 } else { 2272 - return FfiConverterStringINSTANCE.Lift(_uniffiRV), _uniffiErr 5171 + return FfiConverterStringINSTANCE.Lift(_uniffiRV), nil 2273 5172 } 2274 5173 } 2275 5174 2276 - func Sign(manifest string, data []byte, certs []byte, gosigner GoSigner) ([]byte, *SpError) { 5175 + func Sign(manifest string, data []byte, certs []byte, gosigner GoSigner) ([]byte, error) { 2277 5176 _uniffiRV, _uniffiErr := rustCallWithError[SpError](FfiConverterSpError{}, func(_uniffiStatus *C.RustCallStatus) RustBufferI { 2278 5177 return GoRustBuffer{ 2279 5178 inner: C.uniffi_iroh_streamplace_fn_func_sign(FfiConverterStringINSTANCE.Lower(manifest), FfiConverterBytesINSTANCE.Lower(data), FfiConverterBytesINSTANCE.Lower(certs), FfiConverterGoSignerINSTANCE.Lower(gosigner), _uniffiStatus), ··· 2283 5182 var _uniffiDefaultValue []byte 2284 5183 return _uniffiDefaultValue, _uniffiErr 2285 5184 } else { 2286 - return FfiConverterBytesINSTANCE.Lift(_uniffiRV), _uniffiErr 5185 + return FfiConverterBytesINSTANCE.Lift(_uniffiRV), nil 2287 5186 } 2288 5187 } 5188 + 5189 + func SubscribeItemDebug(item SubscribeItem) string { 5190 + return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI { 5191 + return GoRustBuffer{ 5192 + inner: C.uniffi_iroh_streamplace_fn_func_subscribe_item_debug(FfiConverterSubscribeItemINSTANCE.Lower(item), _uniffiStatus), 5193 + } 5194 + })) 5195 + }
+470 -8
pkg/iroh/generated/iroh_streamplace/iroh_streamplace.h
··· 392 392 393 393 394 394 #endif 395 + #ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_DATA_HANDLER_OLD_METHOD0 396 + #define UNIFFI_FFIDEF_CALLBACK_INTERFACE_DATA_HANDLER_OLD_METHOD0 397 + typedef void (*UniffiCallbackInterfaceDataHandlerOldMethod0)(uint64_t uniffi_handle, RustBuffer topic, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return); 398 + 399 + // Making function static works arround: 400 + // https://github.com/golang/go/issues/11263 401 + static void call_UniffiCallbackInterfaceDataHandlerOldMethod0( 402 + UniffiCallbackInterfaceDataHandlerOldMethod0 cb, uint64_t uniffi_handle, RustBuffer topic, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return) 403 + { 404 + return cb(uniffi_handle, topic, data, uniffi_future_callback, uniffi_callback_data, uniffi_out_return); 405 + } 406 + 407 + 408 + #endif 395 409 #ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_GO_SIGNER_METHOD0 396 410 #define UNIFFI_FFIDEF_CALLBACK_INTERFACE_GO_SIGNER_METHOD0 397 411 typedef void (*UniffiCallbackInterfaceGoSignerMethod0)(uint64_t uniffi_handle, RustBuffer data, RustBuffer* uniffi_out_return, RustCallStatus* callStatus ); ··· 414 428 } UniffiVTableCallbackInterfaceDataHandler; 415 429 416 430 #endif 431 + #ifndef UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_DATA_HANDLER_OLD 432 + #define UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_DATA_HANDLER_OLD 433 + typedef struct UniffiVTableCallbackInterfaceDataHandlerOld { 434 + UniffiCallbackInterfaceDataHandlerOldMethod0 handleData; 435 + UniffiCallbackInterfaceFree uniffiFree; 436 + } UniffiVTableCallbackInterfaceDataHandlerOld; 437 + 438 + #endif 417 439 #ifndef UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_GO_SIGNER 418 440 #define UNIFFI_FFIDEF_V_TABLE_CALLBACK_INTERFACE_GO_SIGNER 419 441 typedef struct UniffiVTableCallbackInterfaceGoSigner { ··· 442 464 uint64_t uniffi_iroh_streamplace_fn_method_datahandler_handle_data(void* ptr, RustBuffer topic, RustBuffer data 443 465 ); 444 466 #endif 467 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_DATAHANDLEROLD 468 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_DATAHANDLEROLD 469 + void* uniffi_iroh_streamplace_fn_clone_datahandlerold(void* ptr, RustCallStatus *out_status 470 + ); 471 + #endif 472 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_DATAHANDLEROLD 473 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_DATAHANDLEROLD 474 + void uniffi_iroh_streamplace_fn_free_datahandlerold(void* ptr, RustCallStatus *out_status 475 + ); 476 + #endif 477 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_INIT_CALLBACK_VTABLE_DATAHANDLEROLD 478 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_INIT_CALLBACK_VTABLE_DATAHANDLEROLD 479 + void uniffi_iroh_streamplace_fn_init_callback_vtable_datahandlerold(UniffiVTableCallbackInterfaceDataHandlerOld* vtable 480 + ); 481 + #endif 482 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DATAHANDLEROLD_HANDLE_DATA 483 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DATAHANDLEROLD_HANDLE_DATA 484 + uint64_t uniffi_iroh_streamplace_fn_method_datahandlerold_handle_data(void* ptr, RustBuffer topic, RustBuffer data 485 + ); 486 + #endif 487 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_DB 488 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_DB 489 + void* uniffi_iroh_streamplace_fn_clone_db(void* ptr, RustCallStatus *out_status 490 + ); 491 + #endif 492 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_DB 493 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_DB 494 + void uniffi_iroh_streamplace_fn_free_db(void* ptr, RustCallStatus *out_status 495 + ); 496 + #endif 497 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_ITER_WITH_OPTS 498 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_ITER_WITH_OPTS 499 + uint64_t uniffi_iroh_streamplace_fn_method_db_iter_with_opts(void* ptr, void* filter 500 + ); 501 + #endif 502 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_SUBSCRIBE 503 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_SUBSCRIBE 504 + void* uniffi_iroh_streamplace_fn_method_db_subscribe(void* ptr, void* filter, RustCallStatus *out_status 505 + ); 506 + #endif 507 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_SUBSCRIBE_WITH_OPTS 508 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_SUBSCRIBE_WITH_OPTS 509 + void* uniffi_iroh_streamplace_fn_method_db_subscribe_with_opts(void* ptr, RustBuffer opts, RustCallStatus *out_status 510 + ); 511 + #endif 512 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_WRITE 513 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DB_WRITE 514 + void* uniffi_iroh_streamplace_fn_method_db_write(void* ptr, RustBuffer secret, RustCallStatus *out_status 515 + ); 516 + #endif 445 517 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_ENDPOINT 446 518 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_ENDPOINT 447 519 void* uniffi_iroh_streamplace_fn_clone_endpoint(void* ptr, RustCallStatus *out_status ··· 463 535 uint64_t uniffi_iroh_streamplace_fn_method_endpoint_node_addr(void* ptr 464 536 ); 465 537 #endif 538 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_FILTER 539 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_FILTER 540 + void* uniffi_iroh_streamplace_fn_clone_filter(void* ptr, RustCallStatus *out_status 541 + ); 542 + #endif 543 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_FILTER 544 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_FILTER 545 + void uniffi_iroh_streamplace_fn_free_filter(void* ptr, RustCallStatus *out_status 546 + ); 547 + #endif 548 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_FILTER_NEW 549 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_FILTER_NEW 550 + void* uniffi_iroh_streamplace_fn_constructor_filter_new(RustCallStatus *out_status 551 + 552 + ); 553 + #endif 554 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_GLOBAL 555 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_GLOBAL 556 + void* uniffi_iroh_streamplace_fn_method_filter_global(void* ptr, RustCallStatus *out_status 557 + ); 558 + #endif 559 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_SCOPE 560 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_SCOPE 561 + void* uniffi_iroh_streamplace_fn_method_filter_scope(void* ptr, void* scope, RustCallStatus *out_status 562 + ); 563 + #endif 564 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_SCOPES 565 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_SCOPES 566 + void* uniffi_iroh_streamplace_fn_method_filter_scopes(void* ptr, RustBuffer scopes, RustCallStatus *out_status 567 + ); 568 + #endif 569 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_STREAM 570 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_STREAM 571 + void* uniffi_iroh_streamplace_fn_method_filter_stream(void* ptr, RustBuffer stream, RustCallStatus *out_status 572 + ); 573 + #endif 574 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_TIME_FROM 575 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_TIME_FROM 576 + void* uniffi_iroh_streamplace_fn_method_filter_time_from(void* ptr, uint64_t min, RustCallStatus *out_status 577 + ); 578 + #endif 579 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_TIME_RANGE 580 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_TIME_RANGE 581 + void* uniffi_iroh_streamplace_fn_method_filter_time_range(void* ptr, uint64_t min, uint64_t max, RustCallStatus *out_status 582 + ); 583 + #endif 584 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_TIMESTAMPS 585 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_FILTER_TIMESTAMPS 586 + void* uniffi_iroh_streamplace_fn_method_filter_timestamps(void* ptr, RustBuffer min, RustBuffer max, RustCallStatus *out_status 587 + ); 588 + #endif 466 589 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_GOSIGNER 467 590 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_GOSIGNER 468 591 void* uniffi_iroh_streamplace_fn_clone_gosigner(void* ptr, RustCallStatus *out_status ··· 483 606 RustBuffer uniffi_iroh_streamplace_fn_method_gosigner_sign(void* ptr, RustBuffer data, RustCallStatus *out_status 484 607 ); 485 608 #endif 609 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_NODE 610 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_NODE 611 + void* uniffi_iroh_streamplace_fn_clone_node(void* ptr, RustCallStatus *out_status 612 + ); 613 + #endif 614 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_NODE 615 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_NODE 616 + void uniffi_iroh_streamplace_fn_free_node(void* ptr, RustCallStatus *out_status 617 + ); 618 + #endif 619 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODE_FORWARDER 620 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODE_FORWARDER 621 + uint64_t uniffi_iroh_streamplace_fn_constructor_node_forwarder(RustBuffer config 622 + ); 623 + #endif 624 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODE_RECEIVER 625 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODE_RECEIVER 626 + uint64_t uniffi_iroh_streamplace_fn_constructor_node_receiver(RustBuffer config, void* handler 627 + ); 628 + #endif 629 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODE_SENDER 630 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_NODE_SENDER 631 + uint64_t uniffi_iroh_streamplace_fn_constructor_node_sender(RustBuffer config 632 + ); 633 + #endif 634 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_DB 635 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_DB 636 + void* uniffi_iroh_streamplace_fn_method_node_db(void* ptr, RustCallStatus *out_status 637 + ); 638 + #endif 639 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_JOIN_PEERS 640 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_JOIN_PEERS 641 + uint64_t uniffi_iroh_streamplace_fn_method_node_join_peers(void* ptr, RustBuffer peers 642 + ); 643 + #endif 644 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_NODE_ID 645 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_NODE_ID 646 + uint64_t uniffi_iroh_streamplace_fn_method_node_node_id(void* ptr 647 + ); 648 + #endif 649 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_NODE_SCOPE 650 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_NODE_SCOPE 651 + void* uniffi_iroh_streamplace_fn_method_node_node_scope(void* ptr, RustCallStatus *out_status 652 + ); 653 + #endif 654 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_SEND_SEGMENT 655 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_SEND_SEGMENT 656 + uint64_t uniffi_iroh_streamplace_fn_method_node_send_segment(void* ptr, RustBuffer key, RustBuffer data 657 + ); 658 + #endif 659 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_SUBSCRIBE 660 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_SUBSCRIBE 661 + uint64_t uniffi_iroh_streamplace_fn_method_node_subscribe(void* ptr, RustBuffer key, void* remote_id 662 + ); 663 + #endif 664 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_TICKET 665 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_TICKET 666 + uint64_t uniffi_iroh_streamplace_fn_method_node_ticket(void* ptr 667 + ); 668 + #endif 669 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_UNSUBSCRIBE 670 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_NODE_UNSUBSCRIBE 671 + uint64_t uniffi_iroh_streamplace_fn_method_node_unsubscribe(void* ptr, RustBuffer key, void* remote_id 672 + ); 673 + #endif 486 674 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_NODEADDR 487 675 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_NODEADDR 488 676 void* uniffi_iroh_streamplace_fn_clone_nodeaddr(void* ptr, RustCallStatus *out_status ··· 538 726 void* uniffi_iroh_streamplace_fn_constructor_publickey_from_string(RustBuffer s, RustCallStatus *out_status 539 727 ); 540 728 #endif 729 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_AS_VEC 730 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_AS_VEC 731 + RustBuffer uniffi_iroh_streamplace_fn_method_publickey_as_vec(void* ptr, RustCallStatus *out_status 732 + ); 733 + #endif 541 734 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_EQUAL 542 735 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_EQUAL 543 736 int8_t uniffi_iroh_streamplace_fn_method_publickey_equal(void* ptr, void* other, RustCallStatus *out_status ··· 548 741 RustBuffer uniffi_iroh_streamplace_fn_method_publickey_fmt_short(void* ptr, RustCallStatus *out_status 549 742 ); 550 743 #endif 551 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_TO_BYTES 552 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_TO_BYTES 553 - RustBuffer uniffi_iroh_streamplace_fn_method_publickey_to_bytes(void* ptr, RustCallStatus *out_status 554 - ); 555 - #endif 556 744 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_UNIFFI_TRAIT_DISPLAY 557 745 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEY_UNIFFI_TRAIT_DISPLAY 558 746 RustBuffer uniffi_iroh_streamplace_fn_method_publickey_uniffi_trait_display(void* ptr, RustCallStatus *out_status 559 747 ); 560 748 #endif 749 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_PUBLICKEYOLD 750 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_PUBLICKEYOLD 751 + void* uniffi_iroh_streamplace_fn_clone_publickeyold(void* ptr, RustCallStatus *out_status 752 + ); 753 + #endif 754 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_PUBLICKEYOLD 755 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_PUBLICKEYOLD 756 + void uniffi_iroh_streamplace_fn_free_publickeyold(void* ptr, RustCallStatus *out_status 757 + ); 758 + #endif 759 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEYOLD_FROM_BYTES 760 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEYOLD_FROM_BYTES 761 + void* uniffi_iroh_streamplace_fn_constructor_publickeyold_from_bytes(RustBuffer bytes, RustCallStatus *out_status 762 + ); 763 + #endif 764 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEYOLD_FROM_STRING 765 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CONSTRUCTOR_PUBLICKEYOLD_FROM_STRING 766 + void* uniffi_iroh_streamplace_fn_constructor_publickeyold_from_string(RustBuffer s, RustCallStatus *out_status 767 + ); 768 + #endif 769 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_EQUAL 770 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_EQUAL 771 + int8_t uniffi_iroh_streamplace_fn_method_publickeyold_equal(void* ptr, void* other, RustCallStatus *out_status 772 + ); 773 + #endif 774 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_FMT_SHORT 775 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_FMT_SHORT 776 + RustBuffer uniffi_iroh_streamplace_fn_method_publickeyold_fmt_short(void* ptr, RustCallStatus *out_status 777 + ); 778 + #endif 779 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_TO_BYTES 780 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_TO_BYTES 781 + RustBuffer uniffi_iroh_streamplace_fn_method_publickeyold_to_bytes(void* ptr, RustCallStatus *out_status 782 + ); 783 + #endif 784 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_UNIFFI_TRAIT_DISPLAY 785 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_PUBLICKEYOLD_UNIFFI_TRAIT_DISPLAY 786 + RustBuffer uniffi_iroh_streamplace_fn_method_publickeyold_uniffi_trait_display(void* ptr, RustCallStatus *out_status 787 + ); 788 + #endif 561 789 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_RECEIVER 562 790 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_RECEIVER 563 791 void* uniffi_iroh_streamplace_fn_clone_receiver(void* ptr, RustCallStatus *out_status ··· 613 841 uint64_t uniffi_iroh_streamplace_fn_method_sender_send(void* ptr, RustBuffer key, RustBuffer data 614 842 ); 615 843 #endif 844 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_SUBSCRIBERESPONSE 845 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_SUBSCRIBERESPONSE 846 + void* uniffi_iroh_streamplace_fn_clone_subscriberesponse(void* ptr, RustCallStatus *out_status 847 + ); 848 + #endif 849 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_SUBSCRIBERESPONSE 850 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_SUBSCRIBERESPONSE 851 + void uniffi_iroh_streamplace_fn_free_subscriberesponse(void* ptr, RustCallStatus *out_status 852 + ); 853 + #endif 854 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SUBSCRIBERESPONSE_NEXT_RAW 855 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SUBSCRIBERESPONSE_NEXT_RAW 856 + uint64_t uniffi_iroh_streamplace_fn_method_subscriberesponse_next_raw(void* ptr 857 + ); 858 + #endif 859 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SUBSCRIBERESPONSE_UNIFFI_TRAIT_DEBUG 860 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SUBSCRIBERESPONSE_UNIFFI_TRAIT_DEBUG 861 + RustBuffer uniffi_iroh_streamplace_fn_method_subscriberesponse_uniffi_trait_debug(void* ptr, RustCallStatus *out_status 862 + ); 863 + #endif 864 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_WRITESCOPE 865 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_WRITESCOPE 866 + void* uniffi_iroh_streamplace_fn_clone_writescope(void* ptr, RustCallStatus *out_status 867 + ); 868 + #endif 869 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_WRITESCOPE 870 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FREE_WRITESCOPE 871 + void uniffi_iroh_streamplace_fn_free_writescope(void* ptr, RustCallStatus *out_status 872 + ); 873 + #endif 874 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_WRITESCOPE_PUT 875 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_WRITESCOPE_PUT 876 + uint64_t uniffi_iroh_streamplace_fn_method_writescope_put(void* ptr, RustBuffer stream, RustBuffer key, RustBuffer value 877 + ); 878 + #endif 616 879 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FUNC_GET_MANIFEST_AND_CERT 617 880 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FUNC_GET_MANIFEST_AND_CERT 618 881 RustBuffer uniffi_iroh_streamplace_fn_func_get_manifest_and_cert(RustBuffer data, RustCallStatus *out_status ··· 621 884 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FUNC_SIGN 622 885 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FUNC_SIGN 623 886 RustBuffer uniffi_iroh_streamplace_fn_func_sign(RustBuffer manifest, RustBuffer data, RustBuffer certs, void* gosigner, RustCallStatus *out_status 887 + ); 888 + #endif 889 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FUNC_SUBSCRIBE_ITEM_DEBUG 890 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_FUNC_SUBSCRIBE_ITEM_DEBUG 891 + RustBuffer uniffi_iroh_streamplace_fn_func_subscribe_item_debug(RustBuffer item, RustCallStatus *out_status 624 892 ); 625 893 #endif 626 894 #ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_ALLOC ··· 915 1183 916 1184 ); 917 1185 #endif 1186 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_FUNC_SUBSCRIBE_ITEM_DEBUG 1187 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_FUNC_SUBSCRIBE_ITEM_DEBUG 1188 + uint16_t uniffi_iroh_streamplace_checksum_func_subscribe_item_debug(void 1189 + 1190 + ); 1191 + #endif 918 1192 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DATAHANDLER_HANDLE_DATA 919 1193 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DATAHANDLER_HANDLE_DATA 920 1194 uint16_t uniffi_iroh_streamplace_checksum_method_datahandler_handle_data(void 921 1195 922 1196 ); 923 1197 #endif 1198 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DATAHANDLEROLD_HANDLE_DATA 1199 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DATAHANDLEROLD_HANDLE_DATA 1200 + uint16_t uniffi_iroh_streamplace_checksum_method_datahandlerold_handle_data(void 1201 + 1202 + ); 1203 + #endif 1204 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_ITER_WITH_OPTS 1205 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_ITER_WITH_OPTS 1206 + uint16_t uniffi_iroh_streamplace_checksum_method_db_iter_with_opts(void 1207 + 1208 + ); 1209 + #endif 1210 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_SUBSCRIBE 1211 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_SUBSCRIBE 1212 + uint16_t uniffi_iroh_streamplace_checksum_method_db_subscribe(void 1213 + 1214 + ); 1215 + #endif 1216 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_SUBSCRIBE_WITH_OPTS 1217 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_SUBSCRIBE_WITH_OPTS 1218 + uint16_t uniffi_iroh_streamplace_checksum_method_db_subscribe_with_opts(void 1219 + 1220 + ); 1221 + #endif 1222 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_WRITE 1223 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_DB_WRITE 1224 + uint16_t uniffi_iroh_streamplace_checksum_method_db_write(void 1225 + 1226 + ); 1227 + #endif 924 1228 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_ENDPOINT_NODE_ADDR 925 1229 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_ENDPOINT_NODE_ADDR 926 1230 uint16_t uniffi_iroh_streamplace_checksum_method_endpoint_node_addr(void 927 1231 928 1232 ); 929 1233 #endif 1234 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_GLOBAL 1235 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_GLOBAL 1236 + uint16_t uniffi_iroh_streamplace_checksum_method_filter_global(void 1237 + 1238 + ); 1239 + #endif 1240 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_SCOPE 1241 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_SCOPE 1242 + uint16_t uniffi_iroh_streamplace_checksum_method_filter_scope(void 1243 + 1244 + ); 1245 + #endif 1246 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_SCOPES 1247 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_SCOPES 1248 + uint16_t uniffi_iroh_streamplace_checksum_method_filter_scopes(void 1249 + 1250 + ); 1251 + #endif 1252 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_STREAM 1253 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_STREAM 1254 + uint16_t uniffi_iroh_streamplace_checksum_method_filter_stream(void 1255 + 1256 + ); 1257 + #endif 1258 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_TIME_FROM 1259 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_TIME_FROM 1260 + uint16_t uniffi_iroh_streamplace_checksum_method_filter_time_from(void 1261 + 1262 + ); 1263 + #endif 1264 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_TIME_RANGE 1265 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_TIME_RANGE 1266 + uint16_t uniffi_iroh_streamplace_checksum_method_filter_time_range(void 1267 + 1268 + ); 1269 + #endif 1270 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_TIMESTAMPS 1271 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_FILTER_TIMESTAMPS 1272 + uint16_t uniffi_iroh_streamplace_checksum_method_filter_timestamps(void 1273 + 1274 + ); 1275 + #endif 930 1276 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_GOSIGNER_SIGN 931 1277 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_GOSIGNER_SIGN 932 1278 uint16_t uniffi_iroh_streamplace_checksum_method_gosigner_sign(void 933 1279 934 1280 ); 935 1281 #endif 1282 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_DB 1283 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_DB 1284 + uint16_t uniffi_iroh_streamplace_checksum_method_node_db(void 1285 + 1286 + ); 1287 + #endif 1288 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_JOIN_PEERS 1289 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_JOIN_PEERS 1290 + uint16_t uniffi_iroh_streamplace_checksum_method_node_join_peers(void 1291 + 1292 + ); 1293 + #endif 1294 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_NODE_ID 1295 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_NODE_ID 1296 + uint16_t uniffi_iroh_streamplace_checksum_method_node_node_id(void 1297 + 1298 + ); 1299 + #endif 1300 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_NODE_SCOPE 1301 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_NODE_SCOPE 1302 + uint16_t uniffi_iroh_streamplace_checksum_method_node_node_scope(void 1303 + 1304 + ); 1305 + #endif 1306 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_SEND_SEGMENT 1307 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_SEND_SEGMENT 1308 + uint16_t uniffi_iroh_streamplace_checksum_method_node_send_segment(void 1309 + 1310 + ); 1311 + #endif 1312 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_SUBSCRIBE 1313 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_SUBSCRIBE 1314 + uint16_t uniffi_iroh_streamplace_checksum_method_node_subscribe(void 1315 + 1316 + ); 1317 + #endif 1318 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_TICKET 1319 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_TICKET 1320 + uint16_t uniffi_iroh_streamplace_checksum_method_node_ticket(void 1321 + 1322 + ); 1323 + #endif 1324 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_UNSUBSCRIBE 1325 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODE_UNSUBSCRIBE 1326 + uint16_t uniffi_iroh_streamplace_checksum_method_node_unsubscribe(void 1327 + 1328 + ); 1329 + #endif 936 1330 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_DIRECT_ADDRESSES 937 1331 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_NODEADDR_DIRECT_ADDRESSES 938 1332 uint16_t uniffi_iroh_streamplace_checksum_method_nodeaddr_direct_addresses(void ··· 957 1351 958 1352 ); 959 1353 #endif 1354 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_AS_VEC 1355 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_AS_VEC 1356 + uint16_t uniffi_iroh_streamplace_checksum_method_publickey_as_vec(void 1357 + 1358 + ); 1359 + #endif 960 1360 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_EQUAL 961 1361 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_EQUAL 962 1362 uint16_t uniffi_iroh_streamplace_checksum_method_publickey_equal(void ··· 969 1369 970 1370 ); 971 1371 #endif 972 - #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_TO_BYTES 973 - #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEY_TO_BYTES 974 - uint16_t uniffi_iroh_streamplace_checksum_method_publickey_to_bytes(void 1372 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEYOLD_EQUAL 1373 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEYOLD_EQUAL 1374 + uint16_t uniffi_iroh_streamplace_checksum_method_publickeyold_equal(void 1375 + 1376 + ); 1377 + #endif 1378 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEYOLD_FMT_SHORT 1379 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEYOLD_FMT_SHORT 1380 + uint16_t uniffi_iroh_streamplace_checksum_method_publickeyold_fmt_short(void 1381 + 1382 + ); 1383 + #endif 1384 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEYOLD_TO_BYTES 1385 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_PUBLICKEYOLD_TO_BYTES 1386 + uint16_t uniffi_iroh_streamplace_checksum_method_publickeyold_to_bytes(void 975 1387 976 1388 ); 977 1389 #endif ··· 1005 1417 1006 1418 ); 1007 1419 #endif 1420 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SUBSCRIBERESPONSE_NEXT_RAW 1421 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SUBSCRIBERESPONSE_NEXT_RAW 1422 + uint16_t uniffi_iroh_streamplace_checksum_method_subscriberesponse_next_raw(void 1423 + 1424 + ); 1425 + #endif 1426 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_WRITESCOPE_PUT 1427 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_WRITESCOPE_PUT 1428 + uint16_t uniffi_iroh_streamplace_checksum_method_writescope_put(void 1429 + 1430 + ); 1431 + #endif 1008 1432 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_ENDPOINT_NEW 1009 1433 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_ENDPOINT_NEW 1010 1434 uint16_t uniffi_iroh_streamplace_checksum_constructor_endpoint_new(void 1011 1435 1012 1436 ); 1013 1437 #endif 1438 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_FILTER_NEW 1439 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_FILTER_NEW 1440 + uint16_t uniffi_iroh_streamplace_checksum_constructor_filter_new(void 1441 + 1442 + ); 1443 + #endif 1444 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODE_FORWARDER 1445 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODE_FORWARDER 1446 + uint16_t uniffi_iroh_streamplace_checksum_constructor_node_forwarder(void 1447 + 1448 + ); 1449 + #endif 1450 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODE_RECEIVER 1451 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODE_RECEIVER 1452 + uint16_t uniffi_iroh_streamplace_checksum_constructor_node_receiver(void 1453 + 1454 + ); 1455 + #endif 1456 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODE_SENDER 1457 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODE_SENDER 1458 + uint16_t uniffi_iroh_streamplace_checksum_constructor_node_sender(void 1459 + 1460 + ); 1461 + #endif 1014 1462 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODEADDR_NEW 1015 1463 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_NODEADDR_NEW 1016 1464 uint16_t uniffi_iroh_streamplace_checksum_constructor_nodeaddr_new(void ··· 1029 1477 1030 1478 ); 1031 1479 #endif 1480 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEYOLD_FROM_BYTES 1481 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEYOLD_FROM_BYTES 1482 + uint16_t uniffi_iroh_streamplace_checksum_constructor_publickeyold_from_bytes(void 1483 + 1484 + ); 1485 + #endif 1486 + #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEYOLD_FROM_STRING 1487 + #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_PUBLICKEYOLD_FROM_STRING 1488 + uint16_t uniffi_iroh_streamplace_checksum_constructor_publickeyold_from_string(void 1489 + 1490 + ); 1491 + #endif 1032 1492 #ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_RECEIVER_NEW 1033 1493 #define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_CONSTRUCTOR_RECEIVER_NEW 1034 1494 uint16_t uniffi_iroh_streamplace_checksum_constructor_receiver_new(void ··· 1050 1510 1051 1511 void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0(uint64_t uniffi_handle, RustBuffer topic, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return); 1052 1512 void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerFree(uint64_t handle); 1513 + void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldMethod0(uint64_t uniffi_handle, RustBuffer topic, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return); 1514 + void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerOldFree(uint64_t handle); 1053 1515 void iroh_streamplace_cgo_dispatchCallbackInterfaceGoSignerMethod0(uint64_t uniffi_handle, RustBuffer data, RustBuffer* uniffi_out_return, RustCallStatus* callStatus ); 1054 1516 void iroh_streamplace_cgo_dispatchCallbackInterfaceGoSignerFree(uint64_t handle); 1055 1517
+1 -1
rust/iroh-streamplace/src/endpoint.rs
··· 1 1 use iroh::Watcher; 2 2 3 - use crate::{error::Error, utils::NodeAddr}; 3 + use crate::{error::Error, node_addr::NodeAddr}; 4 4 5 5 #[derive(uniffi::Object, Debug, Clone)] 6 6 pub struct Endpoint {
-7
rust/iroh-streamplace/src/error.rs
··· 5 5 pub enum Error { 6 6 #[snafu(display("Bind failure"), context(false))] 7 7 IrohBind { source: iroh::endpoint::BindError }, 8 - #[snafu(display("Invalid URL"), context(false))] 9 - InvalidUrl { source: url::ParseError }, 10 8 #[snafu(display("Failed to connect"), context(false))] 11 9 IrohConnect { 12 10 source: iroh::endpoint::ConnectError, 13 11 }, 14 - #[snafu(display("Invalid network address"), context(false))] 15 - InvalidNetworkAddress { source: std::net::AddrParseError }, 16 - #[snafu(display("No connection available"))] 17 12 MissingConnection, 18 - #[snafu(display("Invalid public key"))] 19 - InvalidPublicKey, 20 13 #[snafu(display("RPC error"), context(false))] 21 14 Irpc { source: irpc::Error }, 22 15 }
-108
rust/iroh-streamplace/src/key.rs
··· 1 - use std::str::FromStr; 2 - 3 - use crate::error::{Error, InvalidPublicKeySnafu}; 4 - 5 - /// A public key. 6 - /// 7 - /// The key itself is just a 32 byte array, but a key has associated crypto 8 - /// information that is cached for performance reasons. 9 - #[derive(Debug, Clone, Eq, uniffi::Object)] 10 - #[uniffi::export(Display)] 11 - pub struct PublicKeyOld { 12 - pub(crate) key: [u8; 32], 13 - } 14 - 15 - impl From<iroh::PublicKey> for PublicKeyOld { 16 - fn from(key: iroh::PublicKey) -> Self { 17 - PublicKeyOld { 18 - key: *key.as_bytes(), 19 - } 20 - } 21 - } 22 - impl From<&PublicKeyOld> for iroh::PublicKey { 23 - fn from(key: &PublicKeyOld) -> Self { 24 - iroh::PublicKey::from_bytes(&key.key).unwrap() 25 - } 26 - } 27 - 28 - #[uniffi::export] 29 - impl PublicKeyOld { 30 - /// Returns true if the PublicKeys are equal 31 - pub fn equal(&self, other: &PublicKeyOld) -> bool { 32 - *self == *other 33 - } 34 - 35 - /// Express the PublicKey as a byte array 36 - pub fn to_bytes(&self) -> Vec<u8> { 37 - self.key.to_vec() 38 - } 39 - 40 - /// Make a PublicKey from base32 string 41 - #[uniffi::constructor] 42 - pub fn from_string(s: String) -> Result<Self, Error> { 43 - let key = iroh::PublicKey::from_str(&s).map_err(|_| InvalidPublicKeySnafu.build())?; 44 - Ok(key.into()) 45 - } 46 - 47 - /// Make a PublicKey from byte array 48 - #[uniffi::constructor] 49 - pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, Error> { 50 - if bytes.len() != 32 { 51 - InvalidPublicKeySnafu.fail()?; 52 - } 53 - let bytes: [u8; 32] = bytes.try_into().expect("checked above"); 54 - let key = iroh::PublicKey::from_bytes(&bytes).map_err(|_| InvalidPublicKeySnafu.build())?; 55 - Ok(key.into()) 56 - } 57 - 58 - /// Convert to a base32 string limited to the first 10 bytes for a friendly string 59 - /// representation of the key. 60 - pub fn fmt_short(&self) -> String { 61 - iroh::PublicKey::from(self).fmt_short() 62 - } 63 - } 64 - 65 - impl PartialEq for PublicKeyOld { 66 - fn eq(&self, other: &PublicKeyOld) -> bool { 67 - self.key == other.key 68 - } 69 - } 70 - 71 - impl std::fmt::Display for PublicKeyOld { 72 - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 73 - iroh::PublicKey::from(self).fmt(f) 74 - } 75 - } 76 - 77 - #[cfg(test)] 78 - mod tests { 79 - use super::*; 80 - 81 - #[test] 82 - fn test_public_key() { 83 - let key_str = 84 - String::from("523c7996bad77424e96786cf7a7205115337a5b4565cd25506a0f297b191a5ea"); 85 - let fmt_str = String::from("523c7996ba"); 86 - let bytes = b"\x52\x3c\x79\x96\xba\xd7\x74\x24\xe9\x67\x86\xcf\x7a\x72\x05\x11\x53\x37\xa5\xb4\x56\x5c\xd2\x55\x06\xa0\xf2\x97\xb1\x91\xa5\xea"; 87 - // 88 - // create key from string 89 - let key = PublicKeyOld::from_string(key_str.clone()).unwrap(); 90 - // 91 - // test methods are as expected 92 - assert_eq!(key_str, key.to_string()); 93 - assert_eq!(bytes.to_vec(), key.to_bytes()); 94 - assert_eq!(fmt_str, key.fmt_short()); 95 - // 96 - // create key from bytes 97 - let key_0 = PublicKeyOld::from_bytes(bytes.to_vec()).unwrap(); 98 - // 99 - // test methods are as expected 100 - assert_eq!(key_str, key_0.to_string()); 101 - assert_eq!(bytes.to_vec(), key_0.to_bytes()); 102 - assert_eq!(fmt_str, key_0.fmt_short()); 103 - // 104 - // test that the eq function works 105 - assert!(key.equal(&key_0)); 106 - assert!(key_0.equal(&key)); 107 - } 108 - }
+2 -2
rust/iroh-streamplace/src/lib.rs
··· 3 3 pub mod c2pa; 4 4 pub mod endpoint; 5 5 pub mod error; 6 - pub mod key; 6 + pub mod public_key; 7 7 pub mod node; 8 8 pub mod receiver; 9 9 pub mod sender; 10 - pub mod utils; 10 + pub mod node_addr; 11 11 12 12 mod api;
+3 -3
rust/iroh-streamplace/src/node/db.rs
··· 12 12 use snafu::Snafu; 13 13 use tokio::sync::Mutex; 14 14 15 + use crate::public_key::PublicKey; 16 + 15 17 use super::db; 16 18 17 19 // the files here are just copied from iroh-smol-kv-uniffi/src/code 18 20 mod kv { 19 - mod public_key; 20 - pub use public_key::PublicKey; 21 21 mod time_bound; 22 22 pub use time_bound::TimeBound; 23 23 mod subscribe_mode; 24 24 pub use subscribe_mode::SubscribeMode; 25 25 } 26 26 use db::util::format_bytes; 27 - pub use kv::{PublicKey, SubscribeMode, TimeBound}; 27 + pub use kv::{SubscribeMode, TimeBound}; 28 28 29 29 /// Error creating a new database node. 30 30 #[derive(Debug, Snafu, uniffi::Error)]
rust/iroh-streamplace/src/node/db/kv/public_key.rs rust/iroh-streamplace/src/public_key.rs
+3 -3
rust/iroh-streamplace/src/node/streams.rs
··· 644 644 pub async fn subscribe( 645 645 &self, 646 646 key: String, 647 - remote_id: Arc<super::PublicKey>, 647 + remote_id: Arc<crate::public_key::PublicKey>, 648 648 ) -> Result<(), PutError> { 649 649 self.api 650 650 .rpc(api::Subscribe { ··· 661 661 pub async fn unsubscribe( 662 662 &self, 663 663 key: String, 664 - remote_id: Arc<super::PublicKey>, 664 + remote_id: Arc<crate::public_key::PublicKey>, 665 665 ) -> Result<(), PutError> { 666 666 self.api 667 667 .rpc(api::Unsubscribe { ··· 721 721 } 722 722 723 723 /// Get this node's node ID. 724 - pub async fn node_id(&self) -> Result<Arc<super::PublicKey>, PutError> { 724 + pub async fn node_id(&self) -> Result<Arc<crate::public_key::PublicKey>, PutError> { 725 725 let addr = self 726 726 .api 727 727 .rpc(api::GetNodeAddr)
+1 -1
rust/iroh-streamplace/src/node/tests.rs
··· 8 8 9 9 struct TestNode { 10 10 node: Arc<Node>, 11 - public: Arc<PublicKey>, 11 + public: Arc<crate::public_key::PublicKey>, 12 12 ticket: String, 13 13 #[allow(dead_code)] 14 14 private: Vec<u8>,
+3 -3
rust/iroh-streamplace/src/receiver.rs
··· 2 2 3 3 use iroh::protocol::Router; 4 4 5 - use crate::{api::Api, endpoint::Endpoint, error::Error, key::PublicKeyOld, utils::NodeAddr}; 5 + use crate::{api::Api, endpoint::Endpoint, error::Error, public_key::PublicKey, node_addr::NodeAddr}; 6 6 7 7 #[derive(uniffi::Object)] 8 8 pub struct Receiver { ··· 38 38 39 39 /// Subscribe to the given topic on the remote. 40 40 #[uniffi::method(async_runtime = "tokio")] 41 - pub async fn subscribe(&self, remote_id: Arc<PublicKeyOld>, topic: &str) -> Result<(), Error> { 41 + pub async fn subscribe(&self, remote_id: Arc<PublicKey>, topic: &str) -> Result<(), Error> { 42 42 let remote_id: iroh::NodeId = remote_id.as_ref().into(); 43 43 let api = Api::connect(self.endpoint.endpoint.clone(), remote_id); 44 44 api.subscribe(topic.to_string(), self.endpoint.endpoint.node_id()) ··· 50 50 #[uniffi::method(async_runtime = "tokio")] 51 51 pub async fn unsubscribe( 52 52 &self, 53 - remote_id: Arc<PublicKeyOld>, 53 + remote_id: Arc<PublicKey>, 54 54 topic: &str, 55 55 ) -> Result<(), Error> { 56 56 let remote_id: iroh::NodeId = remote_id.as_ref().into();
+1 -1
rust/iroh-streamplace/src/sender.rs
··· 1 1 use bytes::Bytes; 2 2 use iroh::protocol::Router; 3 3 4 - use crate::{api::Api, endpoint::Endpoint, error::Error, utils::NodeAddr}; 4 + use crate::{api::Api, endpoint::Endpoint, error::Error, node_addr::NodeAddr}; 5 5 6 6 #[derive(uniffi::Object)] 7 7 pub struct Sender {
+18 -6
rust/iroh-streamplace/src/utils.rs rust/iroh-streamplace/src/node_addr.rs
··· 1 1 use std::{str::FromStr, sync::Arc}; 2 2 3 - use crate::{error::Error, key::PublicKeyOld}; 3 + use crate::public_key::PublicKey; 4 4 5 5 /// A peer and it's addressing information. 6 6 #[derive(Debug, Clone, PartialEq, Eq, uniffi::Object)] 7 7 pub struct NodeAddr { 8 - node_id: Arc<PublicKeyOld>, 8 + node_id: Arc<PublicKey>, 9 9 relay_url: Option<String>, 10 10 addresses: Vec<String>, 11 11 } ··· 14 14 impl NodeAddr { 15 15 /// Create a new [`NodeAddr`] with empty [`AddrInfo`]. 16 16 #[uniffi::constructor] 17 - pub fn new(node_id: &PublicKeyOld, derp_url: Option<String>, addresses: Vec<String>) -> Self { 17 + pub fn new(node_id: &PublicKey, derp_url: Option<String>, addresses: Vec<String>) -> Self { 18 18 Self { 19 19 node_id: Arc::new(node_id.clone()), 20 20 relay_url: derp_url, ··· 22 22 } 23 23 } 24 24 25 - pub fn node_id(&self) -> PublicKeyOld { 25 + pub fn node_id(&self) -> PublicKey { 26 26 self.node_id.as_ref().clone() 27 27 } 28 28 ··· 42 42 } 43 43 } 44 44 45 + /// Error when converting from ffi NodeAddr to iroh::NodeAddr 46 + #[derive(Debug, snafu::Snafu, uniffi::Error)] 47 + #[uniffi(flat_error)] 48 + #[snafu(visibility(pub(crate)))] 49 + pub enum NodeAddrError { 50 + #[snafu(display("Invalid URL"), context(false))] 51 + InvalidUrl { source: url::ParseError }, 52 + #[snafu(display("Invalid network address"), context(false))] 53 + InvalidNetworkAddress { source: std::net::AddrParseError }, 54 + } 55 + 56 + 45 57 impl TryFrom<NodeAddr> for iroh::NodeAddr { 46 - type Error = Error; 58 + type Error = NodeAddrError; 47 59 48 60 fn try_from(value: NodeAddr) -> Result<Self, Self::Error> { 49 61 let mut node_addr = iroh::NodeAddr::new((&*value.node_id).into()); 50 62 let addresses = value 51 63 .direct_addresses() 52 64 .into_iter() 53 - .map(|addr| std::net::SocketAddr::from_str(&addr).map_err(Error::from)) 65 + .map(|addr| std::net::SocketAddr::from_str(&addr)) 54 66 .collect::<Result<Vec<_>, _>>()?; 55 67 56 68 if let Some(derp_url) = value.relay_url() {