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