• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 DISTRIBUTEDDB_AUTO_LAUNCH_EXPORT_H
17 #define DISTRIBUTEDDB_AUTO_LAUNCH_EXPORT_H
18 
19 #include "types_export.h"
20 #include "kv_store_observer.h"
21 #include "kv_store_nb_delegate.h"
22 #include "store_observer.h"
23 
24 namespace DistributedDB {
25 struct AutoLaunchOption {
26     bool createIfNecessary = true;
27     bool isEncryptedDb = false;
28     CipherType cipher = CipherType::DEFAULT;
29     CipherPassword passwd;
30     std::string schema;
31     bool createDirByStoreIdOnly = false;
32     std::string dataDir;
33     KvStoreObserver *observer = nullptr;
34     int conflictType = 0;
35     KvStoreNbConflictNotifier notifier;
36     SecurityOption secOption;
37     bool isNeedIntegrityCheck = false;
38     bool isNeedRmCorruptedDb = false;
39     bool isNeedCompressOnSync = false;
40     uint8_t compressionRate = 100; // valid in [1, 100].
41     bool isAutoSync = true;
42     StoreObserver *storeObserver = nullptr;
43     bool syncDualTupleMode = false; // communicator label use dualTuple hash or not
44     uint32_t iterateTimes = 0;
45     int conflictResolvePolicy = LAST_WIN;
46     DistributedTableMode tableMode = DistributedTableMode::SPLIT_BY_DEVICE;
47 };
48 
49 struct AutoLaunchParam {
50     std::string userId;
51     std::string appId;
52     std::string storeId;
53     AutoLaunchOption option;
54     AutoLaunchNotifier notifier;
55     std::string path;
56     std::string subUser = "";
57 };
58 
59 using AutoLaunchRequestCallback = std::function<bool (const std::string &identifier, AutoLaunchParam &param)>;
60 } // namespace DistributedDB
61 
62 #endif // DISTRIBUTEDDB_AUTO_LAUNCH_EXPORT_H
63