Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm

Merge pull request #26 from jvalinsky/main

fixes at-microcosm/links#24 for constellation /links/distinct-dids to…

authored by bad-example.com and committed by GitHub daeb837f dcf4af9a

Changed files
+31 -2
constellation
+2 -2
constellation/src/server/mod.rs
··· 285 285 Ok(acceptable( 286 286 accept, 287 287 GetLinkItemsResponse { 288 - total: paged.version.0, 288 + total: paged.total, 289 289 linking_records: paged.items, 290 290 cursor, 291 291 query: (*query).clone(), ··· 346 346 Ok(acceptable( 347 347 accept, 348 348 GetDidItemsResponse { 349 - total: paged.version.0, 349 + total: paged.total, 350 350 linking_dids: paged.items, 351 351 cursor, 352 352 query: (*query).clone(),
+6
constellation/src/storage/mem_store.rs
··· 173 173 version: (0, 0), 174 174 items: Vec::new(), 175 175 next: None, 176 + total: 0, 176 177 }); 177 178 }; 178 179 let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else { ··· 180 181 version: (0, 0), 181 182 items: Vec::new(), 182 183 next: None, 184 + total: 0, 183 185 }); 184 186 }; 185 187 ··· 209 211 version: (total as u64, gone as u64), 210 212 items, 211 213 next, 214 + total: alive as u64, 212 215 }) 213 216 } 214 217 ··· 226 229 version: (0, 0), 227 230 items: Vec::new(), 228 231 next: None, 232 + total: 0, 229 233 }); 230 234 }; 231 235 let Some(did_rkeys) = paths.get(&Source::new(collection, path)) else { ··· 233 237 version: (0, 0), 234 238 items: Vec::new(), 235 239 next: None, 240 + total: 0, 236 241 }); 237 242 }; 238 243 ··· 275 280 version: (total as u64, gone as u64), 276 281 items, 277 282 next, 283 + total: alive as u64, 278 284 }) 279 285 } 280 286
+19
constellation/src/storage/mod.rs
··· 16 16 pub version: (u64, u64), // (collection length, deleted item count) // TODO: change to (total, active)? since dedups isn't "deleted" 17 17 pub items: Vec<T>, 18 18 pub next: Option<u64>, 19 + pub total: u64, 19 20 } 20 21 21 22 #[derive(Debug, Deserialize, Serialize, PartialEq)] ··· 149 150 version: (0, 0), 150 151 items: vec![], 151 152 next: None, 153 + total: 0, 152 154 } 153 155 ); 154 156 assert_eq!( ··· 157 159 version: (0, 0), 158 160 items: vec![], 159 161 next: None, 162 + total: 0, 160 163 } 161 164 ); 162 165 assert_eq!(storage.get_all_counts("bad-example.com")?, HashMap::new()); ··· 647 650 rkey: "asdf".into(), 648 651 }], 649 652 next: None, 653 + total: 1, 650 654 } 651 655 ); 652 656 assert_eq!( ··· 655 659 version: (1, 0), 656 660 items: vec!["did:plc:asdf".into()], 657 661 next: None, 662 + total: 1, 658 663 } 659 664 ); 660 665 assert_stats(storage.get_stats()?, 1..=1, 1..=1, 1..=1); ··· 696 701 }, 697 702 ], 698 703 next: Some(3), 704 + total: 5, 699 705 } 700 706 ); 701 707 assert_eq!( ··· 704 710 version: (5, 0), 705 711 items: vec!["did:plc:asdf-5".into(), "did:plc:asdf-4".into()], 706 712 next: Some(3), 713 + total: 5, 707 714 } 708 715 ); 709 716 let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?; ··· 725 732 }, 726 733 ], 727 734 next: Some(1), 735 + total: 5, 728 736 } 729 737 ); 730 738 assert_eq!( ··· 733 741 version: (5, 0), 734 742 items: vec!["did:plc:asdf-3".into(), "did:plc:asdf-2".into()], 735 743 next: Some(1), 744 + total: 5, 736 745 } 737 746 ); 738 747 let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?; ··· 747 756 rkey: "asdf".into(), 748 757 },], 749 758 next: None, 759 + total: 5, 750 760 } 751 761 ); 752 762 assert_eq!( ··· 755 765 version: (5, 0), 756 766 items: vec!["did:plc:asdf-1".into()], 757 767 next: None, 768 + total: 5, 758 769 } 759 770 ); 760 771 assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5); ··· 795 806 }, 796 807 ], 797 808 next: Some(2), 809 + total: 4, 798 810 } 799 811 ); 800 812 let links = storage.get_links("a.com", "app.t.c", ".abc.uri", 2, links.next)?; ··· 815 827 }, 816 828 ], 817 829 next: None, 830 + total: 4, 818 831 } 819 832 ); 820 833 assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4); ··· 855 868 }, 856 869 ], 857 870 next: Some(2), 871 + total: 4, 858 872 } 859 873 ); 860 874 storage.push( ··· 889 903 }, 890 904 ], 891 905 next: None, 906 + total: 5, 892 907 } 893 908 ); 894 909 assert_stats(storage.get_stats()?, 5..=5, 1..=1, 5..=5); ··· 929 944 }, 930 945 ], 931 946 next: Some(2), 947 + total: 4, 932 948 } 933 949 ); 934 950 storage.push( ··· 950 966 rkey: "asdf".into(), 951 967 },], 952 968 next: None, 969 + total: 3, 953 970 } 954 971 ); 955 972 assert_stats(storage.get_stats()?, 4..=4, 1..=1, 3..=3); ··· 990 1007 }, 991 1008 ], 992 1009 next: Some(2), 1010 + total: 4, 993 1011 } 994 1012 ); 995 1013 storage.push( ··· 1007 1025 rkey: "asdf".into(), 1008 1026 },], 1009 1027 next: None, 1028 + total: 4, 1010 1029 } 1011 1030 ); 1012 1031 assert_stats(storage.get_stats()?, 4..=4, 1..=1, 4..=4);
+4
constellation/src/storage/rocks_store.rs
··· 872 872 version: (0, 0), 873 873 items: Vec::new(), 874 874 next: None, 875 + total: 0, 875 876 }); 876 877 }; 877 878 ··· 914 915 version: (total, gone), 915 916 items, 916 917 next, 918 + total: alive, 917 919 }) 918 920 } 919 921 ··· 936 938 version: (0, 0), 937 939 items: Vec::new(), 938 940 next: None, 941 + total: 0, 939 942 }); 940 943 }; 941 944 ··· 974 977 version: (total, gone), 975 978 items, 976 979 next, 980 + total: alive, 977 981 }) 978 982 } 979 983