Skip to content

Commit

Permalink
kvclient, roachpb: cleanup the CPut API
Browse files Browse the repository at this point in the history
The CPut API was funky: it took an expected value as a roachpb.Value,
but the checksum in it and the timestamp didn't matter. This was
undocumented. The checksum in particular covers both the key and the
value, so its relationship with a CPut is weird (since the key for
which we're using the value might be different from the key from whence
it came). This choice of Value had consequences for the Batch API:
Batch.CPut() was taking a *roachpb.Value, for which it cleared and then
re-initialized the checksum. This was all surprising, and meant that
some callers had to copy the underlying bytes for the value before
passing them to CPut().

This patch changes all the interfaces to just take []byte. There's no
longer a checksum or a timestamp to speak of. CPut() now also internally
copies the expected value's bytes, so the caller no longer needs to
worry about ownership.

Release note: None
  • Loading branch information
andreimatei committed Jun 25, 2020
1 parent 05b5c52 commit 9e14f24
Show file tree
Hide file tree
Showing 31 changed files with 1,055 additions and 829 deletions.
87 changes: 63 additions & 24 deletions c-deps/libroach/protos/roachpb/api.pb.cc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9e14f24

Please sign in to comment.