- commit
- f779fefc1c5b17d4bc864cf36f813d7376c54803
- parent
- 625c6b599c11ec8bf3965d4e727c97abaca8029f
- author
- Dami <dami.etoile@gmail.com>
| M | docs/ | 8 | +++++++- |
| M | docs/ | 2 | +- |
| M | docs/ | 2 | +- |
| M | docs/ | 6 | ++++-- |
| M | docs/ | 3 | ++- |
@@ -94,7 +94,13 @@ If you write scripts, the relay has an HTTP door. Sign a request with your key (
9494 9595 ## Bring events in9696 97-Any relay that lets you read can be copied into yours. On the Storage tab, under **Pull from a relay**, enter its URL. Your relay syncs with it (NIP-77) and fetches what it lacks, in the background. Run it again later and only new events come over. Files come along when the other relay is on bind.ws.97+The Storage tab has a **Jobs** block: work your relay does on its own, in the background, in small rounds, so it keeps going while the relay sleeps between them.98+99+- **Pull** copies what another relay has and yours lacks, by NIP-77 sync. Run it again later and only new events come over. Files come along when the other relay is on bind.ws. Pick an interval and it becomes a standing mirror that keeps your name in sync every hour, six hours or day.100+- **Fetch my history** pulls your own events from every relay in your relay list (kind 10002), if a client has published it here. Or give it relays to fetch from.101+- **Rebroadcast** sends what your relay holds to other relays, like a blaster. Choose kinds and a day window, or leave both blank for everything. As a standing job it forwards only what arrived since the last run. Events only their author may publish are left out, and a members-only relay never rebroadcasts private messages.102+103+Jobs spend awake time, which fuel counts. Up to five standing jobs per relay.98104 99105 Your bans and kind rules apply to what arrives. Your write rule does not: you asked for these events.100106 @@ -77,7 +77,7 @@ What is taking space and what to do about it.
7777 - **Purge** deletes a kind older than a number of days, now. Zero means all of them.7878 - Kinds marked **required** are never expired or purged: profiles, contact lists, relay lists, zap receipts and the roster. The relay depends on them.7979 - **Files** lists uploads with sizes and a delete button.80-- **Pull from a relay** copies what another relay has and this one lacks, by NIP-77 sync. It runs in the background and the line under it follows along. Running it again fetches only what is new. Files come along from relays on this host. Bans and kind rules apply to what arrives; the write rule does not. The other relay has to let anyone read.80+- **Jobs** is work the relay does on its own, one round at a time, so it survives the relay sleeping. The table lists each job with its relays, filter, schedule and last result, with run-now and remove. Three forms add jobs. **Pull** copies what another relay has and this one lacks, by NIP-77 sync; running it again fetches only what is new, files come along from relays on this host, and with an interval it is a standing mirror. **Fetch my history** pulls the owner's own events from the relays in their kind 10002 stored here, or from a given list. **Rebroadcast** forwards events matching kinds and a day window to a list of relays, walking the store with a cursor so a standing rebroadcast forwards only what arrived since. Bans and kind rules apply to what arrives; the write rule does not. The other relay has to let anyone read, or write. Events that only their author may publish are never rebroadcast, and a members-only relay never rebroadcasts private kinds. Standing jobs run every hour, six hours or day, five at most. Jobs spend awake time, which fuel counts.8181 - **Browse recent events** at the bottom shows the feed with delete and ban actions.8282 8383 ## Health@@ -20,7 +20,7 @@ Four things cost the host money, and those four are measured. Each mirrors a lin
2020 2121 Traffic in and out is free and not counted. The console shows it so you can see what the relay does.2222 23-**Time awake** is how long the relay is in memory. It sleeps between messages and wakes when one arrives, so a relay nobody uses is awake for zero hours. A relay with a client connected all day is awake only while messages pass, plus a few seconds after each.23+**Time awake** is how long the relay is in memory. It sleeps between messages and wakes when one arrives, so a relay nobody uses is awake for zero hours. A relay with a client connected all day is awake only while messages pass, plus a few seconds after each. Jobs on the Storage tab, pulls, backfills and rebroadcasts, wake the relay on their own and spend this line while they run; a standing job spends it on every run.2424 2525 **Rows written** is database work. A note costs a few rows. Reactions and other small events cost about the same.2626 @@ -49,7 +49,9 @@ One alarm per object, at most a day out, sooner if a NIP-40 expiry is due or a l
4949 5050 NIP-46 traffic (kind 24133) is ephemeral, never stored and encrypted end to end, so it passes the ownership and write gates, and a subscription to it alone passes the read gate. That lets the relay carry a remote signer's session for the console, including for someone about to claim it. Bans and the per-connection rate limit still apply.5151 52-The alarm also drives pulls (`pull.ts`). `pullfrom` records a job and wakes the alarm; each round opens one websocket to the source, reconciles with NIP-77 as the initiator, fetches a bounded batch of the missing ids, verifies signatures, and stores them through the normal write path minus the client policy. Sources on this host are dialled through their object stub and their files copied in R2 by prefix. Rounds repeat until nothing is missing, so a pull survives the object sleeping, and a second pull only fetches the difference.52+The alarm also drives jobs (`jobs.ts`), a persisted list run one round at a time. `addjob` records one and wakes the alarm; the alarm runs the job that is running or due, saves it, and comes back a quarter second later while there is more. Three failed rounds in a row end a run with the reason. A once job is done after its run; a standing job is scheduled again at its interval, and the daily alarm is never set past the next run.53+54+A pull round (`pull.ts`) opens one websocket to the source, reconciles with NIP-77 as the initiator over the job's filter (authors, kinds, since), fetches a bounded batch of the missing ids, verifies signatures, and stores them through the normal write path minus the client policy. Sources on this host are dialled through their object stub and, on a whole-relay pull, their files copied in R2 by prefix. A pull job syncs its sources in turn, so a backfill is a pull with the owner as author from the relays in their kind 10002. A push round takes the next batch past a sequence cursor kept on the job, offers it to every target, counts OKs (a `duplicate:` counts as sent), and leaves a target alone for the round after several refusals in a row; the cursor survives sleeps and runs, so a standing push forwards only what arrived since. NIP-70 protected events are never pushed, nor private kinds from a members-only relay.5355 5456 ## Fuel5557 @@ -73,7 +75,7 @@ Joins (9021, with an optional invite `code`), leaves (9022) and the moderation k
7375 7476 | Role | May |7577 |---|---|76-| owner | everything, including rules, identity, storage, config, pull, transfer, delete |78+| owner | everything, including rules, identity, storage, config, jobs, transfer, delete |7779 | moderator | read stats and lists, add and edit plain members, ban, delete events, invites, reports |7880 7981 Moderators cannot act on the owner or on each other; only the owner appoints or removes moderators. `transferowner` hands the relay to a member and leaves the old owner as a moderator; the identity key and fuel do not change.@@ -11,7 +11,8 @@ audience: developer
1111 src/1212 index.ts worker entry: hostname → object, POST /lease1313 names.ts valid names, reserved names, lease names14- pull.ts copy another relay in: NIP-77 as the initiator, in alarm rounds14+ pull.ts copy another relay in: NIP-77 as the initiator, one round per connection15+ jobs.ts the alarm's job list: pulls, backfills, rebroadcasts, once or standing1516 relay.ts the Durable Object: sockets, policy, fuel plumbing, NIP-111617 store.ts SQLite schema and queries1718 settings.ts policy, members, bans, kind rules, retention, export/import