This is an archive of the discontinued Mercurial Phabricator instance.

radixbuf: add serialization support for keys (byte arrays)
AbandonedPublic

Authored by quark on Oct 23 2017, 4:12 PM.
Tags
None
Subscribers

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

The radix tree index is intended to be compact. Often, the keys in the index
exists in another file (or called "buffer"). Therefore storing full keys in
the index itself is a waste of space. We can store offsets instead.

This patch implements serialization for a byte array (either fixed 20-byte,
or has a variable length). So we can convert between byte arrays and
offsets.

For cases where we know the mapping already (ex. revlog has a node <->
revision number) mapping, we can "abuse" the serialize interface to return
revision numbers instead of actual buffer offsets and leave "write_to"
unimplemented.

Test Plan

cargo test

Diff Detail

Repository
rFBHGX Facebook Mercurial Extensions
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

quark created this revision.Oct 23 2017, 4:12 PM
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 23 2017, 4:12 PM
quark added a subscriber: durin42.Oct 23 2017, 4:13 PM
quark abandoned this revision.Nov 2 2017, 2:48 PM

This is actually over-engineering. D1292 series does not need serialize support.