From 35a43e25c3ef9120ca36e6115bd9760a4a1fce55 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Fri, 24 Jul 2026 14:39:31 +0100 Subject: [PATCH] bobbin: add sh.tangled.string.getString mimicing getIssue and getPublicKey Signed-off-by: oppiliappan --- bobbin/crates/xrpc/src/lib.rs | 23 ++++++++++++++++++- lexicons/string/getString.json | 41 ++++++++++++++++++++++++++++++++++ localinfra/pds.env | 5 +++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 lexicons/string/getString.json diff --git a/bobbin/crates/xrpc/src/lib.rs b/bobbin/crates/xrpc/src/lib.rs index bc6cfd77..6a70a2f0 100644 --- a/bobbin/crates/xrpc/src/lib.rs +++ b/bobbin/crates/xrpc/src/lib.rs @@ -74,7 +74,9 @@ use bobbin_types::sh_tangled::spindle::member::{ Member as SpindleMember, MemberRecord as SpindleMemberRecord, }; use bobbin_types::sh_tangled::spindle::{Spindle, SpindleRecord}; -use bobbin_types::sh_tangled::string::{TangledString, TangledStringRecord}; +use bobbin_types::sh_tangled::string::{ + TangledString, TangledStringGetRecordOutput, TangledStringRecord, +}; use futures::Stream; use futures::stream::{self, StreamExt, TryStreamExt}; use jacquard_common::types::did::Did; @@ -401,6 +403,7 @@ pub fn router(state: AppState) -> Router { "/xrpc/sh.tangled.spindle.countMembers", get(count_spindle_members), ) + .route("/xrpc/sh.tangled.string.getString", get(get_string)) .route("/xrpc/sh.tangled.string.listStrings", get(list_strings)) .route("/xrpc/sh.tangled.string.countStrings", get(count_strings)) .route("/xrpc/sh.tangled.search.query", get(search_query)) @@ -619,6 +622,11 @@ struct GetPullQuery { pull: AtUri, } +#[derive(Debug, Deserialize)] +struct GetStringQuery { + string: AtUri, +} + #[derive(Debug, Deserialize)] struct GetPublicKeyQuery { #[serde(rename = "publicKey")] @@ -1319,6 +1327,19 @@ async fn get_pull( }))) } +async fn get_string( + State(state): State, + XrpcQuery(q): XrpcQuery, +) -> Result>>, XrpcError> { + let (body, value) = + fetch::>(&state, &q.string).await?; + Ok(Json(Deduped(TangledStringGetRecordOutput { + cid: Some(body.cid.clone()), + uri: body.uri.clone(), + value, + }))) +} + async fn get_public_key( State(state): State, XrpcQuery(q): XrpcQuery, diff --git a/lexicons/string/getString.json b/lexicons/string/getString.json new file mode 100644 index 00000000..0bfa2fee --- /dev/null +++ b/lexicons/string/getString.json @@ -0,0 +1,41 @@ +{ + "lexicon": 1, + "id": "sh.tangled.string.getString", + "defs": { + "main": { + "type": "query", + "parameters": { + "type": "params", + "required": ["string"], + "properties": { + "string": { + "type": "string", + "format": "at-uri", + "description": "AT-URI of the sh.tangled.string record to fetch." + } + } + }, + "output": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["uri", "value"], + "properties": { + "uri": { + "type": "string", + "format": "at-uri" + }, + "cid": { + "type": "string", + "format": "cid" + }, + "value": { + "type": "unknown", + "description": "Embedded sh.tangled.string record." + } + } + } + } + } + } +} diff --git a/localinfra/pds.env b/localinfra/pds.env index ea149ba1..8928db18 100644 --- a/localinfra/pds.env +++ b/localinfra/pds.env @@ -10,4 +10,9 @@ PDS_BLOBSTORE_DISK_LOCATION=/pds/blocks PDS_DID_PLC_URL=http://localhost:8080 PDS_HOSTNAME=pds.tngl.boltless.dev PDS_PORT=3000 + +# firehose backfill window. default is 24h (DAY), which makes cursor=0 emit an +# OutdatedCursor #info once history is >24h old; hydrant mishandles that info +# frame and loops. widen the window so cursor=0 streams from seq 1 cleanly. +PDS_REPO_BACKFILL_LIMIT_MS=31536000000 # PDS_CRAWLERS=https://relay.tngl.boltless.dev -- 2.51.2