YugabyteDB (2.13.1.0-b60, 21121d69985fbf76aa6958d8f04a9bfa936293b5)

Coverage Report

Created: 2022-03-22 16:43

/Users/deen/code/yugabyte-db/ent/src/yb/cdc/cdc_producer.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) YugaByte, Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
4
// in compliance with the License.  You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software distributed under the License
9
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
10
// or implied.  See the License for the specific language governing permissions and limitations
11
// under the License.
12
13
#ifndef ENT_SRC_YB_CDC_CDC_PRODUCER_H
14
#define ENT_SRC_YB_CDC_CDC_PRODUCER_H
15
16
#include <memory>
17
#include <string>
18
19
#include <boost/functional/hash.hpp>
20
#include <boost/unordered_map.hpp>
21
22
#include "yb/cdc/cdc_service.service.h"
23
#include "yb/common/common_fwd.h"
24
#include "yb/common/transaction.h"
25
#include "yb/consensus/consensus_fwd.h"
26
#include "yb/docdb/docdb.pb.h"
27
#include "yb/tablet/tablet_fwd.h"
28
#include "yb/util/monotime.h"
29
#include "yb/util/opid.h"
30
31
namespace yb {
32
33
class MemTracker;
34
35
namespace cdc {
36
37
struct StreamMetadata {
38
  NamespaceId ns_id;
39
  std::vector<TableId> table_ids;
40
  CDCRecordType record_type;
41
  CDCRecordFormat record_format;
42
  CDCRequestSource source_type;
43
  CDCCheckpointType checkpoint_type;
44
45
0
  StreamMetadata() = default;
46
47
  StreamMetadata(NamespaceId ns_id,
48
                 std::vector<TableId> table_ids,
49
                 CDCRecordType record_type,
50
                 CDCRecordFormat record_format,
51
                 CDCRequestSource source_type,
52
                 CDCCheckpointType checkpoint_type)
53
      : ns_id(std::move(ns_id)),
54
        table_ids((std::move(table_ids))),
55
        record_type(record_type),
56
        record_format(record_format),
57
        source_type(source_type),
58
306
        checkpoint_type(checkpoint_type) {
59
306
  }
60
};
61
62
CHECKED_STATUS GetChangesForCDCSDK(const std::string& stream_id,
63
                                   const std::string& tablet_id,
64
                                   const CDCSDKCheckpointPB& op_id,
65
                                   const StreamMetadata& record,
66
                                   const std::shared_ptr<tablet::TabletPeer>& tablet_peer,
67
                                   const std::shared_ptr<MemTracker>& mem_tracker,
68
                                   consensus::ReplicateMsgsHolder* msgs_holder,
69
                                   GetChangesResponsePB* resp,
70
                                   std::string* commit_timestamp,
71
                                   std::shared_ptr<Schema>* cached_schema,
72
                                   OpId* last_streamed_op_id,
73
                                   int64_t* last_readable_opid_index = nullptr,
74
                                   const CoarseTimePoint deadline = CoarseTimePoint::max());
75
76
CHECKED_STATUS GetChangesForXCluster(const std::string& stream_id,
77
                                     const std::string& tablet_id,
78
                                     const OpId& op_id,
79
                                     const StreamMetadata& record,
80
                                     const std::shared_ptr<tablet::TabletPeer>& tablet_peer,
81
                                     const std::shared_ptr<MemTracker>& mem_tracker,
82
                                     consensus::ReplicateMsgsHolder* msgs_holder,
83
                                     GetChangesResponsePB* resp,
84
                                     int64_t* last_readable_opid_index = nullptr,
85
                                     const CoarseTimePoint deadline = CoarseTimePoint::max());
86
}  // namespace cdc
87
}  // namespace yb
88
89
#endif /* ENT_SRC_YB_CDC_CDC_PRODUCER_H */