Subspace packWithVersionstamp vs pack
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
Hey, been reading through some code to start using Versionstamps in my code, and I noticed some interesting behavior with the two pack methods.
[Subspace#pack](https://github.com/apple/foundationdb/blob/170013d69b1e4893d990fcc5a0e09825bc9d8048/bindings/java/src/main/com/apple/foundationdb/tuple/Tuple.java#L360-L362) throws when there is an incomplete versionstamp in the tuple
and
[Subspace#packWithVersionstamp](https://github.com/apple/foundationdb/blob/170013d69b1e4893d990fcc5a0e09825bc9d8048/bindings/java/src/main/com/apple/foundationdb/tuple/Tuple.java#L443-L445) throws when there is no incomplete versionstamp in the Tuple
I ended up doing something like the following, and I saw other people have done the same. Was wondering why the api exists like this rather than having a single pack method that delegates to either of these options. Is there a different pattern I should be using here? Is there a case where you would want to call the pack/packWithVersionstamp method and have the exception get thrown?
```
if (tuple.hasIncompleteVersionstamp()) {
return subspace.packWithVersionstamp(tuple);
} else {
return subspace.pack(tuple);
}
```
Contributor guide
Research direction
Start by comparing the linked Subspace#pack and Subspace#packWithVersionstamp implementations in bindings/java/src/main/com/apple/foundationdb/tuple/Tuple.java. Determine the intended behavior for complete and incomplete versionstamps, then document the supported usage pattern and when each exception is expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100