/** * Copyright (c) 2021 OceanBase * OceanBase CE is licensed under Mulan PubL v2. * You can use this software according to the terms and conditions of the Mulan PubL v2. * You may obtain a copy of Mulan PubL v2 at: * http://license.coscl.org.cn/MulanPubL-2.0 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. * See the Mulan PubL v2 for more details. */ #ifndef OCEANBASE_SHARE_OB_TABLET_CHECKSUM_ITERATOR_H_ #define OCEANBASE_SHARE_OB_TABLET_CHECKSUM_ITERATOR_H_ #include "lib/list/ob_dlist.h" #include "lib/string/ob_sql_string.h" #include "share/schema/ob_schema_struct.h" #include "share/ob_tablet_checksum_operator.h" namespace oceanbase { namespace common { class ObISQLClient; } namespace share { class ObTabletLSPair; class ObTabletChecksumIterator { public: ObTabletChecksumIterator() : is_inited_(false), tenant_id_(OB_INVALID_TENANT_ID), snapshot_version_(OB_INVALID_VERSION), checksum_items_(), cur_idx_(0), sql_proxy_(NULL) {} virtual ~ObTabletChecksumIterator() { reset(); } int init(const uint64_t tenant_id, common::ObISQLClient *sql_proxy); void reset(); void reuse(); int next(ObTabletChecksumItem &item); void set_snapshot_version(const int64_t snapshot_version) { snapshot_version_ = snapshot_version; } private: int fetch_next_batch(); private: static const int64_t BATCH_FETCH_COUNT = 100; bool is_inited_; uint64_t tenant_id_; int64_t snapshot_version_; common::ObSEArray checksum_items_; int64_t cur_idx_; common::ObISQLClient *sql_proxy_; DISALLOW_COPY_AND_ASSIGN(ObTabletChecksumIterator); }; } // namespace share } // namespace oceanbase #endif // OCEANBASE_SHARE_OB_TABLET_CHECKSUM_ITERATOR_H_