1
0
mirror of https://github.com/actix/actix-website synced 2024-11-24 08:43:01 +01:00
actix-website/static/img/diagrams/http_server.svg
Maxim Vorobjov c1a8103cbc Architecture diagrams of HttpServer and Connection lifecycle (#148)
* add arch diagrams and menu

* fix colors for arch diagrams

* refine architecture diagrams, ready for review

* capitalize titles and add mmdc instruction

* apply code review requested changes

* Add links to accept, worker and dispatcher too
2020-01-28 20:36:35 +09:00

4 lines
16 KiB
XML

<svg id="mermaid-1579871632586" width="100%" xmlns="http://www.w3.org/2000/svg" height="100%" style="max-width:1450px;" viewBox="-50 -10 1450 732"><style>#mermaid-1579871632586 .label{font-family:trebuchet ms,verdana,arial;color:#333}#mermaid-1579871632586 .node circle,#mermaid-1579871632586 .node ellipse,#mermaid-1579871632586 .node polygon,#mermaid-1579871632586 .node rect{fill:#eee;stroke:#999;stroke-width:1px}#mermaid-1579871632586 .node.clickable{cursor:pointer}#mermaid-1579871632586 .arrowheadPath{fill:#333}#mermaid-1579871632586 .edgePath .path{stroke:#666;stroke-width:1.5px}#mermaid-1579871632586 .edgeLabel{background-color:#fff}#mermaid-1579871632586 .cluster rect{fill:#eaf2fb!important;stroke:#26a!important;stroke-width:1px!important}#mermaid-1579871632586 .cluster text{fill:#333}#mermaid-1579871632586 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:trebuchet ms,verdana,arial;font-size:12px;background:#eaf2fb;border:1px solid #26a;border-radius:2px;pointer-events:none;z-index:100}#mermaid-1579871632586 .actor{stroke:#999;fill:#eee}#mermaid-1579871632586 text.actor{fill:#333;stroke:none}#mermaid-1579871632586 .actor-line{stroke:#666}#mermaid-1579871632586 .messageLine0{marker-end:"url(#arrowhead)"}#mermaid-1579871632586 .messageLine0,#mermaid-1579871632586 .messageLine1{stroke-width:1.5;stroke-dasharray:"2 2";stroke:#333}#mermaid-1579871632586 #arrowhead{fill:#333}#mermaid-1579871632586 #crosshead path{fill:#333!important;stroke:#333!important}#mermaid-1579871632586 .messageText{fill:#333;stroke:none}#mermaid-1579871632586 .labelBox{stroke:#999;fill:#eee}#mermaid-1579871632586 .labelText,#mermaid-1579871632586 .loopText{fill:#fff;stroke:none}#mermaid-1579871632586 .loopLine{stroke-width:2;stroke-dasharray:"2 2";marker-end:"url(#arrowhead)";stroke:#999}#mermaid-1579871632586 .note{stroke:#770;fill:#ffa}#mermaid-1579871632586 .noteText{fill:#000;stroke:none;font-family:trebuchet ms,verdana,arial;font-size:14px}#mermaid-1579871632586 .section{stroke:none;opacity:.2}#mermaid-1579871632586 .section0,#mermaid-1579871632586 .section2{fill:#80b3e6}#mermaid-1579871632586 .section1,#mermaid-1579871632586 .section3{fill:#fff;opacity:.2}#mermaid-1579871632586 .sectionTitle0,#mermaid-1579871632586 .sectionTitle1,#mermaid-1579871632586 .sectionTitle2,#mermaid-1579871632586 .sectionTitle3{fill:#333}#mermaid-1579871632586 .sectionTitle{text-anchor:start;font-size:11px;text-height:14px}#mermaid-1579871632586 .grid .tick{stroke:#e6e6e6;opacity:.3;shape-rendering:crispEdges}#mermaid-1579871632586 .grid path{stroke-width:0}#mermaid-1579871632586 .today{fill:none;stroke:#d42;stroke-width:2px}#mermaid-1579871632586 .task{stroke-width:2}#mermaid-1579871632586 .taskText{text-anchor:middle;font-size:11px}#mermaid-1579871632586 .taskTextOutsideRight{fill:#333;text-anchor:start;font-size:11px}#mermaid-1579871632586 .taskTextOutsideLeft{fill:#333;text-anchor:end;font-size:11px}#mermaid-1579871632586 .taskText0,#mermaid-1579871632586 .taskText1,#mermaid-1579871632586 .taskText2,#mermaid-1579871632586 .taskText3{fill:#fff}#mermaid-1579871632586 .task0,#mermaid-1579871632586 .task1,#mermaid-1579871632586 .task2,#mermaid-1579871632586 .task3{fill:#26a;stroke:#1a4d80}#mermaid-1579871632586 .taskTextOutside0,#mermaid-1579871632586 .taskTextOutside1,#mermaid-1579871632586 .taskTextOutside2,#mermaid-1579871632586 .taskTextOutside3{fill:#333}#mermaid-1579871632586 .active0,#mermaid-1579871632586 .active1,#mermaid-1579871632586 .active2,#mermaid-1579871632586 .active3{fill:#eee;stroke:#1a4d80}#mermaid-1579871632586 .activeText0,#mermaid-1579871632586 .activeText1,#mermaid-1579871632586 .activeText2,#mermaid-1579871632586 .activeText3{fill:#333!important}#mermaid-1579871632586 .done0,#mermaid-1579871632586 .done1,#mermaid-1579871632586 .done2,#mermaid-1579871632586 .done3{stroke:#666;fill:#bbb;stroke-width:2}#mermaid-1579871632586 .doneText0,#mermaid-1579871632586 .doneText1,#mermaid-1579871632586 .doneText2,#mermaid-1579871632586 .doneText3{fill:#333!important}#mermaid-1579871632586 .crit0,#mermaid-1579871632586 .crit1,#mermaid-1579871632586 .crit2,#mermaid-1579871632586 .crit3{stroke:#b1361b;fill:#d42;stroke-width:2}#mermaid-1579871632586 .activeCrit0,#mermaid-1579871632586 .activeCrit1,#mermaid-1579871632586 .activeCrit2,#mermaid-1579871632586 .activeCrit3{stroke:#b1361b;fill:#eee;stroke-width:2}#mermaid-1579871632586 .doneCrit0,#mermaid-1579871632586 .doneCrit1,#mermaid-1579871632586 .doneCrit2,#mermaid-1579871632586 .doneCrit3{stroke:#b1361b;fill:#bbb;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-1579871632586 .activeCritText0,#mermaid-1579871632586 .activeCritText1,#mermaid-1579871632586 .activeCritText2,#mermaid-1579871632586 .activeCritText3,#mermaid-1579871632586 .doneCritText0,#mermaid-1579871632586 .doneCritText1,#mermaid-1579871632586 .doneCritText2,#mermaid-1579871632586 .doneCritText3{fill:#333!important}#mermaid-1579871632586 .titleText{text-anchor:middle;font-size:18px;fill:#333}#mermaid-1579871632586 g.classGroup text{fill:#999;stroke:none;font-family:trebuchet ms,verdana,arial;font-size:10px}#mermaid-1579871632586 g.classGroup rect{fill:#eee;stroke:#999}#mermaid-1579871632586 g.classGroup line{stroke:#999;stroke-width:1}#mermaid-1579871632586 .classLabel .box{stroke:none;stroke-width:0;fill:#eee;opacity:.5}#mermaid-1579871632586 .classLabel .label{fill:#999;font-size:10px}#mermaid-1579871632586 .relation{stroke:#999;stroke-width:1;fill:none}#mermaid-1579871632586 #compositionEnd,#mermaid-1579871632586 #compositionStart{fill:#999;stroke:#999;stroke-width:1}#mermaid-1579871632586 #aggregationEnd,#mermaid-1579871632586 #aggregationStart{fill:#eee;stroke:#999;stroke-width:1}#mermaid-1579871632586 #dependencyEnd,#mermaid-1579871632586 #dependencyStart,#mermaid-1579871632586 #extensionEnd,#mermaid-1579871632586 #extensionStart{fill:#999;stroke:#999;stroke-width:1}#mermaid-1579871632586 .branch-label,#mermaid-1579871632586 .commit-id,#mermaid-1579871632586 .commit-msg{fill:#d3d3d3;color:#d3d3d3}</style><style>#mermaid-1579871632586 {
color: rgb(0, 0, 0);
font: normal normal 400 normal 16px / normal "Times New Roman";
}</style><g></g><g><line id="actor0" x1="75" y1="5" x2="75" y2="721" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="0" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="75" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="75" dy="0">HttpServer</tspan></text></g><g><line id="actor1" x1="275" y1="5" x2="275" y2="721" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="200" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="275" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="275" dy="0">ServerBuilder</tspan></text></g><g><line id="actor2" x1="475" y1="5" x2="475" y2="721" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="400" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="475" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="475" dy="0">Worker</tspan></text></g><g><line id="actor3" x1="675" y1="5" x2="675" y2="721" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="600" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="675" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="675" dy="0">StreamNewService</tspan></text></g><g><line id="actor4" x1="875" y1="5" x2="875" y2="721" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="800" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="875" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="875" dy="0">HttpService</tspan></text></g><g><line id="actor5" x1="1075" y1="5" x2="1075" y2="721" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="1000" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="1075" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="1075" dy="0">HttpServiceResponse</tspan></text></g><g><line id="actor6" x1="1275" y1="5" x2="1275" y2="721" class="actor-line" stroke-width="0.5px" stroke="#999"></line><rect x="1200" y="0" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="1275" y="32.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="1275" dy="0">Tokio</tspan></text></g><defs><marker id="arrowhead" refX="5" refY="2" markerWidth="6" markerHeight="4" orient="auto"><path d="M 0,0 V 4 L6,2 Z"></path></marker></defs><defs><marker id="crosshead" markerWidth="15" markerHeight="8" orient="auto" refX="16" refY="4"><path fill="black" stroke="#000000" stroke-width="1px" d="M 9,2 V 6 L16,4 Z" style="stroke-dasharray: 0, 0;"></path><path fill="none" stroke="#000000" stroke-width="1px" d="M 0,1 L 6,7 M 6,1 L 0,7" style="stroke-dasharray: 0, 0;"></path></marker></defs><g><text x="475" y="93" class="messageText" style="text-anchor: middle;">build...</text><line x1="75" y1="100" x2="875" y2="100" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></line></g><g><text x="175" y="128" class="messageText" style="text-anchor: middle;">listen(addr,Fn-&gt;HttpService)</text><line x1="75" y1="135" x2="275" y2="135" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="475" y="163" class="messageText" style="text-anchor: middle;">create(addr,Fn-&gt;HttpService)</text><line x1="275" y1="170" x2="675" y2="170" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="175" y="198" class="messageText" style="text-anchor: middle;">start()</text><line x1="75" y1="205" x2="275" y2="205" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="375" y="233" class="messageText" style="text-anchor: middle;">start(StreamNewService)</text><line x1="275" y1="240" x2="475" y2="240" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="575" y="268" class="messageText" style="text-anchor: middle;">InternalServiceFactory::create()</text><line x1="475" y1="275" x2="675" y2="275" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="775" y="303" class="messageText" style="text-anchor: middle;">new_service()</text><line x1="675" y1="310" x2="875" y2="310" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="975" y="338" class="messageText" style="text-anchor: middle;">HttpServiceResponse::new()</text><line x1="875" y1="345" x2="1075" y2="345" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="775" y="373" class="messageText" style="text-anchor: middle;">HttpServiceResponse as Future</text><line x1="875" y1="380" x2="675" y2="380" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="575" y="408" class="messageText" style="text-anchor: middle;">StreamService(HttpServiceResponse) as Future</text><line x1="675" y1="415" x2="475" y2="415" class="messageLine0" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="fill: none;"></line></g><g><text x="875" y="443" class="messageText" style="text-anchor: middle;">spawn(StreamService(HttpServiceResponse)).map(Worker))</text><line x1="475" y1="450" x2="1275" y2="450" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></line></g><g><text x="1175" y="478" class="messageText" style="text-anchor: middle;">poll()</text><line x1="1275" y1="485" x2="1075" y2="485" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></line></g><g><text x="1175" y="513" class="messageText" style="text-anchor: middle;">Ready(Worker(HttpServiceHandler))</text><line x1="1075" y1="520" x2="1275" y2="520" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></line></g><g><text x="875" y="573" class="messageText" style="text-anchor: middle;">poll-&gt;Pending...</text><line x1="1275" y1="580" x2="475" y2="580" class="messageLine1" stroke-width="2" stroke="black" marker-end="url(#arrowhead)" style="stroke-dasharray: 3, 3; fill: none;"></line></g><g><rect x="470" y="582" fill="#f4f4f4" stroke="#666" width="10" height="44" rx="0" ry="0"></rect></g><g><rect x="400" y="590" fill="#EDF2AE" stroke="#666" width="150" height="36" rx="0" ry="0" class="note"></rect><text x="396" y="614" fill="black" class="noteText"><tspan x="416" fill="black">pull messages</tspan></text></g><g><line x1="390" y1="530" x2="1285" y2="530" class="loopLine"></line><line x1="1285" y1="530" x2="1285" y2="636" class="loopLine"></line><line x1="390" y1="636" x2="1285" y2="636" class="loopLine"></line><line x1="390" y1="530" x2="390" y2="636" class="loopLine"></line><polygon points="390,530 440,530 440,543 431.6,550 390,550" class="labelBox"></polygon><text x="397.5" y="545" fill="black" class="labelText"><tspan x="397.5" fill="black">loop</tspan></text><text x="837.5" y="545" fill="black" class="loopText" style="text-anchor: middle;"><tspan x="837.5" fill="black">[ Worker process messages ]</tspan></text></g><g><rect x="0" y="656" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="75" y="688.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="75" dy="0">HttpServer</tspan></text></g><g><rect x="200" y="656" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="275" y="688.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="275" dy="0">ServerBuilder</tspan></text></g><g><rect x="400" y="656" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="475" y="688.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="475" dy="0">Worker</tspan></text></g><g><rect x="600" y="656" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="675" y="688.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="675" dy="0">StreamNewService</tspan></text></g><g><rect x="800" y="656" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="875" y="688.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="875" dy="0">HttpService</tspan></text></g><g><rect x="1000" y="656" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="1075" y="688.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="1075" dy="0">HttpServiceResponse</tspan></text></g><g><rect x="1200" y="656" fill="#eaeaea" stroke="#666" width="150" height="65" rx="3" ry="3" class="actor"></rect><text x="1275" y="688.5" dominant-baseline="central" alignment-baseline="central" class="actor" style="text-anchor: middle;"><tspan x="1275" dy="0">Tokio</tspan></text></g></svg>