• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Distributed Data Management Subsystem Changelog
2
3## cl.distributeddatamgr.1 API Change
4Changed the APIs in **kv_store** of the distributed data management subsystem:
5
6Changed **createKVManager()** from an asynchronous API to a synchronous API, because the execution duration is fixed and short.<br>Before change:<br>**createKVManager(config: KVManagerConfig): Promise\<KVManager\>;**<br>**createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void;**<br>After change:<br>**createKVManager(config: KVManagerConfig): KVManager;**
7
8You need to adapt your application based on the following information.
9
10 **Change Impact**
11
12JS APIs in API version 9 are affected. Your application needs to adapt these APIs so that it can properly implement features in the SDK environment of the new version.
13
14**Key API/Component Changes**
15
16| Module                   | Class               | Method/Attribute/Enumeration/Constant                                         | Change Type|
17| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- |
18| @ohos.distributedKVStore        | distributedKVStore        | function createKVManager(config: KVManagerConfig): Promise\<KVManager\>; | Deleted    |
19| @ohos.distributedKVStore        | distributedKVStore        | function createKVManager(config: KVManagerConfig): KVManager; | Changed    |
20
21
22**Adaptation Guide**
23
24The following sample code shows how to call **createKVManager** to create a **KVManager** object.
25
26Stage model:
27
28```ts
29import AbilityStage from '@ohos.application.Ability'
30let kvManager;
31export default class MyAbilityStage extends AbilityStage {
32    onCreate() {
33        console.log("MyAbilityStage onCreate")
34        let context = this.context
35        const kvManagerConfig = {
36            context: context,
37            bundleName: 'com.example.datamanagertest',
38        }
39        try {
40            kvManager = distributedKVStore.createKVManager(kvManagerConfig);
41        } catch (e) {
42            console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
43        }
44    }
45}
46```
47
48FA model:
49
50```ts
51import featureAbility from '@ohos.ability.featureAbility'
52let kvManager;
53let context = featureAbility.getContext()
54const kvManagerConfig = {
55    context: context,
56    bundleName: 'com.example.datamanagertest',
57}
58try {
59    kvManager = distributedKVStore.createKVManager(kvManagerConfig);
60} catch (e) {
61    console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`);
62}
63```
64
65## cl.distributeddatamgr.2 Moved function getRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
66**Change Impact**
67The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
68
69**Key API/Component Changes**
70
71Moved the following APIs from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**:
72
73Before change:
74
75```ts
76function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback<RdbStoreV9>): void;
77function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise<RdbStoreV9>;
78```
79After change:
80```
81function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<RdbStore>): void;
82function getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>;
83```
84
85**Adaptation Guide**
86 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
87 * Change the names of related APIs accordingly.
88
89## cl.distributeddatamgr.3 Moved function deleteRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
90**Change Impact**
91The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
92
93**Key API/Component Changes**
94APIs:
95```ts
96function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
97function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
98```
99The APIs are moved from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
100```
101function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void;
102function deleteRdbStoreV9(context: Context, name: string): Promise<void>;
103```
104
105**Adaptation Guide**
106 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
107 * Change the names of related APIs accordingly.
108
109## cl.distributeddatamgr.4 Moved interface StoreConfigV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
110**Change Impact**
111The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
112
113**Key API/Component Changes**
114Moved **StoreConfigV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **StoreConfig**.
115
116**Adaptation Guide**
117 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
118 * Change the names of related APIs accordingly.
119
120## cl.distributeddatamgr.5 Moved enum SecurityLevel from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
121**Change Impact**
122The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
123
124**Key API/Component Changes**
125Moved enum **SecurityLevel** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**.
126
127**Adaptation Guide**
128 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
129 * Change the names of related APIs accordingly.
130
131## cl.distributeddatamgr.6 Moved interface RdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
132**Change Impact**
133The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
134
135**Key API/Component Changes**
136Moved **RdbStoreV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbStore**.
137
138**Adaptation Guide**
139 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
140 * Change the names of related APIs accordingly.
141
142## cl.distributeddatamgr.7 Moved class RdbPredicatesV9 from ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts
143**Change Impact**
144The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
145
146**Key API/Component Changes**
147Moved the class **RdbPredicatesV9** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbPredicates**.
148
149**Adaptation Guide**
150 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
151 * Change the names of related APIs accordingly.
152
153## cl.distributeddatamgr.8 Moved interface ResultSetV9 from api/@ohos.data.relationalStore.d.ts to @ohos.data.relationalStore.d.ts
154**Change Impact**
155The application needs to adapt these APIs so that it can be properly compiled in the SDK environment of the new version.
156
157**Key API/Component Changes**
158Moved **ResultSetV9** from **api/data/rdb/resultSet.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **ResultSet**.
159
160**Adaptation Guide**
161
162 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**.
163 * Obtain the **ResultSetV9** instance only by using **getRdbStoreV9**. After modifications are made according to cl.distributeddatamgr.2, the code can automatically adapt to **ResultSet**.
164