1 /* 2 * Copyright (c) 2023 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 DISTRIBUTEDDATAMGR_DATAMGR_SERVICE5_CLOUD_EXTRA_DATA_H 17 #define DISTRIBUTEDDATAMGR_DATAMGR_SERVICE5_CLOUD_EXTRA_DATA_H 18 19 #include "metadata/store_meta_data.h" 20 #include "serializable/serializable.h" 21 22 namespace OHOS::DistributedData { 23 class API_EXPORT Context final : public Serializable { 24 public: 25 std::string traceId; 26 std::string prepareTraceId; 27 bool Marshal(json &node) const override; 28 bool Unmarshal(const json &node) override; 29 }; 30 31 class API_EXPORT ExtensionInfo final : public Serializable { 32 public: 33 std::string accountId; 34 std::string bundleName; 35 std::string containerName; 36 std::string databaseScopes; 37 std::vector<std::string> scopes; 38 std::string recordTypes; 39 std::vector<std::string> tables; 40 Context context; 41 bool Marshal(json &node) const override; 42 bool Unmarshal(const json &node) override; 43 }; 44 45 class API_EXPORT ExtraData final : public Serializable { 46 public: 47 std::string header; 48 std::string data; 49 ExtensionInfo info; 50 51 bool Marshal(json &node) const override; 52 bool Unmarshal(const json &node) override; 53 bool isPrivate() const; 54 bool isShared() const; 55 56 static constexpr const char *PRIVATE_TABLE = "private"; 57 static constexpr const char *SHARED_TABLE = "shared"; 58 }; 59 } 60 #endif // DISTRIBUTEDDATAMGR_DATAMGR_SERVICE5_CLOUD_EXTRA_DATA_H 61