ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
edge_cache_proxy.h File Reference

CDN edge-cache tier - server glue (PROTOCORE_ENABLE_EDGE_CACHE). More...

#include "protocore_config.h"

Go to the source code of this file.

Classes

struct  EdgeProxyNs
 Dispatch table. Addressed by offset, so the layout is asserted below. More...
 

Functions

 PROTOCORE_NS_LAYOUT (EdgeProxyNs, enable, map, bind_sd, add_peer, mesh_serve, reset, purge, purge_prefix, stats)
 
void protocore_edge_proxy_enable (uint8_t *work)
 Enable the edge cache on server: register the cache middleware + .
 
proto_bool protocore_edge_proxy_map (uint8_t *work, const char *path_prefix, const char *origin_base_url)
 Map a request path prefix to an upstream origin (e.g. "/cdn/" -> .
 
void protocore_edge_proxy_bind_sd (uint8_t *work, struct protocore_dbm *dbm)
 Bind an L2 persistent tier: an opened dbm handle (on a mounted WAL .
 
proto_bool protocore_edge_proxy_add_peer (uint8_t *work, const char *host, uint16_t port)
 Add a sibling peer to query on a full local miss before hitting the .
 
void protocore_edge_proxy_mesh_serve (uint8_t *work)
 Serve sibling queries: register the PROTO_MESH handler so this node .
 
void protocore_edge_proxy_reset (uint8_t *work)
 Clear the L1 store, the L2 store (if bound), all route maps, and .
 
proto_bool protocore_edge_proxy_purge (uint8_t *work, const char *canonical_key)
 Invalidate a single canonical key. true if an entry was purged.
 
uint32_t protocore_edge_proxy_purge_prefix (uint8_t *work, const char *path_prefix)
 Invalidate every entry whose request path begins with prefix. the .
 
void protocore_edge_proxy_stats (uint8_t *work, struct EdgeCacheStats *out)
 Snapshot the cache counters.
 
uint8_t * protocore_edge_cache_proxy_span (void)
 The PROTOCORE_EDGE_PROXY_BORROW bytes this module's state lives in.
 

Variables

PROTOCORE_NS EdgeProxyNs EdgeProxy PROTOCORE_UNUSED
 Module namespace.
 

Detailed Description

CDN edge-cache tier - server glue (PROTOCORE_ENABLE_EDGE_CACHE).

Wires the pure engine (edge_cache) + async fetch (edge_fetch) into a PC: registers the cache as a middleware and installs the async-fetch poll hook, maps request path prefixes to upstream origins (fetched over protocore_client), and serves hits with the constant-memory send-pump. A miss or a stale-entry revalidation suspends the client request and drives the origin fetch from the slot's poll, so the worker never stalls; every failure path fails open. Purge + stats round it out.

work is PROTOCORE_EDGE_PROXY_BORROW bytes the CALLER took, at an address it knows. It is not held past the call, so nothing here aliases it. How those bytes are carved is this module's and is never named here.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file edge_cache_proxy.h.

Function Documentation

◆ PROTOCORE_NS_LAYOUT()

PROTOCORE_NS_LAYOUT ( EdgeProxyNs  ,
enable  ,
map  ,
bind_sd  ,
add_peer  ,
mesh_serve  ,
reset  ,
purge  ,
purge_prefix  ,
stats   
)

◆ protocore_edge_proxy_enable()

void protocore_edge_proxy_enable ( uint8_t *  work)

Enable the edge cache on server: register the cache middleware + .

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.

◆ protocore_edge_proxy_map()

proto_bool protocore_edge_proxy_map ( uint8_t *  work,
const char *  path_prefix,
const char *  origin_base_url 
)

Map a request path prefix to an upstream origin (e.g. "/cdn/" -> .

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.
path_prefixPath prefix
origin_base_urlOrigin base url
Returns
PROTO_TRUE on success.

◆ protocore_edge_proxy_bind_sd()

void protocore_edge_proxy_bind_sd ( uint8_t *  work,
struct protocore_dbm *  dbm 
)

Bind an L2 persistent tier: an opened dbm handle (on a mounted WAL .

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.
dbmDbm

◆ protocore_edge_proxy_add_peer()

proto_bool protocore_edge_proxy_add_peer ( uint8_t *  work,
const char *  host,
uint16_t  port 
)

Add a sibling peer to query on a full local miss before hitting the .

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.
hostHost
portPort
Returns
PROTO_TRUE on success.

◆ protocore_edge_proxy_mesh_serve()

void protocore_edge_proxy_mesh_serve ( uint8_t *  work)

Serve sibling queries: register the PROTO_MESH handler so this node .

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.

◆ protocore_edge_proxy_reset()

void protocore_edge_proxy_reset ( uint8_t *  work)

Clear the L1 store, the L2 store (if bound), all route maps, and .

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.

◆ protocore_edge_proxy_purge()

proto_bool protocore_edge_proxy_purge ( uint8_t *  work,
const char *  canonical_key 
)

Invalidate a single canonical key. true if an entry was purged.

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.
canonical_keyCanonical key
Returns
PROTO_TRUE on success.

◆ protocore_edge_proxy_purge_prefix()

uint32_t protocore_edge_proxy_purge_prefix ( uint8_t *  work,
const char *  path_prefix 
)

Invalidate every entry whose request path begins with prefix. the .

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.
path_prefixPath prefix
Returns
The uint32_t.

◆ protocore_edge_proxy_stats()

void protocore_edge_proxy_stats ( uint8_t *  work,
struct EdgeCacheStats *  out 
)

Snapshot the cache counters.

Parameters
workPROTOCORE_EDGE_PROXY_BORROW bytes the caller took. Not held past the call.
outOut

◆ protocore_edge_cache_proxy_span()

uint8_t * protocore_edge_cache_proxy_span ( void  )

The PROTOCORE_EDGE_PROXY_BORROW bytes this module's state lives in.

Stated beside the namespace rather than on it: an entry takes a borrow, and this is where that borrow comes from. Taken once from the end of the pool, which no mark and no release walks, so the state lasts the life of the program.

Returns
the span.

Variable Documentation

◆ PROTOCORE_UNUSED

PROTOCORE_NS EdgeProxyNs EdgeProxy PROTOCORE_UNUSED
Initial value:
proto_bool protocore_edge_proxy_purge(uint8_t *work, const char *canonical_key)
Invalidate a single canonical key. true if an entry was purged.
uint32_t protocore_edge_proxy_purge_prefix(uint8_t *work, const char *path_prefix)
Invalidate every entry whose request path begins with prefix. the .
void protocore_edge_proxy_bind_sd(uint8_t *work, struct protocore_dbm *dbm)
Bind an L2 persistent tier: an opened dbm handle (on a mounted WAL .
void protocore_edge_proxy_stats(uint8_t *work, struct EdgeCacheStats *out)
Snapshot the cache counters.
void protocore_edge_proxy_enable(uint8_t *work)
Enable the edge cache on server: register the cache middleware + .
proto_bool protocore_edge_proxy_map(uint8_t *work, const char *path_prefix, const char *origin_base_url)
Map a request path prefix to an upstream origin (e.g. "/cdn/" -> .
void protocore_edge_proxy_reset(uint8_t *work)
Clear the L1 store, the L2 store (if bound), all route maps, and .
void protocore_edge_proxy_mesh_serve(uint8_t *work)
Serve sibling queries: register the PROTO_MESH handler so this node .
proto_bool protocore_edge_proxy_add_peer(uint8_t *work, const char *host, uint16_t port)
Add a sibling peer to query on a full local miss before hitting the .

Module namespace.

Definition at line 118 of file edge_cache_proxy.h.