ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_app.h
Go to the documentation of this file.
1
31#pragma once
32
33#include <stddef.h>
34#include <stdint.h>
35
36#include "mdl_cache.h"
37#include "mdl_export.h"
38#include "mdl_extract.h"
39#include "mdl_format.h"
40#include "mdl_library.h"
41#include "mdl_net.h"
42#include "mdl_session.h"
43#include "mdl_state.h"
44#include "mdl_storage.h"
45#include "ra8_err.h"
46#include "ra8_io_stream.h"
47
54typedef enum : uint32_t {
55 k_page_buf_bytes = 8U * 1024U * 1024U,
56 k_export_arena_bytes = 96U * 1024U * 1024U,
59
83
103
114typedef struct {
115 const char* cfg_path;
116 const char* series_url;
117 const char* out_dir;
118 const char* cache_dir;
120 bool combine;
121 bool update;
123 double from_num;
124 size_t chapters;
125 uint64_t seed;
126 uint32_t timeout;
129
140typedef struct {
141 const char* cfg_path;
142 const char* term;
143 size_t pick;
144 uint32_t timeout;
145 uint64_t seed;
146 bool browse;
148
181
213
231
247int mdl_app_run_list(const char* out_dir);
248
267int mdl_app_run_remove(const char* out_dir, const char* url_or_slug);
268
285
305 const mdl_run_opts_t* opts,
306 const mdl_series_run_t* base);
307
324int mdl_app_run_verify(const char* target_dir);
325
344int mdl_app_run_init_site(const char* url, const char* descriptor_dir);
345
363int mdl_app_run_pack(const char* dir, mdl_format_t format);
364
384int mdl_app_run_artifact(const char* url,
385 const char* out_dir,
386 uint32_t timeout,
387 const mdl_run_opts_t* opts);
388
411int mdl_app_run_page(const char* url,
412 const char* out_dir,
413 const char* attr,
414 uint32_t max_imgs,
415 uint64_t seed,
416 uint32_t timeout,
417 const mdl_run_opts_t* opts);
int mdl_app_run_artifact(const char *url, const char *out_dir, uint32_t timeout, const mdl_run_opts_t *opts)
Download, validate and atomically publish one direct artifact.
int mdl_app_run_update_all(const mdl_series_run_t *base)
Incrementally update every tracked series under a library root.
int mdl_app_run_discover(const mdl_discover_run_t *req, const mdl_run_opts_t *opts, const mdl_series_run_t *base)
Run search or browse discovery and optionally download one result.
int mdl_app_run_verify(const char *target_dir)
Verify one library or artifact tree without mutating it.
int mdl_app_run_init_site(const char *url, const char *descriptor_dir)
Create a starter descriptor for one validated site URL.
int mdl_app_run_remove(const char *out_dir, const char *url_or_slug)
Remove one explicitly tracked series directory.
int mdl_app_run_page(const char *url, const char *out_dir, const char *attr, uint32_t max_imgs, uint64_t seed, uint32_t timeout, const mdl_run_opts_t *opts)
Download image resources from one direct page URL.
int mdl_app_run_pack(const char *dir, mdl_format_t format)
Package an existing image directory without network access.
int mdl_app_run_list(const char *out_dir)
List every tracked series under one library root.
void mdl_app_bind(mdl_app_context_t *ctx)
Bind the caller-owned working set every application mode will use.
Definition mdl_app.c:28
int mdl_app_run_series(const mdl_series_run_t *run)
Execute one prepared series download.
mdl_app_limits_t
Fixed sizing for one application composition (large buffers in .bss).
Definition mdl_app.h:54
@ k_page_buf_bytes
Max HTML page size.
Definition mdl_app.h:55
@ k_storage_work_bytes
Per-handle FS backend state.
Definition mdl_app.h:57
@ k_export_arena_bytes
Host export scratch ceiling.
Definition mdl_app.h:56
Bounded per-host HTTP document cache for the media downloader.
Package a downloaded chapter folder into a reader-openable container.
struct mdl_export_workspace mdl_export_workspace_t
Caller-owned bounded arena for all exporter scratch state.
Extract image URLs and anchor links from an HTML page (v1 scanner).
@ k_mdl_url_max
Max bytes per URL, including the NUL.
Definition mdl_extract.h:25
Shared media artifact format contract for download and export paths.
mdl_format_t
Artifact format selected by a media-download composition root.
Definition mdl_format.h:35
Portable bounded operations over a tracked media library.
Streaming HTTP(S) GET seam (a real function-pointer vtable) for the host manga downloader (v0).
Session identity (honest User-Agent) and robots.txt gating.
Persistent per-series library state for the media downloader.
mdl_state_reading_direction_t
Persisted fixed-layout reading direction.
Definition mdl_state.h:108
@ k_mdl_language_max
BCP-47 language bytes.
Definition mdl_state.h:101
@ k_mdl_person_max
Writer/artist bytes.
Definition mdl_state.h:100
@ k_mdl_summary_max
Series summary bytes.
Definition mdl_state.h:99
@ k_mdl_title_max
Series title bytes.
Definition mdl_state.h:98
Injected portable storage resources for downloader domain code.
@ k_mdl_storage_io_bytes
One bounded read/write chunk.
Definition mdl_storage.h:28
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_io targetable byte-stream facade – one writer, many destinations.
The one bounded working set every application mode shares.
Definition mdl_app.h:162
max_align_t align
Force backend alignment.
Definition mdl_app.h:176
mdl_series_metadata_t series_metadata
Current scraped metadata.
Definition mdl_app.h:179
mdl_library_workspace_t library_workspace
Bounded tree-removal stack.
Definition mdl_app.h:174
mdl_session_t session
Network policy session.
Definition mdl_app.h:163
ra8_io_stream_t * output
Borrowed command output sink.
Definition mdl_app.h:166
ra8_err_t io_error
First presenter sink failure.
Definition mdl_app.h:168
mdl_url_list_t images
Prepared page image URLs.
Definition mdl_app.h:171
mdl_export_workspace_t export_ws
Bounded exporter arena view.
Definition mdl_app.h:164
mdl_cache_index_t cache_index
One loaded per-host index.
Definition mdl_app.h:173
mdl_storage_t storage
Injected filesystem facade.
Definition mdl_app.h:165
ra8_io_stream_t * diagnostic
Borrowed diagnostic sink.
Definition mdl_app.h:167
mdl_url_list_t chapters
Prepared chapter URLs.
Definition mdl_app.h:170
char page[k_page_buf_bytes]
Whole-page HTML buffer.
Definition mdl_app.h:169
uint8_t bytes[k_mdl_storage_io_bytes]
Second directory cursor.
Definition mdl_app.h:177
mdl_state_t state
Persistent tracked state.
Definition mdl_app.h:172
Caller-owned workspace for one loaded host index.
Definition mdl_cache.h:54
One search or browse request against a configured site descriptor.
Definition mdl_app.h:140
const char * term
Search term; unused when browsing.
Definition mdl_app.h:142
uint32_t timeout
Per-request budget, ms.
Definition mdl_app.h:144
const char * cfg_path
Site descriptor path.
Definition mdl_app.h:141
bool browse
Browse latest updates instead of search.
Definition mdl_app.h:146
size_t pick
1-based hit to download; 0 lists only.
Definition mdl_app.h:143
uint64_t seed
Governor jitter seed.
Definition mdl_app.h:145
Caller-owned directory cursor storage and iterative traversal stack.
Definition mdl_library.h:53
Session-wide security policy for the network backend.
Definition mdl_net.h:81
An injected FACTORY for mdl_net_iface_t: which backend, decided once.
Cross-cutting policy and injected transport threaded into every mode.
Definition mdl_app.h:73
mdl_net_policy_t policy
Backend security policy.
Definition mdl_app.h:74
const char * contact
Operator contact override, or NULL.
Definition mdl_app.h:76
bool polite
True to raise per-host delays.
Definition mdl_app.h:78
bool progress
True to draw a progress bar.
Definition mdl_app.h:80
bool refetch
True to bypass verified page reuse.
Definition mdl_app.h:81
bool allow_incomplete
True to package a run with failures.
Definition mdl_app.h:79
const mdl_net_provider_t * net
Injected transport factory.
Definition mdl_app.h:75
bool honor_robots
False when robots.txt is ignored.
Definition mdl_app.h:77
Bounded metadata scraped while the series HTML is resident.
Definition mdl_app.h:93
char language[k_mdl_language_max]
BCP-47 language tag.
Definition mdl_app.h:99
char title[k_mdl_title_max]
Display title.
Definition mdl_app.h:94
char artist[k_mdl_person_max]
Artist/illustrator.
Definition mdl_app.h:97
mdl_state_reading_direction_t direction
Page progression.
Definition mdl_app.h:100
char cover_url[k_mdl_url_max]
Resolved remote cover.
Definition mdl_app.h:98
bool title_selected
Title selector succeeded.
Definition mdl_app.h:101
char summary[k_mdl_summary_max]
Synopsis/description.
Definition mdl_app.h:95
char writer[k_mdl_person_max]
Writer/author.
Definition mdl_app.h:96
Parameters of one series download, as values rather than arguments.
Definition mdl_app.h:114
bool combine
Combine into one archive.
Definition mdl_app.h:120
uint64_t seed
Politeness jitter seed.
Definition mdl_app.h:125
bool update
Incremental (skip complete).
Definition mdl_app.h:121
const char * out_dir
Output library root.
Definition mdl_app.h:117
mdl_format_t format
Output container.
Definition mdl_app.h:119
double from_num
First chapter number to fetch.
Definition mdl_app.h:123
bool from_present
Whether from_num applies.
Definition mdl_app.h:122
const char * cfg_path
Site descriptor path.
Definition mdl_app.h:115
uint32_t timeout
Per-request budget, ms.
Definition mdl_app.h:126
size_t chapters
Max chapters (window mode).
Definition mdl_app.h:124
const char * series_url
Series page URL.
Definition mdl_app.h:116
const char * cache_dir
Per-host persistent cache root.
Definition mdl_app.h:118
const mdl_run_opts_t * opts
Identity/security knobs.
Definition mdl_app.h:127
One download session's identity and robots.txt state.
Definition mdl_session.h:39
One series' complete persistent state (declare at file scope).
Definition mdl_state.h:175
One non-reentrant downloader filesystem dependency bundle.
Definition mdl_storage.h:40
Bounded list of absolute URLs found on a page.
Definition mdl_extract.h:29
Caller-allocated byte-stream handle binding a sink to its context.