]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/utilities/cassandra/test_utils.h
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / utilities / cassandra / test_utils.h
1 // Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5
6 #pragma once
7 #include <memory>
8 #include "test_util/testharness.h"
9 #include "utilities/cassandra/format.h"
10 #include "utilities/cassandra/serialize.h"
11
12 namespace ROCKSDB_NAMESPACE {
13 namespace cassandra {
14 extern const char kData[];
15 extern const char kExpiringData[];
16 extern const int32_t kTtl;
17 extern const int8_t kColumn;
18 extern const int8_t kTombstone;
19 extern const int8_t kExpiringColumn;
20
21
22 std::shared_ptr<ColumnBase> CreateTestColumn(int8_t mask,
23 int8_t index,
24 int64_t timestamp);
25
26 std::tuple<int8_t, int8_t, int64_t> CreateTestColumnSpec(int8_t mask,
27 int8_t index,
28 int64_t timestamp);
29
30 RowValue CreateTestRowValue(
31 std::vector<std::tuple<int8_t, int8_t, int64_t>> column_specs);
32
33 RowValue CreateRowTombstone(int64_t timestamp);
34
35 void VerifyRowValueColumns(
36 const std::vector<std::shared_ptr<ColumnBase>> &columns,
37 std::size_t index_of_vector, int8_t expected_mask, int8_t expected_index,
38 int64_t expected_timestamp);
39
40 int64_t ToMicroSeconds(int64_t seconds);
41 int32_t ToSeconds(int64_t microseconds);
42 }
43 } // namespace ROCKSDB_NAMESPACE