- services/framecache/: new standalone container
- slot.h/slot.c: shm ring buffer (120 frames, FC_MAGIC header, atomic
write_cursor, POSIX semaphore per slot)
- registry.h/registry.c: in-memory slot registry + /dev/shm/framecache/
registry.json persistence
- framecache.c: HTTP API server (libmicrohttpd, port 7435)
POST /slots, GET /slots, GET /slots/:id, DELETE /slots/:id, GET /health
- fc_client.h/fc_client.c: consumer library — fc_consumer_open/read/close
with per-consumer cursor, timeout via sem_timedwait, automatic skip+count
when consumer falls behind writer by > ring_depth frames
- fc_test_consumer.c: dev utility to attach to any slot and print fps/stats
- CMakeLists.txt: framecache server + fc_client static lib + test consumer
- Dockerfile: builder + slim runtime stages
- docker-compose.worker.yml: add framecache service (profile: capture,
ipc: host, shm_size from FC_SHM_SIZE_GB env var, healthcheck)
- .env.example: document FC_SHM_SIZE_GB with per-node guidance
21 lines
636 B
C
21 lines
636 B
C
#pragma once
|
|
#include "slot.h"
|
|
|
|
/* Maximum number of concurrent slots */
|
|
#define FC_MAX_SLOTS 256
|
|
|
|
/* Registry entry (in-memory) */
|
|
typedef struct {
|
|
int active;
|
|
struct fc_slot *slot;
|
|
char slot_id[FC_MAX_SLOT_ID];
|
|
} fc_registry_entry_t;
|
|
|
|
/* Global registry — managed by framecache.c */
|
|
extern fc_registry_entry_t g_registry[FC_MAX_SLOTS];
|
|
extern int g_registry_count;
|
|
|
|
void registry_add(struct fc_slot *slot);
|
|
void registry_remove(const char *slot_id);
|
|
struct fc_slot *registry_find(const char *slot_id);
|
|
void registry_write_json(void); /* writes /dev/shm/framecache/registry.json */
|