internal/

directory
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT

Directories

Path Synopsis
Package app is the composition root: it loads the configuration, maps it onto the Settings and Specs of every package and builds all components (Create* factories).
Package app is the composition root: it loads the configuration, maps it onto the Settings and Specs of every package and builds all components (Create* factories).
Package auth implements accounts, sessions, API tokens, the setup code, brute-force limits and the audit entries of these actions (spec 10).
Package auth implements accounts, sessions, API tokens, the setup code, brute-force limits and the audit entries of these actions (spec 10).
Package buildinfo carries the version information set by the linker.
Package buildinfo carries the version information set by the linker.
Package collector polls the devices of one connection, normalises their values, turns counters into energy deltas, nets grid energy and books everything into 15-minute buckets (spec 5, 6).
Package collector polls the devices of one connection, normalises their values, turns counters into energy deltas, nets grid energy and books everything into 15-minute buckets (spec 5, 6).
Package config loads the layered configuration (defaults → DB → file → env), decodes it into typed sections and validates its structure.
Package config loads the layered configuration (defaults → DB → file → env), decodes it into typed sections and validates its structure.
Package configstore persists the UI configuration (spec 3): objects and settings with a revision (config_rev), history snapshots, audit entries with a diff, and encrypted secrets.
Package configstore persists the UI configuration (spec 3): objects and settings with a revision (config_rev), history snapshots, audit entries with a diff, and encrypted secrets.
Package database opens the SQLite database, applies the embedded, versioned migrations (always after a verified backup) and makes verified online backups (spec 7.6).
Package database opens the SQLite database, applies the embedded, versioned migrations (always after a verified backup) and makes verified online backups (spec 7.6).
Package derive turns 15-minute buckets into periods (day, month, year, total) and site quantities, caching closed periods in derived_cache (spec 5.1 step 8, 7.3).
Package derive turns 15-minute buckets into periods (day, month, year, total) and site quantities, caching closed periods in derived_cache (spec 5.1 step 8, 7.3).
Package eventbus is the typed in-process event bus through which background components meet (AGENTS.md section 4).
Package eventbus is the typed in-process event bus through which background components meet (AGENTS.md section 4).
Package health is the single supervisor: it starts restartable components, watches their state and heartbeat, restarts them within a budget and cancels the root context with ErrHealthFatal when that is no longer possible (spec 8.2).
Package health is the single supervisor: it starts restartable components, watches their state and heartbeat, restarts them within a budget and cancels the root context with ErrHealthFatal when that is no longer possible (spec 8.2).
http
handler
Package handler holds the HTTP handlers; they contain no business logic and call services only.
Package handler holds the HTTP handlers; they contain no business logic and call services only.
middleware
Package middleware holds HTTP middleware; handlers live in package handler.
Package middleware holds HTTP middleware; handlers live in package handler.
router
Package router declares every HTTP route and its access level in one place.
Package router declares every HTTP route and its access level in one place.
server
Package server runs the HTTP server lifecycle.
Package server runs the HTTP server lifecycle.
Package livecache keeps the newest value per live key ("<meter>/<channel>") and publishes a change event for every new value.
Package livecache keeps the newest value per live key ("<meter>/<channel>") and publishes a change event for every new value.
Package logging builds the injected zerolog.Logger: JSON to stdout and, when a file is configured, additionally to a file rotated by timberjack.
Package logging builds the injected zerolog.Logger: JSON to stdout and, when a file is configured, additionally to a file rotated by timberjack.
Package maintenance holds the CLI jobs that run with the server stopped: the shared lock next to the database, dumps, backups, backfill, import and data correction (spec 13).
Package maintenance holds the CLI jobs that run with the server stopped: the shared lock next to the database, dumps, backups, backfill, import and data correction (spec 13).
Package profile holds the declarative device profiles (spec 4): schema, loader for built-in and local profiles, validation, decoder and status maps.
Package profile holds the declarative device profiles (spec 4): schema, loader for built-in and local profiles, validation, decoder and status maps.
Package report is the pure energy report model (spec 12): complete days of the site quantities go in, sums, ratios, sections, patterns and key figures (with an optional comparison period) come out.
Package report is the pure energy report model (spec 12): complete days of the site quantities go in, sums, ratios, sections, patterns and key figures (with an optional comparison period) come out.
csv
Package csv writes a report's buckets as CSV: one row per day, month or year with the site quantities and the derived columns (this app's estimates end in _est_kwh).
Package csv writes a report's buckets as CSV: one row per day, month or year with the site quantities and the derived columns (this app's estimates end in _est_kwh).
pdf
Package pdf renders a report as an A4 PDF (spec 12): a summary page with key figures, energy charts and where the energy came from and went, the sections the site has (battery, PV sources, loadpoints, load profile), patterns, comparison and data quality, a compact table and a last page on how the report is calculated.
Package pdf renders a report as an A4 PDF (spec 12): a summary page with key figures, energy charts and where the energy came from and went, the sections the site has (battery, PV sources, loadpoints, load profile), patterns, comparison and data quality, a compact table and a last page on how the report is calculated.
Package service holds the read services behind the HTTP handlers.
Package service holds the read services behind the HTTP handlers.
Package simulate provides fake device sources for "pvmon simulate": a small, deterministic household model whose values are encoded through the real profiles, so the whole pipeline runs as with real devices (spec 13).
Package simulate provides fake device sources for "pvmon simulate": a small, deterministic household model whose values are encoded through the real profiles, so the whole pipeline runs as with real devices (spec 13).
Package site builds the effective site model from configured connections, devices and meters plus their profiles: roles, categories, hierarchy, the series catalogue and the capabilities the UI is built from (spec 2, 3, 11).
Package site builds the effective site model from configured connections, devices and meters plus their profiles: roles, categories, hierarchy, the series catalogue and the capabilities the UI is built from (spec 2, 3, 11).
Package sitecalc computes the live site quantities (spec 5.5) from the live cache: on a change of a meter value, debounced, and on a refresh tick so missing inputs remove the quantity.
Package sitecalc computes the live site quantities (spec 5.5) from the live cache: on a change of a meter value, debounced, and on a refresh tick so missing inputs remove the quantity.
Package storage is the sole owner of the SQLite database.
Package storage is the sole owner of the SQLite database.
transport
http
Package http is the HTTP(S) JSON transport: GET requests only, basic and digest authentication, no redirects to other hosts, per-request timeouts and backoff after failures (spec 4.4, 10).
Package http is the HTTP(S) JSON transport: GET requests only, basic and digest authentication, no redirects to other hosts, per-request timeouts and backoff after failures (spec 4.4, 10).
modbus
Package modbus is the Modbus TCP/RTU transport: one shared connection with a FIFO request queue per address, raw register reads (FC 03/04 only), error classification and reconnect with exponential backoff.
Package modbus is the Modbus TCP/RTU transport: one shared connection with a FIFO request queue per address, raw register reads (FC 03/04 only), error classification and reconnect with exponential backoff.
Package util holds small dependency-free helpers shared by all packages: the injected Clock, dependency checks, the Slot container and numeric helpers.
Package util holds small dependency-free helpers shared by all packages: the injected Clock, dependency checks, the Slot container and numeric helpers.
clocktest
Package clocktest provides a manually driven util.Clock for tests: time only moves when the test calls Advance or Set, so polling, backoff and debounce run without sleeps.
Package clocktest provides a manually driven util.Clock for tests: time only moves when the test calls Advance or Set, so polling, backoff and debounce run without sleeps.
ws
Package ws serves live values over WebSocket (spec 9.3): subscriptions per client, a per-client diff against what was sent, pushes coalesced into one frame per tick.
Package ws serves live values over WebSocket (spec 9.3): subscriptions per client, a per-client diff against what was sent, pushes coalesced into one frame per tick.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL