Implementing VersionStamps in bindings

Well I’m glad to have chosen a different way, because my tuple encoder is now extracted from the FDB binding and used elsewhere (where it does not know what an API version is).

I’ve chosen to instead use a random byte token that is searched by SetVersionStampedKey(...) to get the offfset, so I can trivially fix this by checking the API version there :slight_smile:

So to be exact, depending on the API Version:

  • API < 400:
    • Both not supported (=> FAIL).
  • API < 520:
    • SET_VERSIONSTAMPED_KEY must add a two byte offset
    • SET_VERSIONSTAMPED_VALUE does not have any offset at all (first 10 bytes overwritten)
  • API >= 520:
    • SET_VERSIONSTAMPED_KEY must add a four byte offset
    • SET_VERSIONSTAMPED_VALUE must add a four byte offset as well

I think the contract is actually “API Version < 520” and “API Version >= 520”, but yeah, that’s otherwise correct.

I have updated my comment above with the API version.

1 Like

@alloc I forgot to test for the minimum supported API version for VersionStamps.

The release notes says that they appeared in version 4.0.1. Does this correspond to API version 400 or 401?

I think that’s a bug in our documentation. I think we actually introduced in 4.0.0, not 4.0.1 (despite the release notes). I believe it’s API version 400 either way.