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