docs: Mermaid-ize GenStage pipeline diagram - #35
Merged
Conversation
Convert the ASCII GenStage pipeline diagram in the Architecture section to a Mermaid graph LR, verified against lib/ source. - Solid arrows = GenStage subscription chain, dotted = runtime relations (enqueue cast, write/1 delegation, Frame Streams I/O) - Annotate each stage with its actual GenStage role (:producer / :producer_consumer / :consumer) and the writer as a GenServer - Fix encoding-step mislabeling: Protocol Buffers encoding is done in BufferStage, while Frame Streams framing is delegated to the Writer (the old ASCII placed Frame Streams under WriterConsumer)
Member
Author
Review convergence summaryレビュー対応ループを実施し、収束を確認しました。 CI ステータス (head
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
エコシステム横断 TODO #5(アーキテクチャ図の Mermaid 化と一貫適用)の一環として、README の
## Architectureセクションにある GenStage パイプラインの ASCII 図を Mermaid (graph LR) に変換しました。参照実装は tenbin_cache PR #106 です。コード照合の結果
README の既存記述を鵜呑みにせず
lib/の実コードと照合しました。各ステージの実態:Producer={:producer, ...}(lib/elixir_dnstap/producer.ex)— host がenqueue/2(GenStage.cast)で投入、demand ベースのバックプレッシャー + 内部キューBufferStage={:producer_consumer, ...}(lib/elixir_dnstap/buffer_stage.ex)—ElixirDnstap.Encoderで Protocol Buffers にエンコード(ステートレス変換)WriterConsumer={:consumer, ...}(lib/elixir_dnstap/writer_consumer.ex)—writer_module.write/1に委譲Writer.{File,TCP,UnixSocket}= GenServer(lib/elixir_dnstap/writer/)— Frame Streams フレーミング(FrameStreams.encode_data_frame)と実 I/Olib/elixir_dnstap/supervisor.exで確認(Producer → BufferStage → WriterConsumer + 選択された Writer を:one_for_oneで起動)既存 ASCII との差分(修正点)
既存 ASCII 図は 2 段目ラベルで
BufferStage → Encoding/WriterConsumer → Frame Streamsとしており、Frame Streams 段を WriterConsumer の下に誤配置していました。実際には:BufferStageの moduledoc の Design Note: "Frame Streams encoding is delegated to the Writer ... to avoid double encoding")この 2 つは別個のエンコード段であることを Mermaid 化と同時に修正し、補足 note に明記しました。
スタイル方針
graph LR-->= GenStage の subscription chain(下流が上流を subscribe)-. label .->= ランタイム関係(host からの enqueue cast /write/1委譲 / Frame Streams I/O)classDef等の装飾は使わず構造の明快さを優先"名前<br/>(役割)"形式変更後の Mermaid
graph LR Host["Host app<br/>(log_client_query/6)"] Producer["Producer<br/>(GenStage :producer)"] BufferStage["BufferStage<br/>(GenStage :producer_consumer)"] WriterConsumer["WriterConsumer<br/>(GenStage :consumer)"] Writer["Writer.{File,TCP,UnixSocket}<br/>(GenServer)"] Output["File / TCP / Unix socket"] Producer --> BufferStage BufferStage --> WriterConsumer WriterConsumer --> Writer Host -. "enqueue (GenStage.cast)" .-> Producer WriterConsumer -. "write/1" .-> Writer Writer -. "Frame Streams I/O" .-> Outputテスト
Lefthook(format / test / credo)全 green(114 tests passed, credo no issues)。docs のみの変更です。
## Frame Streams Protocol配下の START→DATA→STOP 等の小図はスコープ外として変更していません。