SPB Git

Repository Public MIT Research preview

S10-F03-reprise-idempotence.tex 3.8 KB 51 lines latex

1% S10-F03 — La même panne, deux issues : une création répétée sans clé produit un doublon ;2% avec une clé d'idempotence, la seconde tentative reçoit la réponse de la première.3% Idée : « délai dépassé » ne veut pas dire « rien ne s'est passé ». Tous les instants, les statuts,4% les identifiants et les décomptes viennent de S10-F03-donnees.tex (horloge simulée du code).5\input{S10-F03-donnees.tex}%6\begin{tikzpicture}[x=1mm, y=1mm]7  \def\AtlasFigIdemOrigine{33}% abscisse de t = 0, en mm8  \def\AtlasFigIdemEchelle{25}% millimètres par seconde simulée9  \newcommand{\AtlasFigIdemX}[1]{\AtlasFigIdemOrigine+\AtlasFigIdemEchelle*#1}10  % Axe du temps11  \draw[atlasRule, line width=.8pt] (\AtlasFigIdemOrigine,4.5) -- ++(3.4*\AtlasFigIdemEchelle,0);12  \foreach \s in {0,1,2,3}{13    \draw[atlasRule, line width=.6pt] (\AtlasFigIdemX{\s},4.5) -- ++(0,-1.2);14    \node[atlas note, anchor=north] at (\AtlasFigIdemX{\s},3.2) {\s\ s};15    \draw[atlasRule, line width=.4pt, dash pattern=on 1.5pt off 2pt] (\AtlasFigIdemX{\s},4.5) -- ++(0,42);16  }17  \node[atlas note, anchor=north east] at (\AtlasFigIdemOrigine-3,3.2) {horloge simulée};18  % Une rangée = un client. #1 ordonnée, #2 titre, #3 sous-titre19  \pgfmathsetmacro{\AtlasFigIdemMilieuUn}{\AtlasFigIdemDelai/2}20  \pgfmathsetmacro{\AtlasFigIdemMilieuDeux}{(\AtlasFigIdemDelai+\AtlasFigIdemReprise)/2}21  \newcommand{\AtlasFigIdemRangee}[3]{%22    \node[atlas heading, anchor=west] at (0,#1+4.2) {#2};23    \node[atlas note, anchor=west] at (0,#1-.2) {#3};24    \node[atlas note, anchor=east] at (\AtlasFigIdemOrigine-1.5,#1+4.2) {client};25    \node[atlas note, anchor=east] at (\AtlasFigIdemOrigine-1.5,#1-4.6) {service};26    \fill[atlasUncertain, fill opacity=.28, draw=atlasUncertain, line width=.9pt]27      (\AtlasFigIdemX{0},#1+2.4) rectangle (\AtlasFigIdemX{\AtlasFigIdemDelai},#1+6);28    \node[atlas note, text=atlasFg] at (\AtlasFigIdemX{\AtlasFigIdemMilieuUn},#1+4.2) {tentative 1 : délai dépassé};29    \draw[atlasMuted, line width=.7pt, dash pattern=on 2.4pt off 1.8pt]30      (\AtlasFigIdemX{\AtlasFigIdemDelai},#1+2.4) rectangle (\AtlasFigIdemX{\AtlasFigIdemReprise},#1+6);31    \node[atlas note] at (\AtlasFigIdemX{\AtlasFigIdemMilieuDeux},#1+4.2) {attente \AtlasFigIdemAttenteTexte\ s};32    \fill[atlasFlow, fill opacity=.28, draw=atlasFlow, line width=.9pt]33      (\AtlasFigIdemX{\AtlasFigIdemReprise},#1+2.4) rectangle (\AtlasFigIdemX{\AtlasFigIdemFin},#1+6);34    \node[atlas note, text=atlasFg, anchor=south east] at (\AtlasFigIdemX{\AtlasFigIdemFin}+.6,#1+6.2) {tentative 2 : \AtlasFigIdemStatut};35    \draw[atlas arrow valid] (\AtlasFigIdemX{\AtlasFigIdemLatence},#1+2.4) -- (\AtlasFigIdemX{\AtlasFigIdemLatence},#1-2.6);36    \node[atlas note, text=atlasFg, anchor=west] at (\AtlasFigIdemX{\AtlasFigIdemLatence}+1,#1-4.6) {\AtlasFigIdemFicheUn\ créée, réponse perdue};37  }38  \AtlasFigIdemRangee{37.5}{Sans clé}{le client répète le POST}39  \draw[atlas arrow hazard] (\AtlasFigIdemX{\AtlasFigIdemFin},39.9) -- (\AtlasFigIdemX{\AtlasFigIdemFin},34.9);40  \node[atlas note, text=atlasHazard, anchor=east] at (\AtlasFigIdemX{\AtlasFigIdemFin}-1,32.9) {\AtlasFigIdemFicheDeux\ créée aussi};41  \AtlasFigIdemRangee{16}{Avec clé}{même clé aux deux envois}42  \draw[atlas arrow valid] (\AtlasFigIdemX{\AtlasFigIdemFin},18.4) -- (\AtlasFigIdemX{\AtlasFigIdemFin},13.4);43  \node[atlas note, text=atlasValid, anchor=east] at (\AtlasFigIdemX{\AtlasFigIdemFin}-1,11.4) {même clé : réponse rejouée};44  \draw[atlasRule, line width=.5pt] (0,26.4) -- (142,26.4);45  % Bilans46  \node[atlas block hazard, text width=18mm, minimum height=11mm] at (130.5,36.5)47    {\textbf{\AtlasFigIdemApresNaif\ fiches}\\ \AtlasFigIdemCreeesNaif\ créées : doublon};48  \node[atlas block valid, text width=18mm, minimum height=11mm] at (130.5,15)49    {\textbf{\AtlasFigIdemApresCle\ fiches}\\ \AtlasFigIdemCreeesCle\ seule créée};50\end{tikzpicture}51
Files main
Menu

Theme