From 4b8fa95d2d247f4d907c6f63b7a3a08c2cc26643 Mon Sep 17 00:00:00 2001 From: Seongmin Lee Date: Thu, 19 Mar 2026 14:00:56 +0000 Subject: [PATCH] lexicons: `sync.requestCrawl` and `knot.subscribeRepos` Signed-off-by: Seongmin Lee --- api/tangled/knotsubscribeRepos.go | 34 ++++++++++++++++++++++++++++++++++ api/tangled/syncrequestCrawl.go | 32 ++++++++++++++++++++++++++++++++ lexicons/knot/subscribeRepos.json | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lexicons/sync/requestCrawl.json | 29 +++++++++++++++++++++++++++++ 4 file(s) changed, 152 insertion(s)(+), 0 deletion(s)(-) diff --git a/api/tangled/knotsubscribeRepos.go b/api/tangled/knotsubscribeRepos.go new file mode 100644 --- /dev/null +++ b/api/tangled/knotsubscribeRepos.go @@ -0,0 +1,34 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.knot.subscribeRepos + +const ( + KnotSubscribeReposNSID = "sh.tangled.knot.subscribeRepos" +) + +// KnotSubscribeRepos_GitSync1 is a "gitSync1" in the sh.tangled.knot.subscribeRepos schema. +type KnotSubscribeRepos_GitSync1 struct { + // did: Repository DID identifier + Did string `json:"did" cborgen:"did"` + // seq: The stream sequence number of this message. + Seq int64 `json:"seq" cborgen:"seq"` +} + +// KnotSubscribeRepos_GitSync2 is a "gitSync2" in the sh.tangled.knot.subscribeRepos schema. +type KnotSubscribeRepos_GitSync2 struct { + // did: Repository AT-URI identifier + Did *string `json:"did,omitempty" cborgen:"did,omitempty"` + // seq: The stream sequence number of this message. + Seq int64 `json:"seq" cborgen:"seq"` +} + +// KnotSubscribeRepos_Identity is a "identity" in the sh.tangled.knot.subscribeRepos schema. +type KnotSubscribeRepos_Identity struct { + // did: Repository DID identifier + Did string `json:"did" cborgen:"did"` + // seq: The stream sequence number of this message. + Seq int64 `json:"seq" cborgen:"seq"` + Time string `json:"time" cborgen:"time"` +} diff --git a/api/tangled/syncrequestCrawl.go b/api/tangled/syncrequestCrawl.go new file mode 100644 --- /dev/null +++ b/api/tangled/syncrequestCrawl.go @@ -0,0 +1,32 @@ +// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. + +package tangled + +// schema: sh.tangled.sync.requestCrawl + +import ( + "context" + + "github.com/bluesky-social/indigo/lex/util" +) + +const ( + SyncRequestCrawlNSID = "sh.tangled.sync.requestCrawl" +) + +// SyncRequestCrawl_Input is the input argument to a sh.tangled.sync.requestCrawl call. +type SyncRequestCrawl_Input struct { + // ensureRepo: specific repository to ensure crawling + EnsureRepo *string `json:"ensureRepo,omitempty" cborgen:"ensureRepo,omitempty"` + // hostname: Hostname of the current service (eg, Knot) that is requesting to be crawled. + Hostname string `json:"hostname" cborgen:"hostname"` +} + +// SyncRequestCrawl calls the XRPC method "sh.tangled.sync.requestCrawl". +func SyncRequestCrawl(ctx context.Context, c util.LexClient, input *SyncRequestCrawl_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.sync.requestCrawl", nil, input, nil); err != nil { + return err + } + + return nil +} diff --git a/lexicons/knot/subscribeRepos.json b/lexicons/knot/subscribeRepos.json new file mode 100644 --- /dev/null +++ b/lexicons/knot/subscribeRepos.json @@ -0,0 +1,57 @@ +{ + "lexicon": 1, + "id": "sh.tangled.knot.subscribeRepos", + "defs": { + "main": { + "type": "subscription", + "description": "Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay.", + "parameters": { + "type": "params", + "properties": { + "cursor": { + "type": "integer", + "description": "The last known event seq number to backfill from." + } + } + }, + "message": { + "schema": { + "type": "union", + "refs": ["#identity", "gitRefUpdate"] + } + }, + "errors": [ + { "name": "FutureCursor" }, + { + "name": "ConsumerTooSlow", + "description": "If the consumer of the stream can not keep up with events, and a backlog gets too large, the server will drop the connection." + } + ] + }, + "identity": { + "type": "object", + "required": ["seq", "did", "time"], + "properties": { + "seq": { "type": "integer", "description": "The stream sequence number of this message." }, + "did": { "type": "string", "format": "did", "description": "Repository DID identifier" }, + "time": { "type": "string", "format": "datetime" } + } + }, + "gitSync1": { + "type": "object", + "required": ["seq", "did"], + "properties": { + "seq": { "type": "integer", "description": "The stream sequence number of this message." }, + "did": { "type": "string", "format": "did", "description": "Repository DID identifier" } + } + }, + "gitSync2": { + "type": "object", + "required": ["seq", "repo"], + "properties": { + "seq": { "type": "integer", "description": "The stream sequence number of this message." }, + "did": { "type": "string", "format": "at-uri", "description": "Repository AT-URI identifier" } + } + } + } +} diff --git a/lexicons/sync/requestCrawl.json b/lexicons/sync/requestCrawl.json new file mode 100644 --- /dev/null +++ b/lexicons/sync/requestCrawl.json @@ -0,0 +1,29 @@ +{ + "lexicon": 1, + "id": "sh.tangled.sync.requestCrawl", + "defs": { + "main": { + "type": "procedure", + "description": "Request a service to persistently crawl hosted repos. Does not require auth.", + "input": { + "encoding": "application/json", + "schema": { + "type": "object", + "required": ["hostname"], + "properties": { + "hostname": { + "type": "string", + "description": "Hostname of the current service (eg, Knot) that is requesting to be crawled." + }, + "ensureRepo": { + "type": "string", + "format": "at-uri", + "description": "specific repository to ensure crawling" + } + } + } + }, + "errors": [{ "name": "HostBanned" }] + } + } +} -- tangled.sh