Cache for ordered egress. More...
Cache for ordered egress.
clist based cache ordered by expiry time
Definition in file cache.h.
#include "clist.h"#include <stdint.h>#include <stdbool.h>#include "bplib.h"#include "bplib_stor_vfs.h"
Include dependency graph for cache.h:Go to the source code of this file.
Data Structures | |
| struct | cache_list_node_t |
| Bundle Cache element, containing information to uniquely identify a bundle on vfs. More... | |
| struct | cache_list_t |
| Bundle cache. More... | |
| 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. | |
| void | bplib_cache_mark_front_consumed (cache_list_t *cache) |
| Actually pop the front of the loadbuffer / cache. | |
| bool | bplib_cache_is_empty (cache_list_t *cache) |
| Check if the cache is empty. | |
| 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.
It will not be added if the cache is full with more urgent bundles. If a bundle in the cache is less urgent, it will be replaced.
| cache | Cache instance |
| node | Destinatione node ID of the bundle |
| service | Destinatione service ID of the bundle |
| expiry | Expiry DTN time of the bundle |
| index | Index in the storage, in case the above do not uniquely identify a bundle. |
| 1 | if the new entry was NOT stored, since the cache is full with more urgent bundles |
| 2 | if the new entry was stored and replaced another entry |
| 0 | if the new entry was stored but without replacement |
| int bplib_cache_get | ( | cache_list_t * | cache, |
| char * | bundle_path ) |
Peek the given cache queue.
Does not consume the front element, that has to be done with bplib_cache_mark_front_consumed()
| cache | cache instance |
| bundle_path | buffer for the string of the file path. Has to hold BPLIB_STOR_PATHLEN bytes. |
| bool bplib_cache_is_empty | ( | cache_list_t * | cache | ) |
Check if the cache is empty.
| cache | Cache instance |
| void bplib_cache_mark_front_consumed | ( | cache_list_t * | cache | ) |
Actually pop the front of the loadbuffer / cache.
| cache | Cache instance |