Loading...
Searching...
No Matches
cache.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Hamburg University of Technology (TUHH)
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
21#include "clist.h"
22
23#include <stdint.h>
24#include <stdbool.h>
25
26#include "bplib.h"
27#include "bplib_stor_vfs.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
42typedef struct {
46 uint64_t node;
48 uint64_t service;
50 uint64_t expiry;
55 uint8_t index;
57
72
90 uint64_t node, uint64_t service, uint64_t expiry, uint8_t index);
91
101int bplib_cache_get(cache_list_t* cache, char* bundle_path);
102
109
116
117#ifdef __cplusplus
118}
119#endif
120
Generic functions for vfs based storage.
Circular linked list.
list_node_t clist_node_t
List node structure.
Definition clist.h:104
#define CONFIG_BPLIB_EGRESS_CACHE_LEN
Number of bundle references to be cached.
void bplib_cache_mark_front_consumed(cache_list_t *cache)
Actually pop the front of the loadbuffer / cache.
int bplib_cache_add(cache_list_t *cache, uint64_t node, uint64_t service, uint64_t expiry, uint8_t index)
Add a bundle to the lookup cache.
int bplib_cache_get(cache_list_t *cache, char *bundle_path)
Peek the given cache queue.
bool bplib_cache_is_empty(cache_list_t *cache)
Check if the cache is empty.
Bundle Cache element, containing information to uniquely identify a bundle on vfs.
Definition cache.h:42
uint64_t node
destination node ID of the bundle
Definition cache.h:46
clist_node_t list
clist base
Definition cache.h:44
uint64_t expiry
expiry time of the bundle
Definition cache.h:50
uint8_t index
Index in the storage.
Definition cache.h:55
uint64_t service
destination service ID of the bundle
Definition cache.h:48
Bundle cache.
Definition cache.h:64
bool all_bundles_queued
Whether all bundles in the storage are in the queue.
Definition cache.h:70
clist_node_t list
Head pointer of the clist.
Definition cache.h:66
cache_list_node_t nodes[CONFIG_BPLIB_EGRESS_CACHE_LEN]
Collection of possible cache nodes.
Definition cache.h:68