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