提交 b107d89b 编写于 作者: A annie_wangli

update docs

Signed-off-by: Nannie_wangli <annie.wangli@huawei.com>
上级 ddd0c95c
# Distributed Data Management # Distributed Data Management
>![](../../public_sys-resources/icon-note.gif) **NOTE** >![](../../public_sys-resources/icon-note.gif) **NOTE**<br/>
>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. >The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -10,10 +9,6 @@ ...@@ -10,10 +9,6 @@
``` ```
import distributedData from '@ohos.data.distributedData'; import distributedData from '@ohos.data.distributedData';
``` ```
## System Capabilities
SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
## distributedData.createKVManager ## distributedData.createKVManager
...@@ -22,17 +17,18 @@ createKVManager(config: KVManagerConfig, callback: AsyncCallback&lt;KVManager&gt ...@@ -22,17 +17,18 @@ createKVManager(config: KVManagerConfig, callback: AsyncCallback&lt;KVManager&gt
Creates a **KVManager** object to manage key-value (KV) stores. This method uses an asynchronous callback to return the result. Creates a **KVManager** object to manage key-value (KV) stores. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ | | ----- | ------ | ------ | ------ |
| config | [KVManagerConfig](#kvmanagerconfig) | Yes| Configuration of the **KVManager** object, including the bundle name and user information of the caller.| | config | [KVManagerConfig](#kvmanagerconfig) | Yes | Configuration of the **KVManager** object, including the bundle name and user information of the caller.|
| callback | AsyncCallback&lt;[KVManager](#kvmanager)&gt; | Yes| Callback invoked to return the **KVManager** object created.| | callback | AsyncCallback&lt;[KVManager](#kvmanager)&gt; | Yes | Callback invoked to return the **KVManager** object created.|
- Example **Example**
```
let kvManager; let kvManager;
try { try {
const kvManagerConfig = { const kvManagerConfig = {
...@@ -53,7 +49,6 @@ Creates a **KVManager** object to manage key-value (KV) stores. This method uses ...@@ -53,7 +49,6 @@ Creates a **KVManager** object to manage key-value (KV) stores. This method uses
} catch (e) { } catch (e) {
console.log("An unexpected error occurred. Error:" + e); console.log("An unexpected error occurred. Error:" + e);
} }
```
## distributedData.createKVManager ## distributedData.createKVManager
...@@ -61,21 +56,22 @@ createKVManager(config: KVManagerConfig): Promise&lt;KVManager&gt; ...@@ -61,21 +56,22 @@ createKVManager(config: KVManagerConfig): Promise&lt;KVManager&gt;
Creates a **KVManager** object to manage KV stores. This method uses a promise to return the result. Creates a **KVManager** object to manage KV stores. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ | | ----- | ------ | ------ | ------ |
| config |[KVManagerConfig](#kvmanager) | Yes| Configuration of the **KVManager** object, including the bundle name and user information of the caller.| | config |[KVManagerConfig](#kvmanager) | Yes | Configuration of the **KVManager** object, including the bundle name and user information of the caller.|
- Return value **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Promise&lt;[KVManager](#kvmanager)&gt; | Promise used to return the **KVManager** object created.| | Promise&lt;[KVManager](#kvmanager)&gt; | Promise used to return the **KVManager** object created.|
- Example **Example**
```
let kvManager; let kvManager;
try { try {
const kvManagerConfig = { const kvManagerConfig = {
...@@ -94,17 +90,18 @@ Creates a **KVManager** object to manage KV stores. This method uses a promise t ...@@ -94,17 +90,18 @@ Creates a **KVManager** object to manage KV stores. This method uses a promise t
} catch (e) { } catch (e) {
console.log("An unexpected error occurred. Error:" + e); console.log("An unexpected error occurred. Error:" + e);
} }
```
## KVManagerConfig ## KVManagerConfig
Provides configuration of the **KVManager** object, including the bundle name and user information of the caller. Provides configuration of the **KVManager** object, including the bundle name and user information of the caller.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ | | ----- | ------ | ------ | ------ |
| userInfo | [UserInfo](#userinfo) | Yes| User information.| | userInfo | [UserInfo](#userinfo) | Yes | User information.|
| bundleName | string | Yes| Bundle name.| | bundleName | string | Yes | Bundle name.|
...@@ -112,40 +109,48 @@ Provides configuration of the **KVManager** object, including the bundle name an ...@@ -112,40 +109,48 @@ Provides configuration of the **KVManager** object, including the bundle name an
Defines user information. Defines user information.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ | | ----- | ------ | ------ | ------ |
| userId | string | Yes| User ID.| | userId | string | Yes | User ID.|
| userType | [UserType](#usertype) | Yes| User type.| | userType | [UserType](#usertype) | Yes | User type.|
## UserType ## UserType
Defines the user type. Defines the user type.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Default Value| Description| | Name| Default Value| Description|
| ----- | ------ | ------ | | ----- | ------ | ------ |
| SAME\_USER_ID| 0 | User who logs in to different devices using the same account.| | SAME_USER_ID | 0 | User who logs in to different devices using the same account.|
## KVManager ## KVManager
Creates a **KVManager** object to obtain KV store information. Before calling any method in **KVManager**, you must use **createKVManager** to create a **KVManager** object. Creates a **KVManager** object to obtain KV store information. Before calling any method in **KVManager**, you must use **createKVManager** to create a **KVManager** object.
### getKVStore ### getKVStore
getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback&lt;T&gt;): void getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options, callback: AsyncCallback&lt;T&gt;): void
Creates and obtains a KV store. This method uses an asynchronous callback to return the result. Creates and obtains a KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| ----- | ------ | ------ | ------ | | ----- | ------ | ------ | ------ |
| storeId | string | Yes| Unique identifier of the KV store. The length cannot exceed [MAX\_STORE\_ID\_LENGTH](#constants).| | storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).|
| options | [Options](#options) | Yes| Configuration of the KV store.| | options | [Options](#options) | Yes | Configuration of the KV store.|
| callback | AsyncCallback&lt;T&gt;, &lt;T extends KVStore&gt;| Yes| Callback invoked to return the KV store created.| | callback | AsyncCallback&lt;T&gt;, &lt;T extends KVStore&gt;| Yes | Callback invoked to return the KV store created.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -179,22 +184,24 @@ getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options): Promise& ...@@ -179,22 +184,24 @@ getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options): Promise&
Creates and obtains a KV store. This method uses a promise to return the result. Creates and obtains a KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type | Mandatory | Description |
| ------- | ---------------------- | ---- | -------------------- | | ------- | ---------------------- | ---- | -------------------- |
| storeId | string | Yes| Unique identifier of the KV store. The length cannot exceed [MAX\_STORE\_ID\_LENGTH](#constants).| | storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).|
| options | [Options](#options) | Yes| Configuration of the KV store.| | options | [Options](#options) | Yes | Configuration of the KV store.|
- Return value **Return value**
| Type| Description| | Type | Description |
| -------------------------------------- | ------------------------ | | -------------------------------------- | ------------------------ |
| Promise&lt;T&gt; &lt;T extends KVStore&gt; | Promise used to return the KV store created.| | Promise&lt;T&gt; &lt;T extends KVStore&gt; | Promise used to return the KV store created.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -221,22 +228,24 @@ Creates and obtains a KV store. This method uses a promise to return the result. ...@@ -221,22 +228,24 @@ Creates and obtains a KV store. This method uses a promise to return the result.
### closeKVStore<sup>8+</sup> ### ### closeKVStore<sup>8+</sup> ###
closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback&lt;void&gt;): void; closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback&lt;void&gt;): void
Closes a KV store. This method uses an asynchronous callback to return the result. Closes a KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| Name | Type | Mandatory| Description |
| ------- | ----------------- | ---- | --------------------------- | | ------- | ----------------- | ---- | --------------------------- |
| appId | string | Yes| Bundle name of the app that invokes the KV store.| | appId | string | Yes | Bundle name of the app that invokes the KV store. |
| storeId | string | Yes| Unique identifier of the KV store to close. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).| | storeId | string | Yes | Unique identifier of the KV store to close. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
| kvStore | [KVStore](#kvstore) | Yes| KV store to close.| | kvStore | [KVStore](#kvstore) | Yes | KV store to close. |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the KV store is closed, **true** will be returned. Otherwise, **false** will be returned.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the KV store is closed, **true** will be returned. Otherwise, **false** will be returned. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -265,25 +274,27 @@ Closes a KV store. This method uses an asynchronous callback to return the resul ...@@ -265,25 +274,27 @@ Closes a KV store. This method uses an asynchronous callback to return the resul
### closeKVStore<sup>8+</sup> ### ### closeKVStore<sup>8+</sup> ###
closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise&lt;void&gt;; closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise&lt;void&gt;
Closes a KV store. This method uses a promise to return the result. Closes a KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------------- | | ----- | ------ | ---- | ----------------------------- |
| appId | string | Yes| Bundle name of the app that invokes the KV store.| | appId | string | Yes | Bundle name of the app that invokes the KV store. |
| storeId | string | Yes| Unique identifier of the KV store to close. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).| | storeId | string | Yes | Unique identifier of the KV store to close. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
| kvStore | [KVStore](#kvstore) | Yes| KV store to close.| | kvStore | [KVStore](#kvstore) | Yes | KV store to close. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------------- | -------------- | | ------------- | -------------- |
| Promise<void> | Promise used to return the result. If the KV store is closed, **true** will be returned. Otherwise, **false** will be returned.| | Promise<void> | Promise used to return the result. If the KV store is closed, **true** will be returned. Otherwise, **false** will be returned.|
- Example **Example**
``` ```
let kvManager; let kvManager;
...@@ -317,20 +328,22 @@ Closes a KV store. This method uses a promise to return the result. ...@@ -317,20 +328,22 @@ Closes a KV store. This method uses a promise to return the result.
### deleteKVStore<sup>8+</sup> ### ### deleteKVStore<sup>8+</sup> ###
deleteKVStore(appId: string, storeId: string, callback: AsyncCallback&lt;void&gt;): void; deleteKVStore(appId: string, storeId: string, callback: AsyncCallback&lt;void&gt;): void
Deletes a KV store. This method uses an asynchronous callback to return the result. Deletes a KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| appId | string | Yes| Bundle name of the app that invokes the KV store.| | appId | string | Yes | Bundle name of the app that invokes the KV store. |
| storeId | string | Yes| Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).| | storeId | string | Yes | Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the KV store is deleted, **true** will be returned. Otherwise, **false** will be returned.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the KV store is deleted, **true** will be returned. Otherwise, **false** will be returned. |
- Example **Example**
``` ```
let kvManager; let kvManager;
...@@ -359,25 +372,27 @@ Deletes a KV store. This method uses an asynchronous callback to return the resu ...@@ -359,25 +372,27 @@ Deletes a KV store. This method uses an asynchronous callback to return the resu
### deleteKVStore<sup>8+</sup> ### ### deleteKVStore<sup>8+</sup> ###
deleteKVStore(appId: string, storeId: string): Promise&lt;void&gt;; deleteKVStore(appId: string, storeId: string): Promise&lt;void&gt;
Deletes a KV store. This method uses a promise to return the result. Deletes a KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| appId | string | Yes| Bundle name of the app that invokes the KV store.| | appId | string | Yes | Bundle name of the app that invokes the KV store. |
| storeId | string | Yes| Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX\_STORE\_ID_LENGTH](#constants).| | storeId | string | Yes | Unique identifier of the KV store to delete. The length cannot exceed the value of [MAX_STORE_ID_LENGTH](#constants).|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------------- | -------------- | | ------------- | -------------- |
| Promise&lt;void&gt; | Promise used to return the result. If the KV store is deleted, **true** will be returned. Otherwise, **false** will be returned.| | Promise&lt;void&gt; | Promise used to return the result. If the KV store is deleted, **true** will be returned. Otherwise, **false** will be returned.|
- Example **Example**
``` ```
let kvManager; let kvManager;
...@@ -411,18 +426,20 @@ Deletes a KV store. This method uses a promise to return the result. ...@@ -411,18 +426,20 @@ Deletes a KV store. This method uses a promise to return the result.
### getAllKVStoreId<sup>8+</sup> ### ### getAllKVStoreId<sup>8+</sup> ###
getAllKVStoreId(appId: string, callback: AsyncCallback&lt;string[]&gt;): void; getAllKVStoreId(appId: string, callback: AsyncCallback&lt;string[]&gt;): void
Obtains the IDs of all the KV stores that are created using **getKvStore** and have not been deleted using **deleteKvStore**. This method uses an asynchronous callback to return the result. Obtains the IDs of all the KV stores that are created using **getKvStore** and have not been deleted using **deleteKvStore**. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| appId | string | Yes| Bundle name of the app that invokes the KV store.| | appId | string | Yes | Bundle name of the app that invokes the KV store. |
| callback | AsyncCallback&lt;void&gt; | Yes|Callback used to return the KV store IDs obtained. | | callback | AsyncCallback&lt;void&gt; | Yes |Callback used to return the KV store IDs obtained. |
- Example **Example**
``` ```
let kvManager; let kvManager;
...@@ -439,24 +456,26 @@ Obtains the IDs of all the KV stores that are created using **getKvStore** and h ...@@ -439,24 +456,26 @@ Obtains the IDs of all the KV stores that are created using **getKvStore** and h
### getAllKVStoreId<sup>8+</sup> ### ### getAllKVStoreId<sup>8+</sup> ###
getAllKVStoreId(appId: string): Promise&lt;string[]&gt;; getAllKVStoreId(appId: string): Promise&lt;string[]&gt;
Obtains the IDs of all the KV stores that are created using **getKvStore** and have not been deleted using **deleteKvStore**. This method uses a promise to return the result. Obtains the IDs of all the KV stores that are created using **getKvStore** and have not been deleted using **deleteKvStore**. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| appId | string | Yes| Bundle name of the app that invokes the KV store.| | appId | string | Yes | Bundle name of the app that invokes the KV store. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------------- | -------------- | | ------------- | -------------- |
| Promise&lt;string[]&gt;| Promise used to return the KV store IDs obtained.| | Promise&lt;string[]&gt;| Promise used to return the KV store IDs obtained.|
- Example **Example**
``` ```
let kvManager; let kvManager;
...@@ -476,20 +495,22 @@ Obtains the IDs of all the KV stores that are created using **getKvStore** and h ...@@ -476,20 +495,22 @@ Obtains the IDs of all the KV stores that are created using **getKvStore** and h
### on<sup>8+</sup> ### ### on<sup>8+</sup> ###
on(event: 'distributedDataServiceDie', deathCallback: Callback&lt;void&gt;): void; on(event: 'distributedDataServiceDie', deathCallback: Callback&lt;void&gt;): void
Subscribes to the **distributedDataServiceDie** events. This method uses a synchronous callback to return the result. Subscribes to the **distributedDataServiceDie** events. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event | 'distributedDataServiceDie' | Yes| Type of events to subscribe to. | | event | 'distributedDataServiceDie' | Yes | Type of events to subscribe to. |
| deathCallback | Callback&lt;void&gt; | Yes| Callback invoked when the distributed data service is dead.| | deathCallback | Callback&lt;void&gt; | Yes | Callback invoked when the distributed data service is dead. |
- Example **Example**
``` ```
let kvManager; let kvManager;
...@@ -508,19 +529,21 @@ Subscribes to the **distributedDataServiceDie** events. This method uses a synch ...@@ -508,19 +529,21 @@ Subscribes to the **distributedDataServiceDie** events. This method uses a synch
### off<sup>8+</sup> ### ### off<sup>8+</sup> ###
off(event: 'distributedDataServiceDie', deathCallback?: Callback&lt;void&gt;): void; off(event: 'distributedDataServiceDie', deathCallback?: Callback&lt;void&gt;): void
Unsubscribes from the **distributedDataServiceDie** events. This method uses a synchronous callback to return the result. Unsubscribes from the **distributedDataServiceDie** events. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event | 'distributedDataServiceDie' | Yes| Type of events to unsubscribe from. | | event | 'distributedDataServiceDie' | Yes | Type of events to unsubscribe from. |
| deathCallback | Callback&lt;void&gt; | No| Callback used to return the **distributedDataServiceDie** events.| | deathCallback | Callback&lt;void&gt; | No | Callback used to return the **distributedDataServiceDie** events. |
- Example **Example**
``` ```
let kvManager; let kvManager;
...@@ -540,25 +563,30 @@ Unsubscribes from the **distributedDataServiceDie** events. This method uses a s ...@@ -540,25 +563,30 @@ Unsubscribes from the **distributedDataServiceDie** events. This method uses a s
Provides KV store configuration. Provides KV store configuration.
| Name| Type| Mandatory| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| createIfMissing | boolean | No| Whether to create a KV store if no database file exists. By default, a KV store is created.| | createIfMissing | boolean | No| Whether to create a KV store if no database file exists. By default, a KV store is created. |
| encrypt | boolean | No|Whether to encrypt database files. By default, database files are not encrypted.| | encrypt | boolean | No|Whether to encrypt database files. By default, database files are not encrypted. |
| backup | boolean | No|Whether to back up database files. By default, database files are backed up. | | backup | boolean | No|Whether to back up database files. By default, database files are backed up. |
| autoSync | boolean | No|Whether to automatically synchronize database files. By default, database files are not automatically synchronized.| | autoSync | boolean | No|Whether to automatically synchronize database files. By default, database files are not automatically synchronized. |
| kvStoreType | [KVStoreType](#kvstoretype) | No|Type of the KV store to create. By default, a device KV store is created. The device KV store stores data for multiple devices that collaborate with each other.| | kvStoreType | [KVStoreType](#kvstoretype) | No|Type of the KV store to create. By default, a device KV store is created. The device KV store stores data for multiple devices that collaborate with each other.|
| securityLevel | [SecurityLevel](#securitylevel) | No|Security level of the KV store. By default, the security level is not set.| | securityLevel | [SecurityLevel](#securitylevel) | No|Security level of the KV store. By default, the security level is not set. |
| schema | [schema](#Schema<sup>8+</sup>) | No| Schema used to define the values stored in a KV store.|
## KVStoreType ## KVStoreType
Defines the KV store types. Defines the KV store types.
| Name| Default Value| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Default Value| Description |
| --- | ---- | ----------------------- | | --- | ---- | ----------------------- |
| DEVICE_COLLABORATION | 0 | Device KV store.| | DEVICE_COLLABORATION | 0 | Device KV store. |
| SINGLE_VERSION | 1 | Single KV store.| | SINGLE_VERSION | 1 | Single KV store. |
| MULTI_VERSION | 2 | Multi-version KV store. This type is not supported currently.| | MULTI_VERSION | 2 | Multi-version KV store. This type is not supported currently. |
...@@ -566,83 +594,102 @@ Defines the KV store types. ...@@ -566,83 +594,102 @@ Defines the KV store types.
Defines the KV store security levels. Defines the KV store security levels.
| Name| Default Value| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Default Value| Description |
| --- | ---- | ----------------------- | | --- | ---- | ----------------------- |
| NO_LEVEL | 0 | No security level is set for the KV store.| | NO_LEVEL | 0 | No security level is set for the KV store. |
| S0 | 1 | The KV store security level is public.| | S0 | 1 | The KV store security level is public. |
| S1 | 2 | The KV store security level is low. If data leakage occurs, minor impact will be caused on the database.| | S1 | 2 | The KV store security level is low. If data leakage occurs, minor impact will be caused on the database. |
| S2 | 3 | The KV store security level is medium. If data leakage occurs, moderate impact will be caused on the database.| | S2 | 3 | The KV store security level is medium. If data leakage occurs, moderate impact will be caused on the database. |
| S3 | 5 | The KV store security level is high. If data leakage occurs, major impact will be caused on the database.| | S3 | 5 | The KV store security level is high. If data leakage occurs, major impact will be caused on the database. |
| S4 | 6 | The KV store security level is critical. If data leakage occurs, severe impact will be caused on the database.| | S4 | 6 | The KV store security level is critical. If data leakage occurs, severe impact will be caused on the database. |
## Constants ## Constants
Defines the KV store constants. Defines the KV store constants.
| Name| Default Value| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Default Value| Description |
| --- | ---- | ----------------------- | | --- | ---- | ----------------------- |
| MAX\_KEY_LENGTH| 1024 | Maximum length (in bytes) of a key in the KV store.| | MAX_KEY_LENGTH | 1024 | Maximum length (in bytes) of a key in the KV store. |
| MAX\_VALUE_LENGTH| 4194303 | Maximum length (in bytes) of a value in the KV store.| | MAX_VALUE_LENGTH | 4194303 | Maximum length (in bytes) of a value in the KV store. |
| MAX\_KEY\_LENGTH\_DEVICE| 896 | Maximum length of the device coordinate key.| | MAX_KEY_LENGTH_DEVICE | 896 | Maximum length of the device coordinate key. |
| MAX\_STORE\_ID\_LENGTH| 128 | Maximum length (in bytes) of a KV store ID.| | MAX_STORE_ID_LENGTH | 128 | Maximum length (in bytes) of a KV store ID. |
| MAX\_QUERY_LENGTH| 512000 | Maximum query length.| | MAX_QUERY_LENGTH | 512000 | Maximum query length. |
| MAX\_BATCH_SIZE| 128 | Maximum size of a batch operation.| | MAX_BATCH_SIZE | 128 | Maximum size of a batch operation. |
## Schema<sup>8+</sup> ## ## Schema<sup>8+</sup> ##
Defines a database schema. When creating or opening a KV store, you can create a **Schema** object and put it into **Options**. Defines a database schema. When creating or opening a KV store, you can create a **Schema** object and put it into **Options**.
### toJsonString<sup>8+</sup> ### **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
toJsonString():string; | Name | Type| Description |
| --- | ---- | ----------------------- |
| root<sup>8+</sup> | [FieldNode](#FieldNode) | JSON root object. |
| indexes<sup>8+</sup> | Array<string> | String array in JSON format. |
| mode<sup>8+</sup> | number | Schema mode. |
| skip<sup>8+</sup> | number | Size of a skip of the schema. |
Obtains the schema in JSON format. ### constructor<sup>8+</sup> ###
- Return value constructor()
| Type| Description| A constructor used to create a **Schema** instance.
| ------------- | -------------- |
| string |Schema in JSON format obtained.|
- Example **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
``` ## FieldNode<sup>8+</sup> ##
import ddm from '@ohos.data.distributedData';
try {
let schema = new ddm.Schema();
const str = schema.toJsonString();
console.log("schema: " + str);
} catch (e) {
console.log("toJsonString " + e);
}
```
Represents a **Schema** instance, which provides the methods for defining the values stored in a KV store.
## FieldNode<sup>8+</sup> ## **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name | Type| Description |
| --- | ---- | ----------------------- |
| nullable<sup>8+</sup> | boolean | Whether the database field can be null. |
| default<sup>8+</sup> | string | Default value of a **FieldNode**.|
| type<sup>8+</sup> | number | Value to store.|
### constructor<sup>8+</sup> ###
Defines a node of a **Schema** instance. It provides methods for defining values stored in the KV store. constructor(name: string)
A constructor used to create a **FieldNode** instance with a string field.
**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
**Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| name | string | Yes | Value of **FieldNode**.
### appendChild<sup>8+</sup> ### ### appendChild<sup>8+</sup> ###
appendChild(child: FieldNode): boolean; appendChild(child: FieldNode): boolean
Adds a child node to this **FieldNode**. Appends a child node to this **FieldNode**.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| child | [FieldNode](#FieldNode) | Yes| Child node to add.| | child | [FieldNode](#FieldNode) | Yes | Child node to append. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------------- | -------------- | | ------------- | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.| | boolean |Returns **true** if the operation is successful; returns **false** otherwise.|
- Example **Example**
``` ```
import ddm from '@ohos.data.distributedData'; import ddm from '@ohos.data.distributedData';
...@@ -665,50 +712,28 @@ Adds a child node to this **FieldNode**. ...@@ -665,50 +712,28 @@ Adds a child node to this **FieldNode**.
``` ```
### toJson<sup>8+</sup> ###
toJson(): string;
Obtains the field name.
- Return value
| Type| Description|
| ------ | -------------- |
| string |Field name obtained.|
- Example
```
import ddm from '@ohos.data.distributedData';
try {
let node = new ddm.FieldNode("root");
let child = new ddm.FieldNode("child");
node.appendChild(child);
console.log("appendNode " + node.toJson());
} catch (e) {
console.log("ToJson " + e);
}
```
## KvStoreResultSet<sup>8+</sup> ## ## KvStoreResultSet<sup>8+</sup> ##
Provides methods to obtain the KV store result set and query or move the data read position. Before calling any method in **KvStoreResultSet**, you must use **KvStore** to create a **KvStore** instance. Provides methods to obtain the KV store result set and query or move the data read position. Before calling any method in **KvStoreResultSet**, you must use **KvStore** to create a **KvStore** instance.
### getCount<sup>8+</sup> ### ### getCount<sup>8+</sup> ###
getCount(): number; getCount(): number
Obtains the number of rows in the result set. Obtains the number of rows in the result set.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| number |Number of rows obtained.| | number |Number of rows obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -730,17 +755,19 @@ Obtains the number of rows in the result set. ...@@ -730,17 +755,19 @@ Obtains the number of rows in the result set.
### getPosition<sup>8+</sup> ### ### getPosition<sup>8+</sup> ###
getPosition(): number; getPosition(): number
Obtains the current data read position (position from which data is read) in the result set. Obtains the current data read position (position from which data is read) in the result set.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| number |Current data read position obtained.| | number |Current data read position obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -762,17 +789,19 @@ Obtains the current data read position (position from which data is read) in the ...@@ -762,17 +789,19 @@ Obtains the current data read position (position from which data is read) in the
### moveToFirst<sup>8+</sup> ### ### moveToFirst<sup>8+</sup> ###
moveToFirst(): boolean; moveToFirst(): boolean
Moves the data read position to the first row. Moves the data read position to the first row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.| | boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -794,17 +823,19 @@ Moves the data read position to the first row. ...@@ -794,17 +823,19 @@ Moves the data read position to the first row.
### moveToLast<sup>8+</sup> ### ### moveToLast<sup>8+</sup> ###
moveToLast(): boolean; moveToLast(): boolean
Moves the data read position to the last row. Moves the data read position to the last row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.| | boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -826,17 +857,19 @@ Moves the data read position to the last row. ...@@ -826,17 +857,19 @@ Moves the data read position to the last row.
### moveToNext<sup>8+</sup> ### ### moveToNext<sup>8+</sup> ###
moveToNext(): boolean; moveToNext(): boolean
Moves the data read position to the next row. Moves the data read position to the next row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.| | boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -858,17 +891,19 @@ Moves the data read position to the next row. ...@@ -858,17 +891,19 @@ Moves the data read position to the next row.
### moveToPrevious<sup>8+</sup> ### ### moveToPrevious<sup>8+</sup> ###
moveToPrevious(): boolean; moveToPrevious(): boolean
Moves the data read position to the previous row. Moves the data read position to the previous row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.| | boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -890,23 +925,25 @@ Moves the data read position to the previous row. ...@@ -890,23 +925,25 @@ Moves the data read position to the previous row.
### move<sup>8+</sup> ### ### move<sup>8+</sup> ###
move(offset: number): boolean; move(offset: number): boolean
Moves the data read position with the specified offset from the current position. Moves the data read position with the specified offset from the current position.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| offset | number | Yes| Offset to move the data read position. A negative value means to move backward, and a positive value means to move forward.| | offset | number | Yes | Offset to move the data read position. A negative value means to move backward, and a positive value means to move forward. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.| | boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -928,23 +965,25 @@ Moves the data read position with the specified offset from the current position ...@@ -928,23 +965,25 @@ Moves the data read position with the specified offset from the current position
### moveToPosition<sup>8+</sup> ### ### moveToPosition<sup>8+</sup> ###
moveToPosition(position: number): boolean; moveToPosition(position: number): boolean
Moves the data read position from 0 to an absolute position. Moves the data read position from 0 to an absolute position.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| position | number | Yes|Absolute position to move to.| | position | number | Yes |Absolute position to move to. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the operation is successful; returns **false** otherwise.| | boolean |Returns **true** if the operation is successful; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -966,17 +1005,19 @@ Moves the data read position from 0 to an absolute position. ...@@ -966,17 +1005,19 @@ Moves the data read position from 0 to an absolute position.
### isFirst<sup>8+</sup> ### ### isFirst<sup>8+</sup> ###
isFirst(): boolean; isFirst(): boolean
Checks whether the data read position is the first row. Checks whether the data read position is the first row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the data read position is the first row; returns **false** otherwise.| | boolean |Returns **true** if the data read position is the first row; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -998,17 +1039,19 @@ Checks whether the data read position is the first row. ...@@ -998,17 +1039,19 @@ Checks whether the data read position is the first row.
### isLast<sup>8+</sup> ### ### isLast<sup>8+</sup> ###
isLast(): boolean; isLast(): boolean
Checks whether the data read position is the last row. Checks whether the data read position is the last row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the data read position is the last row; returns **false** otherwise.| | boolean |Returns **true** if the data read position is the last row; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -1030,17 +1073,19 @@ Checks whether the data read position is the last row. ...@@ -1030,17 +1073,19 @@ Checks whether the data read position is the last row.
### isBeforeFirst<sup>8+</sup> ### ### isBeforeFirst<sup>8+</sup> ###
isBeforeFirst(): boolean; isBeforeFirst(): boolean
Checks whether the data read position is before the first row. Checks whether the data read position is before the first row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the read position is before the first row; returns **false** otherwise.| | boolean |Returns **true** if the read position is before the first row; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -1062,17 +1107,19 @@ Checks whether the data read position is before the first row. ...@@ -1062,17 +1107,19 @@ Checks whether the data read position is before the first row.
### isAfterLast<sup>8+</sup> ### ### isAfterLast<sup>8+</sup> ###
isAfterLast(): boolean; isAfterLast(): boolean
Checks whether the data read position is after the last row. Checks whether the data read position is after the last row.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | -------------- | | ------ | -------------- |
| boolean |Returns **true** if the data read position is after the last row; returns **false** otherwise.| | boolean |Returns **true** if the data read position is after the last row; returns **false** otherwise. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -1094,17 +1141,19 @@ Checks whether the data read position is after the last row. ...@@ -1094,17 +1141,19 @@ Checks whether the data read position is after the last row.
### getEntry<sup>8+</sup> ### ### getEntry<sup>8+</sup> ###
getEntry(): Entry; getEntry(): Entry
Obtains a KV pair. Obtains a KV pair.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| Entry |KV pair obtained.| | Entry |KV pair obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -1129,19 +1178,33 @@ Obtains a KV pair. ...@@ -1129,19 +1178,33 @@ Obtains a KV pair.
Provides methods to create a **Query** object, which defines different data query criteria. Provides methods to create a **Query** object, which defines different data query criteria.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
### constructor<sup>8+</sup> ###
constructor()
A constructor used to create a **Schema** instance.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
### reset<sup>8+</sup> ### ### reset<sup>8+</sup> ###
reset(): Query; reset(): Query
Resets the **Query** object that contains common query options. Resets the **Query** object that contains common query options.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description|
**Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object reset.| | [Query](#query8) |**Query** object reset.|
- Example **Example**
``` ```
try { try {
...@@ -1163,20 +1226,22 @@ equalTo(field: string, value: number|string|boolean): Query; ...@@ -1163,20 +1226,22 @@ equalTo(field: string, value: number|string|boolean): Query;
Creates a **Query** object to match the specified field whose value is equal to the specified value. Creates a **Query** object to match the specified field whose value is equal to the specified value.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| value | number/string/boolean | Yes| Value specified.| | value | number/string/boolean | Yes | Value specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object created.|
- Example **Example**
``` ```
try { try {
...@@ -1192,24 +1257,26 @@ Creates a **Query** object to match the specified field whose value is equal to ...@@ -1192,24 +1257,26 @@ Creates a **Query** object to match the specified field whose value is equal to
### notEqualTo<sup>8+</sup> ### ### notEqualTo<sup>8+</sup> ###
notEqualTo(field: string, value: number|string|boolean): Query; notEqualTo(field: string, value: number|string|boolean): Query
Creates a **Query** object to match the specified field whose value is not equal to the specified value. Creates a **Query** object to match the specified field whose value is not equal to the specified value.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| value | number/string/boolean | Yes| Value specified.| | value | number/string/boolean | Yes | Value specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object created.|
- Example **Example**
``` ```
try { try {
...@@ -1225,24 +1292,26 @@ Creates a **Query** object to match the specified field whose value is not equal ...@@ -1225,24 +1292,26 @@ Creates a **Query** object to match the specified field whose value is not equal
### greaterThan<sup>8+</sup> ### ### greaterThan<sup>8+</sup> ###
greaterThan(field: string, value: number|string|boolean): Query; greaterThan(field: string, value: number|string|boolean): Query
Creates a **Query** object to match the specified field whose value is greater than the specified value. Creates a **Query** object to match the specified field whose value is greater than the specified value.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| value | number/string/boolean | Yes| Value specified.| | value | number/string/boolean | Yes | Value specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1258,24 +1327,26 @@ Creates a **Query** object to match the specified field whose value is greater t ...@@ -1258,24 +1327,26 @@ Creates a **Query** object to match the specified field whose value is greater t
### lessThan<sup>8+</sup> ### ### lessThan<sup>8+</sup> ###
lessThan(field: string, value: number|string): Query; lessThan(field: string, value: number|string): Query
Creates a **Query** object to match the specified field whose value is less than the specified value. Creates a **Query** object to match the specified field whose value is less than the specified value.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| value | number/string/boolean | Yes| Value specified.| | value | number/string/boolean | Yes | Value specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1291,24 +1362,26 @@ Creates a **Query** object to match the specified field whose value is less than ...@@ -1291,24 +1362,26 @@ Creates a **Query** object to match the specified field whose value is less than
### greaterThanOrEqualTo<sup>8+</sup> ### ### greaterThanOrEqualTo<sup>8+</sup> ###
greaterThanOrEqualTo(field: string, value: number|string): Query; greaterThanOrEqualTo(field: string, value: number|string): Query
Creates a **Query** object to match the specified field whose value is greater than or equal to the specified value. Creates a **Query** object to match the specified field whose value is greater than or equal to the specified value.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| value | number/string/boolean | Yes| Value specified.| | value | number/string/boolean | Yes | Value specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1324,24 +1397,26 @@ Creates a **Query** object to match the specified field whose value is greater t ...@@ -1324,24 +1397,26 @@ Creates a **Query** object to match the specified field whose value is greater t
### lessThanOrEqualTo<sup>8+</sup> ### ### lessThanOrEqualTo<sup>8+</sup> ###
lessThanOrEqualTo(field: string, value: number|string): Query; lessThanOrEqualTo(field: string, value: number|string): Query
Creates a **Query** object to match the specified field whose value is less than or equal to the specified value. Creates a **Query** object to match the specified field whose value is less than or equal to the specified value.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| value | number/string/boolean | Yes| Value specified.| | value | number/string/boolean | Yes | Value specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1357,23 +1432,26 @@ Creates a **Query** object to match the specified field whose value is less than ...@@ -1357,23 +1432,26 @@ Creates a **Query** object to match the specified field whose value is less than
### isNull<sup>8+</sup> ### ### isNull<sup>8+</sup> ###
isNull(field: string): Query; isNull(field: string): Query
Creates a **Query** object to match the specified field whose value is **null**. Creates a **Query** object to match the specified field whose value is **null**.
- Parameters
| Name| Type| Mandatory| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1389,25 +1467,28 @@ Creates a **Query** object to match the specified field whose value is **null**. ...@@ -1389,25 +1467,28 @@ Creates a **Query** object to match the specified field whose value is **null**.
### inNumber<sup>8+</sup> ### ### inNumber<sup>8+</sup> ###
inNumber(field: string, valueList: number[]): Query; inNumber(field: string, valueList: number[]): Query
Creates a **Query** object to match the specified field whose value is within the specified list of numbers. Creates a **Query** object to match the specified field whose value is within the specified list of numbers.
- Parameters
| Name| Type| Mandatory| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
**Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| valueList | number[] | Yes| List of numbers.| | valueList | number[] | Yes | List of numbers.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1423,24 +1504,26 @@ Creates a **Query** object to match the specified field whose value is within th ...@@ -1423,24 +1504,26 @@ Creates a **Query** object to match the specified field whose value is within th
### inString<sup>8+</sup> ### ### inString<sup>8+</sup> ###
inString(field: string, valueList: string[]): Query; inString(field: string, valueList: string[]): Query
Creates a **Query** object to match the specified field whose value is within the specified list of strings. Creates a **Query** object to match the specified field whose value is within the specified list of strings.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| valueList | string[] | Yes| List of strings.| | valueList | string[] | Yes | List of strings.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1456,24 +1539,26 @@ Creates a **Query** object to match the specified field whose value is within th ...@@ -1456,24 +1539,26 @@ Creates a **Query** object to match the specified field whose value is within th
### notInNumber<sup>8+</sup> ### ### notInNumber<sup>8+</sup> ###
notInNumber(field: string, valueList: number[]): Query; notInNumber(field: string, valueList: number[]): Query
Creates a **Query** object to match the specified field whose value is not within the specified list of numbers. Creates a **Query** object to match the specified field whose value is not within the specified list of numbers.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| valueList | number[] | Yes| List of numbers.| | valueList | number[] | Yes | List of numbers.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1489,24 +1574,26 @@ Creates a **Query** object to match the specified field whose value is not withi ...@@ -1489,24 +1574,26 @@ Creates a **Query** object to match the specified field whose value is not withi
### notInString<sup>8+</sup> ### ### notInString<sup>8+</sup> ###
notInString(field: string, valueList: string[]): Query; notInString(field: string, valueList: string[]): Query
Creates a **Query** object to match the specified field whose value is not within the specified list of strings. Creates a **Query** object to match the specified field whose value is not within the specified list of strings.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| valueList | string[] | Yes| List of strings.| | valueList | string[] | Yes | List of strings.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1522,24 +1609,26 @@ Creates a **Query** object to match the specified field whose value is not withi ...@@ -1522,24 +1609,26 @@ Creates a **Query** object to match the specified field whose value is not withi
### like<sup>8+</sup> ### ### like<sup>8+</sup> ###
like(field: string, value: string): Query; like(field: string, value: string): Query
Creates a **Query** object to match the specified field whose value is similar to the specified string. Creates a **Query** object to match the specified field whose value is similar to the specified string.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| valueList | string | Yes| String specified.| | valueList | string | Yes | String specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1555,24 +1644,26 @@ Creates a **Query** object to match the specified field whose value is similar t ...@@ -1555,24 +1644,26 @@ Creates a **Query** object to match the specified field whose value is similar t
### unlike<sup>8+</sup> ### ### unlike<sup>8+</sup> ###
unlike(field: string, value: string): Query; unlike(field: string, value: string): Query
Creates a **Query** object to match the specified field whose value is not similar to the specified string. Creates a **Query** object to match the specified field whose value is not similar to the specified string.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
| valueList | string | Yes| String specified.| | valueList | string | Yes | String specified.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1588,17 +1679,19 @@ Creates a **Query** object to match the specified field whose value is not simil ...@@ -1588,17 +1679,19 @@ Creates a **Query** object to match the specified field whose value is not simil
### and<sup>8+</sup> ### ### and<sup>8+</sup> ###
and(): Query; and(): Query
Creates a **Query** object with the AND condition. Creates a **Query** object with the AND condition.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1616,17 +1709,19 @@ Creates a **Query** object with the AND condition. ...@@ -1616,17 +1709,19 @@ Creates a **Query** object with the AND condition.
### or<sup>8+</sup> ### ### or<sup>8+</sup> ###
or(): Query; or(): Query
Creates a **Query** object with the OR condition. Creates a **Query** object with the OR condition.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1644,23 +1739,25 @@ Creates a **Query** object with the OR condition. ...@@ -1644,23 +1739,25 @@ Creates a **Query** object with the OR condition.
### orderByAsc<sup>8+</sup> ### ### orderByAsc<sup>8+</sup> ###
orderByAsc(field: string): Query; orderByAsc(field: string): Query
Creates a **Query** object to sort the query results in ascending order. Creates a **Query** object to sort the query results in ascending order.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1677,24 +1774,26 @@ Creates a **Query** object to sort the query results in ascending order. ...@@ -1677,24 +1774,26 @@ Creates a **Query** object to sort the query results in ascending order.
### orderByDesc<sup>8+</sup> ### ### orderByDesc<sup>8+</sup> ###
orderByDesc(field: string): Query; orderByDesc(field: string): Query
Creates a **Query** object to sort the query results in descending order. Creates a **Query** object to sort the query results in descending order.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field to match. It must start with $ and cannot contain ^.| | fieId | string | Yes |Field to match. It must start with $ and cannot contain ^. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1711,24 +1810,26 @@ Creates a **Query** object to sort the query results in descending order. ...@@ -1711,24 +1810,26 @@ Creates a **Query** object to sort the query results in descending order.
### limit<sup>8+</sup> ### ### limit<sup>8+</sup> ###
limit(total: number, offset: number): Query; limit(total: number, offset: number): Query
Creates a **Query** object to specify the number of results and where to start. Creates a **Query** object to specify the number of results and where to start.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| total | number | Yes|Number of results to query.| | total | number | Yes |Number of results to query. |
| offset | number | Yes|Start position for query.| | offset | number | Yes |Start position for query. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1745,23 +1846,25 @@ Creates a **Query** object to specify the number of results and where to start. ...@@ -1745,23 +1846,25 @@ Creates a **Query** object to specify the number of results and where to start.
### isNotNull<sup>8+</sup> ### ### isNotNull<sup>8+</sup> ###
isNotNull(field: string): Query; isNotNull(field: string): Query
Creates a **Query** object with a specified field that is not null. Creates a **Query** object with a specified field that is not null.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| fieId | string | Yes|Field specified.| | fieId | string | Yes |Field specified. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1777,17 +1880,19 @@ Creates a **Query** object with a specified field that is not null. ...@@ -1777,17 +1880,19 @@ Creates a **Query** object with a specified field that is not null.
### beginGroup<sup>8+</sup> ### ### beginGroup<sup>8+</sup> ###
beginGroup(): Query; beginGroup(): Query
Creates a **Query** object for a query condition group with a left parenthesis. Creates a **Query** object for a query condition group with a left parenthesis.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1805,17 +1910,19 @@ Creates a **Query** object for a query condition group with a left parenthesis. ...@@ -1805,17 +1910,19 @@ Creates a **Query** object for a query condition group with a left parenthesis.
### endGroup<sup>8+</sup> ### ### endGroup<sup>8+</sup> ###
endGroup(): Query; endGroup(): Query
Creates a **Query** object for a query condition group with a right parenthesis. Creates a **Query** object for a query condition group with a right parenthesis.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1833,23 +1940,25 @@ Creates a **Query** object for a query condition group with a right parenthesis. ...@@ -1833,23 +1940,25 @@ Creates a **Query** object for a query condition group with a right parenthesis.
### prefixKey<sup>8+</sup> ### ### prefixKey<sup>8+</sup> ###
prefixKey(prefix: string): Query; prefixKey(prefix: string): Query
Creates a **Query** object with a specified key prefix. Creates a **Query** object with a specified key prefix.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| prefix | string | Yes|Key prefix.| | prefix | string | Yes |Key prefix. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1866,23 +1975,25 @@ Creates a **Query** object with a specified key prefix. ...@@ -1866,23 +1975,25 @@ Creates a **Query** object with a specified key prefix.
### setSuggestIndex<sup>8+</sup> ### ### setSuggestIndex<sup>8+</sup> ###
setSuggestIndex(index: string): Query; setSuggestIndex(index: string): Query
Creates a **Query** object with an index preferentially used for query. Creates a **Query** object with an index preferentially used for query.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| index | string | Yes|Index preferentially used for query.| | index | string | Yes |Index preferentially used for query. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1899,24 +2010,26 @@ Creates a **Query** object with an index preferentially used for query. ...@@ -1899,24 +2010,26 @@ Creates a **Query** object with an index preferentially used for query.
### deviceId<sup>8+</sup> ### ### deviceId<sup>8+</sup> ###
deviceId(deviceId:string):Query; deviceId(deviceId:string):Query
Creates a **Query** object with the device ID as the key prefix. Creates a **Query** object with the device ID as the key prefix.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId | string | Yes|Device ID.| | deviceId | string | Yes |Device ID. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object created.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1931,17 +2044,19 @@ Creates a **Query** object with the device ID as the key prefix. ...@@ -1931,17 +2044,19 @@ Creates a **Query** object with the device ID as the key prefix.
### getSqlLike<sup>8+</sup> ### ### getSqlLike<sup>8+</sup> ###
getSqlLike():string; getSqlLike():string
Obtains the query statement of this **Query** object. Obtains the query statement of this **Query** object.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| [Query](#query8) |**Query** object.| | [Query](#query8) |**Query** object Created.|
- Example **Example**
``` ```
try { try {
...@@ -1958,21 +2073,25 @@ Obtains the query statement of this **Query** object. ...@@ -1958,21 +2073,25 @@ Obtains the query statement of this **Query** object.
Provides methods to manage data in a KV store, for example, adding or deleting data and subscribing to data changes or completion of data synchronization. Before calling any method in **KVStore**, you must use **getKVStore** to obtain a **KVStore** object. Provides methods to manage data in a KV store, for example, adding or deleting data and subscribing to data changes or completion of data synchronization. Before calling any method in **KVStore**, you must use **getKVStore** to obtain a **KVStore** object.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
### put ### put
put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback&lt;void&gt;): void put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback&lt;void&gt;): void
Adds a KV pair of the specified type to this KV store. This method uses an asynchronous callback to return the result. Adds a KV pair of the specified type to this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| ----- | ------ | ---- | ----------------------- |
| key | string | Yes|Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).|
| value | Uint8Array / string / number / boolean | Yes|Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX\_VALUE\_LENGTH](#constants).|
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- |
| key | string | Yes |Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
| value | Uint8Array \| string \| number \| boolean | Yes |Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX_VALUE_LENGTH](#constants). |
| callback | AsyncCallback&lt;void> | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -1998,21 +2117,23 @@ put(key: string, value: Uint8Array | string | number | boolean): Promise&lt;void ...@@ -1998,21 +2117,23 @@ put(key: string, value: Uint8Array | string | number | boolean): Promise&lt;void
Adds a KV pair of the specified type to this KV store. This method uses a promise to return the result. Adds a KV pair of the specified type to this KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| key | string | Yes|Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).| | key | string | Yes |Key of the KV pair to add. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
| value | Uint8Array / string / number / boolean | Yes|Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX\_VALUE\_LENGTH](#constants).| | value | Uint8Array \| string \| number \| boolean | Yes |Value of the KV pair to add. The value type can be Uint8Array, number, string, or boolean. A value of the Uint8Array or string type cannot exceed [MAX_VALUE_LENGTH](#constants). |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2036,14 +2157,16 @@ delete(key: string, callback: AsyncCallback&lt;void&gt;): void ...@@ -2036,14 +2157,16 @@ delete(key: string, callback: AsyncCallback&lt;void&gt;): void
Deletes a KV pair from this KV store. This method uses an asynchronous callback to return the result. Deletes a KV pair from this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| key | string | Yes|Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).| | key | string | Yes |Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
| callback | AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2076,19 +2199,21 @@ delete(key: string): Promise&lt;void&gt; ...@@ -2076,19 +2199,21 @@ delete(key: string): Promise&lt;void&gt;
Deletes a KV pair from this KV store. This method uses a promise to return the result. Deletes a KV pair from this KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| key | string | Yes|Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).| | key | string | Yes |Key of the KV pair to delete. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2117,16 +2242,18 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback&lt;ChangeNotific ...@@ -2117,16 +2242,18 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback&lt;ChangeNotific
Subscribes to data changes of the specified type. This method uses a synchronous callback to return the result. Subscribes to data changes of the specified type. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event |'dataChange' | Yes|Type of the events to subscribe to.| | event |'dataChange' | Yes |Type of the events. |
| type |[SubscribeType](#subscribetype) | Yes|Type of data changes.| | type |[SubscribeType](#subscribetype) | Yes |Type of data changes. |
| observer |Callback&lt;[ChangeNotification](#changenotification)&gt; | Yes|Callback used to return the result.| | observer |Callback&lt;[ChangeNotification](#changenotification)&gt; | Yes |Callback invoked to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2138,19 +2265,21 @@ Subscribes to data changes of the specified type. This method uses a synchronous ...@@ -2138,19 +2265,21 @@ Subscribes to data changes of the specified type. This method uses a synchronous
### on ### on
on(event: 'syncComplete', syncCallback: Callback<Array&lt;[string, number]&gt;): void on(event: 'syncComplete', syncCallback: Callback&lt;Array&lt;[string, number]&gt;&gt;): void
Subscribes to data synchronization completion events. This method uses a synchronous callback to return the result. Subscribes to data synchronization completion events. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | Yes|Type of the events to subscribe to.| | event |'syncComplete' | Yes |Type of the events. |
| syncCallback |Callback&lt;Array&lt;[string, number]&gt; | Yes|Callback used to return the result.| | syncCallback |Callback&lt;Array&lt;[string, number]&gt;&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2161,18 +2290,20 @@ Subscribes to data synchronization completion events. This method uses a synchro ...@@ -2161,18 +2290,20 @@ Subscribes to data synchronization completion events. This method uses a synchro
### off<sup>8+</sup> ### off<sup>8+</sup>
off(event:'dataChange', observer?: Callback&lt;ChangeNotification&gt;): void; off(event:'dataChange', observer?: Callback&lt;ChangeNotification&gt;): void
Unsubscribes from data change events. This method uses a synchronouscallback to return the result. Unsubscribes from data change events. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event |'dataChange' | Yes|Type of the events to unsubscribe from.| | event |'dataChange' | Yes |Type of the events. |
| observer |Callback&lt;[ChangeNotification](#changenotification)&gt; |No|Callback used to return the result.| | observer |Callback&lt;[ChangeNotification](#changenotification)&gt; |No |Callback used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2187,18 +2318,20 @@ Unsubscribes from data change events. This method uses a synchronouscallback to ...@@ -2187,18 +2318,20 @@ Unsubscribes from data change events. This method uses a synchronouscallback to
### putBatch<sup>8+</sup> ### putBatch<sup>8+</sup>
putBatch(entries: Entry[], callback: AsyncCallback&lt;void&gt;): void; putBatch(entries: Entry[], callback: AsyncCallback&lt;void&gt;): void
Inserts KV pairs in batches to this KV store. This method uses an asynchronous callback to return the result. Inserts KV pairs in batches to this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| entries |[Entry](#entry)[] | Yes|KV pairs to insert in batches.| | entries |[Entry](#entry)[] | Yes |KV pairs to insert in batches. |
| callback |Asyncallback&lt;void&gt; |Yes|Callback used to return the result.| | callback |Asyncallback&lt;void&gt; |Yes |Callback invoked to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2233,23 +2366,25 @@ Inserts KV pairs in batches to this KV store. This method uses an asynchronous c ...@@ -2233,23 +2366,25 @@ Inserts KV pairs in batches to this KV store. This method uses an asynchronous c
### putBatch<sup>8+</sup> ### putBatch<sup>8+</sup>
putBatch(entries: Entry[]): Promise&lt;void&gt;; putBatch(entries: Entry[]): Promise&lt;void&gt;
Inserts KV pairs in batches to this KV store. This method uses a promise to return the result. Inserts KV pairs in batches to this KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| entries |[Entry](#entry)[] | Yes|KV pairs to insert in batches.| | entries |[Entry](#entry)[] | Yes |KV pairs to insert in batches. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2286,18 +2421,20 @@ Inserts KV pairs in batches to this KV store. This method uses a promise to retu ...@@ -2286,18 +2421,20 @@ Inserts KV pairs in batches to this KV store. This method uses a promise to retu
### deleteBatch<sup>8+</sup> ### deleteBatch<sup>8+</sup>
deleteBatch(keys: string[], callback: AsyncCallback&lt;void&gt;): void; deleteBatch(keys: string[], callback: AsyncCallback&lt;void&gt;): void
Deletes KV pairs in batches from this KV store. This method uses an asynchronous callback to return the result. Deletes KV pairs in batches from this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| keys |string[] | Yes|KV pairs to delete in batches.| | keys |string[] | Yes |KV pairs to delete in batches. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2331,23 +2468,25 @@ Deletes KV pairs in batches from this KV store. This method uses an asynchronous ...@@ -2331,23 +2468,25 @@ Deletes KV pairs in batches from this KV store. This method uses an asynchronous
### deleteBatch<sup>8+</sup> ### ### deleteBatch<sup>8+</sup> ###
deleteBatch(keys: string[]): Promise&lt;void&gt;; deleteBatch(keys: string[]): Promise&lt;void&gt;
Deletes KV pairs in batches from this KV store. This method uses a promise to return the result. Deletes KV pairs in batches from this KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| keys |string[] | Yes|KV pairs to delete in batches.| | keys |string[] | Yes |KV pairs to delete in batches. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2385,17 +2524,19 @@ Deletes KV pairs in batches from this KV store. This method uses a promise to re ...@@ -2385,17 +2524,19 @@ Deletes KV pairs in batches from this KV store. This method uses a promise to re
### startTransaction<sup>8+</sup> ### ### startTransaction<sup>8+</sup> ###
startTransaction(callback: AsyncCallback&lt;void&gt;): void; startTransaction(callback: AsyncCallback&lt;void&gt;): void
Starts the transaction in this KV store. This method uses an asynchronous callback to return the result. Starts the transaction in this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2435,17 +2576,19 @@ Starts the transaction in this KV store. This method uses an asynchronous callba ...@@ -2435,17 +2576,19 @@ Starts the transaction in this KV store. This method uses an asynchronous callba
### startTransaction<sup>8+</sup> ### ### startTransaction<sup>8+</sup> ###
startTransaction(): Promise&lt;void&gt;; startTransaction(): Promise&lt;void&gt;
Starts the transaction in this KV store. This method uses a promise to return the result. Starts the transaction in this KV store. This method uses a promise to return the result.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2468,17 +2611,19 @@ Starts the transaction in this KV store. This method uses a promise to return th ...@@ -2468,17 +2611,19 @@ Starts the transaction in this KV store. This method uses a promise to return th
### commit<sup>8+</sup> ### ### commit<sup>8+</sup> ###
commit(callback: AsyncCallback&lt;void&gt;): void; commit(callback: AsyncCallback&lt;void&gt;): void
Commits the transaction in this KV store. This method uses an asynchronous callback to return the result. Commits the transaction in this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2498,17 +2643,19 @@ Commits the transaction in this KV store. This method uses an asynchronous callb ...@@ -2498,17 +2643,19 @@ Commits the transaction in this KV store. This method uses an asynchronous callb
### commit<sup>8+</sup> ### ### commit<sup>8+</sup> ###
commit(): Promise&lt;void&gt;; commit(): Promise&lt;void&gt;
Commits the transaction in this KV store. This method uses a promise to return the result. Commits the transaction in this KV store. This method uses a promise to return the result.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2526,17 +2673,19 @@ Commits the transaction in this KV store. This method uses a promise to return t ...@@ -2526,17 +2673,19 @@ Commits the transaction in this KV store. This method uses a promise to return t
### rollback<sup>8+</sup> ### ### rollback<sup>8+</sup> ###
rollback(callback: AsyncCallback&lt;void&gt;): void; rollback(callback: AsyncCallback&lt;void&gt;): void
Rolls back the transaction in this KV store. This method uses an asynchronous callback to return the result. Rolls back the transaction in this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2556,17 +2705,19 @@ Rolls back the transaction in this KV store. This method uses an asynchronous ca ...@@ -2556,17 +2705,19 @@ Rolls back the transaction in this KV store. This method uses an asynchronous ca
### rollback<sup>8+</sup> ### ### rollback<sup>8+</sup> ###
rollback(): Promise&lt;void&gt;; rollback(): Promise&lt;void&gt;
Rolls back the transaction in this KV store. This method uses a promise to return the result. Rolls back the transaction in this KV store. This method uses a promise to return the result.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2584,18 +2735,20 @@ Rolls back the transaction in this KV store. This method uses a promise to retur ...@@ -2584,18 +2735,20 @@ Rolls back the transaction in this KV store. This method uses a promise to retur
### enableSync<sup>8+</sup> ### ### enableSync<sup>8+</sup> ###
enableSync(enabled: boolean, callback: AsyncCallback&lt;void&gt;): void; enableSync(enabled: boolean, callback: AsyncCallback&lt;void&gt;): void
Sets data synchronization, which can be enabled or disable. This method uses an asynchronous callback to return the result. Sets data synchronization, which can be enabled or disable. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| enabled |boolean | Yes|Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite.| | enabled |boolean | Yes |Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2615,23 +2768,25 @@ Sets data synchronization, which can be enabled or disable. This method uses an ...@@ -2615,23 +2768,25 @@ Sets data synchronization, which can be enabled or disable. This method uses an
### enableSync<sup>8+</sup> ### ### enableSync<sup>8+</sup> ###
enableSync(enabled: boolean): Promise&lt;void&gt;; enableSync(enabled: boolean): Promise&lt;void&gt;
Sets data synchronization, which can be enabled or disable. This method uses a promise to return the result. Enables or disables data synchronization. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| enabled |boolean | Yes|Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite.| | enabled |boolean | Yes |Whether to enable data synchronization. The value **true** means to enable data synchronization, and **false** means the opposite. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2649,19 +2804,21 @@ Sets data synchronization, which can be enabled or disable. This method uses a p ...@@ -2649,19 +2804,21 @@ Sets data synchronization, which can be enabled or disable. This method uses a p
### setSyncRange<sup>8+</sup> ### ### setSyncRange<sup>8+</sup> ###
setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback&lt;void&gt;): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback&lt;void&gt;): void
Sets the data synchronization range. This method uses an asynchronous callback to return the result. Sets the data synchronization range. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| localLabels |string[] | Yes|Synchronization labels set for the local device.| | localLabels |string[] | Yes |Synchronization labels set for the local device. |
| remoteSupportLabels |string[] | Yes|Synchronization labels set for remote devices.| | remoteSupportLabels |string[] | Yes |Synchronization labels set for remote devices. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback invoked to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2679,25 +2836,27 @@ Sets the data synchronization range. This method uses an asynchronous callback t ...@@ -2679,25 +2836,27 @@ Sets the data synchronization range. This method uses an asynchronous callback t
### setSyncRange<sup>8+</sup> ### ### setSyncRange<sup>8+</sup> ###
setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise&lt;void&gt;; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise&lt;void&gt;
Sets the data synchronization range. This method uses a promise to return the result. Sets the data synchronization range. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| localLabels |string[] | Yes|Synchronization labels set for the local device.| | localLabels |string[] | Yes |Synchronization labels set for the local device. |
| remoteSupportLabels |string[] | Yes|Synchronization labels set for remote devices.| | remoteSupportLabels |string[] | Yes |Synchronization labels set for remote devices. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
| Promise&lt;void&gt; |Promise used to return the result.| | Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2719,41 +2878,49 @@ Sets the data synchronization range. This method uses a promise to return the re ...@@ -2719,41 +2878,49 @@ Sets the data synchronization range. This method uses a promise to return the re
Defines the subscription type. Defines the subscription type.
| Name| Default Value| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Default Value | Description |
| ----- | ------ | ----------------------- | | ----- | ------ | ----------------------- |
| SUBSCRIBE_TYPE_LOCAL |0 |Local data changes.| | SUBSCRIBE_TYPE_LOCAL |0 |Local data changes. |
| SUBSCRIBE_TYPE_REMOTE |1 |Remote data changes.| | SUBSCRIBE_TYPE_REMOTE |1 |Remote data changes. |
| SUBSCRIBE_TYPE_ALL |2 |Local and remote data changes.| | SUBSCRIBE_TYPE_ALL |2 |Local and remote data changes. |
## ChangeNotification ## ChangeNotification
Defines the content of data change notifications, including inserted data, updated data, deleted data, and device ID. Defines the content of data change notifications, including inserted data, updated data, deleted data, and device ID.
| Name| Type|Readable|Writable| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Type |Readable |Writable | Description |
| ----- | ------- | -----| ------|------------------------ | | ----- | ------- | -----| ------|------------------------ |
| insertEntries | [Entry](#entry)[] | Yes| Yes|Data inserted.| | insertEntries | [Entry](#entry)[] | Yes | Yes|Data inserted. |
| updateEntries | [Entry](#entry)[] | Yes| Yes|Data updated.| | updateEntries | [Entry](#entry)[] | Yes | Yes|Data updated. |
| deleteEntries | [Entry](#entry)[] | Yes| Yes|Data deleted.| | deleteEntries | [Entry](#entry)[] | Yes | Yes|Data deleted. |
| deviceId | string | Yes| Yes|UUID of the device.| | deviceId | string | Yes | Yes|UUID of the device. |
## Entry ## Entry
Defines the KV pairs stored in the KV store. Defines the KV pairs stored in the KV store.
| Name| Type|Readable|Writable| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Type |Readable |Writable | Description |
| ----- | ------- | -----| ------|------------------------ | | ----- | ------- | -----| ------|------------------------ |
| key | string | Yes| Yes|Key of the KV pair stored in the KV store.| | key | string | Yes | Yes|Key of the KV pair stored in the KV store. |
| value | [Value](#value) | Yes| Yes|Value of the KV pair stored in the KV store.| | value | [Value](#value) | Yes | Yes|Value of the KV pair stored in the KV store. |
## Value ## Value
Defines the value in a KV pair. Defines the value in a KV pair.
| Name| Type|Readable|Writable| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Type |Readable |Writable | Description |
| ----- | ------- | -----| ------|------------------------ | | ----- | ------- | -----| ------|------------------------ |
| type | [ValueType](#value) | Yes| Yes|Type of the value.| | type | [ValueType](#value) | Yes | Yes|Type of the value. |
| value | Uint8Array / string / number / boolean| Yes| Yes|Specific value.| | value | Uint8Array / string / number / boolean| Yes | Yes|Value of the KV pair stored in the KV store. |
## ValueType ## ValueType
...@@ -2761,33 +2928,39 @@ Enumerates the types of values in KV pairs. ...@@ -2761,33 +2928,39 @@ Enumerates the types of values in KV pairs.
These value types can be used only by internal applications. These value types can be used only by internal applications.
| Name| Default Value| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Default Value | Description |
| ----- | ------ | ----------------------- | | ----- | ------ | ----------------------- |
| STRING |0 |String.| | STRING |0 |String. |
| INTEGER |1 |Integer.| | INTEGER |1 |Integer. |
| FLOAT |2 |Float (single-precision floating point).| | FLOAT |2 |Float (single-precision floating point). |
| BYTE_ARRAY |3 |Byte array.| | BYTE_ARRAY |3 |Byte array. |
| BOOLEAN |4 |Boolean.| | BOOLEAN |4 |Boolean. |
| DOUBLE |5 |Double (double-precision floating point).| | DOUBLE |5 |Double (double-precision floating point). |
## SingleKVStore ## SingleKVStore
Provides methods to query and synchronize data in a single KV store. This class inherits from **KVStore**. Before calling any method in **SingleKVStore**, you must use **getKVStore** to obtain a **SingleKVStore** object. Provides methods to query and synchronize data in a single KV store. This class inherits from **KVStore**. Before calling any method in **SingleKVStore**, you must use **getKVStore** to obtain a **SingleKVStore** object.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core
### get ### get
get(key: string, callback: AsyncCallback&lt;Uint8Array | string | boolean | number&gt;): void get(key: string, callback: AsyncCallback&lt;Uint8Array | string | boolean | number&gt;): void
Obtains the value of a specified key. This method uses an asynchronous callback to return the result. Obtains the value of a specified key. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| key |string | Yes|Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).| | key |string | Yes |Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
| callback |AsyncCallback&lt;Uint8Array / string / boolean / number&gt;) | Yes|Callback used to return the value obtained.| | callback |AsyncCallback&lt;Uint8Array / string / boolean / number&gt;) | Yes |Callback used to return the value obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2812,25 +2985,27 @@ Obtains the value of a specified key. This method uses an asynchronous callback ...@@ -2812,25 +2985,27 @@ Obtains the value of a specified key. This method uses an asynchronous callback
### get ### get
get(key: string): Promise&lt;Uint8Array | string | boolean | number&gt; get(key: string): Promise&lt;Uint8Array | string | boolean | number&gt
Obtains the value of a specified key. This method uses a promise to return the result. Obtains the value of a specified key. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| key |string | Yes|Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX\_KEY\_LENGTH](#constants).| | key |string | Yes |Key of the value to obtain. It cannot be empty, and the length cannot exceed [MAX_KEY_LENGTH](#constants). |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;Uint8Array / string / boolean / number&gt; |Promise used to return the value obtained.| |Promise&lt;Uint8Array / string / boolean / number&gt; |Promise used to return the value obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2854,18 +3029,20 @@ Obtains the value of a specified key. This method uses a promise to return the r ...@@ -2854,18 +3029,20 @@ Obtains the value of a specified key. This method uses a promise to return the r
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(keyPrefix: string, callback: AsyncCallback&lt;Entry[]&gt;): void; getEntries(keyPrefix: string, callback: AsyncCallback&lt;Entry[]&gt;): void
Obtains the KV pairs that match the specified key prefix. This method uses an asynchronous callback to return the result. Obtains the KV pairs that match the specified key prefix. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match. |
| callback |AsyncCallback&lt;Entry[]&gt; | Yes|Callback used to return the KV pairs obtained.| | callback |AsyncCallback&lt;Entry[]&gt; | Yes |Callback used to return the KV pairs obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2898,23 +3075,25 @@ Obtains the KV pairs that match the specified key prefix. This method uses an as ...@@ -2898,23 +3075,25 @@ Obtains the KV pairs that match the specified key prefix. This method uses an as
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(keyPrefix: string): Promise&lt;Entry[]&gt;; getEntries(keyPrefix: string): Promise&lt;Entry[]&gt;
Obtains the KV pairs that match the specified key prefix. This method uses a promise to return the result. Obtains the KV pairs that match the specified key prefix. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.| |Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -2954,18 +3133,20 @@ Obtains the KV pairs that match the specified key prefix. This method uses a pro ...@@ -2954,18 +3133,20 @@ Obtains the KV pairs that match the specified key prefix. This method uses a pro
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(query: Query, callback: AsyncCallback&lt;Entry[]&gt;): void; getEntries(query: Query, callback: AsyncCallback&lt;Entry[]&gt;): void
Obtains the KV pairs that match the specified **Query** object. This method uses an asynchronous callback to return the result. Obtains the KV pairs that match the specified **Query** object. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;Entry[]&gt; | Yes|Callback used to return the KV pairs obtained.| | callback |AsyncCallback&lt;Entry[]&gt; | Yes |Callback used to return the KV pairs obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3003,23 +3184,25 @@ Obtains the KV pairs that match the specified **Query** object. This method uses ...@@ -3003,23 +3184,25 @@ Obtains the KV pairs that match the specified **Query** object. This method uses
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(query: Query): Promise&lt;Entry[]&gt;; getEntries(query: Query): Promise&lt;Entry[]&gt;
Obtains the KV pairs that match the specified **Query** object. This method uses a promise to return the result. Obtains the KV pairs that match the specified **Query** object. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.| |Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.|
- Example **Example**
``` ```
try { try {
...@@ -3058,18 +3241,20 @@ Obtains the KV pairs that match the specified **Query** object. This method uses ...@@ -3058,18 +3241,20 @@ Obtains the KV pairs that match the specified **Query** object. This method uses
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(keyPrefix: string, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void; getResultSet(keyPrefix: string, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void
Obtains the result set with the specified key prefix from this single KV store. This method uses an asynchronous callback to return the result. Obtains the result set with the specified key prefix from this single KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match.|
| callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; | Yes|Callback used to return the result set obtained.| | callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; | Yes |Callback used to return the result set obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3105,23 +3290,25 @@ Obtains the result set with the specified key prefix from this single KV store. ...@@ -3105,23 +3290,25 @@ Obtains the result set with the specified key prefix from this single KV store.
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(keyPrefix: string): Promise&lt;KvStoreResultSet&gt;; getResultSet(keyPrefix: string): Promise&lt;KvStoreResultSet&gt;
Obtains the result set with the specified key prefix from this single KV store. This method uses a promise to return the result. Obtains the result set with the specified key prefix from this single KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match.|
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; |Promise used to return the result set obtained.| |Promise&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; |Promise used to return the result set obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3163,18 +3350,20 @@ Obtains the result set with the specified key prefix from this single KV store. ...@@ -3163,18 +3350,20 @@ Obtains the result set with the specified key prefix from this single KV store.
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(query: Query, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void; getResultSet(query: Query, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses an asynchronous callback to return the result. Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |Query | Yes|**Query** object to match.| | query |Query | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; | Yes|Callback used to return the **KvStoreResultSet** object obtained.| | callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; | Yes |Callback used to return the **KvStoreResultSet** object obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3209,23 +3398,25 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj ...@@ -3209,23 +3398,25 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(query: Query): Promise&lt;KvStoreResultSet&gt;; getResultSet(query: Query): Promise&lt;KvStoreResultSet&gt;
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses a promise to return the result. Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; |Promise used to return the **KvStoreResultSet** object obtained.| |Promise&lt;[KvStoreResultSet](#kvstoreresultset8)&gt; |Promise used to return the **KvStoreResultSet** object obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3261,20 +3452,23 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj ...@@ -3261,20 +3452,23 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
} }
``` ```
### closeResultSet<sup>8+</sup> ### ### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback&lt;void&gt;): void; closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback&lt;void&gt;): void
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses an asynchronous callback to return the result. Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes|**KvStoreResultSet** object to close.| | resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes |**KvStoreResultSet** object to close. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the execution result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback used to return the execution result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3295,23 +3489,25 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method ...@@ -3295,23 +3489,25 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### closeResultSet<sup>8+</sup> ### ### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet): Promise&lt;void&gt;; closeResultSet(resultSet: KvStoreResultSet): Promise&lt;void&gt;
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses a promise to return the result. Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes|**KvStoreResultSet** object to close.| | resultSet |[KvStoreResultSet](#kvstoreresultset8) | Yes |**KvStoreResultSet** object to close. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;void&gt; |Promise used to return the result.| |Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3330,18 +3526,20 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method ...@@ -3330,18 +3526,20 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### getResultSize<sup>8+</sup> ### ### getResultSize<sup>8+</sup> ###
getResultSize(query: Query, callback: AsyncCallback&lt;number&gt;): void; getResultSize(query: Query, callback: AsyncCallback&lt;number&gt;): void
Obtains the number of results matching the specified **Query** object. This method uses an asynchronous callback to return the result. Obtains the number of results that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;number&gt; | Yes|Callback used to return the number of results obtained.| | callback |AsyncCallback&lt;number&gt; | Yes |Callback used to return the number of results obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3374,23 +3572,25 @@ Obtains the number of results matching the specified **Query** object. This meth ...@@ -3374,23 +3572,25 @@ Obtains the number of results matching the specified **Query** object. This meth
### getResultSize<sup>8+</sup> ### ### getResultSize<sup>8+</sup> ###
getResultSize(query: Query): Promise&lt;number&gt;; getResultSize(query: Query): Promise&lt;number&gt;
Obtains the number of results that matches the specified **Query** object. This method uses a promise to return the result.
Obtains the number of results matching the specified **Query** object. This method uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
- Parameters **Parameters**
| Name| Type| Mandatory| Description| | Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;number&gt; |Promise used to return the number of results obtained.| |Promise&lt;number&gt; |Promise used to return the number of results obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3427,18 +3627,20 @@ Obtains the number of results matching the specified **Query** object. This meth ...@@ -3427,18 +3627,20 @@ Obtains the number of results matching the specified **Query** object. This meth
### removeDeviceData<sup>8+</sup> ### ### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string, callback: AsyncCallback&lt;void&gt;): void; removeDeviceData(deviceId: string, callback: AsyncCallback&lt;void&gt;): void
Deletes data of a device. This method uses an asynchronous callback to return the result. Deletes data of a device. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback used to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3467,23 +3669,25 @@ Deletes data of a device. This method uses an asynchronous callback to return th ...@@ -3467,23 +3669,25 @@ Deletes data of a device. This method uses an asynchronous callback to return th
### removeDeviceData<sup>8+</sup> ### ### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string): Promise&lt;void&gt;; removeDeviceData(deviceId: string): Promise&lt;void&gt;
Deletes data of a device. This method uses a promise to return the result. Deletes data of a device. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;void&gt; |Promise used to return the result.| |Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3514,18 +3718,20 @@ Deletes data of a device. This method uses a promise to return the result. ...@@ -3514,18 +3718,20 @@ Deletes data of a device. This method uses a promise to return the result.
### on<sup>8+</sup> ### ### on<sup>8+</sup> ###
on(event: 'syncComplete', syncCallback: Callback<Array&lt;[string, number]&gt;): void; on(event: 'syncComplete', syncCallback: Callback&lt;Array&lt;[string, number]&gt;&gt;): void
Subscribes to the synchronization completion events. This method uses a synchronous callback to return the result. Subscribes to the synchronization completion events. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | Yes|Event triggered when the synchronization is complete.| | event |'syncComplete' | Yes |Event triggered when the synchronization is complete. |
| syncCallback |Callback<Array&lt;[string, number]&gt; | Yes|Callback used to return the synchronization result.| | syncCallback |Callback&lt;Array&lt;[string, number]&gt;&gt; | Yes |Callback used to return the synchronization result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3548,19 +3754,21 @@ Subscribes to the synchronization completion events. This method uses a synchron ...@@ -3548,19 +3754,21 @@ Subscribes to the synchronization completion events. This method uses a synchron
### off<sup>8+</sup> ### ### off<sup>8+</sup> ###
off(event: 'syncComplete', syncCallback?: Callback<Array&lt;[string, number]&gt;): void; off(event: 'syncComplete', syncCallback?: Callback&lt;Array&lt;[string, number]&gt;&gt;): void
Unsubscribes from the synchronization completion events. This method uses a synchronization callback to return the result. Unsubscribes from the synchronization completion events. This method uses a synchronization callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | Yes|Event triggered when the synchronization is complete.| | event |'syncComplete' | Yes |Event triggered when the synchronization is complete. |
| syncCallback |Callback<Array&lt;[string, number]&gt; | No|Callback used to return the synchronization result.| | syncCallback |Callback&lt;Array&lt;[string, number]&gt;&gt; | No |Callback used to return the synchronization result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3582,15 +3790,17 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void ...@@ -3582,15 +3790,17 @@ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void
Manually triggers KV store synchronization synchronously. Manually triggers KV store synchronization synchronously.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceIdList |string[] | Yes|IDs of the devices to be synchronized. These devices must be in the same networking environment.| | deviceIdList |string[] | Yes |IDs of the devices to be synchronized. These devices must be in the same networking environment. |
| mode |[SyncMode](#syncmode) | Yes|Data synchronization mode.| | mode |[SyncMode](#syncmode) | Yes |Data synchronization mode. |
| allowedDelayMs |number | No|Allowed synchronization delay time, in ms.| | allowedDelayMs |number | No |Allowed synchronization delay time, in ms. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3599,19 +3809,21 @@ Manually triggers KV store synchronization synchronously. ...@@ -3599,19 +3809,21 @@ Manually triggers KV store synchronization synchronously.
### setSyncParam<sup>8+</sup> ### ### setSyncParam<sup>8+</sup> ###
setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback&lt;void&gt;): void; setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback&lt;void&gt;): void
Sets the default delay of database synchronization. This method uses an asynchronous callback to return the result. Sets the default delay of database synchronization. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| defaultAllowedDelayMs |number | Yes|Default delay allowed for database synchronization, in ms.| | defaultAllowedDelayMs |number | Yes |Default delay allowed for database synchronization, in ms. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback used to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3628,24 +3840,26 @@ Sets the default delay of database synchronization. This method uses an asynchro ...@@ -3628,24 +3840,26 @@ Sets the default delay of database synchronization. This method uses an asynchro
### setSyncParam<sup>8+</sup> ### ### setSyncParam<sup>8+</sup> ###
setSyncParam(defaultAllowedDelayMs: number): Promise&lt;void&gt;; setSyncParam(defaultAllowedDelayMs: number): Promise&lt;void&gt;
Sets the default delay of database synchronization. This method uses a promise to return the result. Sets the default delay of database synchronization. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| defaultAllowedDelayMs |number | Yes|Default delay allowed for database synchronization, in ms.| | defaultAllowedDelayMs |number | Yes |Default delay allowed for database synchronization, in ms. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;void&gt; |Promise used to return the result.| |Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3664,17 +3878,19 @@ Sets the default delay of database synchronization. This method uses a promise t ...@@ -3664,17 +3878,19 @@ Sets the default delay of database synchronization. This method uses a promise t
### getSecurityLevel<sup>8+</sup> ### ### getSecurityLevel<sup>8+</sup> ###
getSecurityLevel(callback: AsyncCallback&lt;SecurityLevel&gt;): void; getSecurityLevel(callback: AsyncCallback&lt;SecurityLevel&gt;): void
Obtains the security level of this KV store. This method uses an asynchronous callback to return the result. Obtains the security level of this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| callback |AsyncCallback&lt;[SecurityLevel](#securitylevel)&gt; | Yes|Callback used to return the security level obtained.| | callback |AsyncCallback&lt;[SecurityLevel](#securitylevel)&gt; | Yes |Callback used to return the security level obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3690,18 +3906,20 @@ Obtains the security level of this KV store. This method uses an asynchronous ca ...@@ -3690,18 +3906,20 @@ Obtains the security level of this KV store. This method uses an asynchronous ca
### getSecurityLevel<sup>8+</sup> ### ### getSecurityLevel<sup>8+</sup> ###
getSecurityLevel(): Promise&lt;SecurityLevel&gt;; getSecurityLevel(): Promise&lt;SecurityLevel&gt;
Obtains the security level of this KV store. This method uses a promise to return the result. Obtains the security level of this KV store. This method uses a promise to return the result.
- Return value **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Type| Description| **Return value**
| Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[SecurityLevel](#securitylevel)&gt; |Promise used to return the security level obtained.| |Promise&lt;[SecurityLevel](#securitylevel)&gt; |Promise used to return the security level obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3721,22 +3939,26 @@ Obtains the security level of this KV store. This method uses a promise to retur ...@@ -3721,22 +3939,26 @@ Obtains the security level of this KV store. This method uses a promise to retur
Provides methods to manage distributed data by device in the distributed system. This class inherits from **KvStore** and provides data query and synchronization methods. Before calling any method in **DeviceKVStore**, you must use **getKVStore** to obtain a **DeviceKVStore** object. Provides methods to manage distributed data by device in the distributed system. This class inherits from **KvStore** and provides data query and synchronization methods. Before calling any method in **DeviceKVStore**, you must use **getKVStore** to obtain a **DeviceKVStore** object.
**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
### get<sup>8+</sup> ### ### get<sup>8+</sup> ###
get(deviceId: string, key: string, callback: AsyncCallback&lt;boolean|string|number|Uint8Array&gt;): void; get(deviceId: string, key: string, callback: AsyncCallback&lt;boolean|string|number|Uint8Array&gt;): void
Obtains the string value that matches the specified key for a device. This method uses an asynchronous callback to return the result. Obtains the string value that matches the specified key for a device. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| key |string | Yes|Key to match.| | key |string | Yes |Key to match. |
| callback |AsyncCallback&lt;boolean/string/number/Uint8Array&gt; | Yes|Callback used to return the value obtained.| | callback |AsyncCallback&lt;boolean/string/number/Uint8Array&gt; | Yes |Callback used to return the value obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3757,24 +3979,26 @@ Obtains the string value that matches the specified key for a device. This metho ...@@ -3757,24 +3979,26 @@ Obtains the string value that matches the specified key for a device. This metho
### get<sup>8+</sup> ### ### get<sup>8+</sup> ###
get(deviceId: string, key: string): Promise&lt;boolean|string|number|Uint8Array&gt;; get(deviceId: string, key: string): Promise&lt;boolean|string|number|Uint8Array&gt;
Obtains the string value that matches the specified key for a device. This method uses a promise to return the result. Obtains the string value that matches the specified key for a device. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| key |string | Yes|Key to match.| | key |string | Yes |Key to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;boolean/string/number/Uint8Array&gt; |Promise used to return the value obtained.| |Promise&lt;boolean/string/number/Uint8Array&gt; |Promise used to return the value obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3799,19 +4023,21 @@ Obtains the string value that matches the specified key for a device. This metho ...@@ -3799,19 +4023,21 @@ Obtains the string value that matches the specified key for a device. This metho
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback&lt;Entry[]&gt;): void; getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback&lt;Entry[]&gt;): void
Obtains the KV pairs that match the specified key prefix for a device. This method uses an asynchronous callback to return the result. Obtains the KV pairs that match the specified key prefix for a device. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match. |
| callback |AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes|Callback used to return the KV pairs obtained.| | callback |AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes |Callback used to return the KV pairs obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3845,24 +4071,26 @@ Obtains the KV pairs that match the specified key prefix for a device. This meth ...@@ -3845,24 +4071,26 @@ Obtains the KV pairs that match the specified key prefix for a device. This meth
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, keyPrefix: string): Promise&lt;Entry[]&gt;; getEntries(deviceId: string, keyPrefix: string): Promise&lt;Entry[]&gt;
Obtains the KV pairs that match the specified key prefix for a device. This method uses a promise to return the result. Obtains the KV pairs that match the specified key prefix for a device. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.| |Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3902,18 +4130,20 @@ Obtains the KV pairs that match the specified key prefix for a device. This meth ...@@ -3902,18 +4130,20 @@ Obtains the KV pairs that match the specified key prefix for a device. This meth
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(query: Query, callback: AsyncCallback&lt;Entry[]&gt;): void; getEntries(query: Query, callback: AsyncCallback&lt;Entry[]&gt;): void
Obtains the KV pairs matching the specified **Query** object. This method uses an asynchronous callback to return the result. Obtains the KV pairs that match the specified **Query** object. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes|Callback used to return the KV pairs obtained.| | callback |AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes |Callback used to return the KV pairs obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -3953,23 +4183,25 @@ Obtains the KV pairs matching the specified **Query** object. This method uses a ...@@ -3953,23 +4183,25 @@ Obtains the KV pairs matching the specified **Query** object. This method uses a
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(query: Query): Promise&lt;Entry[]&gt;; getEntries(query: Query): Promise&lt;Entry[]&gt;
Obtains the KV pairs matching the specified **Query** object. This method uses a promise to return the result. Obtains the KV pairs that match the specified **Query** object. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.| |Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4009,19 +4241,21 @@ Obtains the KV pairs matching the specified **Query** object. This method uses a ...@@ -4009,19 +4241,21 @@ Obtains the KV pairs matching the specified **Query** object. This method uses a
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, query: Query, callback: AsyncCallback&lt;Entry[]&gt;): void; getEntries(deviceId: string, query: Query, callback: AsyncCallback&lt;Entry[]&gt;): void
Obtains the KV pairs matching the specified **Query** object for a device. This method uses an asynchronous callback to return the result. Obtains the KV pairs that match the specified **Query** object for a device. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes|Callback used to return the KV pairs obtained.| | callback |AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes |Callback used to return the KV pairs obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4061,24 +4295,26 @@ Obtains the KV pairs matching the specified **Query** object for a device. This ...@@ -4061,24 +4295,26 @@ Obtains the KV pairs matching the specified **Query** object for a device. This
### getEntries<sup>8+</sup> ### ### getEntries<sup>8+</sup> ###
getEntries(deviceId: string, query: Query): Promise&lt;Entry[]&gt;; getEntries(deviceId: string, query: Query): Promise&lt;Entry[]&gt;
Obtains the KV pairs matching the specified **Query** object for a device. This method uses a promise to return the result. Obtains the KV pairs that match the specified **Query** object for a device. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.| |Promise&lt;[Entry](#entry)[]&gt; |Promise used to return the KV pairs obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4119,19 +4355,21 @@ Obtains the KV pairs matching the specified **Query** object for a device. This ...@@ -4119,19 +4355,21 @@ Obtains the KV pairs matching the specified **Query** object for a device. This
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void; getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void
Obtains the **KvStoreResultSet** object that matches the specified key prefix for a device. This method uses an asynchronous callback to return the result. Obtains the **KvStoreResultSet** object that matches the specified key prefix for a device. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match. |
| callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; | Yes|Callback used to return the **KvStoreResultSet** object obtained.| | callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; | Yes |Callback used to return the **KvStoreResultSet** object obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4152,24 +4390,26 @@ Obtains the **KvStoreResultSet** object that matches the specified key prefix fo ...@@ -4152,24 +4390,26 @@ Obtains the **KvStoreResultSet** object that matches the specified key prefix fo
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, keyPrefix: string): Promise&lt;KvStoreResultSet&gt;; getResultSet(deviceId: string, keyPrefix: string): Promise&lt;KvStoreResultSet&gt;
Obtains the **KvStoreResultSet** object that matches the specified key prefix for a device. This method uses a promise to return the result. Obtains the **KvStoreResultSet** object that matches the specified key prefix for a device. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| keyPrefix |string | Yes|Key prefix to match.| | keyPrefix |string | Yes |Key prefix to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; |Promise used to return the **KvStoreResultSet** object obtained.| |Promise&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; |Promise used to return the **KvStoreResultSet** object obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4194,18 +4434,20 @@ Obtains the **KvStoreResultSet** object that matches the specified key prefix fo ...@@ -4194,18 +4434,20 @@ Obtains the **KvStoreResultSet** object that matches the specified key prefix fo
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(query: Query, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void; getResultSet(query: Query, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses an asynchronous callback to return the result. Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; | Yes|Callback used to return the **KvStoreResultSet** object obtained.| | callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; | Yes |Callback used to return the **KvStoreResultSet** object obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4244,23 +4486,25 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj ...@@ -4244,23 +4486,25 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(query: Query): Promise&lt;KvStoreResultSet&gt;; getResultSet(query: Query): Promise&lt;KvStoreResultSet&gt;
Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses a promise to return the result. Obtains the **KvStoreResultSet** object that matches the specified **Query** object. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; |Promise used to return the **KvStoreResultSet** object obtained.| |Promise&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; |Promise used to return the **KvStoreResultSet** object obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4306,19 +4550,21 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj ...@@ -4306,19 +4550,21 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, query: Query, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void; getResultSet(deviceId: string, query: Query, callback: AsyncCallback&lt;KvStoreResultSet&gt;): void
Obtains the **KvStoreResultSet** object that matches the specified **Query** object for a device. This method uses an asynchronous callback to return the result. Obtains the **KvStoreResultSet** object that matches the specified **Query** object for a device. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; | Yes|Callback used to return the **KvStoreResultSet** object obtained.| | callback |AsyncCallback&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; | Yes |Callback used to return the **KvStoreResultSet** object obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4356,24 +4602,26 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj ...@@ -4356,24 +4602,26 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### getResultSet<sup>8+</sup> ### ### getResultSet<sup>8+</sup> ###
getResultSet(deviceId: string, query: Query): Promise&lt;KvStoreResultSet&gt;; getResultSet(deviceId: string, query: Query): Promise&lt;KvStoreResultSet&gt;
Obtains the **KvStoreResultSet** object that matches the specified **Query** object for a device. This method uses a promise to return the result. Obtains the **KvStoreResultSet** object that matches the specified **Query** object for a device. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; |Promise used to return the **KvStoreResultSet** object obtained.| |Promise&lt;[KvStoreResultSet](#kvstoreresultset8)[]&gt; |Promise used to return the **KvStoreResultSet** object obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4420,18 +4668,20 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj ...@@ -4420,18 +4668,20 @@ Obtains the **KvStoreResultSet** object that matches the specified **Query** obj
### closeResultSet<sup>8+</sup> ### ### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback&lt;void&gt;): void; closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback&lt;void&gt;): void
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses an asynchronous callback to return the result. Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| resultSet |[KvStoreResultSet](#getresultset8) | Yes|**KvStoreResultSet** object to close.| | resultSet |[KvStoreResultSet](#getresultset8) | Yes |**KvStoreResultSet** object to close. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback used to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4453,23 +4703,25 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method ...@@ -4453,23 +4703,25 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### closeResultSet<sup>8+</sup> ### ### closeResultSet<sup>8+</sup> ###
closeResultSet(resultSet: KvStoreResultSet): Promise&lt;void&gt;; closeResultSet(resultSet: KvStoreResultSet): Promise&lt;void&gt;
Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses a promise to return the result. Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| resultSet |[KvStoreResultSet](#getresultset8) | Yes|**KvStoreResultSet** object to close.| | resultSet |[KvStoreResultSet](#getresultset8) | Yes |**KvStoreResultSet** object to close. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;void&gt; |Promise used to return the result.| |Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4489,18 +4741,20 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method ...@@ -4489,18 +4741,20 @@ Closes the **KvStoreResultSet** object obtained by **getResultSet**. This method
### getResultSize<sup>8+</sup> ### ### getResultSize<sup>8+</sup> ###
getResultSize(query: Query, callback: AsyncCallback&lt;number&gt;): void; getResultSize(query: Query, callback: AsyncCallback&lt;number&gt;): void
Obtains the number of results that matches the specified **Query** object. This method uses an asynchronous callback to return the result. Obtains the number of results that matches the specified **Query** object. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;number&gt; | Yes|Callback used to return the number of results obtained.| | callback |AsyncCallback&lt;number&gt; | Yes |Callback used to return the number of results obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4534,23 +4788,25 @@ Obtains the number of results that matches the specified **Query** object. This ...@@ -4534,23 +4788,25 @@ Obtains the number of results that matches the specified **Query** object. This
### getResultSize<sup>8+</sup> ### ### getResultSize<sup>8+</sup> ###
getResultSize(query: Query): Promise&lt;number&gt;; getResultSize(query: Query): Promise&lt;number&gt;
Obtains the number of results that matches the specified **Query** object. This method uses a promise to return the result. Obtains the number of results that matches the specified **Query** object. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;number&gt; |Promise used to return the number of results obtained.| |Promise&lt;number&gt; |Promise used to return the number of results obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4592,15 +4848,17 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback&lt;number& ...@@ -4592,15 +4848,17 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback&lt;number&
Obtains the number of results that matches the specified **Query** object for a device. This method uses an asynchronous callback to return the result. Obtains the number of results that matches the specified **Query** object for a device. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
| callback |AsyncCallback&lt;number&gt; | Yes|Callback used to return the number of results obtained.| | callback |AsyncCallback&lt;number&gt; | Yes |Callback used to return the number of results obtained. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4633,24 +4891,26 @@ Obtains the number of results that matches the specified **Query** object for a ...@@ -4633,24 +4891,26 @@ Obtains the number of results that matches the specified **Query** object for a
### getResultSize<sup>8+</sup> ### ### getResultSize<sup>8+</sup> ###
getResultSize(deviceId: string, query: Query): Promise&lt;number&gt;; getResultSize(deviceId: string, query: Query): Promise&lt;number&gt;
Obtains the number of results that matches the specified **Query** object for a device. This method uses a promise to return the result. Obtains the number of results that matches the specified **Query** object for a device. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| query |[Query](#query8) | Yes|**Query** object to match.| | query |[Query](#query8) | Yes |**Query** object to match. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;number&gt; |Promise used to return the number of results obtained.| |Promise&lt;number&gt; |Promise used to return the number of results obtained.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4687,18 +4947,20 @@ Obtains the number of results that matches the specified **Query** object for a ...@@ -4687,18 +4947,20 @@ Obtains the number of results that matches the specified **Query** object for a
### removeDeviceData<sup>8+</sup> ### ### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string, callback: AsyncCallback&lt;void&gt;): void; removeDeviceData(deviceId: string, callback: AsyncCallback&lt;void&gt;): void
Removes data of a device from this KV store. This method uses an asynchronous callback to return the result. Removes data of a device from this KV store. This method uses an asynchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
| callback |AsyncCallback&lt;void&gt; | Yes|Callback used to return the result.| | callback |AsyncCallback&lt;void&gt; | Yes |Callback used to return the result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4727,23 +4989,25 @@ Removes data of a device from this KV store. This method uses an asynchronous ca ...@@ -4727,23 +4989,25 @@ Removes data of a device from this KV store. This method uses an asynchronous ca
### removeDeviceData<sup>8+</sup> ### ### removeDeviceData<sup>8+</sup> ###
removeDeviceData(deviceId: string): Promise&lt;void&gt;; removeDeviceData(deviceId: string): Promise&lt;void&gt;
Removes data of a device from this KV store. This method uses a promise to return the result. Removes data of a device from this KV store. This method uses a promise to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceId |string | Yes|ID of the target device.| | deviceId |string | Yes |ID of the target device. |
- Return value **Return value**
| Type| Description| | Type | Description |
| ------ | ------- | | ------ | ------- |
|Promise&lt;void&gt; |Promise used to return the result.| |Promise&lt;void&gt; |Promise used to return the result.|
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4774,20 +5038,22 @@ Removes data of a device from this KV store. This method uses a promise to retur ...@@ -4774,20 +5038,22 @@ Removes data of a device from this KV store. This method uses a promise to retur
### sync<sup>8+</sup> ### ### sync<sup>8+</sup> ###
sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void
Manually triggers KV store synchronization synchronously. Manually triggers KV store synchronization synchronously.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| deviceIdList |string[] | Yes|IDs of the devices to be synchronized.| | deviceIdList |string[] | Yes |IDs of the devices to be synchronized.|
| mode |[SyncMode](#syncmode) | Yes|Data synchronization mode, which can be **PUSH**, **PULL**, or **PUSH_PULL**.| | mode |[SyncMode](#syncmode) | Yes |Data synchronization mode, which can be **PUSH**, **PULL**, or **PUSH_PULL**. |
| allowedDelayMs |number | No|Allowed synchronization delay time, in ms.| | allowedDelayMs |number | No |Allowed synchronization delay time, in ms. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4810,18 +5076,20 @@ Manually triggers KV store synchronization synchronously. ...@@ -4810,18 +5076,20 @@ Manually triggers KV store synchronization synchronously.
### on<sup>8+</sup> ### ### on<sup>8+</sup> ###
on(event: 'syncComplete', syncCallback: Callback<Arrary&lt;<[string, number]&gt;): void; on(event: 'syncComplete', syncCallback: Callback&lt;Arrary&lt;[string, number]&gt;&gt;): void
Subscribes to the synchronization completion events. This method uses a synchronous callback to return the result. Subscribes to the synchronization completion events. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | Yes|Event triggered when the synchronization is complete.| | event |'syncComplete' | Yes |Event triggered when the synchronization is complete.|
| syncCallback |Callback<Arrary&lt;<[string, number]&gt; | Yes|Callback used to return the synchronization result.| | syncCallback |Callback<Arrary&lt;<[string, number]&gt; | Yes |Callback used to return the synchronization result. |
- Example **Example**
``` ```
const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
const VALUE_TEST_FLOAT_ELEMENT = 321.12; const VALUE_TEST_FLOAT_ELEMENT = 321.12;
...@@ -4842,19 +5110,21 @@ Subscribes to the synchronization completion events. This method uses a synchron ...@@ -4842,19 +5110,21 @@ Subscribes to the synchronization completion events. This method uses a synchron
### off<sup>8+</sup> ### ### off<sup>8+</sup> ###
off(event: 'syncComplete', syncCallback?: Callback<Array&lt;[string, number]&gt;): void; off(event: 'syncComplete', syncCallback?: Callback&lt;Array&lt;[string, number]&gt;&gt;): void
Unsubscribes from the synchronization completion events. This method uses a synchronous callback to return the result. Unsubscribes from the synchronization completion events. This method uses a synchronous callback to return the result.
- Parameters **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name| Type| Mandatory| Description| **Parameters**
| Name | Type| Mandatory | Description |
| ----- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ----------------------- |
| event |'syncComplete' | Yes|Event triggered when the synchronization is complete.| | event |'syncComplete' | Yes |Event triggered when the synchronization is complete.|
| syncCallback |Callback<Arrary&lt;<[string, number]&gt; | No|Callback used to return the synchronization result.| | syncCallback |Callback<Arrary&lt;[string, number]&gt;&gt; | No |Callback used to return the synchronization result. |
- Example **Example**
``` ```
let kvStore; let kvStore;
...@@ -4874,7 +5144,9 @@ Unsubscribes from the synchronization completion events. This method uses a sync ...@@ -4874,7 +5144,9 @@ Unsubscribes from the synchronization completion events. This method uses a sync
Defines the synchronization mode. Defines the synchronization mode.
| Name| Default Value| Description| **System capability**: SystemCapability.DistributedDataManager.KVStore.Core
| Name | Default Value | Description |
| ----- | ------ | ----------------------- | | ----- | ------ | ----------------------- |
| PULL_ONLY |0 |Pull data from the peer end to the local end only.| | PULL_ONLY |0 |Pull data from the peer end to the local end only.|
| PUSH_ONLY |1 |Push data from the local end to the peer end only.| | PUSH_ONLY |1 |Push data from the local end to the peer end only.|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册