Registries, Search and Archives¶
Registry providers¶
A registry provider (indexer) follows relays, keeps a write-ahead log of what it received, and serves search. Anyone can run one. It advertises itself with a signed descriptor (kind 30501) on the relays it follows.
| Variable | Default | Meaning |
|---|---|---|
RELAYS |
none | Relays to follow |
REGISTRY_NAME, PUBLIC_URL |
required | Name and endpoint in the descriptor |
SPECIALIZATION |
general |
Specialization |
REGISTRY_TAGS |
none | Tags of the descriptor |
RULES_FILE |
none | Provider rules |
API_KEYS |
none | Additional API keys |
ADMIN_TOKEN |
required | Administration token |
BACKFILL_SECONDS |
60 |
Interval of reconciliation with relays |
DESCRIPTOR_SECONDS |
30 |
Interval of publishing the descriptor |
DATA_FILE, KEY_FILE |
/data/registry.db, /data/provider.key |
Storage |
Provider rules:
{"kinds": [], "require_tags": [], "deny_authors": [], "deny_hashes": [], "deny_words": [], "reputation": {}, "daily_quota": 0}
reputation maps author keys to a weight used in ranking. private requires an API key for every request.
Ranking¶
| Query | Strategy |
|---|---|
| By hash or id | lookup |
| Text, sorted by relevance | hybrid: full text and vector similarity |
Text, sorted by recent |
text |
| Neither | scan, newest first |
The score combines text (0.6), vector similarity (0.25), freshness (0.1) and reputation (0.05). Reputation grows with the number of distinct authors that reference an asset.
HTTP API¶
| Method and path | Access | Purpose |
|---|---|---|
GET /v1/search |
open, or API key | Parameters q, kind, author, id, tag (letter:value), sha256, since, until, sort (relevance or recent), limit (20, max 100), offset (max 1000) |
GET /v1/events/{id} |
open, or API key | One event |
GET /v1/registries |
open, or API key | Known descriptors |
GET /v1/descriptor |
open | Own descriptor |
GET /v1/quota/{key}, PUT /v1/quota/{key} |
admin | Daily quota of an API key, or of ip:<address> |
POST /v1/rebuild |
admin | Rebuild the index from the write-ahead log |
GET /metrics |
open | Query and ingestion metrics |
Send API keys as X-Api-Key and the administration token as Authorization: Bearer.
Federated search¶
search scans relays for descriptors and queries several registries at once. It verifies every returned event, drops those that do not match the query, merges duplicates, and ranks by reciprocal rank across providers with a small bonus for freshness.
| Variable | Default | Meaning |
|---|---|---|
RELAYS |
none | Relays to scan for descriptors |
PROVIDERS |
all | Provider keys to accept |
MAX_PROVIDERS |
16 |
Registries per query, preferring fast and reliable ones |
PROVIDER_TIMEOUT |
5 |
Seconds |
SCAN_SECONDS |
15 |
Interval of scanning |
ALLOW_PRIVATE |
false |
Allow private addresses |
GET /v1/search takes the parameters above, and provider and specialization to select registries. GET /v1/providers lists the catalog. The answer contains partial, which is true when a provider failed or none was selected, and the state of each provider.
Archives¶
An archiver keeps the complete history in an append-only database, including events that relays have replaced or pruned, and reconciles with peer archivers.
| Variable | Default | Meaning |
|---|---|---|
RELAYS |
none | Relays to follow |
PEERS |
none | Peer archivers |
ARCHIVE_TOKEN |
required | Token used between archivers |
EXPORT_TOKENS |
none | Additional tokens that may read |
BACKFILL_SECONDS, SYNC_SECONDS |
60, 30 |
Intervals |
| Method and path | Purpose |
|---|---|
GET /v1/stats |
Number of events and cursor |
GET /v1/export?after=&limit= |
Incremental export as JSON lines. X-Next-Cursor continues it |
GET /v1/snapshot |
Complete gzip snapshot in canonical order |
POST /v1/sync/reconcile, POST /v1/sync/fetch |
Used by peers |
Events deleted by their author are left out of exports unless deleted=1. archiver restore reads JSON lines from standard input, verifies every event and stores it.
Asset stores¶
assets stores files by SHA-256 and fetches missing ones from PEERS, verifying them.
| Method and path | Purpose |
|---|---|
POST /blobs?sha256= |
Store a file. Needs ASSETS_TOKEN |
GET /blobs/{id} |
Read by SHA-256 or CIDv1 |
MAX_BYTES (1 GiB) limits the size of a file.