63 "mdl: state file unreadable or corrupt while ",
70 "mdl: library capacity exceeded while ",
84 "mdl: library storage unavailable while ",
89 "mdl: library operation failed while ",
116 const char* state_path,
135 *out_continue = output_error ==
k_ra8_ok;
152 }
else if (list.
found == 0U) {
154 "no tracked series under ",
188 "mdl: cannot resolve series '",
197 "mdl: refusing to remove unsafe series path '",
202 char state_path[PATH_MAX];
203 bool state_exists =
false;
208 "mdl: refusing to remove untracked directory '",
210 "' (missing or unsafe .mdl_state)\n");
217 "mdl: refusing to remove '",
219 "' (state is unreadable or corrupt)\n");
225 sizeof(recorded_slug));
230 "mdl: refusing to remove '",
232 "' (state identity does not match target)\n");
248 "mdl: failed to remove ",
288 const char* state_path,
297 (void)snprintf(url,
sizeof(url),
"%s", state->
series_url);
302 if ((url[0] ==
'\0') || (cfg[0] ==
'\0')) {
306 " (no series URL / descriptor "
309 *out_continue = output_error ==
k_ra8_ok;
315 *out_continue =
false;
319 run.series_url = url;
327 *out_continue =
true;
344 "no tracked series to update under ",
357 " series failed to update\n");
ra8_err_t fw_fs_stat(const fw_fs_namespace_t *names, const char *path, fw_fs_stat_t *out)
Query a path; a miss is success with out->exists == false.
@ k_fw_fs_node_directory
Directory.
mdl_app_context_t * priv_mdl_app_context(void)
The working set the composition root bound with mdl_app_bind.
int mdl_app_run_series(const mdl_series_run_t *run)
Execute one prepared series download.
Module-private contract shared by the application-mode translation units.
@ k_dir_path_bytes
Directory-path buffer.
@ k_cov_bytes
Coverage summary line buffer.
@ k_slug_bytes
Series slug buffer.
bool priv_mdl_app_state_path_of(const char *abs_dir, char *out, size_t cap)
Compose the state-journal path within a series directory.
static ra8_err_t internal_list_cb(const char *series_dir, const char *state_path, const mdl_state_t *state, void *ctx, bool *out_continue)
Print one tracked series for library-list mode.
static ra8_err_t internal_library_report(const char *action, ra8_err_t error)
Report a portable library-enumeration failure in user-facing terms.
int mdl_app_run_update_all(const mdl_series_run_t *base)
Incrementally update every tracked series under a library root.
static ra8_err_t internal_update_all_cb(const char *series_dir, const char *state_path, const mdl_state_t *state, void *ctx, bool *out_continue)
Incrementally update one visited tracked series.
static ra8_err_t internal_library_text3(ra8_io_stream_t *stream, const char *first, const char *second, const char *third)
Write up to three borrowed fragments through one selected sink.
static bool internal_resolve_removal_target(const char *out_dir, const char *url_or_slug, char *dir)
Resolve and authenticate one tracked library-removal target.
int mdl_app_run_remove(const char *out_dir, const char *url_or_slug)
Remove one explicitly tracked series directory.
int mdl_app_run_list(const char *out_dir)
List every tracked series under one library root.
ra8_err_t mdl_library_for_each(mdl_storage_t *storage, const char *out_dir, mdl_state_t *state_scratch, mdl_library_workspace_t *workspace, const mdl_library_policy_t *policy, mdl_library_fn callback, void *callback_ctx)
Visit every authenticated tracked series under a library root.
mdl_library_policy_t mdl_library_policy_default(void)
Return the production library traversal policy.
ra8_err_t mdl_library_remove_tree(mdl_storage_t *storage, const char *dir, const mdl_library_policy_t *policy, mdl_library_workspace_t *workspace)
Remove one canonical directory tree through portable namespace calls.
bool mdl_path_join(const char *parent, const char *seg, char *out, size_t cap)
Join one safe child segment under a parent directory path.
void mdl_state_coverage(const mdl_state_t *st, char *buf, size_t cap)
Render a one-line coverage summary (chapter span, count, gaps).
@ k_mdl_cfgpath_max
Site-descriptor path bytes.
ra8_err_t mdl_state_load_authenticated(mdl_storage_t *storage, const char *path, mdl_state_t *st)
Load only an authenticated checksummed state generation.
ra8_err_t mdl_state_probe(mdl_storage_t *storage, const char *path, bool *out_exists)
Probe the complete two-generation state marker through portable storage.
ra8_err_t priv_mdl_stream_text(ra8_err_t prior, ra8_io_stream_t *stream, const char *text)
Append text unless an earlier operation already failed.
ra8_err_t priv_mdl_stream_u64(ra8_err_t prior, ra8_io_stream_t *stream, uint64_t value)
Append one unsigned integer unless an earlier append failed.
void mdl_urlname_last_segment(const char *url, char *out, size_t cap)
Sanitised last non-empty path segment of a URL.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_hw_not_ready
Hardware peripheral exists but not ready yet.
@ k_ra8_err_invalid_size
Invalid size parameter (too large, too small, or misaligned).
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
int strcmp(const char *s1, const char *s2)
Compare two null-terminated strings.
Result of a portable metadata query.
bool exists
False means a clean lookup miss.
fw_fs_node_type_t type
Kind of node at the path.
size_t found
Authenticated tracked series encountered.
mdl_library_workspace_t library_workspace
Bounded tree-removal stack.
Caller-selected limits within the compile-time hard ceilings.
Caller-owned directory cursor storage and iterative traversal stack.
uint32_t required_entries
Entries observed through cap+1.
uint32_t entry_limit
Active explicit traversal limit.
Parameters of one series download, as values rather than arguments.
const char * out_dir
Output library root.
const char * cfg_path
Site descriptor path.
One series' complete persistent state (declare at file scope).
char series_url[k_mdl_url_max]
Series page URL.
char config_path[k_mdl_cfgpath_max]
Descriptor used.
Caller-allocated byte-stream handle binding a sink to its context.
Context threaded through internal_update_all_cb for --update-all.
size_t updated
Count of series updated.
size_t failed
Count of series skipped or unsuccessfully updated.
const mdl_series_run_t * base
Template run (format/knobs); url filled per series.