1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef KV_STORE_NB_CONFLICT_DATA_H 17 #define KV_STORE_NB_CONFLICT_DATA_H 18 19 #include "store_types.h" 20 21 namespace DistributedDB { 22 enum KvStoreNbConflictType { 23 CONFLICT_FOREIGN_KEY_ONLY = 0x01, // sync conflict for same origin dev 24 CONFIICT_FOREIGN_KEY_ONLY = CONFLICT_FOREIGN_KEY_ONLY, // sync conflict for same origin dev(compatible for mistake) 25 CONFLICT_FOREIGN_KEY_ORIG = 0x02, // sync conflict for different origin dev 26 CONFLICT_NATIVE_ALL = 0x0c, // native conflict. 27 }; 28 29 class KvStoreNbConflictData { 30 public: 31 enum class ValueType { 32 OLD_VALUE = 0, 33 NEW_VALUE, 34 }; 35 ~KvStoreNbConflictData()36 DB_API virtual ~KvStoreNbConflictData() {}; 37 38 DB_API virtual KvStoreNbConflictType GetType() const = 0; 39 40 DB_API virtual void GetKey(Key &key) const = 0; 41 42 DB_API virtual DBStatus GetValue(ValueType type, Value &value) const = 0; 43 44 DB_API virtual bool IsDeleted(ValueType type) const = 0; 45 46 DB_API virtual bool IsNative(ValueType type) const = 0; 47 }; 48 } // namespace DistributedDB 49 50 #endif // KV_STORE_NB_CONFLICT_DATA_H 51