Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit 77cc2ea

Browse files
Update index.md(format of series entry) (#515)
* Update index.md * more clear format representation * move dots to the bottom * update #labels count, #chunks count * use correct variable types. Signed-off-by: naivewong <[email protected]>
2 parents 1bcda9d + 9b227d2 commit 77cc2ea

File tree

1 file changed

+52
-46
lines changed

1 file changed

+52
-46
lines changed

docs/format/index.md

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -85,34 +85,40 @@ After the labels, the number of indexed chunks is encoded, followed by a sequenc
8585
`mint` of the first chunk is stored, it's `maxt` is stored as a delta and the `mint` and `maxt` are encoded as deltas to the previous time for subsequent chunks. Similarly, the reference of the first chunk is stored and the next ref is stored as a delta to the previous one.
8686

8787
```
88-
┌─────────────────────────────────────────────────────────────────────────┐
89-
│ len <uvarint> │
90-
├─────────────────────────────────────────────────────────────────────────┤
91-
│ ┌──────────────────┬──────────────────────────────────────────────────┐ │
92-
│ │ │ ┌──────────────────────────────────────────┐ │ │
93-
│ │ │ │ ref(l_i.name) <uvarint> │ │ │
94-
│ │ #labels │ ├──────────────────────────────────────────┤ ... │ │
95-
│ │ <uvarint> │ │ ref(l_i.value) <uvarint> │ │ │
96-
│ │ │ └──────────────────────────────────────────┘ │ │
97-
│ ├──────────────────┼──────────────────────────────────────────────────┤ │
98-
│ │ │ ┌──────────────────────────────────────────┐ │ │
99-
│ │ │ │ c_0.mint <varint> │ │ │
100-
│ │ │ ├──────────────────────────────────────────┤ │ │
101-
│ │ │ │ c_0.maxt - c_0.mint <uvarint> │ │ │
102-
│ │ │ ├──────────────────────────────────────────┤ │ │
103-
│ │ │ │ ref(c_0.data) <uvarint> │ │ │
104-
│ │ #chunks │ └──────────────────────────────────────────┘ │ │
105-
│ │ <uvarint> │ ┌──────────────────────────────────────────┐ │ │
106-
│ │ │ │ c_i.mint - c_i-1.maxt <uvarint> │ │ │
107-
│ │ │ ├──────────────────────────────────────────┤ │ │
108-
│ │ │ │ c_i.maxt - c_i.mint <uvarint> │ │ │
109-
│ │ │ ├──────────────────────────────────────────┤ ... │ │
110-
│ │ │ │ ref(c_i.data) - ref(c_i-1.data) <varint> │ │ │
111-
│ │ │ └──────────────────────────────────────────┘ │ │
112-
│ └──────────────────┴──────────────────────────────────────────────────┘ │
113-
├─────────────────────────────────────────────────────────────────────────┤
114-
│ CRC32 <4b> │
115-
└─────────────────────────────────────────────────────────────────────────┘
88+
┌──────────────────────────────────────────────────────────────────────────┐
89+
│ len <uvarint> │
90+
├──────────────────────────────────────────────────────────────────────────┤
91+
│ ┌──────────────────────────────────────────────────────────────────────┐ │
92+
│ │ labels count <uvarint64> │ │
93+
│ ├──────────────────────────────────────────────────────────────────────┤ │
94+
│ │ ┌────────────────────────────────────────────┐ │ │
95+
│ │ │ ref(l_i.name) <uvarint32> │ │ │
96+
│ │ ├────────────────────────────────────────────┤ │ │
97+
│ │ │ ref(l_i.value) <uvarint32> │ │ │
98+
│ │ └────────────────────────────────────────────┘ │ │
99+
│ │ ... │ │
100+
│ ├──────────────────────────────────────────────────────────────────────┤ │
101+
│ │ chunks count <uvarint64> │ │
102+
│ ├──────────────────────────────────────────────────────────────────────┤ │
103+
│ │ ┌────────────────────────────────────────────┐ │ │
104+
│ │ │ c_0.mint <varint64> │ │ │
105+
│ │ ├────────────────────────────────────────────┤ │ │
106+
│ │ │ c_0.maxt - c_0.mint <uvarint64> │ │ │
107+
│ │ ├────────────────────────────────────────────┤ │ │
108+
│ │ │ ref(c_0.data) <uvarint64> │ │ │
109+
│ │ └────────────────────────────────────────────┘ │ │
110+
│ │ ┌────────────────────────────────────────────┐ │ │
111+
│ │ │ c_i.mint - c_i-1.maxt <uvarint64> │ │ │
112+
│ │ ├────────────────────────────────────────────┤ │ │
113+
│ │ │ c_i.maxt - c_i.mint <uvarint64> │ │ │
114+
│ │ ├────────────────────────────────────────────┤ │ │
115+
│ │ │ ref(c_i.data) - ref(c_i-1.data) <varint64> │ │ │
116+
│ │ └────────────────────────────────────────────┘ │ │
117+
│ │ ... │ │
118+
│ └──────────────────────────────────────────────────────────────────────┘ │
119+
├──────────────────────────────────────────────────────────────────────────┤
120+
│ CRC32 <4b> │
121+
└──────────────────────────────────────────────────────────────────────────┘
116122
```
117123

118124

@@ -176,24 +182,24 @@ The sequence of postings sections is finalized by an [offset table](#offset-tabl
176182
An offset table stores a sequence of entries that maps a list of strings to an offset. They are used to track label index and postings sections. They are read into memory when an index file is loaded.
177183

178184
```
179-
┌─────────────────────┬────────────────────┐
180-
│ len <4b> │ #entries <4b> │
181-
├─────────────────────┴────────────────────┤
182-
│ ┌──────────────────────────────────────┐ │
183-
│ │ n = #strs <uvarint> │ │
184-
│ ├──────────────────────┬───────────────┤ │
185-
│ │ len(str_1) <uvarint> │ str_1 <bytes> │ │
186-
│ ├──────────────────────┴───────────────┤ │
187-
│ │ ... │ │
188-
│ ├──────────────────────┬───────────────┤ │
189-
│ │ len(str_n) <uvarint> │ str_n <bytes> │ │
190-
│ ├──────────────────────┴───────────────┤ │
191-
│ │ offset <uvarint> │ │
192-
│ └──────────────────────────────────────┘ │
193-
│ . . . │
194-
├──────────────────────────────────────────┤
195-
│ CRC32 <4b> │
196-
└──────────────────────────────────────────┘
185+
┌─────────────────────┬──────────────────────
186+
│ len <4b> │ #entries <4b>
187+
├─────────────────────┴──────────────────────
188+
│ ┌────────────────────────────────────────┐ │
189+
│ │ n = #strs <uvarint> │ │
190+
│ ├──────────────────────┬─────────────────┤ │
191+
│ │ len(str_1) <uvarint> │ str_1 <bytes> │ │
192+
│ ├──────────────────────┴─────────────────┤ │
193+
│ │ ... │ │
194+
│ ├──────────────────────┬─────────────────┤ │
195+
│ │ len(str_n) <uvarint> │ str_n <bytes> │ │
196+
│ ├──────────────────────┴─────────────────┤ │
197+
│ │ offset <uvarint64> │ │
198+
│ └────────────────────────────────────────┘ │
199+
. . . │
200+
├────────────────────────────────────────────
201+
│ CRC32 <4b>
202+
└────────────────────────────────────────────
197203
```
198204

199205

0 commit comments

Comments
 (0)