apple / apple/foundationdb

The get_versionstamp method is a bit confusing (Python)

Open
#1,426 0 comments 0 reactions 1 assignee Claimed by @alecgrieser View on GitHub
Dominant language
C++
Stars
16.7k
Forks
1.6k
Avg merge
1d 20h
Merged PRs (30d)
126

Description

Though the documentation says that `Transaction.get_versionstamp()` "returns a future which will contain the versionstamp...", the actual return type (once the future is resolved) is `fdb.impl.Key`. Unfortunately, if the user tries to create a `Versionstamp` object with this value, they can hit the following issue:
```
>>> vs_future = tr.get_versionstamp()
>>> tr.commit().wait()
>>> fdb.tuple.Versionstamp(vs_future).to_bytes()
struct.error: argument for 's' must be a bytes object
```
I was planning on creating a pull request to extract the value from `Key` objects like it is for `Value` objects when packing the `Versionstamp` and to update the docs to make the `get_versionstamp` return type a bit clearer. However, I wanted to check first to make sure that `fdb.impl.Key` is really the desired return type.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.