Created
August 11, 2016 13:00
-
-
Save larstvei/cf5b967a7cdbb54a013dfeb599d84c19 to your computer and use it in GitHub Desktop.
This file contains 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
\documentclass{standalone} | |
\usepackage{tikz} | |
\usetikzlibrary{arrows.meta, positioning, decorations.pathreplacing} | |
\pgfdeclarelayer{bg} % declare background layer | |
\pgfsetlayers{bg,main} % set the order of the layers (main is the standard % layer) | |
\begin{document} | |
\begin{tikzpicture}[>=stealth, shorten >= 5pt, node distance=4em, scale=1] | |
\tikzstyle{vertex} = [circle, scale=0.5] | |
\tikzstyle{O_0} = [vertex, fill=black!30!green] | |
\tikzstyle{O_1} = [vertex, fill=black!30!blue] | |
\tikzstyle{O_2} = [vertex, fill=black!30!red] | |
\tikzstyle{to} = [-{Stealth[scale=1.2]}] | |
\tikzstyle{toO_0} = [to, color=black!30!green] | |
\tikzstyle{toO_1} = [to, color=black!30!blue] | |
\tikzstyle{toO_2} = [to, color=black!30!red] | |
\tikzstyle{op} = [midway, above=-3pt, sloped, text=black, font=\small] | |
%% Server receives operations in this order | |
\node (s) at (4, 6) {$S$}; | |
\coordinate (se) at (4, 0) {}; | |
\node[O_0, below = 2em of s,] (s1) {}; | |
\node[O_1, below = 2em of s1,] (s2) {}; | |
\node[O_2, below = 2em of s2,] (s3) {}; | |
\node[O_1, below = 3em of s3,] (s4) {}; | |
%% User 0 generates/receives in this order | |
\node (u0) at (10, 6) {$u_0$}; | |
\node (u0e) at (10, 0) {}; | |
\node[O_2, below = 2em of u0,] (u01) {}; | |
\node[O_0, below = 2em of u01,] (u02) {}; | |
\node[O_1, below = 3em of u02,] (u03) {}; | |
\node[O_2, below = 2em of u03,] (u04) {}; | |
%% User 1 generates/receives in this order | |
\node (u1) at (7, 6) {$u_1$}; | |
\node (u1e) at (7, 0) {}; | |
\node[O_0, below = 1em of u1,] (u10) {}; | |
%% User 2 generates/receives in this order | |
\node (u2) at (0, 6) {$u_{new}$}; | |
\node (u2e) at (0, 0) {}; | |
\node[O_1, below = 2em of u2] (u20) {}; | |
\node[O_1, below = 10em of u20] (u21) {}; | |
\begin{pgfonlayer}{bg} % select the background layer | |
\draw[to, color=black!30] (s) -- (se); | |
\draw[to, color=black!30] (u0) -- (u0e); | |
\draw[to, color=black!30] (u1) -- (u1e); | |
\draw[to, color=black!30] (u2) -- (u2e); | |
% Life of O_0 | |
\draw[toO_0] (u10) -- (s1) node [op, near end] {$O_0$}; | |
\draw[toO_0] (s1) -- (u02) node [op, pos=0.6] {$O_0$}; | |
% Life of O_1 | |
\draw[toO_1] (u20) -- (s2) node [op] {\texttt{connect-request}}; | |
\draw[toO_1] (s2) -- (u03) node [op, pos=0.72] {\texttt{buffer-request}}; | |
\draw[toO_1] (u03) -- (s4) node [op, near end] {$O_a$}; | |
\draw[toO_1] (u03) -- (s4) node [op, draw=none, near end, below=-2pt] {\texttt{buffer-response}}; | |
\draw[toO_1] (s4) -- (u21) node [op] {$O_1 \circ O_0 \circ O_1^{-1} \circ O_a$}; | |
\draw[toO_1] (s4) -- (u21) node [op, draw=none, below=-2pt] {\texttt{operations}}; | |
\draw [decorate,shorten >=0pt,decoration={brace, amplitude=10pt}] (u21.west) -- (u20.west) node [midway,xshift=-0.8cm] {\footnotesize wait}; | |
% Life of O_2 | |
\draw[toO_2] (u01) -- (s3) node [op, pos=0.6] {$O_1$}; | |
\draw[toO_2] (s3) -- (u04) node [op, pos=0.35] {$O_1 \circ O_0 \circ O_1^{-1}$}; | |
\end{pgfonlayer} | |
\end{tikzpicture} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment