summaryrefslogtreecommitdiffstats
path: root/presentation/images/qcow2_addressing.tex
blob: f052248a532754b83f79ab0cde2ce941c0b8b47a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
%-------------------------------------------------------------------------------
% qcow2_addressing.tex - addressing of QCOW2 data clusters as image
%-------------------------------------------------------------------------------
% author   : Manuel Bentele
% date     : Aug 29, 2019
% copyright: (c) 2019 Manuel Bentele
%-------------------------------------------------------------------------------

\begin{tikzpicture}[
        arrow/.style = {-triangle 45},
        datacluster/.style = {rectangle, draw, fill = dat,
            minimum width = 0.1\textwidth, minimum height = 0.1\textheight},
        heading/.style = {font = \Large}
    ]
    \node[inner sep = 0, anchor = north] (l1table) at (0, 0) {
        \begin{tabular}{|p{0.25\textwidth}|} \hline
            \cellcolor{dat} \\ \hline
                            \\ \hline
            \cellcolor{dat} \\ \hline
                            \\ \hline
        \end{tabular}
    };

    \node[inner sep = 0, anchor = north] (l2table1) at (0.5\textwidth, 0) {
        \begin{tabular}{|p{0.25\textwidth}|} \hline
                            \\ \hline
                            \\ \hline
            \cellcolor{dat} \\ \hline
                            \\ \hline
            \cellcolor{dat} \\ \hline
        \end{tabular}
    };

    \node[inner sep = 0, below = 0.75 of l2table1] (l2table2) {
        \begin{tabular}{|p{0.25\textwidth}|} \hline
                            \\ \hline
            \cellcolor{dat} \\ \hline
            \cellcolor{dat} \\ \hline
                            \\ \hline
            \cellcolor{dat} \\ \hline
        \end{tabular}
    };

    \node[inner sep = 0, anchor = north, datacluster] (data1) at (0.9\textwidth, 0) {};
    \node[inner sep = 0, below = 0.5 of data1, datacluster] (data2) {};
    \node[inner sep = 0, below = 0.5 of data2, datacluster] (data3) {};
    \node[inner sep = 0, below = 0.5 of data3, datacluster] (data4) {};
    \node[inner sep = 0, below = 0.5 of data4, datacluster] (data5) {};

    \node[above = 0.5 of l1table, heading]  {L1~table};
    \node[above = 0.5 of l2table1, heading] {L2~tables};
    \node[above = 0.5 of data1, heading]    {Data clusters};
    

    \draw[arrow] ($(l1table.north east)!0.125!(l1table.south east)$) -- ($(l2table1.north west)!0.1!(l2table1.south west)$);
    \draw[arrow] ($(l1table.north east)!0.625!(l1table.south east)$) -- ($(l2table2.north west)!0.1!(l2table2.south west)$);
    
    \draw[arrow] ($(l2table1.north east)!0.5!(l2table1.south east)$) -- (data1.west);
    \draw[arrow] ($(l2table1.north east)!0.9!(l2table1.south east)$) -- (data2.west);
    \draw[arrow] ($(l2table2.north east)!0.3!(l2table2.south east)$) -- (data3.west);
    \draw[arrow] ($(l2table2.north east)!0.5!(l2table2.south east)$) -- (data4.west);
    \draw[arrow] ($(l2table2.north east)!0.9!(l2table2.south east)$) -- (data5.west);
\end{tikzpicture}