• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2024 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 #ifndef OHOS_DISTRIBUTED_DATA_GDB_JS_NAPI_GDB_CONTEXT_H
16 #define OHOS_DISTRIBUTED_DATA_GDB_JS_NAPI_GDB_CONTEXT_H
17 
18 #include "full_result.h"
19 #include "gdb_store.h"
20 #include "gdb_store_config.h"
21 #include "napi_async_call.h"
22 
23 namespace OHOS {
24 namespace GraphStoreJsKit {
25 using namespace OHOS::DistributedDataAip;
26 struct GdbStoreContextBase : public ContextBase {
StealGdbStoreGdbStoreContextBase27     std::shared_ptr<DBStore> StealGdbStore()
28     {
29         auto gdb = std::move(gdbStore);
30         gdbStore = nullptr;
31         return gdb;
32     }
33     std::shared_ptr<DBStore> gdbStore = nullptr;
34 };
35 
36 struct ContextParam {
37     std::string bundleName;
38     std::string moduleName;
39     std::string baseDir;
40     int32_t area = 2;
41     bool isSystemApp = false;
42     bool isStageMode = true;
43 };
44 
45 struct GdbStoreContext : public GdbStoreContextBase {
46     std::string device;
47     std::string gql;
48     std::vector<std::string> columns;
49     int64_t int64Output;
50     int intOutput;
51     ContextParam param;
52     StoreConfig config;
53     std::shared_ptr<Result> result;
54     std::vector<std::string> keys;
55     std::string key;
56     std::string aliasName;
57     std::string pathName;
58     std::string srcName;
59     std::string columnName;
60     int32_t enumArg;
61     uint64_t cursor = UINT64_MAX;
62     int64_t txId = 0;
63     napi_ref asyncHolder = nullptr;
64     bool isQueryGql = false;
65     uint32_t expiredTime = 0;
66 
GdbStoreContextGdbStoreContext67     GdbStoreContext() : int64Output(0), intOutput(0), enumArg(-1)
68     {
69     }
~GdbStoreContextGdbStoreContext70     virtual ~GdbStoreContext()
71     {
72     }
73 };
74 
75 struct CreateTransactionContext : public GdbStoreContextBase {
76     std::shared_ptr<Transaction> transaction;
77 };
78 } // namespace GraphStoreJsKit
79 } // namespace OHOS
80 #endif