1# Distributed Data Management Subsystem JS API Changelog 2 3## cl.distributeddatamgr.1 API Change 4Changed the APIs in **kv_store** of the distributed data management subsystem: 5 6Changed the **createKVManager()** implementation from asynchronous mode to synchronous mode because the execution duration is fixed and short. 7 8Before change:<br>**createKVManager(config: KVManagerConfig): Promise\<KVManager\>;**<br>**createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void;**<br>After change:<br>**createKVManager(config: KVManagerConfig): KVManager;** 9 10You need to adapt your application. 11 12**Change Impact** 13 14JS 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. 15 16**Key API/Component Changes** 17 18| Module | Class | Method/Attribute/Enum/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 Move of getRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts 68Moved **getRdbStoreV9()** from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts, and renamed it **getRdbStore()**. 69 70**Change Impact** 71The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. 72 73**Key API/Component Changes** 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``` 80Moved the above APIs 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 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**. 88 * Change the names of the **getRdbStore()** APIs. 89 90## cl.distributeddatamgr.3 Move of deleteRdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts 91 92Moved **deleteRdbStoreV9()** from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts, and renamed it **deleteRdbStore()**. 93 94**Change Impact** 95The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. 96 97**Key API/Component Changes** 98APIs: 99```ts 100function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback<void>): void; 101function deleteRdbStoreV9(context: Context, name: string): Promise<void>; 102``` 103Moved the above APIs from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**. 104``` 105function deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void; 106function deleteRdbStore(context: Context, name: string): Promise<void>; 107``` 108 109**Adaptation Guide** 110 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**. 111 * Change the names of the **deleteRdbStoreV9()** APIs. 112 113## cl.distributeddatamgr.4 Move of StoreConfigV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts 114**Change Impact** 115The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. 116 117**Key API/Component Changes** 118Moved **StoreConfigV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **StoreConfig**. 119 120**Adaptation Guide** 121 122 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**. 123 * Change the **StoreConfigV9** in APIs. 124 125## cl.distributeddatamgr.5 Move of enum SecurityLevel from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts 126**Change Impact** 127The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. 128 129**Key API/Component Changes** 130Moved **enum SecurityLevel** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts**. 131 132**Adaptation Guide** 133 134Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**. 135 136## cl.distributeddatamgr.6 Mover of RdbStoreV9 from @ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts 137**Change Impact** 138The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. 139 140**Key API/Component Changes** 141Moved **RdbStoreV9** from **@ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbStore**. 142 143**Adaptation Guide** 144 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**. 145 * Change **RdbStoreV9** in relevant APIs. 146 147## cl.distributeddatamgr.7 Move of class RdbPredicatesV9 from ohos.data.rdb.d.ts to @ohos.data.relationalStore.d.ts 148**Change Impact** 149The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. 150 151**Key API/Component Changes** 152Moved the class **RdbPredicatesV9** from **ohos.data.rdb.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **RdbPredicates**. 153 154**Adaptation Guide** 155 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**. 156 * Change **RdbPredicatesV9** in the relevant APIs. 157 158## cl.distributeddatamgr.8 Move of ResultSetV9 from api/@ohos.data.relationalStore.d.ts to @ohos.data.relationalStore.d.ts 159**Change Impact** 160The change must be made for all the applications that use these APIs. Otherwise, the compilation in the SDK of the new version cannot be successful. 161 162**Key API/Component Changes** 163Moved **ResultSetV9** from **api/data/rdb/resultSet.d.ts** to **@ohos.data.relationalStore.d.ts** and renamed it **ResultSet**. 164 165**Adaptation Guide** 166 * Change **import rdb from "@ohos.data.rdb"** to **import rdb from "@ohos.data.relationalStore"**. 167 * Obtain the **ResultSetV9** instance only by using **getRdbStoreV9**. After modifications are made according to cl.distributeddatamgr.2, the code can automatically adapt to **ResultSet**. 168 169