Scalable and distributed custom feed generator, ott - on that topic

Begin to fix the xrpc service

Changed files
+121 -13
crates
+108 -1
crates/Cargo.lock
··· 335 335 ] 336 336 337 337 [[package]] 338 + name = "atrium-api" 339 + version = "0.25.6" 340 + source = "registry+https://github.com/rust-lang/crates.io-index" 341 + checksum = "ef9d5e9352fd27d99383ae1db2b6a6aa239e683a7e750e8d73a73996d82b1fd2" 342 + dependencies = [ 343 + "atrium-common", 344 + "atrium-xrpc", 345 + "chrono", 346 + "http", 347 + "ipld-core", 348 + "langtag", 349 + "regex", 350 + "serde", 351 + "serde_bytes", 352 + "serde_json", 353 + "thiserror 1.0.69", 354 + "tokio", 355 + "trait-variant", 356 + ] 357 + 358 + [[package]] 359 + name = "atrium-common" 360 + version = "0.1.2" 361 + source = "registry+https://github.com/rust-lang/crates.io-index" 362 + checksum = "9ed5610654043faa396a5a15afac0ac646d76aebe45aebd7cef4f8b96b0ab7f4" 363 + dependencies = [ 364 + "dashmap", 365 + "lru", 366 + "moka", 367 + "thiserror 1.0.69", 368 + "tokio", 369 + "trait-variant", 370 + "web-time", 371 + ] 372 + 373 + [[package]] 374 + name = "atrium-xrpc" 375 + version = "0.12.3" 376 + source = "registry+https://github.com/rust-lang/crates.io-index" 377 + checksum = "0216ad50ce34e9ff982e171c3659e65dedaa2ed5ac2994524debdc9a9647ffa8" 378 + dependencies = [ 379 + "http", 380 + "serde", 381 + "serde_html_form", 382 + "serde_json", 383 + "thiserror 1.0.69", 384 + "trait-variant", 385 + ] 386 + 387 + [[package]] 338 388 name = "autocfg" 339 389 version = "1.5.0" 340 390 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 897 947 ] 898 948 899 949 [[package]] 950 + name = "dashmap" 951 + version = "6.1.0" 952 + source = "registry+https://github.com/rust-lang/crates.io-index" 953 + checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" 954 + dependencies = [ 955 + "cfg-if", 956 + "crossbeam-utils", 957 + "hashbrown 0.14.5", 958 + "lock_api", 959 + "once_cell", 960 + "parking_lot_core 0.9.12", 961 + ] 962 + 963 + [[package]] 900 964 name = "data-encoding" 901 965 version = "2.9.0" 902 966 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1791 1855 1792 1856 [[package]] 1793 1857 name = "hashbrown" 1858 + version = "0.14.5" 1859 + source = "registry+https://github.com/rust-lang/crates.io-index" 1860 + checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" 1861 + 1862 + [[package]] 1863 + name = "hashbrown" 1794 1864 version = "0.15.5" 1795 1865 source = "registry+https://github.com/rust-lang/crates.io-index" 1796 1866 checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" ··· 2331 2401 ] 2332 2402 2333 2403 [[package]] 2404 + name = "langtag" 2405 + version = "0.3.4" 2406 + source = "registry+https://github.com/rust-lang/crates.io-index" 2407 + checksum = "ed60c85f254d6ae8450cec15eedd921efbc4d1bdf6fcf6202b9a58b403f6f805" 2408 + dependencies = [ 2409 + "serde", 2410 + ] 2411 + 2412 + [[package]] 2334 2413 name = "lazy_static" 2335 2414 version = "1.5.0" 2336 2415 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2553 2632 source = "registry+https://github.com/rust-lang/crates.io-index" 2554 2633 checksum = "8261cd88c312e0004c1d51baad2980c66528dfdb2bee62003e643a4d8f86b077" 2555 2634 dependencies = [ 2635 + "async-lock", 2556 2636 "crossbeam-channel", 2557 2637 "crossbeam-epoch", 2558 2638 "crossbeam-utils", 2559 2639 "equivalent", 2640 + "event-listener", 2641 + "futures-util", 2560 2642 "parking_lot 0.12.5", 2561 2643 "portable-atomic", 2562 2644 "rustc_version", ··· 2822 2904 "atproto-oauth", 2823 2905 "atproto-record", 2824 2906 "atproto-xrpcs", 2907 + "atrium-api", 2825 2908 "axum", 2826 2909 "clap", 2827 2910 "elliptic-curve", ··· 3150 3233 "once_cell", 3151 3234 "socket2 0.6.0", 3152 3235 "tracing", 3153 - "windows-sys 0.59.0", 3236 + "windows-sys 0.60.2", 3154 3237 ] 3155 3238 3156 3239 [[package]] ··· 3702 3785 ] 3703 3786 3704 3787 [[package]] 3788 + name = "serde_html_form" 3789 + version = "0.2.8" 3790 + source = "registry+https://github.com/rust-lang/crates.io-index" 3791 + checksum = "b2f2d7ff8a2140333718bb329f5c40fc5f0865b84c426183ce14c97d2ab8154f" 3792 + dependencies = [ 3793 + "form_urlencoded", 3794 + "indexmap", 3795 + "itoa", 3796 + "ryu", 3797 + "serde_core", 3798 + ] 3799 + 3800 + [[package]] 3705 3801 name = "serde_ipld_dagcbor" 3706 3802 version = "0.6.4" 3707 3803 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4545 4641 "tracing", 4546 4642 "tracing-core", 4547 4643 "tracing-log", 4644 + ] 4645 + 4646 + [[package]] 4647 + name = "trait-variant" 4648 + version = "0.1.2" 4649 + source = "registry+https://github.com/rust-lang/crates.io-index" 4650 + checksum = "70977707304198400eb4835a78f6a9f928bf41bba420deb8fdb175cd965d77a7" 4651 + dependencies = [ 4652 + "proc-macro2", 4653 + "quote", 4654 + "syn 2.0.106", 4548 4655 ] 4549 4656 4550 4657 [[package]]
+1
crates/ott-xrpc/Cargo.toml
··· 10 10 atproto-oauth = "0.13.0" 11 11 atproto-record = "0.13.0" 12 12 atproto-xrpcs = "0.13.0" 13 + atrium-api = "0.25.6" 13 14 axum = "0.8.6" 14 15 clap = { version = "4.5.48", features = ["derive", "env"] } 15 16 elliptic-curve = "0.13.8"
+10 -10
crates/ott-xrpc/src/main.rs
··· 4 4 key::{generate_key, identify_key, to_public, KeyType}, 5 5 }; 6 6 use atproto_xrpcs::authorization::ResolvingAuthorization; 7 + use atrium_api::app::bsky::feed::defs::SkeletonFeedPost; 8 + 9 + use atrium_api::app::bsky::feed::get_feed_skeleton::{ 10 + OutputData as FeedResponse, ParametersData as FeedParameters, 11 + }; 7 12 use axum::{ 8 13 extract::{Query, State}, 9 14 response::{Html, IntoResponse, Response}, ··· 92 97 get(handle_wellknown_atproto_did), 93 98 ) 94 99 .route( 95 - "/xrpc/garden.lexicon.ngerakines.helloworld.Hello", 96 - get(handle_xrpc_hello_world), 100 + "/xrpc/app.bsky.feed.getFeedSkeleton", 101 + get(handle_get_feed_skeleton), 97 102 ) 98 103 .with_state(web_context); 99 104 ··· 134 139 (StatusCode::OK, service_did.0 .0).into_response() 135 140 } 136 141 137 - #[derive(Deserialize)] 138 - struct HelloParameters { 139 - subject: Option<String>, 140 - } 141 - 142 142 // /xrpc/garden.lexicon.ngerakines.helloworld.Hello 143 - async fn handle_xrpc_hello_world( 144 - parameters: Query<HelloParameters>, 143 + async fn handle_get_feed_skeleton( 144 + parameters: Query<FeedParameters>, 145 145 headers: HeaderMap, 146 146 authorization: Option<ResolvingAuthorization>, 147 147 ) -> Json<serde_json::Value> { 148 148 println!("headers {headers:?}"); 149 - let subject = parameters.subject.as_deref().unwrap_or("World"); 149 + let subject = parameters.feed.as_str(); 150 150 let message = if let Some(auth) = authorization { 151 151 format!("Hello, authenticated {}! (caller: {})", subject, auth.3) 152 152 } else {
+2 -2
crates/ott-xrpc/src/webcontext.rs
··· 102 102 "publicKeyMultibase": config.public_service_key 103 103 }], 104 104 "service":[{ 105 - "id":"#helloworld", 106 - "type":"HelloWorldService", 105 + "id":"#bsky_fg", 106 + "type":"BskyFeedGenerator", 107 107 "serviceEndpoint":format!("https://{external_base}") 108 108 }] 109 109 }