How dcos/lashup works
Main Components
• Overlay Builder:
• “lashup_hyparview” components (e.g., lashup_hyparview_membership, lashup_hyparview_ping_handler, lashup_hyparview_events). These modules manage the overlay network which forms a strongly connected, sparse TCP graph ensuring scalability and stability.
• Subcomponents like randomized timers, throttling, and persistent member storage.
• Routing & Failure Detection:
• Components such as lashup_gm, lashup_gm_events, lashup_gm_route, lashup_gm_route_events, lashup_gm_fanout, and the multicast-related modules (e.g., lashup_gm_mc, lashup_gm_mc_events) that handle dissemination of routing information and failure detection.
• Dependency where health checks, gossip messages, and adjacency table updates work together to quickly detect node failures and propagate changes.
• Distributed Key-Value Store:
• “lashup_kv*” modules (like lashup_kv, lashup_kv_aae_mgr, lashup_kv_sync_rx_fsm, lashup_kv_sync_tx_fsm) that together implement a CRDT store over riak_dt with Mnesia as the persistence layer.
• API for performing operations and the subscription functionality (pattern-based subscriptions using ETS match specs).
• Supervision & Infrastructure:
• Supervisory tree (modules such as lashup_core_sup, lashup_platform_sup, lashup_gm_sup, lashup_kv_sup, lashup_gm_worker_sup, and lashup_sup) that organizes how these components start, crash-recover, and interact.
• Utility modules (lashup_config, lashup_utils) that support configuration and shared functionality.
• From the overlay builder to the routing layer: show how the overlay’s adjacencies and membership details are communicated upward.
• Related modules into logical clusters:
• One cluster for network construction and maintenance (Overlay Builder).
• One cluster for routing and failure detection.
• One cluster for the distributed database functionality.
• An outer layer that shows the supervision infrastructure coordinating these inner components.
Architectural Patterns and Technologies
• Architectural patterns:
• OTP supervision hierarchies, which enforce fault tolerance and modular design.
• Use of the HyParView protocol (with modifications) for building the overlay network.
• Gossip-based dissemination for rapid failure detection and state propagation.
• CRDTs (via basho/riak_dt) for a distributed key-value store and eventual consistency.
• Technologies and frameworks:
• Erlang/OTP (including Mnesia for persistence).
• riak_dt for CRDT operations.
• ETS for in-memory subscriptions.
• CircleCI for continuous integration (as hinted by the .circleci config).