|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
CDN edge-cache tier - async origin-fetch engine (PROTOCORE_ENABLE_EDGE_CACHE). More...
#include "protocore_config.h"Go to the source code of this file.
Classes | |
| struct | EdgeFetchTransport |
| The origin transport, bound to protocore_client on the device and a mock in host tests. More... | |
| struct | EdgeFetch |
| One in-flight origin fetch (fixed-size, zero-heap). More... | |
| struct | EdgeFetchNs |
| Dispatch table. Addressed by offset, so the layout is asserted below. More... | |
Typedefs | |
| typedef struct EdgeFetchTransport | EdgeFetchTransport |
| The origin transport, bound to protocore_client on the device and a mock in host tests. | |
| typedef enum PROTO_ENUM_PACKED | EdgeFetchStatus |
| Fetch progress. | |
Enumerations | |
| enum | PROTO_ENUM_PACKED { EDGE_FETCH_STATUS_PENDING , EDGE_FETCH_STATUS_DONE , EDGE_FETCH_STATUS_OVERSIZE , EDGE_FETCH_STATUS_FAILED } |
| Fetch progress. More... | |
Functions | |
| PROTOCORE_NS_LAYOUT (EdgeFetchNs, begin, pump, end, edge_resp_complete) | |
| void | protocore_edge_fetcher_begin (uint8_t *work, EdgeFetch *f, const EdgeFetchTransport *t, const char *host, uint16_t port, const void *request, size_t req_len, uint32_t now_ms) |
| Open the origin connection and park request; begin the fetch. Sets . | |
| EdgeFetchStatus | protocore_edge_fetcher_pump (uint8_t *work, EdgeFetch *f, const EdgeFetchTransport *t, uint32_t now_ms) |
| Drain available bytes and advance. On DONE the response is parsed . | |
| void | protocore_edge_fetcher_end (uint8_t *work, EdgeFetch *f, const EdgeFetchTransport *t) |
| Release the transport connection (idempotent). | |
| proto_bool | protocore_edge_fetcher_edge_resp_complete (uint8_t *work, const uint8_t *buf, size_t len, proto_bool conn_closed, size_t *head_len) |
| Is the accumulated response complete? (headers terminated + body . | |
Variables | |
| PROTOCORE_NS EdgeFetchNs EdgeFetcher | PROTOCORE_UNUSED |
| Module namespace. | |
CDN edge-cache tier - async origin-fetch engine (PROTOCORE_ENABLE_EDGE_CACHE).
A non-blocking origin fetch: open + send a request over a transport seam, accumulate the response across poll loops into a bounded buffer, detect completion (Content-Length / chunked / connection close), then parse it with the proven http_client codec. Pumped from the server poll loop so a miss or revalidation never stalls the worker; the transport seam is protocore_client on the device and a mock in host tests. Zero heap; the buffer is fixed (PROTOCORE_EDGE_FETCH_BUF).
work is bytes the CALLER holds. This module reads none of them: it carries nothing between calls, so there is no state to keep and nothing to wipe. The parameter is there so a caller drives every namespace the same way.
Definition in file edge_fetch.h.
| typedef struct EdgeFetchTransport EdgeFetchTransport |
The origin transport, bound to protocore_client on the device and a mock in host tests.
| typedef enum PROTO_ENUM_PACKED EdgeFetchStatus |
Fetch progress.
| enum PROTO_ENUM_PACKED |
Fetch progress.
Definition at line 46 of file edge_fetch.h.
| PROTOCORE_NS_LAYOUT | ( | EdgeFetchNs | , |
| begin | , | ||
| pump | , | ||
| end | , | ||
| edge_resp_complete | |||
| ) |
| void protocore_edge_fetcher_begin | ( | uint8_t * | work, |
| EdgeFetch * | f, | ||
| const EdgeFetchTransport * | t, | ||
| const char * | host, | ||
| uint16_t | port, | ||
| const void * | request, | ||
| size_t | req_len, | ||
| uint32_t | now_ms | ||
| ) |
Open the origin connection and park request; begin the fetch. Sets .
| work | PROTOCORE_EDGE_FETCHER_BORROW bytes the caller took. Not held past the call. |
| f | F |
| t | T |
| host | Host |
| port | Port |
| request | Request |
| req_len | Req len |
| now_ms | Now ms |
| EdgeFetchStatus protocore_edge_fetcher_pump | ( | uint8_t * | work, |
| EdgeFetch * | f, | ||
| const EdgeFetchTransport * | t, | ||
| uint32_t | now_ms | ||
| ) |
Drain available bytes and advance. On DONE the response is parsed .
| work | PROTOCORE_EDGE_FETCHER_BORROW bytes the caller took. Not held past the call. |
| f | F |
| t | T |
| now_ms | Now ms |
| void protocore_edge_fetcher_end | ( | uint8_t * | work, |
| EdgeFetch * | f, | ||
| const EdgeFetchTransport * | t | ||
| ) |
Release the transport connection (idempotent).
| work | PROTOCORE_EDGE_FETCHER_BORROW bytes the caller took. Not held past the call. |
| f | F |
| t | T |
| proto_bool protocore_edge_fetcher_edge_resp_complete | ( | uint8_t * | work, |
| const uint8_t * | buf, | ||
| size_t | len, | ||
| proto_bool | conn_closed, | ||
| size_t * | head_len | ||
| ) |
Is the accumulated response complete? (headers terminated + body .
| work | PROTOCORE_EDGE_FETCHER_BORROW bytes the caller took. Not held past the call. |
| buf | Buf |
| len | Len |
| conn_closed | Conn closed |
| head_len | Head len |
| PROTOCORE_NS EdgeFetchNs EdgeFetcher PROTOCORE_UNUSED |
Module namespace.
Definition at line 123 of file edge_fetch.h.