ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_fetch_internal.h
Go to the documentation of this file.
1
19
20#pragma once
21
22#include <stddef.h>
23#include <stdint.h>
24
25#include "mdl_fetch.h"
26#include "mdl_net.h"
27#include "ra8_attributes.h"
28#include "ra8_err.h"
29
32
46
69 const char* url,
70 const mdl_net_req_t* request,
71 char* buffer,
72 size_t capacity,
73 size_t* out_length,
74 mdl_net_resp_t* response);
75
81typedef struct {
84 const char* chapter_id;
86
88typedef enum : uint16_t {
91
131
166
192RA8_PRIV void priv_mdl_fetch_reason(ra8_err_t err, long status, char* buf, size_t cap);
193
208RA8_PRIV void
209priv_mdl_fetch_record_fail(const mdl_fetch_ctx_t* ctx, const char* url, long status, ra8_err_t err);
210
226
250 const char* host,
251 const char* url,
252 const mdl_net_req_t* req,
254 uint32_t jmin,
255 uint32_t jmax,
256 mdl_net_resp_t* out_resp,
257 size_t* out_bytes);
258
281 const char* chapter_url,
282 const char* dest_abs,
283 const char* dest_rel,
284 size_t base,
286 mdl_fetch_stats_t* stats,
287 const mdl_run_pos_t* pos);
State-aware chapter/page download orchestrator for the media downloader.
ra8_err_t priv_mdl_fetch_chapter_pages(mdl_fetch_ctx_t *ctx, const char *chapter_url, const char *dest_abs, const char *dest_rel, size_t base, mdl_chapter_rec_t *rec, mdl_fetch_stats_t *stats, const mdl_run_pos_t *pos)
Fetch and checkpoint every extracted page in one chapter.
ra8_err_t priv_mdl_fetch_checkpoint(const mdl_fetch_ctx_t *ctx)
Persist the current fetch state when a checkpoint path is configured.
Definition mdl_fetch.c:193
struct mdl_fetch_cache_request mdl_fetch_cache_request_t
Caller-owned governor parameters for one cached buffer fetch.
bool priv_mdl_fetch_run_incomplete(const mdl_fetch_stats_t *stats)
Whether a finished run left anything unfetched (chapter or page).
Definition mdl_fetch.c:115
bool priv_mdl_fetch_is_retryable(ra8_err_t rc)
Whether a failed transfer result is worth retrying.
Definition mdl_fetch.c:110
ra8_err_t priv_mdl_fetch_with_retry(mdl_fetch_ctx_t *ctx, const char *host, const char *url, const mdl_net_req_t *req, mdl_net_body_sink_t *sink, uint32_t jmin, uint32_t jmax, mdl_net_resp_t *out_resp, size_t *out_bytes)
Perform one bounded governed file transfer with retry classification.
Definition mdl_fetch.c:264
void priv_mdl_fetch_record_fail(const mdl_fetch_ctx_t *ctx, const char *url, long status, ra8_err_t err)
Record one classified failure in the caller's bounded log.
Definition mdl_fetch.c:175
void priv_mdl_fetch_reason(ra8_err_t err, long status, char *buf, size_t cap)
Render a human-readable reason for a transfer result and HTTP status.
Definition mdl_fetch.c:130
ra8_err_t priv_mdl_fetch_cache_get_buf(void *context, const char *url, const mdl_net_req_t *request, char *buffer, size_t capacity, size_t *out_length, mdl_net_resp_t *response)
Fetch one cache buffer through governor and bounded retry policy.
Definition mdl_fetch.c:421
mdl_fetch_reason_size_t
Buffer size the priv_mdl_fetch_reason renderer never overruns.
@ k_mdl_reason_max
Failure-reason string buffer bytes.
Streaming HTTP(S) GET seam (a real function-pointer vtable) for the host manga downloader (v0).
@ k_mdl_gov_host_max
Host-key buffer bytes (matches config).
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
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
One chapter's coverage in library state.
Definition mdl_state.h:128
Governed retry context for one cache buffer callback.
mdl_fetch_ctx_t * ctx
Active fetch dependencies.
char host[k_mdl_gov_host_max]
Governor host key.
uint32_t jmin
Minimum request delay.
uint32_t jmax
Maximum request delay.
Everything mdl_fetch_run needs, injected for testability.
Definition mdl_fetch.h:164
Tallies a fetch run reports back (all zero-initialised by the run).
Definition mdl_fetch.h:65
Caller-owned lifecycle and write seam for one response body.
Definition mdl_net.h:162
Per-request session parameters.
Definition mdl_net.h:43
Per-transfer response metadata surfaced to the politeness governor.
Definition mdl_net.h:120
Stable chapter position carried into per-page progress events.
size_t chapter_total
Total chapters in the run.
size_t chapter_index
1-based chapter position in the run.
const char * chapter_id
Stable chapter identifier.