Author: | Valentin Haenel |
---|---|
Contact: | [email protected] |
The following 32 bit header is proposed for bloscpack as of version 0.2.0
.
The design goals of the new header format are to contain as much information as
possible to achieve interesting things in the future and to be as general as
possible such that the new persistence layer of CArray is compatible with
bloscpack.
The following ascii representation shows the layout of the header:
|-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-| | b l p k | ^ | ^ | ^ | ^ | chunk-size | last-chunk | | | | | version ----+ | | | options --------+ | | checksum ------------+ | typesize ----------------+ |-0-|-1-|-2-|-3-|-4-|-5-|-6-|-7-|-8-|-9-|-A-|-B-|-C-|-D-|-E-|-F-| | nchunks | RESERVED |
The first 4 bytes are the magic string blpk
. Then there are 4 bytes, the
first three are described below and the last one is reserved. This is followed
by 4 bytes for the chunk-size
, another 4 bytes for the last-chunk-size
and 8 bytes for the number of chunks. The last 8 bytes are reserved for use in
future versions of the format.
All entries are little-endian.
version: | ( |
||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options: | (
|
||||||||||||||||||
checksum: | (
|
||||||||||||||||||
typesize: | ( |
||||||||||||||||||
chunk-size: | ( |
||||||||||||||||||
last-chunk: | ( |
||||||||||||||||||
nchunks: | ( |
The overall file-size can be computed as chunk-size * (nchunks - 1) +
last-chunk-size
.
Offsets of the chunks into the file are to be used for accelerated seeking. The
offsets (if activated) follow the header. Each offset is a 64 bit signed
little-endian integer (int64
). A value of -1
denotes an unknown offset.
Each offset denotes the exact position of the chunk in the file such that
seeking to the offset, will position the file pointer such that, reading the
next 16 bytes gives the blosc header, which is at the start of the desired
chunk. The layout of the file is then:
|-bloscpack-header-|-offset-|-offset-|...|-chunk-|-chunk-|...|