ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
mdl_cache.h
Go to the documentation of this file.
1
11#pragma once
12
13#include <stddef.h>
14#include <stdint.h>
15
16#include "mdl_config.h"
17#include "mdl_net.h"
18#include "mdl_state.h"
19#include "mdl_storage.h"
20#include "ra8_err.h"
21#include "ra8_io_stream.h"
22
28
47
60
78typedef ra8_err_t (*mdl_cache_fetch_fn)(void* context,
79 const char* url,
80 const mdl_net_req_t* request,
81 char* buffer,
82 size_t capacity,
83 size_t* out_length,
84 mdl_net_resp_t* response);
85
99
112
143[[nodiscard]] ra8_err_t mdl_cache_get_buf(mdl_cache_t* cache,
144 const char* url,
145 const mdl_net_req_t* base_request,
146 mdl_cache_fetch_fn fetch,
147 void* fetch_context,
148 char* buffer,
149 size_t capacity,
150 size_t* out_length,
151 mdl_net_resp_t* response,
152 mdl_cache_result_t* result);
ra8_err_t(* mdl_cache_fetch_fn)(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)
Injected bounded GET callback used by the cache.
Definition mdl_cache.h:78
mdl_cache_limit_t
Persistent cache schema and fixed-capacity record bound.
Definition mdl_cache.h:24
@ k_mdl_cache_schema_version
Current binary index schema.
Definition mdl_cache.h:25
@ k_mdl_cache_record_max
Records retained per host.
Definition mdl_cache.h:26
ra8_err_t mdl_cache_get_buf(mdl_cache_t *cache, const char *url, const mdl_net_req_t *base_request, mdl_cache_fetch_fn fetch, void *fetch_context, char *buffer, size_t capacity, size_t *out_length, mdl_net_resp_t *response, mdl_cache_result_t *result)
Fetch one document through the per-host persistent cache.
Definition mdl_cache.c:537
Per-site descriptor loaded from a flat key=value config file.
@ k_mdl_url_max
Max bytes per URL, including the NUL.
Definition mdl_extract.h:25
Streaming HTTP(S) GET seam (a real function-pointer vtable) for the host manga downloader (v0).
@ k_mdl_last_mod_max
Raw Last-Modified header value buffer bytes.
Definition mdl_net.h:95
@ k_mdl_etag_max
Raw ETag header value buffer bytes.
Definition mdl_net.h:94
Persistent per-series library state for the media downloader.
@ k_mdl_relpath_max
Page path relative to the series dir.
Definition mdl_state.h:102
Injected portable storage resources for downloader domain code.
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.
Caller-owned workspace for one loaded host index.
Definition mdl_cache.h:54
uint64_t host_hash
Bound host identity.
Definition mdl_cache.h:56
uint16_t schema_version
Binary schema version.
Definition mdl_cache.h:57
mdl_cache_record_t records[k_mdl_cache_record_max]
Retained observations.
Definition mdl_cache.h:55
uint16_t record_count
Populated rows.
Definition mdl_cache.h:58
One exact URL-keyed cached document observation.
Definition mdl_cache.h:37
uint64_t content_hash
Exact persisted body identity.
Definition mdl_cache.h:43
char url[k_mdl_url_max]
Exact canonical request URL.
Definition mdl_cache.h:38
char etag[k_mdl_etag_max]
Last response ETag, or empty.
Definition mdl_cache.h:40
char last_modified[k_mdl_last_mod_max]
Last-Modified, or empty.
Definition mdl_cache.h:41
uint64_t url_hash
FNV identity accelerator.
Definition mdl_cache.h:42
uint16_t response_status
Last observed HTTP status.
Definition mdl_cache.h:45
int64_t fetched_at
Completion epoch seconds.
Definition mdl_cache.h:44
char relative_path[k_mdl_relpath_max]
Body leaf beneath the host dir.
Definition mdl_cache.h:39
Observable outcome of one cache lookup.
Definition mdl_cache.h:105
bool body_reused
Returned bytes came from verified storage.
Definition mdl_cache.h:108
bool revalidated
A network request was issued.
Definition mdl_cache.h:109
bool index_rebuilt
A corrupt index was discarded first.
Definition mdl_cache.h:110
int64_t age_seconds
Age before this operation, or -1 if unknown.
Definition mdl_cache.h:106
uint16_t observed_status
Network or retained status.
Definition mdl_cache.h:107
One non-reentrant cache binding over caller storage.
Definition mdl_cache.h:92
bool refetch
Force a network revalidation.
Definition mdl_cache.h:97
const char * root
Canonical cache root.
Definition mdl_cache.h:95
mdl_storage_t * storage
Injected portable storage binding.
Definition mdl_cache.h:93
mdl_cache_index_t * index
Caller-owned index workspace.
Definition mdl_cache.h:94
ra8_io_stream_t * diagnostic
Optional cache event sink.
Definition mdl_cache.h:96
Per-request session parameters.
Definition mdl_net.h:43
Per-transfer response metadata surfaced to the politeness governor.
Definition mdl_net.h:120
One non-reentrant downloader filesystem dependency bundle.
Definition mdl_storage.h:40
Caller-allocated byte-stream handle binding a sink to its context.