service
service
¶
Seeder service for BigBrotr.
Seeds initial relay URLs into the database as candidates for validation. This is a one-shot service intended to run once at startup to bootstrap relay discovery.
Relay URLs are read from a text file (one URL per line) and can be inserted either as validation candidates (picked up by Validator) or directly into the relays table.
Note
The seeder is the only one-shot service. Call
run() once at startup; do not use run_forever(). In the
default configuration (to_validate=True), seed URLs are inserted
as candidates in service_state so that the
Validator verifies them
before promoting to the relay table.
See Also
SeederConfig: Configuration
model for seed file path and insertion mode.
BaseService: Abstract base
class providing run() and from_yaml() lifecycle.
Brotr: Database facade used for relay
insertion.
insert_candidates:
Query used to insert seed URLs as validation candidates.
Examples:
from bigbrotr.core import Brotr
from bigbrotr.services import Seeder
brotr = Brotr.from_yaml("config/brotr.yaml")
seeder = Seeder.from_yaml("config/services/seeder.yaml", brotr=brotr)
async with brotr:
await seeder.run()
Classes¶
Seeder
¶
Seeder(brotr: Brotr, config: ConfigT | None = None)
Bases: BaseService[SeederConfig]
Database seeding service.
Reads relay URLs from a seed file and inserts them into the database. URLs can be added as validation candidates (for Validator to process) or inserted directly into the relays table.
This is a one-shot service; call run() once at startup.
See Also
SeederConfig: Configuration model for this service. Finder: Discovers additional relay URLs continuously.
Source code in src/bigbrotr/core/base_service.py
Functions¶
run
async
¶
Execute the full seeding sequence: parse file and insert relays.
Source code in src/bigbrotr/services/seeder/service.py
seed
async
¶
Parse the seed file and insert relays.
Reads relay URLs from the configured seed file, validates them,
then inserts them as validation candidates or directly into the
relays table based on the to_validate configuration flag.
Returns:
-
int–Number of relays inserted.