|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Per-site descriptor loaded from a flat key=value config file. More...
#include <stddef.h>#include <stdint.h>#include "mdl_politeness.h"#include "mdl_storage.h"#include "ra8_err.h"Go to the source code of this file.
Data Structures | |
| struct | mdl_site_t |
| One site's scraping rules (all data, no logic). More... | |
Enumerations | |
| enum | mdl_chapter_order_t : uint8_t { k_mdl_order_doc = 0 , k_mdl_order_reverse = 1 , k_mdl_order_asc = 2 } |
| How to order chapters extracted from a series page. More... | |
| enum | mdl_config_limits_t : uint16_t { k_mdl_name_max = 64 , k_mdl_host_max = 128 , k_mdl_kind_max = 16 , k_mdl_match_max = 128 , k_mdl_attr_max = 16 , k_mdl_contact_max = 128 , k_mdl_search_url_max = 256 } |
| Fixed field sizes for a site descriptor. More... | |
Functions | |
| ra8_err_t | mdl_config_load (mdl_storage_t *storage, const char *path, mdl_site_t *out) |
| Load a site descriptor from a flat key=value file. | |
| mdl_gov_cfg_t | mdl_config_gov_cfg (const mdl_site_t *site) |
| Build the politeness-governor tunables for a loaded site descriptor. | |
| void | mdl_config_apply_polite (mdl_site_t *site) |
| Raise a descriptor's per-request delay floors for --polite. | |
Per-site descriptor loaded from a flat key=value config file.
Replaces the Kotlin original's hardcoded when(host) branches: adding a site is dropping in a .conf file, no rebuild. v1 is a deliberately small flat key=value format (# comments, [section] lines ignored) parsed into a fixed-size struct – zero dynamic allocation, every field bounded, so the same descriptor model ports to the RA8 unchanged. The richer TOML schema is a later milestone; this proves the data-driven approach end to end.
Definition in file mdl_config.h.
| enum mdl_chapter_order_t : uint8_t |
How to order chapters extracted from a series page.
| Enumerator | |
|---|---|
| k_mdl_order_doc | Keep document order. |
| k_mdl_order_reverse | Reverse document order (newest-first -> old). |
| k_mdl_order_asc | Sort by the number parsed from the URL. |
Definition at line 25 of file mdl_config.h.
| enum mdl_config_limits_t : uint16_t |
Fixed field sizes for a site descriptor.
Definition at line 32 of file mdl_config.h.
| void mdl_config_apply_polite | ( | mdl_site_t * | site | ) |
Raise a descriptor's per-request delay floors for --polite.
The --polite opt-in lifts the per-image and inter-chapter jitter floors to cautious minimums (never lowering a site that is already slower). Shared by the series and discovery paths so both interpret --polite the same way.
| [in,out] | site | Descriptor whose delay floors are raised in place. |
site is non-NULL and was populated by mdl_config_load. site in place. Definition at line 625 of file mdl_config.c.
References mdl_site_t::chapter_delay_max, mdl_site_t::chapter_delay_min, mdl_site_t::img_delay_max, mdl_site_t::img_delay_min, internal_config_max_u32(), k_polite_chap_max_ms, k_polite_chap_min_ms, k_polite_img_max_ms, and k_polite_img_min_ms.
Referenced by mdl_app_run_discover(), and mdl_app_run_series().
| mdl_gov_cfg_t mdl_config_gov_cfg | ( | const mdl_site_t * | site | ) |
Build the politeness-governor tunables for a loaded site descriptor.
Overlays the descriptor's governor fields (rate/burst/backoff/in-flight) onto the conservative mdl_gov_cfg_default baseline, so every run mode – series download, discovery, library update – derives its governor identically from one place rather than re-copying the same six assignments.
| [in] | site | Loaded descriptor (never NULL). |
site. | (by | value) Defaults with the descriptor's governor fields applied. |
site is non-NULL and was populated by mdl_config_load. site is unchanged.Definition at line 594 of file mdl_config.c.
References mdl_gov_cfg_t::backoff_base_ms, mdl_site_t::backoff_base_ms, mdl_gov_cfg_t::backoff_max_ms, mdl_site_t::backoff_max_ms, mdl_gov_cfg_t::burst, mdl_site_t::burst, mdl_gov_cfg_t::max_inflight, mdl_site_t::max_inflight, mdl_gov_cfg_default(), mdl_gov_cfg_t::rate_per_min, and mdl_site_t::rate_per_min.
Referenced by internal_run_prepared(), and mdl_app_run_discover().
|
nodiscard |
Load a site descriptor from a flat key=value file.
| [in,out] | storage | Initialized portable filesystem binding and exclusive file/I/O workspace. |
| [in] | path | Canonical path beneath the bound filesystem root. |
| [out] | out | Descriptor to fill; defaults are applied first, then the file overrides recognised keys. |
| k_ra8_ok | Loaded and every key/value passed validation. |
| k_ra8_err_invalid_arg | Invalid binding, pointer, or path. |
| k_ra8_err_invalid_size | Descriptor or backend progress bound exceeded. |
| k_ra8_err_invalid_state | A line, key, value, or required field was invalid. |
| other | Open, size, read, or close error propagated by the filesystem. |
storage was initialized by mdl_storage_init and is exclusively owned. path is canonical under the injected binding (for example /sites/a.conf). out. Definition at line 557 of file mdl_config.c.
References internal_config_reader_t::file, mdl_storage_t::file_workspace, mdl_storage_t::file_workspace_bytes, mdl_storage_t::fs, fw_fs_close(), fw_fs_file_size(), fw_fs_open(), internal_config_parse(), internal_config_set_defaults(), internal_config_valid(), mdl_storage_t::io_buffer, mdl_storage_t::io_buffer_bytes, k_config_file_max, k_fw_fs_open_read, k_ra8_err_invalid_arg, k_ra8_err_invalid_size, k_ra8_err_invalid_state, k_ra8_ok, and fw_fs_t::streams.
Referenced by mdl_app_run_discover(), and mdl_app_run_series().