Skip to content

Index

core

Core layer providing the foundation for all BigBrotr services.

Sits in the middle of the diamond DAG -- depends only on bigbrotr.models and is depended upon by bigbrotr.services.

Attributes:

  • Pool

    Async PostgreSQL connection pool with retry/backoff and health checks. See Pool.

  • Brotr

    High-level database facade wrapping stored procedures via _call_procedure(). Services use Brotr, never Pool directly.

  • BaseService

    Abstract generic base class with lifecycle management (run() / run_forever() / shutdown), factory methods (from_yaml(), from_dict()), and Prometheus metrics integration.

  • Logger

    Structured logger supporting key=value and JSON output modes. See Logger.

  • MetricsServer

    Prometheus /metrics HTTP endpoint for metrics exposition. See MetricsServer.

  • YAML

    Safe YAML loading with yaml.safe_load() to prevent code execution. See load_yaml().

Examples:

from bigbrotr.core import Pool, Brotr, Logger

pool = Pool.from_yaml("config.yaml")
brotr = Brotr(pool=pool)
async with brotr:
    await brotr.insert_relay([...])
See Also

bigbrotr.models: Pure dataclass models consumed by this layer. bigbrotr.services: Service implementations that depend on this layer.