Monorepo for Tangled tangled.org

knotserver,knotmirror/xrpc: sync.requestCrawl support #1202

merged opened by boltless.me targeting master from sl/rvyxvsnxkkql

knotmirror ingests repo creation event from atproto relay through tap, not from knotstream. Therefore, knotserver will request sync.requestCrawl with optional new repo information to notify the repo creation event.

Knot will call sync.requestCrawl on following cases:

  • on startup
  • when /event stream has failed
  • on repo creation (mandatory)

Signed-off-by: Seongmin Lee git@boltless.me

Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3mhk6tzq7xq22
+22 -1
Interdiff #1 #2
knotmirror/hostutil/hostutil.go

This file has not been changed.

knotmirror/knotmirror.go

This file has not been changed.

knotmirror/resyncer.go

This file has not been changed.

+10 -1
knotmirror/xrpc/sync_requestCrawl.go
··· 61 61 } 62 62 record := out.Value.Val.(*tangled.Repo) 63 63 64 + knotUrl := record.Knot 65 + if !strings.Contains(record.Knot, "://") { 66 + if noSSL { 67 + knotUrl = "http://" + knotUrl 68 + } else { 69 + knotUrl = "https://" + knotUrl 70 + } 71 + } 72 + 64 73 repo := &models.Repo{ 65 74 Did: owner.DID, 66 75 Rkey: repoAt.RecordKey(), 67 76 Cid: (*syntax.CID)(out.Cid), 68 77 Name: record.Name, 69 - KnotDomain: record.Knot, 78 + KnotDomain: knotUrl, 70 79 State: models.RepoStatePending, 71 80 ErrorMsg: "", 72 81 RetryAfter: 0,
knotmirror/xrpc/xrpc.go

This file has not been changed.

knotserver/config/config.go

This file has not been changed.

knotserver/events.go

This file has not been changed.

knotserver/server.go

This file has not been changed.

knotserver/xrpc/create_repo.go

This file has not been changed.

+9
nix/modules/knot.nix
··· 115 115 ''; 116 116 }; 117 117 118 + knotmirrors = mkOption { 119 + type = types.listOf types.str; 120 + default = [ 121 + "https://mirror.tangled.network" 122 + ]; 123 + description = "List of knotmirror hosts to request crawl"; 124 + }; 125 + 118 126 server = { 119 127 listenAddr = mkOption { 120 128 type = types.str; ··· 263 271 "KNOT_SERVER_PLC_URL=${cfg.server.plcUrl}" 264 272 "KNOT_SERVER_JETSTREAM_ENDPOINT=${cfg.server.jetstreamEndpoint}" 265 273 "KNOT_SERVER_OWNER=${cfg.server.owner}" 274 + "KNOT_MIRRORS=${concatStringsSep "," cfg.knotmirrors}" 266 275 "KNOT_SERVER_LOG_DIDS=${ 267 276 if cfg.server.logDids 268 277 then "true"
+3
nix/vm.nix
··· 111 111 jetstreamEndpoint = jetstream; 112 112 listenAddr = "0.0.0.0:6444"; 113 113 }; 114 + knotmirrors = [ 115 + "http://localhost:7000" 116 + ]; 114 117 }; 115 118 services.tangled.spindle = { 116 119 enable = true;

History

7 rounds 4 comments
sign up or login to add to the discussion
1 commit
expand
nix,knotserver,knotmirror/xrpc: sync.requestCrawl support
2/3 timeout, 1/3 success
expand
expand 1 comment
pull request successfully merged
1 commit
expand
nix,knotserver,knotmirror/xrpc: sync.requestCrawl support
2/3 timeout, 1/3 success
expand
expand 3 comments

knotmirror/xrpc/sync_requestCrawl.go:22 this is unauthed right? so if this code goes through, I could curl -X POST /xrpc/sh.tangled.sync.requestCrawl -d "garbage" and crash knotmirror?

Thank you for checking. I should make a git hook to check unimplemented codes before push at this point...

1 commit
expand
nix,knotserver,knotmirror/xrpc: sync.requestCrawl support
2/3 timeout, 1/3 success
expand
expand 0 comments
1 commit
expand
nix,knotserver,knotmirror/xrpc: sync.requestCrawl support
expand 0 comments
1 commit
expand
knotserver,knotmirror/xrpc: sync.requestCrawl support
expand 0 comments
1 commit
expand
knotserver,knotmirror/xrpc: sync.requestCrawl support
expand 0 comments
1 commit
expand
knotserver,knotmirror/xrpc: sync.requestCrawl support
expand 0 comments