src/yb/docdb/doc_kv_util.cc
Status CheckHybridTimeSizeAndValueType(
    const rocksdb::Slice& key,
    int* ht_byte_size_dest) {
  RETURN_NOT_OK(
      DocHybridTime::CheckAndGetEncodedSize(key, ht_byte_size_dest));
  const size_t hybrid_time_value_type_offset = key.size() - *ht_byte_size_dest - 1;
  const ValueType value_type = DecodeValueType(key[hybrid_time_value_type_offset]);
  if (value_type != ValueType::kHybridTime) {
    return STATUS_FORMAT(
        Corruption,
        "Expected to find value type kHybridTime preceding the HybridTime component of the "
            "encoded key, found $0. DocHybridTime bytes: $1",
        value_type,
        ToShortDebugStr(rocksdb::Slice(key.data() + hybrid_time_value_type_offset,
                                       key.size() - hybrid_time_value_type_offset)));
  }

  return Status::OK();
}
// Given a DocDB key stored in RocksDB, validate the DocHybridTime size stored as the
// last few bits of the final byte of the key, and ensure that the ValueType byte preceding that
// encoded DocHybridTime is ValueType::kHybridTime.
Given a DocDB key stored in RocksDB, validate the DocHybridTime size stored as the
last few bits of the final byte of the key, and ensure that the ValueType byte preceding that
encoded DocHybridTime is ValueType::kHybridTime.
Given a DocDB key stored in RocksDB validate the DocHybridTime size stored as the last few bits of the final byte of the key and ensure that the ValueType byte preceding that encoded DocHybridTime is ValueType :: kHybridTime .
Status CheckHybridTimeSizeAndValueType(
    const rocksdb::Slice& key,
    int* ht_byte_size_dest) {
  RETURN_NOT_OK(
      DocHybridTime::CheckAndGetEncodedSize(key, ht_byte_size_dest));
  const size_t hybrid_time_value_type_offset = key.size() - *ht_byte_size_dest - 1;
  const ValueType value_type = DecodeValueType(key[hybrid_time_value_type_offset]);
  if (value_type != ValueType::kHybridTime) {
    return STATUS_FORMAT(
        Corruption,
        "Expected to find value type kHybridTime preceding the HybridTime component of the "
            "encoded key, found $0. DocHybridTime bytes: $1",
        value_type,
        ToShortDebugStr(rocksdb::Slice(key.data() + hybrid_time_value_type_offset,
                                       key.size() - hybrid_time_value_type_offset)));
  }
  return Status::OK();
}
Status CheckHybridTimeSizeAndValueType ( const rocksdb :: Slice & key , int * ht_byte_size_dest ) { RETURN_NOT_OK ( DocHybridTime :: CheckAndGetEncodedSize ( key , ht_byte_size_dest ) ) ; const size_t hybrid_time_value_type_offset = key . size ( ) - * ht_byte_size_dest - 1 ; const ValueType value_type = DecodeValueType ( key [ hybrid_time_value_type_offset ] ) ; if ( value_type != ValueType :: kHybridTime ) { return STATUS_FORMAT ( Corruption , " " " " , value_type , ToShortDebugStr ( rocksdb :: Slice ( key . data ( ) + hybrid_time_value_type_offset , key . size ( ) - hybrid_time_value_type_offset ) ) ) ; } return Status :: OK ( ) ; }
Given a DocDB key stored in RocksDB, validate the DocHybridTime size stored as the
last few bits of the final byte of the key, and ensure that the ValueType byte preceding that
encoded DocHybridTime is ValueType::kHybridTime.
Given a DocDB key stored in RocksDB validate the DocHybridTime size stored as the last few bits of the final byte of the key and ensure that the ValueType byte preceding that encoded DocHybridTime is ValueType :: kHybridTime .