⚡ V SIGIL DIFFICULTY: Adept Behavioral

The Mediator Sigil

Centralizing complex chaotic communications between independent elemental nodes.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Mediator
ARCANUM SCHOOL: Abjuration // Coordination
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// V PATTERN //
module main

interface GridMediator {
	notify(sender string, event string)
}

@[heap]
struct ControlTower {
mut:
	alpha_node &Node = unsafe { nil }
	beta_node  &Node = unsafe { nil }
}
fn (mut t ControlTower) notify(sender string, event string) {
	if sender == "Alpha" && event == "Overload" {
		println("Tower: Alpha is overloading. Triggering Beta cooling.")
		t.beta_node.cool_down()
	}
}

@[heap]
struct Node {
	name     string
mut:
	mediator GridMediator
}
fn (mut n Node) trigger_overload() {
	println("\$n.name: Experiencing overload!")
	n.mediator.notify(n.name, "Overload")
}
fn (n Node) cool_down() {
	println("\$n.name: Cooling down systems.")
}

fn main() {
	mut tower := &ControlTower{}

	mut alpha := &Node{name: "Alpha", mediator: tower}
	mut beta := &Node{name: "Beta", mediator: tower}

	tower.alpha_node = alpha
	tower.beta_node = beta

	alpha.trigger_overload()
}

The Mediator Sigil

When dozens of nodes form a localized grid, having them interact directly results in a tangled spaghetti web of dependencies. The Mediator sigil serves as the Control Tower. Nodes report anomalies solely to the Mediator, which houses the macro-logic for routing power and cooling directives.

Runic Tags: #vlang #mediator #behavioral #control