# C API fdb\_future\_get\_int64

**URL:** <https://forums.foundationdb.org/t/c-api-fdb-future-get-int64/3019>\
**Category:** Development\
**Tags:** bindings\
**Created:** [November 18, 2021, 11:39am UTC](https://forums.foundationdb.org/t/c-api-fdb-future-get-int64/3019 "2021-11-18T11:39:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajivr](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/rajivr/32/1100_2.png) [@rajivr](https://forums.foundationdb.org/u/rajivr)\
**Post date:** [November 18, 2021, 11:39am UTC](https://forums.foundationdb.org/t/c-api-fdb-future-get-int64/3019/1 "2021-11-18T11:39:48Z")

</div>

As I was working on binding tester, I noticed that C API [`fdb_future_get_int64`](https://apple.github.io/foundationdb/api-c.html#c.fdb_future_get_int64) that is used to resolve the futures returned by

- [`fdb_transaction_get_read_version`](https://apple.github.io/foundationdb/api-c.html#c.fdb_transaction_get_read_version)
- [`fdb_transaction_get_estimated_range_size_bytes`](https://apple.github.io/foundationdb/api-c.html#c.fdb_transaction_get_read_version)
- [`fdb_transaction_get_approximate_size`](https://apple.github.io/foundationdb/api-c.html#c.fdb_transaction_get_approximate_size)

returns a `int64`. I was wondering if there was some reason to return a `int64` instead of a `uint64` for these APIs? I should have noticed this before, but somehow missed it. 🙂

I had previously assumed GRV was a cluster-wide 64 bit _positive_ counter.

---

<div class="post-metadata">

**Author:** ![jzhou](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/jzhou/32/445_2.png) [@jzhou](https://forums.foundationdb.org/u/jzhou)\
**Post date:** [November 19, 2021, 4:42am UTC](https://forums.foundationdb.org/t/c-api-fdb-future-get-int64/3019/2 "2021-11-19T04:42:38Z")

</div>

The `Version` type within FDB is defined as `int64_t`, see [here](https://github.com/apple/foundationdb/blob/master/fdbclient/FDBTypes.h#L33). That’s why `int64` is chosen.

---

<div class="post-metadata">

**Author:** ![rajivr](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/rajivr/32/1100_2.png) [@rajivr](https://forums.foundationdb.org/u/rajivr)\
**Post date:** [November 19, 2021, 5:08am UTC](https://forums.foundationdb.org/t/c-api-fdb-future-get-int64/3019/3 "2021-11-19T05:08:45Z")

</div>

I see. So, if we are going to rely on GRV to infer _happens before_ relation between two transactions, then its our (caller’s) responsibility to transmute the `int64` to `uint64`.

Would this be a correct assumption?

---

<div class="post-metadata">

**Author:** ![jzhou](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/jzhou/32/445_2.png) [@jzhou](https://forums.foundationdb.org/u/jzhou)\
**Post date:** [November 19, 2021, 6:09am UTC](https://forums.foundationdb.org/t/c-api-fdb-future-get-int64/3019/4 "2021-11-19T06:09:18Z")

</div>

Yes, the caller has to do that. However, I want to point out that the GRV that the caller gets **should** always be positive numbers. Negative version number only exists internally for initializations of some version numbers.

BTW, GRV only implies _happen-before_ for **read-only** transactions. For read-write transactions, they happen at the _commit version_, which should be used to reason about _happen-before_ relationship.

---

<div class="post-metadata">

**Author:** ![rajivr](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/rajivr/32/1100_2.png) [@rajivr](https://forums.foundationdb.org/u/rajivr)\
**Post date:** [November 19, 2021, 6:26am UTC](https://forums.foundationdb.org/t/c-api-fdb-future-get-int64/3019/5 "2021-11-19T06:26:58Z")

</div>

Thanks @jzhou for the reply! 🙂
