Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3b19580a
Commit
3b19580a
authored
Dec 16, 2016
by
antirez
Browse files
ziplist.c explanation of format improved a bit.
parent
457c6878
Changes
1
Show whitespace changes
Inline
Side-by-side
src/ziplist.c
View file @
3b19580a
...
...
@@ -8,24 +8,31 @@
*
* ----------------------------------------------------------------------------
*
* ZIPLIST OVERALL LAYOUT:
* ZIPLIST OVERALL LAYOUT
*
* The general layout of the ziplist is as follows:
* <zlbytes><zltail><zllen><entry><entry><zlend>
*
* <zlbytes> is an unsigned integer to hold the number of bytes that the
* ziplist occupies. This value needs to be stored to be able to resize the
* <zlbytes> <zltail> <zllen> <entry> <entry> ... <entry> <zlend>
*
* All fields are stored in little endian.
*
* <uint32_t zlbytes> is an unsigned integer to hold the number of bytes that
* the ziplist occupies. This value needs to be stored to be able to resize the
* entire structure without the need to traverse it first.
*
* <zltail> is the offset to the last entry in the list. This allows a pop
* operation on the far side of the list without the need for full traversal.
* <uint32_t zltail> is the offset to the last entry in the list. This allows
* a pop operation on the far side of the list without the need for full
* traversal.
*
* <uint16_t zllen> is the number of entries. When this value is larger
* than 2^16-2, we need to traverse the entire list to know how many items it
* holds.
*
* <zl
l
en> is
the number of entries.When this value is larger than 2**16-2,
*
we need to traverse the entire list to know how many items it holds
.
* <
uint8_t
zlen
d
> is
a single byte special value, equal to 255, which
*
indicates the end of the list
.
*
* <zlend> is a single byte special value, equal to 255, which indicates the
* end of the list.
* ZIPLIST ENTRIES
*
* ZIPLIST ENTRIES:
* Every entry in the ziplist is prefixed by a header that contains two pieces
* of information. First, the length of the previous entry is stored to be
* able to traverse the list from back to front. Second, the encoding with an
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment