This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch asf-site-source
in repository https://gitbox.apache.org/repos/asf/ratis-hadoop-projects.git

commit f2367c4fda45d3e64d7a875de17d101121f2ec02
Author: Clay Baenziger <[email protected]>
AuthorDate: Thu Aug 22 19:59:12 2019 -0400

    RATIS-667. Provide a visual for the LogService lifecycle
    
    If graphviz is installed, the lifecycle SVG will be regenerated.
    
    Co-authored-by: Josh Elser <[email protected]>
---
 build.sh                        |  53 +++++++++--
 content/logservice/lifecycle.md |   7 ++
 static/lifecycle.dot            |  45 +++++++++
 static/lifecycle.svg            | 206 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 301 insertions(+), 10 deletions(-)

diff --git a/build.sh b/build.sh
index b238e9c..46cf4bb 100755
--- a/build.sh
+++ b/build.sh
@@ -17,6 +17,43 @@
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 set -e
 mkdir -p build
+
+# Usage
+if [[ $# -ne 1 ]]; then
+  echo "Usage: ./build.sh <website_output>" 1>&2
+  exit 3
+fi
+
+BUILD_OUTPUT_DIR="$1"
+
+# The command call will fail, but that's OK because we're catching it.
+set +e
+DOT_EXEC="$(command -v dot)"
+if [ "$?" -eq 0 ]; then
+  echo 'Re-generating SVGs'
+  set -e
+  # Generate the SVG, but use sed to inject the license header
+  "$DOT_EXEC" -Tsvg "$DIR"/static/lifecycle.dot | sed 's/ Generated by 
graphviz version/\
+  Licensed under the Apache License, Version 2.0 (the "License");\
+  you may not use this file except in compliance with the License.\
+  You may obtain a copy of the License at\
+\
+    http:\/\/www.apache.org\/licenses\/LICENSE-2.0\
+\
+  Unless required by applicable law or agreed to in writing, software\
+  distributed under the License is distributed on an "AS IS" BASIS,\
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\
+  See the License for the specific language governing permissions and\
+  limitations under the License. See accompanying LICENSE file.\
+-->\
+<!-- Generated by graphviz version/' > "$DIR"/static/lifecycle.svg
+else
+  echo "Cannot find executable 'dot', SVG's will not be regenerated. Install 
Graphviz to regenerate SVG's automatically"
+fi
+
+set -e
+
+# RAT check
 rat_version="0.13"
 filename="apache-rat-${rat_version}-bin.tar.gz"
 artifact="creadur/apache-rat-${rat_version}/${filename}"
@@ -52,16 +89,12 @@ else
   echo "RAT check appears to have passed"
 fi
 
-if [[ $# -ne 1 ]]; then
-  echo "Usage: ./build.sh <website_output>"
-  exit 3
-fi
-
-BUILD_OUTPUT_DIR="$1"
-HUGO_EXEC=$(which hugo)
+# The command call will fail, but that's OK because we're catching it.
+set +e
+HUGO_EXEC="$(command -v hugo)"
 if [ "$?" -ne 0 ]; then
-      echo "Please install hugo and put it to the path"
-               exit 1
+  echo "Please install hugo and put it to the path"
+  exit 1
 fi
 echo -e "\nBuilding website to ${BUILD_OUTPUT_DIR}"
-$HUGO_EXEC -d ${BUILD_OUTPUT_DIR}
+"$HUGO_EXEC" -d "${BUILD_OUTPUT_DIR}"
diff --git a/content/logservice/lifecycle.md b/content/logservice/lifecycle.md
index ea8e556..9b94c58 100644
--- a/content/logservice/lifecycle.md
+++ b/content/logservice/lifecycle.md
@@ -95,3 +95,10 @@ An export of a log is more generic in that:
 * A log does not need to be CLOSED to be exported.
 * A log can be repeatedly exported (e.g. to multiple locations).
 * More data can be appended to a log that was exported (but new data would not 
be reflected in the exported version of the log).
+
+## Visualization
+
+To get a visual understanding of the log states, please see the image below:
+<p>
+  <img src="lifecycle.svg" alt="Graphviz view of the logstates"/>"
+</p>
diff --git a/static/lifecycle.dot b/static/lifecycle.dot
new file mode 100644
index 0000000..afc8d2a
--- /dev/null
+++ b/static/lifecycle.dot
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+/* Rendered with dot -Tsvg lifecycle.dot > lifecycle.svg */
+digraph LogServiceStates {
+  node [shape=box, fontsize=16]
+  { rank = same;
+    write [shape=plaintext, label="write()",fillcolor=grey,style=filled];
+    read1 [shape=plaintext, label="read()",fillcolor=grey,style=filled];
+    read2 [shape=plaintext, label="read()",fillcolor=grey,style=filled];
+    export [shape=plaintext, label="export()",fillcolor=grey,style=filled];
+  }
+
+  external1 [shape=none,label=""];
+  external2 [shape=none,label=""];
+
+  OPEN [shape=Mdiamond];
+  DELETED [shape=Msquare];
+  OPEN -> CLOSED [label="API\nCall"];
+  OPEN -> CLOSED [label="Quorum\nFailure"];
+  CLOSED -> DELETED;
+  CLOSED -> ARCHIVING [label="API\nCall"];
+  OPEN -> {write; read1; export} -> OPEN;
+  CLOSED -> read2 -> CLOSED;
+  ARCHIVING -> ARCHIVED [label="On\nCompletion"];
+  ARCHIVED -> DELETED;
+
+  ARCHIVING -> external1 [label="Writes\nData\nExternally",style=dotted];
+  export -> external2 [label="Writes\nData\nExternally",style=dotted];
+}
diff --git a/static/lifecycle.svg b/static/lifecycle.svg
new file mode 100644
index 0000000..d9bf361
--- /dev/null
+++ b/static/lifecycle.svg
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+<!--
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License. See accompanying LICENSE file.
+-->
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: LogServiceStates Pages: 1 -->
+<svg width="315pt" height="597pt"
+ viewBox="0.00 0.00 315.19 596.98" xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink";>
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 
592.9766)">
+<title>LogServiceStates</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-592.9766 
311.1875,-592.9766 311.1875,4 -4,4"/>
+<!-- write -->
+<g id="node1" class="node">
+<title>write</title>
+<polygon fill="#c0c0c0" stroke="transparent" points="234.6268,-588.9766 
175.5607,-588.9766 175.5607,-552.9766 234.6268,-552.9766 234.6268,-588.9766"/>
+<text text-anchor="middle" x="205.0938" y="-566.1766" 
font-family="Times,serif" font-size="16.00" fill="#000000">write()</text>
+</g>
+<!-- OPEN -->
+<g id="node7" class="node">
+<title>OPEN</title>
+<polygon fill="none" stroke="#000000" points="198.0938,-474.9766 
143.4609,-456.9766 198.0937,-438.9766 252.7266,-456.9766 198.0938,-474.9766"/>
+<polyline fill="none" stroke="#000000" points="154.8583,-460.7317 
154.8583,-453.2215 "/>
+<polyline fill="none" stroke="#000000" points="186.6964,-442.7317 
209.4911,-442.7317 "/>
+<polyline fill="none" stroke="#000000" points="241.3292,-453.2215 
241.3292,-460.7317 "/>
+<polyline fill="none" stroke="#000000" points="209.4911,-471.2215 
186.6964,-471.2215 "/>
+<text text-anchor="middle" x="198.0938" y="-452.1766" 
font-family="Times,serif" font-size="16.00" fill="#000000">OPEN</text>
+</g>
+<!-- write&#45;&gt;OPEN -->
+<g id="edge8" class="edge">
+<title>write&#45;&gt;OPEN</title>
+<path fill="none" stroke="#000000" d="M198.8958,-552.9129C195.8239,-534.3296 
193.7857,-505.1697 193.9134,-483.8728"/>
+<polygon fill="#000000" stroke="#000000" points="197.4131,-483.9267 
194.1691,-473.8408 190.4154,-483.7483 197.4131,-483.9267"/>
+</g>
+<!-- read1 -->
+<g id="node2" class="node">
+<title>read1</title>
+<polygon fill="#c0c0c0" stroke="transparent" points="307.2816,-588.9766 
252.9059,-588.9766 252.9059,-552.9766 307.2816,-552.9766 307.2816,-588.9766"/>
+<text text-anchor="middle" x="280.0938" y="-566.1766" 
font-family="Times,serif" font-size="16.00" fill="#000000">read()</text>
+</g>
+<!-- read1&#45;&gt;OPEN -->
+<g id="edge9" class="edge">
+<title>read1&#45;&gt;OPEN</title>
+<path fill="none" stroke="#000000" d="M259.8299,-552.6845C246.6433,-536.8707 
229.8031,-513.4038 215.0938,-492.9766 212.63,-489.5551 210.0324,-485.9526 
207.5583,-482.4026"/>
+<polygon fill="#000000" stroke="#000000" points="210.282,-480.1797 
201.809,-473.819 204.4661,-484.0752 210.282,-480.1797"/>
+</g>
+<!-- read2 -->
+<g id="node3" class="node">
+<title>read2</title>
+<polygon fill="#c0c0c0" stroke="transparent" points="54.2816,-588.9766 
-.0941,-588.9766 -.0941,-552.9766 54.2816,-552.9766 54.2816,-588.9766"/>
+<text text-anchor="middle" x="27.0938" y="-566.1766" font-family="Times,serif" 
font-size="16.00" fill="#000000">read()</text>
+</g>
+<!-- CLOSED -->
+<g id="node9" class="node">
+<title>CLOSED</title>
+<polygon fill="none" stroke="#000000" points="87.3206,-374.9766 
8.8669,-374.9766 8.8669,-338.9766 87.3206,-338.9766 87.3206,-374.9766"/>
+<text text-anchor="middle" x="48.0938" y="-352.1766" font-family="Times,serif" 
font-size="16.00" fill="#000000">CLOSED</text>
+</g>
+<!-- read2&#45;&gt;CLOSED -->
+<g id="edge12" class="edge">
+<title>read2&#45;&gt;CLOSED</title>
+<path fill="none" stroke="#000000" d="M24.9044,-552.731C25.1567,-515.3011 
33.3126,-429.6128 40.6007,-385.0536"/>
+<polygon fill="#000000" stroke="#000000" points="44.0529,-385.6301 
42.3323,-375.1759 37.1581,-384.4213 44.0529,-385.6301"/>
+</g>
+<!-- export -->
+<g id="node4" class="node">
+<title>export</title>
+<polygon fill="#c0c0c0" stroke="transparent" points="156.6266,-588.9766 
89.5609,-588.9766 89.5609,-552.9766 156.6266,-552.9766 156.6266,-588.9766"/>
+<text text-anchor="middle" x="123.0938" y="-566.1766" 
font-family="Times,serif" font-size="16.00" fill="#000000">export()</text>
+</g>
+<!-- external2 -->
+<g id="node6" class="node">
+<title>external2</title>
+</g>
+<!-- export&#45;&gt;external2 -->
+<g id="edge16" class="edge">
+<title>export&#45;&gt;external2</title>
+<path fill="none" stroke="#000000" stroke-dasharray="1,5" 
d="M94.7505,-552.8706C89.0998,-547.815 83.9391,-541.8054 80.7832,-534.9766 
73.6132,-519.4618 75.9153,-500.4795 80.143,-485.1257"/>
+<polygon fill="#000000" stroke="#000000" points="83.6152,-485.7527 
83.2848,-475.163 76.9393,-483.6474 83.6152,-485.7527"/>
+<text text-anchor="middle" x="110.249" y="-523.7766" font-family="Times,serif" 
font-size="14.00" fill="#000000">Writes</text>
+<text text-anchor="middle" x="110.249" y="-509.7766" font-family="Times,serif" 
font-size="14.00" fill="#000000">Data</text>
+<text text-anchor="middle" x="110.249" y="-495.7766" font-family="Times,serif" 
font-size="14.00" fill="#000000">Externally</text>
+</g>
+<!-- export&#45;&gt;OPEN -->
+<g id="edge10" class="edge">
+<title>export&#45;&gt;OPEN</title>
+<path fill="none" stroke="#000000" d="M129.889,-552.9129C141.0163,-532.8273 
162.2388,-500.3857 178.2385,-478.8715"/>
+<polygon fill="#000000" stroke="#000000" points="181.2215,-480.7323 
184.5142,-470.6621 175.6603,-476.481 181.2215,-480.7323"/>
+</g>
+<!-- external1 -->
+<g id="node5" class="node">
+<title>external1</title>
+</g>
+<!-- OPEN&#45;&gt;write -->
+<g id="edge5" class="edge">
+<title>OPEN&#45;&gt;write</title>
+<path fill="none" stroke="#000000" d="M203.9625,-473.1125C207.1569,-491.2143 
209.3251,-520.9099 209.279,-542.8501"/>
+<polygon fill="#000000" stroke="#000000" points="205.7785,-542.8435 
209.0733,-552.9129 212.7771,-542.9866 205.7785,-542.8435"/>
+</g>
+<!-- OPEN&#45;&gt;read1 -->
+<g id="edge6" class="edge">
+<title>OPEN&#45;&gt;read1</title>
+<path fill="none" stroke="#000000" d="M215.2245,-469.6323C221.2328,-476.53 
227.5074,-485.2187 233.0938,-492.9766 245.2749,-509.8929 258.9174,-528.8938 
268.6383,-543.9065"/>
+<polygon fill="#000000" stroke="#000000" points="265.8617,-546.0673 
274.136,-552.6845 271.7942,-542.3517 265.8617,-546.0673"/>
+</g>
+<!-- OPEN&#45;&gt;export -->
+<g id="edge7" class="edge">
+<title>OPEN&#45;&gt;export</title>
+<path fill="none" stroke="#000000" d="M192.356,-473.1125C182.2618,-491.7079 
162.2842,-522.5382 146.2232,-544.6275"/>
+<polygon fill="#000000" stroke="#000000" points="143.2215,-542.7987 
140.0665,-552.9129 148.8402,-546.9738 143.2215,-542.7987"/>
+</g>
+<!-- OPEN&#45;&gt;CLOSED -->
+<g id="edge1" class="edge">
+<title>OPEN&#45;&gt;CLOSED</title>
+<path fill="none" stroke="#000000" d="M189.7429,-441.4718C181.255,-427.0573 
166.8478,-405.9181 149.0938,-392.9766 133.878,-381.8853 114.9187,-373.9385 
97.5495,-368.3829"/>
+<polygon fill="#000000" stroke="#000000" points="98.1308,-364.9033 
87.5468,-365.3824 96.1195,-371.6081 98.1308,-364.9033"/>
+<text text-anchor="middle" x="186.7593" y="-409.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">API</text>
+<text text-anchor="middle" x="186.7593" y="-395.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">Call</text>
+</g>
+<!-- OPEN&#45;&gt;CLOSED -->
+<g id="edge2" class="edge">
+<title>OPEN&#45;&gt;CLOSED</title>
+<path fill="none" stroke="#000000" d="M164.4541,-449.8273C143.9998,-444.3213 
118.1179,-435.1943 98.4316,-420.9766 84.6511,-411.0241 72.71,-396.3003 
63.9209,-383.4836"/>
+<polygon fill="#000000" stroke="#000000" points="66.7664,-381.4403 
58.3558,-374.9973 60.9128,-385.279 66.7664,-381.4403"/>
+<text text-anchor="middle" x="122.4248" y="-409.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">Quorum</text>
+<text text-anchor="middle" x="122.4248" y="-395.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">Failure</text>
+</g>
+<!-- DELETED -->
+<g id="node8" class="node">
+<title>DELETED</title>
+<polygon fill="none" stroke="#000000" points="88.0703,-87.9648 .1172,-87.9648 
.1172,-.0117 88.0703,-.0117 88.0703,-87.9648"/>
+<polyline fill="none" stroke="#000000" points="12.1172,-87.9648 .1172,-75.9648 
"/>
+<polyline fill="none" stroke="#000000" points=".1172,-12.0117 12.1172,-.0117 
"/>
+<polyline fill="none" stroke="#000000" points="76.0703,-.0117 88.0703,-12.0117 
"/>
+<polyline fill="none" stroke="#000000" points="88.0703,-75.9648 
76.0703,-87.9648 "/>
+<text text-anchor="middle" x="44.0938" y="-39.1883" font-family="Times,serif" 
font-size="16.00" fill="#000000">DELETED</text>
+</g>
+<!-- CLOSED&#45;&gt;read2 -->
+<g id="edge11" class="edge">
+<title>CLOSED&#45;&gt;read2</title>
+<path fill="none" stroke="#000000" d="M50.2834,-375.1759C50.0377,-412.5661 
41.8846,-498.2515 34.5958,-542.8445"/>
+<polygon fill="#000000" stroke="#000000" points="31.142,-542.2771 
32.864,-552.731 38.037,-543.4849 31.142,-542.2771"/>
+</g>
+<!-- CLOSED&#45;&gt;DELETED -->
+<g id="edge3" class="edge">
+<title>CLOSED&#45;&gt;DELETED</title>
+<path fill="none" stroke="#000000" d="M47.8614,-338.7961C47.2726,-292.7238 
45.7037,-169.9637 44.7868,-98.2176"/>
+<polygon fill="#000000" stroke="#000000" points="48.284,-97.9719 
44.6564,-88.0175 41.2846,-98.0614 48.284,-97.9719"/>
+</g>
+<!-- ARCHIVING -->
+<g id="node10" class="node">
+<title>ARCHIVING</title>
+<polygon fill="none" stroke="#000000" points="165.8674,-274.9766 
60.3201,-274.9766 60.3201,-238.9766 165.8674,-238.9766 165.8674,-274.9766"/>
+<text text-anchor="middle" x="113.0938" y="-252.1766" 
font-family="Times,serif" font-size="16.00" fill="#000000">ARCHIVING</text>
+</g>
+<!-- CLOSED&#45;&gt;ARCHIVING -->
+<g id="edge4" class="edge">
+<title>CLOSED&#45;&gt;ARCHIVING</title>
+<path fill="none" stroke="#000000" d="M60.0158,-338.635C70.003,-323.2701 
84.3944,-301.1294 95.6729,-283.7778"/>
+<polygon fill="#000000" stroke="#000000" points="98.732,-285.4938 
101.2473,-275.2018 92.8628,-281.6788 98.732,-285.4938"/>
+<text text-anchor="middle" x="100.7593" y="-309.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">API</text>
+<text text-anchor="middle" x="100.7593" y="-295.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">Call</text>
+</g>
+<!-- ARCHIVING&#45;&gt;external1 -->
+<g id="edge15" class="edge">
+<title>ARCHIVING&#45;&gt;external1</title>
+<path fill="none" stroke="#000000" stroke-dasharray="1,5" 
d="M159.6663,-238.8905C167.693,-234.0672 175.3025,-228.1469 181.0938,-220.9766 
192.4795,-206.8797 197.9773,-187.2254 200.6298,-171.1732"/>
+<polygon fill="#000000" stroke="#000000" points="204.1008,-171.6229 
201.9953,-161.2394 197.166,-170.6696 204.1008,-171.6229"/>
+<text text-anchor="middle" x="227.249" y="-209.7766" font-family="Times,serif" 
font-size="14.00" fill="#000000">Writes</text>
+<text text-anchor="middle" x="227.249" y="-195.7766" font-family="Times,serif" 
font-size="14.00" fill="#000000">Data</text>
+<text text-anchor="middle" x="227.249" y="-181.7766" font-family="Times,serif" 
font-size="14.00" fill="#000000">Externally</text>
+</g>
+<!-- ARCHIVED -->
+<g id="node11" class="node">
+<title>ARCHIVED</title>
+<polygon fill="none" stroke="#000000" points="158.2584,-160.9766 
59.9291,-160.9766 59.9291,-124.9766 158.2584,-124.9766 158.2584,-160.9766"/>
+<text text-anchor="middle" x="109.0938" y="-138.1766" 
font-family="Times,serif" font-size="16.00" fill="#000000">ARCHIVED</text>
+</g>
+<!-- ARCHIVING&#45;&gt;ARCHIVED -->
+<g id="edge13" class="edge">
+<title>ARCHIVING&#45;&gt;ARCHIVED</title>
+<path fill="none" stroke="#000000" d="M112.4599,-238.9129C111.823,-220.7593 
110.8319,-192.5125 110.0897,-171.3625"/>
+<polygon fill="#000000" stroke="#000000" points="113.5864,-171.2043 
109.7378,-161.3332 106.5908,-171.4498 113.5864,-171.2043"/>
+<text text-anchor="middle" x="145.1489" y="-202.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">On</text>
+<text text-anchor="middle" x="145.1489" y="-188.7766" 
font-family="Times,serif" font-size="14.00" fill="#000000">Completion</text>
+</g>
+<!-- ARCHIVED&#45;&gt;DELETED -->
+<g id="edge14" class="edge">
+<title>ARCHIVED&#45;&gt;DELETED</title>
+<path fill="none" stroke="#000000" d="M97.1717,-124.8206C91.9033,-116.7972 
85.4092,-106.9074 78.793,-96.8316"/>
+<polygon fill="#000000" stroke="#000000" points="81.6454,-94.799 
73.2309,-88.3611 75.7941,-98.6412 81.6454,-94.799"/>
+</g>
+</g>
+</svg>

Reply via email to