apple / apple/foundationdb

Missing tuple documentation for Positive / Negative arbitrary precision integers

Open
#2,732 1 comment 0 reactions 0 assignees View on GitHub
documentation
Dominant language
C++
Stars
16.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
126

Description

The [document describing tuples](https://github.com/apple/foundationdb/blob/master/design/tuple.md#negative-arbitrary-precision-integer) is missing documentation for the wire format of +/- arbitrary precision integers.

These are already implemented in the python and java bindings, and as a result are unlikely to change. We should document the format.

The [python binding code is here](https://github.com/apple/foundationdb/blob/92b41e3562e639e16dbe0142cc479a3304e9c08a/bindings/python/fdb/tuple.py#L239-L252):

```python
elif code == POS_INT_END: # 0x1d; Positive 9-255 byte integer
length = six.indexbytes(v, pos + 1)
val = 0
for i in _range(length):
val = val << 8
val += six.indexbytes(v, pos + 2 + i)
return val, pos + 2 + length
elif code == NEG_INT_START: # 0x0b; Negative 9-255 byte integer
length = six.indexbytes(v, pos + 1) ^ 0xff
val = 0
for i in _range(length):
val = val << 8
val += six.indexbytes(v, pos + 2 + i)
return val - (1 << (length * 8)) + 1, pos + 2 + length
```

Contributor guide

Open the contributing guide

Research direction

Read design/tuple.md at the linked negative arbitrary precision integer section, then compare its existing wire-format descriptions with the referenced Python binding and the Java binding implementation. Done means the documentation specifies both positive and negative arbitrary-precision integer encodings consistently with those implementations.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.