1/**
2 * Copyright 2021 Alibaba, Inc. and its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15
16 * \author Dianzhang.Chen
17 * \date Jan 2021
18 * \brief This file includes some baic & common functions
19 */
20
21#pragma once
22
23#include <string>
24#include <aitheta2/index_framework.h>
25#include "proto/common.pb.h"
26#include "proto/proxima_be.pb.h"
27
28namespace proxima {
29namespace be {
30namespace repository {
31
32const uint64_t UPDATE_INTERVAL{1};
33
34enum class CollectionStateFlag : uint32_t { NORMAL = 0, UPDATE, DROP };
35enum class CollectionStatus : uint32_t {
36 INIT = 0,
37 RUNNING,
38 UPDATING,
39 FINISHED
40};
41
42enum class ScanMode : uint32_t { FULL = 0, INCREMENTAL };
43enum RowDataStatus : uint32_t { NORMAL = 0, NO_MORE_DATA, SCHEMA_CHANGED };
44
45#define INVALID_PRIMARY_KEY std::numeric_limits<uint64_t>::max()
46
47using CollectionConfig = proto::CollectionConfig;
48using WriteRequest = proto::WriteRequest;
49
50using GenericValue = proto::GenericValue;
51using FieldType = proto::GenericValueMeta::FieldType;
52
53using GenericValueMeta = proxima::be::proto::GenericValueMeta;
54using GenericValueMetaList =
55 google::protobuf::RepeatedPtrField<proxima::be::proto::GenericValueMeta>;
56
57// new
58using CollectionInfo = proto::CollectionInfo;
59
60struct LsnContext {
61 //! binlog file name
62 std::string file_name;
63 //! binlog position
64 uint64_t position;
65 //! table sequence id
66 uint64_t seq_id;
67 //! row data status
68 RowDataStatus status;
69
70 LsnContext()
71 : file_name(""), position(4), seq_id(0), status(RowDataStatus::NORMAL) {}
72};
73
74} // end namespace repository
75} // namespace be
76} // end namespace proxima
77