macula_gateway_dht (macula v0.7.29)
View SourceDHT Query Handler Module - handles DHT message forwarding to routing server.
Responsibilities: - Forward DHT STORE messages to routing server - Forward DHT FIND_VALUE messages to routing server, send encoded replies - Forward DHT FIND_NODE messages to routing server, send encoded replies - Handle DHT queries from process messages - Encode replies using protocol encoder - Handle errors gracefully
Pattern: Stateless delegation module - No GenServer (no state to manage) - Pure functions forwarding to routing server - Consistent error handling ({ok, Result} | {error, Reason})
Extracted from macula_gateway.erl (Phase 10)
Summary
Functions
Handle DHT FIND_NODE message. Forwards to routing server and sends encoded reply over stream. Crashes on routing server or encoding failures - exposes DHT/protocol bugs.
Handle DHT FIND_VALUE message. Forwards to routing server and sends encoded reply over stream. Crashes on routing server or encoding failures - exposes DHT/protocol bugs.
Handle DHT query from process message. Decodes query, forwards to routing server, encodes reply, sends to requesting process. Crashes on decode or routing failures - exposes protocol/DHT bugs.
Handle DHT STORE message. Forwards to routing server (no reply sent back). Crashes on routing server failures - this exposes DHT issues immediately.
Look up a value from the DHT by key. Synchronous lookup from local DHT storage. Returns list of subscribers for the given key.
Functions
Handle DHT FIND_NODE message. Forwards to routing server and sends encoded reply over stream. Crashes on routing server or encoding failures - exposes DHT/protocol bugs.
Handle DHT FIND_VALUE message. Forwards to routing server and sends encoded reply over stream. Crashes on routing server or encoding failures - exposes DHT/protocol bugs.
Handle DHT query from process message. Decodes query, forwards to routing server, encodes reply, sends to requesting process. Crashes on decode or routing failures - exposes protocol/DHT bugs.
Handle DHT STORE message. Forwards to routing server (no reply sent back). Crashes on routing server failures - this exposes DHT issues immediately.
Look up a value from the DHT by key. Synchronous lookup from local DHT storage. Returns list of subscribers for the given key.