GALANTHUS / ABI FUNCTION REFERENCE
gln_load_local_cache
Declared in <galanthus/c_api/gln_capi.h>.
GLN_API gln_status_t GLN_CALL gln_load_local_cache(
const char* in_cache_path,
const char* in_key_path_or_null,
uint8_t** out_payload,
size_t* out_payload_len,
gln_error_t* out_error);
Purpose
Loads and decrypts one local-cache payload previously written by gln_save_local_cache.
A missing cache file is reported with GLN_ERR_NOT_FOUND after clearing the output payload pointer and length.
Nullable parameter slots (in_key_path_or_null, out_error) may be passed as NULL; all other non-value parameters follow the nullability shown in the table.
Return
Returns GLN_OK on success and a non-OK gln_status_t value on failure.
| Type | Nullability | Ownership |
|---|---|---|
gln_status_t | value | value |
Parameters
| Name | Direction | Type | Nullability | Ownership |
|---|---|---|---|---|
in_cache_path | input | const char* | nonnull | borrowed |
in_key_path_or_null | input | const char* | nullable | borrowed |
out_payload | output | uint8_t** | nonnull | transferred_out |
out_payload_len | output | size_t* | nonnull | caller_allocated_output |
out_error | output | gln_error_t* | nullable | caller_allocated_output |
Path Semantics
in_cache_path and in_key_path_or_null must identify the same payload and sidecar pair used for saving.
Missing Cache
When the payload has not been saved, the function returns GLN_ERR_NOT_FOUND and sets *out_payload to NULL and *out_payload_len to zero.
Output Ownership
On GLN_OK, *out_payload is owned by the caller and must be released with gln_release_buffer. A zero-length cache may return NULL with length zero.
Failure Cases
Tampering, wrong sidecar key, wrong protected-key purpose, malformed ciphertext, or payloads above the storage layer's maximum decompressed size return a non-OK status.