☎️ ERLANG HIVE DIFFICULTY: Adept Structural

The Proxy of the Hive Switchboard

A shadow process standing in for the true entity.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Proxy
ARCANUM SCHOOL: Illusion // Phantoms
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ERLANG PATTERN //
-module(the_proxy).
-export([start/1, request/2]).

start(RealTarget) ->
    spawn(fun() -> proxy_loop(RealTarget) end).

request(ProxyPid, Msg) ->
    ProxyPid ! {request, self(), Msg},
    receive {reply, Reply} -> Reply end.

proxy_loop(RealTarget) ->
    receive
        {request, Caller, Msg} ->
            RealTarget ! {request, self(), Msg},
            receive
                {reply, Reply} -> Caller ! {reply, Reply}
            end,
            proxy_loop(RealTarget)
    end.

The Proxy

We spin up intermediate phantoms to intercept, delay, or authorize telepathic communiques before they reach the True Mind.

Runic Tags: #erlang #actors #telepathy #switchboard #proxy