allow ntuple anchor to be zipped
This commit is contained in:
parent
67603efe3a
commit
1b8ad7098a
2 changed files with 15 additions and 3 deletions
|
@ -942,7 +942,10 @@ struct Sec_Hover_Fn {
|
|||
const RNTuple_Anchor_Info *info = (const RNTuple_Anchor_Info *)section.info;
|
||||
titled_section(push_str8f(arena, "RNTuple Anchor \"%s;%hu\"", info->name.c(), info->cycle).c(), [this] {
|
||||
tkey();
|
||||
titled_section("Data", [this] {
|
||||
b8 zipped = maybe_rootzip();
|
||||
if (zipped) {
|
||||
range("Compressed payload", section.range.len - section.post_size - ROOTZIP_RANGE_LEN);
|
||||
} else {
|
||||
field<u32>("Object len: %u", [] (Arena *arena, String8_Node *prev, const char *fmt, u32 x) {
|
||||
x = bswap(x);
|
||||
x -= 0x4000'0000;
|
||||
|
@ -961,7 +964,7 @@ struct Sec_Hover_Fn {
|
|||
field_be<u64>("Len Footer: %u");
|
||||
field_be<u64>("Max Key Size: %u");
|
||||
field_le<u64>("Checksum: 0x%" PRIX64);
|
||||
}, HoverSec_HideIfNotHovered);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,7 @@ b8 walk_tkeys(Arena *arena, const u8 *data, u64 data_len, u32 flags, TFile_Data
|
|||
}
|
||||
|
||||
const u64 key_version_off = 4;
|
||||
const u64 objlen_off = 6;
|
||||
const u64 keylen_off = 14;
|
||||
const u64 cycle_off = 16;
|
||||
|
||||
|
@ -224,6 +225,7 @@ b8 walk_tkeys(Arena *arena, const u8 *data, u64 data_len, u32 flags, TFile_Data
|
|||
}
|
||||
|
||||
u16 key_version = read_be<u16>(data + cur + key_version_off);
|
||||
u32 objlen = read_be<u32>(data + cur + objlen_off);
|
||||
u16 keylen = read_be<u16>(data + cur + keylen_off);
|
||||
if (!keylen) {
|
||||
fprintf(stderr, "Error: found key or obj with len 0. Bailing out...\n");
|
||||
|
@ -304,7 +306,14 @@ b8 walk_tkeys(Arena *arena, const u8 *data, u64 data_len, u32 flags, TFile_Data
|
|||
|
||||
u64 anchor_seek = cur + keylen;
|
||||
RNTuple_Anchor_On_Disk anchor;
|
||||
memcpy(&anchor, data + anchor_seek, sizeof(anchor));
|
||||
u32 obj_nbytes = n_bytes - keylen;
|
||||
if (obj_nbytes != objlen) {
|
||||
char zipped_anchor[sizeof(anchor)];
|
||||
memcpy(zipped_anchor, data + anchor_seek, sizeof(zipped_anchor));
|
||||
ROOT::Experimental::Internal::RNTupleDecompressor::Unzip(zipped_anchor, obj_nbytes, objlen, &anchor);
|
||||
} else {
|
||||
memcpy(&anchor, data + anchor_seek, sizeof(anchor));
|
||||
}
|
||||
|
||||
rntuple_info->anchor = ROOT::Experimental::Internal::CreateAnchor(
|
||||
bswap(anchor.epoch_be), bswap(anchor.major_be), bswap(anchor.minor_be), bswap(anchor.patch_be),
|
||||
|
|
Loading…
Add table
Reference in a new issue