| 9358 | bool ok = kv_read_header(fp, &hdr, &text_bytes); |
| 9359 | uint64_t skip = (uint64_t)text_bytes + hdr.payload_bytes; |
| 9360 | if (ok && hdr.model_id == model_id && (hdr.ext_flags & KV_EXT_TOOL_MAP) && |
| 9361 | skip <= (uint64_t)INT64_MAX && |
| 9362 | fseeko(fp, (off_t)skip, SEEK_CUR) == 0) |
| 9363 | { |
| 9364 | kv_tool_map_load_from_pos(s, fp, &wanted); |
| 9365 | } |
| 9366 | fclose(fp); |
| 9367 | } |
| 9368 | closedir(d); |
| 9369 | id_list_free(&wanted); |
| 9370 | } |
| 9371 | |
| 9372 | #ifdef DS4_SERVER_TEST |
| 9373 | static double kv_entry_eviction_score(const kv_entry *e, const ds4_tokens *live, |
| 9374 | uint64_t now, |
| 9375 | const ds4_kvstore_eviction_context *incoming) { |
| 9376 | return ds4_kvstore_entry_eviction_score(e, live, now, incoming); |
| 9377 | } |
| 9378 | #endif |
| 9379 | |
| 9380 | #ifdef DS4_SERVER_TEST |
| 9381 | static void kv_cache_evict(kv_disk_cache *kc, const ds4_tokens *live, |
| 9382 | uint64_t extra_bytes, |
| 9383 | const ds4_kvstore_eviction_context *incoming) { |
| 9384 | ds4_kvstore_evict(kc, live, extra_bytes, incoming); |
| 9385 | } |
| 9386 | #endif |
| 9387 | |
| 9388 | static void kv_cache_log_cb(void *ud, ds4_kvstore_log_type type, const char *msg) { |
| 9389 | (void)ud; |
| 9390 | ds4_log_type stype = DS4_LOG_KVCACHE; |
| 9391 | if (type == DS4_KVSTORE_LOG_DEFAULT) stype = DS4_LOG_DEFAULT; |
| 9392 | else if (type == DS4_KVSTORE_LOG_WARNING) stype = DS4_LOG_WARNING; |
| 9393 | server_log(stype, "%s", msg); |
| 9394 | } |
no test coverage detected