未验证 提交 6b51c76f 编写于 作者: O openharmony_ci 提交者: Gitee

!16182 [翻译完成】#I6MRCK (15950+15865+15812+15692+15641+15638)

Merge pull request !16182 from Annie_wang/PR15905
...@@ -104,6 +104,11 @@ Creates an **X509Cert** instance. This API uses an asynchronous callback to retu ...@@ -104,6 +104,11 @@ Creates an **X509Cert** instance. This API uses an asynchronous callback to retu
| inStream | [EncodingBlob](#encodingblob) | Yes | X.509 certificate serialization data. | | inStream | [EncodingBlob](#encodingblob) | Yes | X.509 certificate serialization data. |
| callback | AsyncCallback\<X509Cert> | Yes | Callback invoked to return the result. **X509Cert** instance created.| | callback | AsyncCallback\<X509Cert> | Yes | Callback invoked to return the result. **X509Cert** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
...@@ -146,6 +151,12 @@ Creates an **X509Cert** instance. This API uses a promise to return the result. ...@@ -146,6 +151,12 @@ Creates an **X509Cert** instance. This API uses a promise to return the result.
| ------- | ---------------- | | ------- | ---------------- |
| Promise\<X509Cert> | **X509Cert** instance created.| | Promise\<X509Cert> | **X509Cert** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
```js ```js
...@@ -184,6 +195,11 @@ Verifies the certificate signature. This API uses an asynchronous callback to re ...@@ -184,6 +195,11 @@ Verifies the certificate signature. This API uses an asynchronous callback to re
| key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | | key | cryptoFramework.PubKey | Yes | Public key used for signature verification. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.|
**Error codes**
| ID| Error Message |
| -------- | ------------------ |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -235,6 +251,12 @@ Verifies the certificate signature. This API uses a promise to return the result ...@@ -235,6 +251,12 @@ Verifies the certificate signature. This API uses a promise to return the result
| -------------- | ----------- | | -------------- | ----------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | ------------------ |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -275,6 +297,13 @@ Obtains the serialized X.509 certificate data. This API uses an asynchronous cal ...@@ -275,6 +297,13 @@ Obtains the serialized X.509 certificate data. This API uses an asynchronous cal
| -------- | --------------------------------------------- | ---- | -------------------------------- | | -------- | --------------------------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized X.509 certificate data obtained.| | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized X.509 certificate data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
...@@ -318,6 +347,14 @@ Obtains the serialized X.509 certificate data. This API uses a promise to return ...@@ -318,6 +347,14 @@ Obtains the serialized X.509 certificate data. This API uses a promise to return
| --------------------------------------- | ---------------------- | | --------------------------------------- | ---------------------- |
| Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized X.509 certificate data obtained.| | Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized X.509 certificate data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -356,6 +393,13 @@ Obtains the public key of this X.509 certificate. This API uses an asynchronous ...@@ -356,6 +393,13 @@ Obtains the public key of this X.509 certificate. This API uses an asynchronous
| ------ | ---------------- | | ------ | ---------------- |
| cryptoFramework.PubKey | Public key of the X509 certificate obtained. This object is used only for **verify()** of **X509Cert**.| | cryptoFramework.PubKey | Public key of the X509 certificate obtained. This object is used only for **verify()** of **X509Cert**.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -398,6 +442,15 @@ Checks the validity period of this X.509 certificate. This API uses an asynchron ...@@ -398,6 +442,15 @@ Checks the validity period of this X.509 certificate. This API uses an asynchron
| -------- | -------------- | ---- | ---------- | | -------- | -------------- | ---- | ---------- |
| date | string | Yes | Date in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The date must end with **Z**, which indicates the UTC.| | date | string | Yes | Date in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The date must end with **Z**, which indicates the UTC.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error.|
| 19030003 | The certificate has not taken effect. |
| 19030004 | The certificate has expired.|
**Example** **Example**
```js ```js
...@@ -513,6 +566,14 @@ Obtains the X.509 certificate issuer. ...@@ -513,6 +566,14 @@ Obtains the X.509 certificate issuer.
| --------------------- | ---------------------- | | --------------------- | ---------------------- |
| [DataBlob](#datablob) | X.509 certificate issuer obtained.| | [DataBlob](#datablob) | X.509 certificate issuer obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -549,6 +610,14 @@ Obtains the subject of this X.509 certificate. ...@@ -549,6 +610,14 @@ Obtains the subject of this X.509 certificate.
| --------------------- | -------------------- | | --------------------- | -------------------- |
| [DataBlob](#datablob) | Subject name obtained.| | [DataBlob](#datablob) | Subject name obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -585,6 +654,14 @@ Obtains the start time of this X.509 certificate. ...@@ -585,6 +654,14 @@ Obtains the start time of this X.509 certificate.
| ------ | ------------------------------------------------------------ | | ------ | ------------------------------------------------------------ |
| string | Start time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.| | string | Start time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -621,6 +698,14 @@ Obtains the expiration time of this X.509 certificate. ...@@ -621,6 +698,14 @@ Obtains the expiration time of this X.509 certificate.
| ------ | ------------------------------------------------------------ | | ------ | ------------------------------------------------------------ |
| string | Expiration time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.| | string | Expiration time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -657,6 +742,14 @@ Obtains the signature data of this X.509 certificate. ...@@ -657,6 +742,14 @@ Obtains the signature data of this X.509 certificate.
| --------------------- | -------------------- | | --------------------- | -------------------- |
| [DataBlob](#datablob) | Signature data obtained.| | [DataBlob](#datablob) | Signature data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -693,6 +786,14 @@ Obtains the signing algorithm of this X.509 certificate. ...@@ -693,6 +786,14 @@ Obtains the signing algorithm of this X.509 certificate.
| ------ | ------------------------ | | ------ | ------------------------ |
| string | X.509 certificate signing algorithm obtained.| | string | X.509 certificate signing algorithm obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -729,6 +830,14 @@ Obtains the object identifier (OID) of the X.509 certificate signing algorithm. ...@@ -729,6 +830,14 @@ Obtains the object identifier (OID) of the X.509 certificate signing algorithm.
| ------ | --------------------------------- | | ------ | --------------------------------- |
| string | OID obtained.| | string | OID obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -765,6 +874,14 @@ Obtains the signing algorithm parameters of this X.509 certificate. ...@@ -765,6 +874,14 @@ Obtains the signing algorithm parameters of this X.509 certificate.
| --------------------- | ------------------------ | | --------------------- | ------------------------ |
| [DataBlob](#datablob) | X.509 certificate signing algorithm parameters obtained.| | [DataBlob](#datablob) | X.509 certificate signing algorithm parameters obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -801,6 +918,13 @@ Obtains the key usage of this X.509 certificate. ...@@ -801,6 +918,13 @@ Obtains the key usage of this X.509 certificate.
| --------------------- | -------------------- | | --------------------- | -------------------- |
| [DataBlob](#datablob) | Key usage of the X.509 certificate obtained.| | [DataBlob](#datablob) | Key usage of the X.509 certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -837,6 +961,14 @@ Obtains the usage of the extended key of this X.509 certificate. ...@@ -837,6 +961,14 @@ Obtains the usage of the extended key of this X.509 certificate.
| ----------------------- | ------------------------ | | ----------------------- | ------------------------ |
| [DataArray](#dataarray) | Usage of the extended key obtained.| | [DataArray](#dataarray) | Usage of the extended key obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -909,6 +1041,14 @@ Obtains the Subject Alternative Names (SANs) of this X.509 certificate. ...@@ -909,6 +1041,14 @@ Obtains the Subject Alternative Names (SANs) of this X.509 certificate.
| ----------------------- | ------------------------ | | ----------------------- | ------------------------ |
| [DataArray](#dataarray) | SANs obtained.| | [DataArray](#dataarray) | SANs obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -945,6 +1085,14 @@ Obtains the Issuer Alternative Names (IANs) of this X.509 certificate. ...@@ -945,6 +1085,14 @@ Obtains the Issuer Alternative Names (IANs) of this X.509 certificate.
| ----------------------- | -------------------------- | | ----------------------- | -------------------------- |
| [DataArray](#dataarray) | IANs obtained.| | [DataArray](#dataarray) | IANs obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error.|
**Example** **Example**
```js ```js
...@@ -982,6 +1130,11 @@ Creates an **X509Crl** instance. This API uses an asynchronous callback to retur ...@@ -982,6 +1130,11 @@ Creates an **X509Crl** instance. This API uses an asynchronous callback to retur
| inStream | [EncodingBlob](#encodingblob) | Yes | Serialized certificate revocation list (CRL) data. | | inStream | [EncodingBlob](#encodingblob) | Yes | Serialized certificate revocation list (CRL) data. |
| callback | AsyncCallback\<X509Crl> | Yes | Callback invoked to return the result. Promise used to return the **X509Crl** instance created.| | callback | AsyncCallback\<X509Crl> | Yes | Callback invoked to return the result. Promise used to return the **X509Crl** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
...@@ -1024,6 +1177,12 @@ Creates an **X509Crl** instance. This API uses a promise to return the result. ...@@ -1024,6 +1177,12 @@ Creates an **X509Crl** instance. This API uses a promise to return the result.
| ----------------- | -------------------- | | ----------------- | -------------------- |
| Promise\<X509Crl> | Promise used to return the **X509Crl** instance created.| | Promise\<X509Crl> | Promise used to return the **X509Crl** instance created.|
**Error codes**
| ID| Error Message |
| -------- | ------------- |
| 19020001 | Memory error. |
**Example** **Example**
```js ```js
...@@ -1145,6 +1304,13 @@ Obtains the serialized X.509 CRL data. This API uses an asynchronous callback to ...@@ -1145,6 +1304,13 @@ Obtains the serialized X.509 CRL data. This API uses an asynchronous callback to
| -------- | ---------------------------- | ---- | ------------------------------------------ | | -------- | ---------------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback\<EncodingBlob> | Yes | Callback invoked to return the serialized X.509 CRL data obtained.| | callback | AsyncCallback\<EncodingBlob> | Yes | Callback invoked to return the serialized X.509 CRL data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -1188,6 +1354,14 @@ Obtains the serialized X.509 CRL data. This API uses a promise to return the res ...@@ -1188,6 +1354,14 @@ Obtains the serialized X.509 CRL data. This API uses a promise to return the res
| ---------------------- | -------------------------------- | | ---------------------- | -------------------------------- |
| Promise\<EncodingBlob> | Promise used to return the serialized X.509 CRL data obtained.| | Promise\<EncodingBlob> | Promise used to return the serialized X.509 CRL data obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1227,6 +1401,11 @@ Verifies the signature of the X.509 CRL. This API uses an asynchronous callback ...@@ -1227,6 +1401,11 @@ Verifies the signature of the X.509 CRL. This API uses an asynchronous callback
| key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | | key | cryptoFramework.PubKey | Yes | Public key used for signature verification. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -1279,6 +1458,12 @@ Verifies the signature of the X.509 CRL. This API uses a promise to return the r ...@@ -1279,6 +1458,12 @@ Verifies the signature of the X.509 CRL. This API uses a promise to return the r
| ---- | ------------------------------------------------------------ | | ---- | ------------------------------------------------------------ |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1356,6 +1541,14 @@ Obtains the issuer of the X.509 CRL. ...@@ -1356,6 +1541,14 @@ Obtains the issuer of the X.509 CRL.
| --------------------- | ------------------------------ | | --------------------- | ------------------------------ |
| [DataBlob](#datablob) | Issuer of the X.509 CRL obtained.| | [DataBlob](#datablob) | Issuer of the X.509 CRL obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1392,6 +1585,14 @@ Obtains the date when the X.509 CRL was last updated. ...@@ -1392,6 +1585,14 @@ Obtains the date when the X.509 CRL was last updated.
| ------ | ------------------------------------ | | ------ | ------------------------------------ |
| string | Last update date of the X.509 CRL.| | string | Last update date of the X.509 CRL.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1428,6 +1629,14 @@ Obtains the date when the CRL will be updated the next time. ...@@ -1428,6 +1629,14 @@ Obtains the date when the CRL will be updated the next time.
| ------ | ------------------------------------ | | ------ | ------------------------------------ |
| string | Next update date obtained.| | string | Next update date obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1470,6 +1679,13 @@ Obtains the revoked X.509 certificate based on the specified serial number of th ...@@ -1470,6 +1679,13 @@ Obtains the revoked X.509 certificate based on the specified serial number of th
| ---------------------- | --------------------- | | ---------------------- | --------------------- |
| X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.| | X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1518,6 +1734,13 @@ Obtains the revoked X.509 certificate based on the specified certificate. This A ...@@ -1518,6 +1734,13 @@ Obtains the revoked X.509 certificate based on the specified certificate. This A
| ------------ | -------------------- | | ------------ | -------------------- |
| X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.| | X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1560,6 +1783,12 @@ Obtains all the revoked X.509 certificates. This API uses an asynchronous callba ...@@ -1560,6 +1783,12 @@ Obtains all the revoked X.509 certificates. This API uses an asynchronous callba
| -------- | ----------------------------------- | ---- | -------------------------------- | | -------- | ----------------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback<Array\<X509CrlEntry>> | Yes | Callback invoked to return the result. Promise used to return a list of revoked X.509 certificates.| | callback | AsyncCallback<Array\<X509CrlEntry>> | Yes | Callback invoked to return the result. Promise used to return a list of revoked X.509 certificates.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -1603,6 +1832,13 @@ Obtains all the revoked X.509 certificates. This API uses a promise to return th ...@@ -1603,6 +1832,13 @@ Obtains all the revoked X.509 certificates. This API uses a promise to return th
| ----------------------------- | ---------------------- | | ----------------------------- | ---------------------- |
| Promise<Array\<X509CrlEntry>> | Promise used to return a list of revoked X.509 certificates.| | Promise<Array\<X509CrlEntry>> | Promise used to return a list of revoked X.509 certificates.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1641,6 +1877,14 @@ Obtains the DER-encoded CRL information, the **tbsCertList** from this CRL. This ...@@ -1641,6 +1877,14 @@ Obtains the DER-encoded CRL information, the **tbsCertList** from this CRL. This
| --------------------- | ------------------------------- | | --------------------- | ------------------------------- |
| [DataBlob](#datablob) | Promise used to return the **tbsCertList** information obtained.| | [DataBlob](#datablob) | Promise used to return the **tbsCertList** information obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1681,6 +1925,14 @@ Obtains the signature data of the X.509 CRL. ...@@ -1681,6 +1925,14 @@ Obtains the signature data of the X.509 CRL.
| --------------------- | ------------------------------ | | --------------------- | ------------------------------ |
| [DataBlob](#datablob) | Signature data of the X.509 CRL obtained.| | [DataBlob](#datablob) | Signature data of the X.509 CRL obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1717,6 +1969,14 @@ Obtains the signing algorithm of the X.509 CRL. ...@@ -1717,6 +1969,14 @@ Obtains the signing algorithm of the X.509 CRL.
| ------ | -------------------------------- | | ------ | -------------------------------- |
| string | Signing algorithm obtained.| | string | Signing algorithm obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1753,6 +2013,14 @@ Obtains the OID of the X.509 CRL signing algorithm. OIDs are allocated by the In ...@@ -1753,6 +2013,14 @@ Obtains the OID of the X.509 CRL signing algorithm. OIDs are allocated by the In
| ------ | --------------------------------------------- | | ------ | --------------------------------------------- |
| string | OID of the X.509 CRL signing algorithm obtained.| | string | OID of the X.509 CRL signing algorithm obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1789,6 +2057,14 @@ Obtains the parameters of the X.509 CRL signing algorithm. ...@@ -1789,6 +2057,14 @@ Obtains the parameters of the X.509 CRL signing algorithm.
| --------------------- | ---------------------------------- | | --------------------- | ---------------------------------- |
| [DataBlob](#datablob) | Algorithm parameters obtained.| | [DataBlob](#datablob) | Algorithm parameters obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1831,6 +2107,14 @@ Creates a **CertChainValidator** object. ...@@ -1831,6 +2107,14 @@ Creates a **CertChainValidator** object.
| ------------------ | -------------------- | | ------------------ | -------------------- |
| CertChainValidator | **CertChainValidator** object created.| | CertChainValidator | **CertChainValidator** object created.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -1846,7 +2130,7 @@ Provides APIs for certificate chain validator operations. ...@@ -1846,7 +2130,7 @@ Provides APIs for certificate chain validator operations.
### Attributes ### Attributes
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.Cert
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------- | ------ | ---- | ---- | -------------------------- | | ------- | ------ | ---- | ---- | -------------------------- |
...@@ -1869,6 +2153,19 @@ The certificate chain validator does not verify the certificate validity period ...@@ -1869,6 +2153,19 @@ The certificate chain validator does not verify the certificate validity period
| certChain | [CertChainData](#certchaindata) | Yes | Serialized X.509 certificate chain data. | | certChain | [CertChainData](#certchaindata) | Yes | Serialized X.509 certificate chain data. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the X.509 certificate chain is valid. If **error** is not **null**, the X.509 certificate chain is not valid.| | callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If **error** is **null**, the X.509 certificate chain is valid. If **error** is not **null**, the X.509 certificate chain is not valid.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
| 19030002 | The certificate signature verification failed. |
| 19030003 | The certificate has not taken effect. |
| 19030004 | The certificate has expired. |
| 19030005 | Failed to obtain the certificate issuer. |
| 19030006 | The key cannot be used for signing a certificate. |
| 19030007 | The key cannot be used for digital signature. |
**Example** **Example**
...@@ -1916,6 +2213,20 @@ The certificate chain validator does not verify the certificate validity period ...@@ -1916,6 +2213,20 @@ The certificate chain validator does not verify the certificate validity period
| -------------- | ----------- | | -------------- | ----------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
| 19030002 | The certificate signature verification failed. |
| 19030003 | The certificate has not taken effect. |
| 19030004 | The certificate has expired. |
| 19030005 | Failed to obtain the certificate issuer. |
| 19030006 | The key cannot be used for signing a certificate. |
| 19030007 | The key cannot be used for digital signature. |
**Example** **Example**
```js ```js
...@@ -1980,6 +2291,13 @@ Obtains the serialized data of this revoked certificate. This API uses an asynch ...@@ -1980,6 +2291,13 @@ Obtains the serialized data of this revoked certificate. This API uses an asynch
| -------- | --------------------------------------------- | ---- | ------------------------------------ | | -------- | --------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized data of the revoked certificate obtained.| | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized data of the revoked certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
...@@ -2011,6 +2329,14 @@ Obtains the serialized data of this revoked certificate. This API uses a promise ...@@ -2011,6 +2329,14 @@ Obtains the serialized data of this revoked certificate. This API uses a promise
| --------------------------------------- | -------------------------- | | --------------------------------------- | -------------------------- |
| Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized data of the revoked certificate obtained.| | Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized data of the revoked certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
...@@ -2063,6 +2389,13 @@ Obtains the issuer of this revoked certificate. This API uses an asynchronous ca ...@@ -2063,6 +2389,13 @@ Obtains the issuer of this revoked certificate. This API uses an asynchronous ca
| --------------------- | ----------------------- | | --------------------- | ----------------------- |
| [DataBlob](#datablob) | Promise used to return the issuer of the revoked certificate obtained.| | [DataBlob](#datablob) | Promise used to return the issuer of the revoked certificate obtained.|
**Error codes**
| ID| Error Message |
| -------- | -------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
**Example** **Example**
```js ```js
...@@ -2091,6 +2424,14 @@ Obtains the date when the certificate was revoked. This API uses an asynchronous ...@@ -2091,6 +2424,14 @@ Obtains the date when the certificate was revoked. This API uses an asynchronous
| ------ | ------------------ | | ------ | ------------------ |
| string | Promise used to return the certificate revocation date obtained.| | string | Promise used to return the certificate revocation date obtained.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------- |
| 19020001 | Memory error. |
| 19020002 | Runtime error. |
| 19030001 | Crypto operation error. |
**Example** **Example**
```js ```js
......
...@@ -51,7 +51,7 @@ For details about the supported specifications, see [HMAC Algorithm Specificatio ...@@ -51,7 +51,7 @@ For details about the supported specifications, see [HMAC Algorithm Specificatio
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ | | ------- | ------ | ---- | ------------------------------------------------------------ |
| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [HMAC Algorithm Specifications](../../security/cryptoFramework-overview.md#hmac-algorithm-specifications). | | algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [HMAC Algorithm Specifications](../../security/cryptoFramework-overview.md#hmac-algorithm-specifications).|
**Return value** **Return value**
...@@ -483,7 +483,7 @@ For details about the supported specifications, see [MD Algorithm Specifications ...@@ -483,7 +483,7 @@ For details about the supported specifications, see [MD Algorithm Specifications
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------ | ---- | ------------------------------------------------------------ | | ------- | ------ | ---- | ------------------------------------------------------------ |
| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [MD Algorithm Specifications](../../security/cryptoFramework-overview.md#md-algorithm-specifications). | | algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [MD Algorithm Specifications](../../security/cryptoFramework-overview.md#md-algorithm-specifications).|
**Return value** **Return value**
...@@ -1852,7 +1852,7 @@ Updates the data to encrypt or decrypt by segment. This API uses a promise to re ...@@ -1852,7 +1852,7 @@ Updates the data to encrypt or decrypt by segment. This API uses a promise to re
| Type | Description | | Type | Description |
| ------------------------------- | ------------------------------------------------ | | ------------------------------- | ------------------------------------------------ |
| Promise\<[DataBlob](#datablob)> | Promise used to return the **DataBlob** (containing the encrypted or decrypted data). | | Promise\<[DataBlob](#datablob)> | Promise used to return the **DataBlob** (containing the encrypted or decrypted data).|
**Error codes** **Error codes**
...@@ -2174,7 +2174,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void ...@@ -2174,7 +2174,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void
Updates the data to be signed. This API uses an asynchronous callback to return the result. Updates the data to be signed. This API uses an asynchronous callback to return the result.
> **NOTE**<br> > **NOTE**<br>
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
...@@ -2200,7 +2200,7 @@ update(data : DataBlob) : Promise\<void>; ...@@ -2200,7 +2200,7 @@ update(data : DataBlob) : Promise\<void>;
Updates the data to be signed. This API uses a promise to return the result. Updates the data to be signed. This API uses a promise to return the result.
> **NOTE**<br> > **NOTE**<br>
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
...@@ -2267,6 +2267,8 @@ Signs the data. This API uses a promise to return the result. ...@@ -2267,6 +2267,8 @@ Signs the data. This API uses a promise to return the result.
| -------------- | ----------- | | -------------- | ----------- |
| Promise\<void> | Promise used to return the result.| | Promise\<void> | Promise used to return the result.|
**Error codes**
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------- | | -------- | ---------------------- |
| 17620001 | memory error. | | 17620001 | memory error. |
...@@ -2465,7 +2467,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void ...@@ -2465,7 +2467,7 @@ update(data : DataBlob, callback : AsyncCallback\<void>) : void
Updates the data for signature verification. This API uses an asynchronous callback to return the result. Updates the data for signature verification. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
...@@ -2491,7 +2493,7 @@ update(data : DataBlob) : Promise\<void>; ...@@ -2491,7 +2493,7 @@ update(data : DataBlob) : Promise\<void>;
Updates the data for signature verification. This API uses a promise to return the result. Updates the data for signature verification. This API uses a promise to return the result.
> **NOTE** > **NOTE**
> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). > For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature).
**System capability**: SystemCapability.Security.CryptoFramework **System capability**: SystemCapability.Security.CryptoFramework
......
...@@ -28,7 +28,7 @@ Provides the **KVManager** instance configuration, including the bundle name of ...@@ -28,7 +28,7 @@ Provides the **KVManager** instance configuration, including the bundle name of
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------- | --------------------- | ---- | ------------------------------------------------------------ | | ---------- | --------------------- | ---- | ------------------------------------------------------------ |
| context | Context | Yes |Application context.<br>For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).<br>For the application context of the stage model, see [Context](js-apis-ability-context.md).| | context | Context | Yes |Application context.<br>For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).|
| bundleName | string | Yes | Bundle name. | | bundleName | string | Yes | Bundle name. |
## Constants ## Constants
...@@ -258,7 +258,7 @@ Creates a **KVManager** instance to manage KV stores. ...@@ -258,7 +258,7 @@ Creates a **KVManager** instance to manage KV stores.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ----------------------------- | ---- | --------------------------------------------------------- | | ------ | ----------------------------- | ---- | --------------------------------------------------------- |
| config | [KVManagerConfig](#kvmanagerconfig) | Yes | **KVManager** instance configuration, including the bundle name and user information of the caller.| | config | [KVManagerConfig](#kvmanagerconfig) | Yes | **KVManager** instance configuration, including the bundle name of the caller and user information.|
**Return value** **Return value**
...@@ -271,8 +271,7 @@ Creates a **KVManager** instance to manage KV stores. ...@@ -271,8 +271,7 @@ Creates a **KVManager** instance to manage KV stores.
Stage model: Stage model:
```js ```js
import UIAbility from '@ohos.app.ability.UIAbility'; import UIAbility from '@ohos.app.ability.UIAbility'
let kvManager; let kvManager;
export default class EntryAbility extends UIAbility { export default class EntryAbility extends UIAbility {
onCreate() { onCreate() {
...@@ -295,7 +294,7 @@ export default class EntryAbility extends UIAbility { ...@@ -295,7 +294,7 @@ export default class EntryAbility extends UIAbility {
FA model: FA model:
```js ```js
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility'
let kvManager; let kvManager;
let context = featureAbility.getContext() let context = featureAbility.getContext()
const kvManagerConfig = { const kvManagerConfig = {
...@@ -358,7 +357,7 @@ try { ...@@ -358,7 +357,7 @@ try {
console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Obtained the KVStore successfully."); console.log("Succeeded in getting KVStore");
kvStore = store; kvStore = store;
}); });
} catch (e) { } catch (e) {
...@@ -411,7 +410,7 @@ try { ...@@ -411,7 +410,7 @@ try {
securityLevel: distributedKVStore.SecurityLevel.S2, securityLevel: distributedKVStore.SecurityLevel.S2,
}; };
kvManager.getKVStore('storeId', options).then((store) => { kvManager.getKVStore('storeId', options).then((store) => {
console.log("Obtained the KVStore successfully."); console.log("Succeeded in getting KVStore");
kvStore = store; kvStore = store;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`);
...@@ -453,14 +452,14 @@ const options = { ...@@ -453,14 +452,14 @@ const options = {
} }
try { try {
kvManager.getKVStore('storeId', options, async function (err, store) { kvManager.getKVStore('storeId', options, async function (err, store) {
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.closeKVStore('appId', 'storeId', function (err, data) { kvManager.closeKVStore('appId', 'storeId', function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the KVStore successfully.'); console.log('Succeeded in closing KVStore');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -505,10 +504,10 @@ const options = { ...@@ -505,10 +504,10 @@ const options = {
} }
try { try {
kvManager.getKVStore('storeId', options).then(async (store) => { kvManager.getKVStore('storeId', options).then(async (store) => {
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.closeKVStore('appId', 'storeId').then(() => { kvManager.closeKVStore('appId', 'storeId').then(() => {
console.log('Closed the KVStore successfully.'); console.log('Succeeded in closing KVStore');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`);
}); });
...@@ -564,14 +563,14 @@ try { ...@@ -564,14 +563,14 @@ try {
console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.deleteKVStore('appId', 'storeId', function (err, data) { kvManager.deleteKVStore('appId', 'storeId', function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log(`Deleted the KVStore successfully.`); console.log(`Succeeded in deleting KVStore`);
}); });
}); });
} catch (e) { } catch (e) {
...@@ -624,10 +623,10 @@ const options = { ...@@ -624,10 +623,10 @@ const options = {
} }
try { try {
kvManager.getKVStore('storeId', options).then(async (store) => { kvManager.getKVStore('storeId', options).then(async (store) => {
console.log('Obtained the KVStore successfully.'); console.log('Succeeded in getting KVStore');
kvStore = store; kvStore = store;
kvManager.deleteKVStore('appId', 'storeId').then(() => { kvManager.deleteKVStore('appId', 'storeId').then(() => {
console.log('Deleted the KVStore successfully.'); console.log('Succeeded in deleting KVStore');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`);
}); });
...@@ -664,7 +663,7 @@ try { ...@@ -664,7 +663,7 @@ try {
console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained all KV store IDs successfully.'); console.log('Succeeded in getting AllKVStoreId');
console.log(`GetAllKVStoreId size = ${data.length}`); console.log(`GetAllKVStoreId size = ${data.length}`);
}); });
} catch (e) { } catch (e) {
...@@ -699,7 +698,7 @@ let kvManager; ...@@ -699,7 +698,7 @@ let kvManager;
try { try {
console.log('GetAllKVStoreId'); console.log('GetAllKVStoreId');
kvManager.getAllKVStoreId('appId').then((data) => { kvManager.getAllKVStoreId('appId').then((data) => {
console.log('Obtained all KV store IDs successfully.'); console.log('Succeeded in getting AllKVStoreId');
console.log(`GetAllKVStoreId size = ${data.length}`); console.log(`GetAllKVStoreId size = ${data.length}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`);
...@@ -829,7 +828,7 @@ let kvStore; ...@@ -829,7 +828,7 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('getResultSet succeeded.');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.log('getResultSet failed: ' + err); console.log('getResultSet failed: ' + err);
...@@ -1000,7 +999,7 @@ let kvStore; ...@@ -1000,7 +999,7 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -1039,7 +1038,7 @@ let kvStore; ...@@ -1039,7 +1038,7 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -1242,7 +1241,7 @@ Resets the **Query** object. ...@@ -1242,7 +1241,7 @@ Resets the **Query** object.
| Type | Description | | Type | Description |
| -------------- | --------------------- | | -------------- | --------------------- |
| [Query](query) | **Query** object reset.| | [Query](#query) | **Query** object reset.|
**Example** **Example**
...@@ -1278,7 +1277,7 @@ Creates a **Query** object to match the specified field whose value is equal to ...@@ -1278,7 +1277,7 @@ Creates a **Query** object to match the specified field whose value is equal to
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1312,7 +1311,7 @@ Creates a **Query** object to match the specified field whose value is not equal ...@@ -1312,7 +1311,7 @@ Creates a **Query** object to match the specified field whose value is not equal
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1345,7 +1344,7 @@ Creates a **Query** object to match the specified field whose value is greater t ...@@ -1345,7 +1344,7 @@ Creates a **Query** object to match the specified field whose value is greater t
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1380,7 +1379,7 @@ Creates a **Query** object to match the specified field whose value is less than ...@@ -1380,7 +1379,7 @@ Creates a **Query** object to match the specified field whose value is less than
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1415,7 +1414,7 @@ Creates a **Query** object to match the specified field whose value is greater t ...@@ -1415,7 +1414,7 @@ Creates a **Query** object to match the specified field whose value is greater t
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1450,7 +1449,7 @@ Creates a **Query** object to match the specified field whose value is less than ...@@ -1450,7 +1449,7 @@ Creates a **Query** object to match the specified field whose value is less than
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1483,7 +1482,7 @@ Creates a **Query** object to match the specified field whose value is **null**. ...@@ -1483,7 +1482,7 @@ Creates a **Query** object to match the specified field whose value is **null**.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1517,7 +1516,7 @@ Creates a **Query** object to match the specified field whose value is within th ...@@ -1517,7 +1516,7 @@ Creates a **Query** object to match the specified field whose value is within th
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1551,7 +1550,7 @@ Creates a **Query** object to match the specified field whose value is within th ...@@ -1551,7 +1550,7 @@ Creates a **Query** object to match the specified field whose value is within th
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1585,7 +1584,7 @@ Creates a **Query** object to match the specified field whose value is not withi ...@@ -1585,7 +1584,7 @@ Creates a **Query** object to match the specified field whose value is not withi
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1619,7 +1618,7 @@ Creates a **Query** object to match the specified field whose value is not withi ...@@ -1619,7 +1618,7 @@ Creates a **Query** object to match the specified field whose value is not withi
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1653,7 +1652,7 @@ Creates a **Query** object to match the specified field whose value is similar t ...@@ -1653,7 +1652,7 @@ Creates a **Query** object to match the specified field whose value is similar t
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1687,7 +1686,7 @@ Creates a **Query** object to match the specified field whose value is not simil ...@@ -1687,7 +1686,7 @@ Creates a **Query** object to match the specified field whose value is not simil
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1714,7 +1713,7 @@ Creates a **Query** object with the AND condition. ...@@ -1714,7 +1713,7 @@ Creates a **Query** object with the AND condition.
| Type | Description | | Type | Description |
| -------------- | -------------- | | -------------- | -------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1743,7 +1742,7 @@ Creates a **Query** object with the OR condition. ...@@ -1743,7 +1742,7 @@ Creates a **Query** object with the OR condition.
| Type | Description | | Type | Description |
| -------------- | -------------- | | -------------- | -------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1778,7 +1777,7 @@ Creates a **Query** object to sort the query results in ascending order. ...@@ -1778,7 +1777,7 @@ Creates a **Query** object to sort the query results in ascending order.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1812,7 +1811,7 @@ Creates a **Query** object to sort the query results in descending order. ...@@ -1812,7 +1811,7 @@ Creates a **Query** object to sort the query results in descending order.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1847,7 +1846,7 @@ Creates a **Query** object to specify the number of results and where to start. ...@@ -1847,7 +1846,7 @@ Creates a **Query** object to specify the number of results and where to start.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1883,7 +1882,7 @@ Creates a **Query** object to match the specified field whose value is not **nul ...@@ -1883,7 +1882,7 @@ Creates a **Query** object to match the specified field whose value is not **nul
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1910,7 +1909,7 @@ Creates a **Query** object for a query condition group with a left parenthesis. ...@@ -1910,7 +1909,7 @@ Creates a **Query** object for a query condition group with a left parenthesis.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1939,7 +1938,7 @@ Creates a **Query** object for a query condition group with a right parenthesis. ...@@ -1939,7 +1938,7 @@ Creates a **Query** object for a query condition group with a right parenthesis.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -1974,7 +1973,7 @@ Creates a **Query** object with a specified key prefix. ...@@ -1974,7 +1973,7 @@ Creates a **Query** object with a specified key prefix.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -2008,7 +2007,7 @@ Creates a **Query** object with an index preferentially used for query. ...@@ -2008,7 +2007,7 @@ Creates a **Query** object with an index preferentially used for query.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -2042,7 +2041,7 @@ Creates a **Query** object with the device ID as the key prefix. ...@@ -2042,7 +2041,7 @@ Creates a **Query** object with the device ID as the key prefix.
| Type | Description | | Type | Description |
| -------------- | --------------- | | -------------- | --------------- |
| [Query](query) | **Query** object created.| | [Query](#query) | **Query** object created.|
**Example** **Example**
...@@ -2125,7 +2124,7 @@ try { ...@@ -2125,7 +2124,7 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Put data successfully."); console.log("Succeeded in putting");
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`);
...@@ -2170,7 +2169,7 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -2170,7 +2169,7 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully. data=${data}`); console.log(`Succeeded in putting.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2226,12 +2225,12 @@ try { ...@@ -2226,12 +2225,12 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key', function (err, entries) { kvStore.getEntries('batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -2289,9 +2288,9 @@ try { ...@@ -2289,9 +2288,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (entries) => { kvStore.putBatch(entries).then(async (entries) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key').then((entries) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`PutBatch ${entries}`); console.log(`PutBatch ${entries}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
...@@ -2349,7 +2348,7 @@ try { ...@@ -2349,7 +2348,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}) })
} catch (e) { } catch (e) {
console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`); console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`);
...@@ -2402,7 +2401,7 @@ try { ...@@ -2402,7 +2401,7 @@ try {
v8Arr.push(vb2); v8Arr.push(vb2);
v8Arr.push(vb3); v8Arr.push(vb3);
kvStore.putBatch(v8Arr).then(async (data) => { kvStore.putBatch(v8Arr).then(async (data) => {
console.log(`Batch put data successfully.`); console.log(`Succeeded in putting patch`);
}).catch((err) => { }).catch((err) => {
console.error(`putBatch fail.code is ${err.code},message is ${err.message}`); console.error(`putBatch fail.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2447,13 +2446,13 @@ try { ...@@ -2447,13 +2446,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting');
kvStore.delete(KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.delete(KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -2498,9 +2497,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -2498,9 +2497,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully: ${data}`); console.log(`Succeeded in putting: ${data}`);
kvStore.delete(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.delete(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2547,7 +2546,7 @@ try { ...@@ -2547,7 +2546,7 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
kvStore.delete(predicates, function (err, data) { kvStore.delete(predicates, function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
} else { } else {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
} }
...@@ -2599,9 +2598,9 @@ try { ...@@ -2599,9 +2598,9 @@ try {
let arr = ["name"]; let arr = ["name"];
predicates.inKeys(arr); predicates.inKeys(arr);
kvStore.put("name", "bob").then((data) => { kvStore.put("name", "bob").then((data) => {
console.log(`Put data successfully: ${data}`); console.log(`Succeeded in putting: ${data}`);
kvStore.delete(predicates).then((data) => { kvStore.delete(predicates).then((data) => {
console.log('Deleted data successfully.'); console.log('Succeeded in deleting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2662,13 +2661,13 @@ try { ...@@ -2662,13 +2661,13 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.deleteBatch(keys, async function (err, data) { kvStore.deleteBatch(keys, async function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch deleted data successfully.'); console.log('Succeeded in deleting Batch');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -2726,9 +2725,9 @@ try { ...@@ -2726,9 +2725,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (data) => { kvStore.putBatch(entries).then(async (data) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.deleteBatch(keys).then((err) => { kvStore.deleteBatch(keys).then((err) => {
console.log('Batch deleted data successfully.'); console.log('Succeeded in deleting Batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2771,15 +2770,15 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; ...@@ -2771,15 +2770,15 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2';
const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, async function (err, data) { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, async function (err, data) {
console.log('Put data successfully.'); console.log('Succeeded in putting data');
const deviceid = 'no_exist_device_id'; const deviceid = 'no_exist_device_id';
kvStore.removeDeviceData(deviceid, async function (err, data) { kvStore.removeDeviceData(deviceid, async function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Removed device data successfully.'); console.log('succeeded in removing device data');
} else { } else {
console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `);
kvStore.get(KEY_TEST_STRING_ELEMENT, async function (err, data) { kvStore.get(KEY_TEST_STRING_ELEMENT, async function (err, data) {
console.log('Obtained data successfully.'); console.log('Succeeded in getting data');
}); });
} }
}); });
...@@ -2825,18 +2824,18 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; ...@@ -2825,18 +2824,18 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2';
const VALUE_TEST_STRING_ELEMENT = 'value-string-001'; const VALUE_TEST_STRING_ELEMENT = 'value-string-001';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((err) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((err) => {
console.log('Put data successfully.'); console.log('Succeeded in putting data');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put data.code is ${err.code},message is ${err.message} `); console.error(`Fail to put data.code is ${err.code},message is ${err.message} `);
}); });
const deviceid = 'no_exist_device_id'; const deviceid = 'no_exist_device_id';
kvStore.removeDeviceData(deviceid).then((err) => { kvStore.removeDeviceData(deviceid).then((err) => {
console.log('Removed device data successfully.'); console.log('succeeded in removing device data');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `);
}); });
kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log('Obtained data successfully.'); console.log('Succeeded in getting data');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get data.code is ${err.code},message is ${err.message} `); console.error(`Fail to get data.code is ${err.code},message is ${err.message} `);
}); });
...@@ -2882,13 +2881,13 @@ try { ...@@ -2882,13 +2881,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Put data successfully."); console.log("Succeeded in putting");
kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}); });
}); });
} catch (e) { } catch (e) {
...@@ -2934,9 +2933,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -2934,9 +2933,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully. data=${data}`); console.log(`Succeeded in putting data.data=${data}`);
kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
}); });
...@@ -2995,13 +2994,13 @@ try { ...@@ -2995,13 +2994,13 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key', function (err, entries) { kvStore.getEntries('batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -3059,9 +3058,9 @@ try { ...@@ -3059,9 +3058,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (entries) => { kvStore.putBatch(entries).then(async (entries) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key').then((entries) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`PutBatch ${entries}`); console.log(`PutBatch ${entries}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
...@@ -3086,7 +3085,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an ...@@ -3086,7 +3085,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ----------------------------------------------- | | -------- | -------------------------------------- | ---- | ----------------------------------------------- |
| query | [Query](query) | Yes | Key prefix to match. | | query | [Query](#query) | Yes | Key prefix to match. |
| callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.| | callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.|
**Error codes** **Error codes**
...@@ -3118,7 +3117,7 @@ try { ...@@ -3118,7 +3117,7 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query, function (err, entries) { kvStore.getEntries(query, function (err, entries) {
...@@ -3126,7 +3125,7 @@ try { ...@@ -3126,7 +3125,7 @@ try {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -3148,7 +3147,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a ...@@ -3148,7 +3147,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -3185,18 +3184,18 @@ try { ...@@ -3185,18 +3184,18 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query).then((entries) => { kvStore.getEntries(query).then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
}); });
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`)
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
} catch (e) { } catch (e) {
console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -3249,20 +3248,20 @@ try { ...@@ -3249,20 +3248,20 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getResultSet('batch_test_string_key', async function (err, result) { kvStore.getResultSet('batch_test_string_key', async function (err, result) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
}); });
...@@ -3319,18 +3318,18 @@ try { ...@@ -3319,18 +3318,18 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3386,7 +3385,7 @@ try { ...@@ -3386,7 +3385,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet(query, async function (err, result) { kvStore.getResultSet(query, async function (err, result) {
...@@ -3394,7 +3393,7 @@ try { ...@@ -3394,7 +3393,7 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -3414,7 +3413,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec ...@@ -3414,7 +3413,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -3450,14 +3449,14 @@ try { ...@@ -3450,14 +3449,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet(query).then((result) => { kvStore.getResultSet(query).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
...@@ -3508,14 +3507,14 @@ try { ...@@ -3508,14 +3507,14 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -3565,13 +3564,13 @@ try { ...@@ -3565,13 +3564,13 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.prefixKey("batch_test_string_key"); predicates.prefixKey("batch_test_string_key");
kvStore.getResultSet(predicates).then((result) => { kvStore.getResultSet(predicates).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3603,7 +3602,7 @@ try { ...@@ -3603,7 +3602,7 @@ try {
let resultSet = null; let resultSet = null;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
} else { } else {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
} }
...@@ -3640,7 +3639,7 @@ let kvStore; ...@@ -3640,7 +3639,7 @@ let kvStore;
try { try {
let resultSet = null; let resultSet = null;
kvStore.closeResultSet(resultSet).then(() => { kvStore.closeResultSet(resultSet).then(() => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3661,7 +3660,7 @@ Obtains the number of results that matches the specified **Query** object. This ...@@ -3661,7 +3660,7 @@ Obtains the number of results that matches the specified **Query** object. This
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------- | | -------- | --------------------------- | ---- | ------------------------------------------- |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.|
**Error codes** **Error codes**
...@@ -3691,7 +3690,7 @@ try { ...@@ -3691,7 +3690,7 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query, async function (err, resultSize) { kvStore.getResultSize(query, async function (err, resultSize) {
...@@ -3699,7 +3698,7 @@ try { ...@@ -3699,7 +3698,7 @@ try {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -3719,7 +3718,7 @@ Obtains the number of results that matches the specified **Query** object. This ...@@ -3719,7 +3718,7 @@ Obtains the number of results that matches the specified **Query** object. This
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -3754,14 +3753,14 @@ try { ...@@ -3754,14 +3753,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query).then((resultSize) => { kvStore.getResultSize(query).then((resultSize) => {
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3803,7 +3802,7 @@ try { ...@@ -3803,7 +3802,7 @@ try {
if (err) { if (err) {
console.error(`Fail to backup.code is ${err.code},message is ${err.message} `); console.error(`Fail to backup.code is ${err.code},message is ${err.message} `);
} else { } else {
console.info(`Backed up data successfully. data=${data}`); console.info(`Succeeded in backupping data.data=${data}`);
} }
}); });
} catch (e) { } catch (e) {
...@@ -3846,7 +3845,7 @@ let kvStore; ...@@ -3846,7 +3845,7 @@ let kvStore;
let file = "BK001"; let file = "BK001";
try { try {
kvStore.backup(file).then((data) => { kvStore.backup(file).then((data) => {
console.info(`Backed up data successfully. data=${data}`); console.info(`Succeeded in backupping data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to backup.code is ${err.code},message is ${err.message}`); console.error(`Fail to backup.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3888,7 +3887,7 @@ try { ...@@ -3888,7 +3887,7 @@ try {
if (err) { if (err) {
console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); console.error(`Fail to restore.code is ${err.code},message is ${err.message}`);
} else { } else {
console.info(`Restored data successfully. data=${data}`); console.info(`Succeeded in restoring data.data=${data}`);
} }
}); });
} catch (e) { } catch (e) {
...@@ -3931,7 +3930,7 @@ let kvStore; ...@@ -3931,7 +3930,7 @@ let kvStore;
let file = "BK001"; let file = "BK001";
try { try {
kvStore.restore(file).then((data) => { kvStore.restore(file).then((data) => {
console.info(`Restored data successfully. data=${data}`); console.info(`Succeeded in restoring data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); console.error(`Fail to restore.code is ${err.code},message is ${err.message}`);
}); });
...@@ -3965,7 +3964,7 @@ try { ...@@ -3965,7 +3964,7 @@ try {
if (err) { if (err) {
console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`);
} else { } else {
console.info(`Deleted the backup file successfully. data=${data}`); console.info(`Succeed in deleting Backup.data=${data}`);
} }
}); });
} catch (e) { } catch (e) {
...@@ -4000,7 +3999,7 @@ let kvStore; ...@@ -4000,7 +3999,7 @@ let kvStore;
let files = ["BK001", "BK002"]; let files = ["BK001", "BK002"];
try { try {
kvStore.deleteBackup(files).then((data) => { kvStore.deleteBackup(files).then((data) => {
console.info(`Deleted the backup file successfully. data=${data}`); console.info(`Succeed in deleting Backup.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`);
}) })
...@@ -4061,7 +4060,7 @@ try { ...@@ -4061,7 +4060,7 @@ try {
console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Started the transaction successfully.'); console.log('Succeeded in starting Transaction');
let entries = putBatchString(10, 'batch_test_string_key'); let entries = putBatchString(10, 'batch_test_string_key');
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
...@@ -4069,7 +4068,7 @@ try { ...@@ -4069,7 +4068,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -4110,7 +4109,7 @@ try { ...@@ -4110,7 +4109,7 @@ try {
count++; count++;
}); });
kvStore.startTransaction().then(async (err) => { kvStore.startTransaction().then(async (err) => {
console.log('Started the transaction successfully.'); console.log('Succeeded in starting Transaction');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4148,7 +4147,7 @@ let kvStore; ...@@ -4148,7 +4147,7 @@ let kvStore;
try { try {
kvStore.commit(function (err, data) { kvStore.commit(function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Committed the transaction successfully.'); console.log('Succeeded in committing');
} else { } else {
console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); console.error(`Fail to commit.code is ${err.code},message is ${err.message}`);
} }
...@@ -4186,7 +4185,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err ...@@ -4186,7 +4185,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
let kvStore; let kvStore;
try { try {
kvStore.commit().then(async (err) => { kvStore.commit().then(async (err) => {
console.log('Committed the transaction successfully.'); console.log('Succeeded in committing');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); console.error(`Fail to commit.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4224,7 +4223,7 @@ let kvStore; ...@@ -4224,7 +4223,7 @@ let kvStore;
try { try {
kvStore.rollback(function (err,data) { kvStore.rollback(function (err,data) {
if (err == undefined) { if (err == undefined) {
console.log('Rolled back the transaction successfully'); console.log('Succeeded in rolling back');
} else { } else {
console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`);
} }
...@@ -4262,7 +4261,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err ...@@ -4262,7 +4261,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
let kvStore; let kvStore;
try { try {
kvStore.rollback().then(async (err) => { kvStore.rollback().then(async (err) => {
console.log('Rolled back the transaction successfully'); console.log('Succeeded in rolling back');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4293,7 +4292,7 @@ let kvStore; ...@@ -4293,7 +4292,7 @@ let kvStore;
try { try {
kvStore.enableSync(true, function (err, data) { kvStore.enableSync(true, function (err, data) {
if (err == undefined) { if (err == undefined) {
console.log('Enabled sync successfully.'); console.log('Succeeded in enabling sync');
} else { } else {
console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`);
} }
...@@ -4329,7 +4328,7 @@ Sets data synchronization, which can be enabled or disabled. This API uses a pro ...@@ -4329,7 +4328,7 @@ Sets data synchronization, which can be enabled or disabled. This API uses a pro
let kvStore; let kvStore;
try { try {
kvStore.enableSync(true).then((err) => { kvStore.enableSync(true).then((err) => {
console.log('Enabled sync successfully.'); console.log('Succeeded in enabling sync');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4366,7 +4365,7 @@ try { ...@@ -4366,7 +4365,7 @@ try {
console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Set syncRange successfully.'); console.log('Succeeded in setting syncRange');
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`);
...@@ -4402,7 +4401,7 @@ try { ...@@ -4402,7 +4401,7 @@ try {
const localLabels = ['A', 'B']; const localLabels = ['A', 'B'];
const remoteSupportLabels = ['C', 'D']; const remoteSupportLabels = ['C', 'D'];
kvStore.setSyncRange(localLabels, remoteSupportLabels).then((err) => { kvStore.setSyncRange(localLabels, remoteSupportLabels).then((err) => {
console.log('Set syncRange successfully.'); console.log('Succeeded in setting syncRange');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4437,7 +4436,7 @@ try { ...@@ -4437,7 +4436,7 @@ try {
console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Set syncParam successfully'); console.log('Succeeded in setting syncParam');
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`);
...@@ -4471,7 +4470,7 @@ let kvStore; ...@@ -4471,7 +4470,7 @@ let kvStore;
try { try {
const defaultAllowedDelayMs = 500; const defaultAllowedDelayMs = 500;
kvStore.setSyncParam(defaultAllowedDelayMs).then((err) => { kvStore.setSyncParam(defaultAllowedDelayMs).then((err) => {
console.log('Set syncParam successfully'); console.log('Succeeded in setting syncParam');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4522,7 +4521,7 @@ try { ...@@ -4522,7 +4521,7 @@ try {
console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting data');
const devices = ['deviceList']; const devices = ['deviceList'];
const mode = distributedKVStore.SyncMode.PULL_ONLY; const mode = distributedKVStore.SyncMode.PULL_ONLY;
kvStore.sync(devices, mode, 1000); kvStore.sync(devices, mode, 1000);
...@@ -4548,7 +4547,7 @@ Synchronizes the KV store manually. This API returns the result synchronously. F ...@@ -4548,7 +4547,7 @@ Synchronizes the KV store manually. This API returns the result synchronously. F
| --------- | --------------------- | ---- | ---------------------------------------------- | | --------- | --------------------- | ---- | ---------------------------------------------- |
| deviceIds | string[] | Yes | List of IDs of the devices in the same networking environment to be synchronized.| | deviceIds | string[] | Yes | List of IDs of the devices in the same networking environment to be synchronized.|
| mode | [SyncMode](#syncmode) | Yes | Synchronization mode. | | mode | [SyncMode](#syncmode) | Yes | Synchronization mode. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| delayMs | number | No | Allowed synchronization delay time, in ms. | | delayMs | number | No | Allowed synchronization delay time, in ms. |
**Error codes** **Error codes**
...@@ -4575,7 +4574,7 @@ try { ...@@ -4575,7 +4574,7 @@ try {
console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); console.error(`Fail to sync.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting data');
const devices = ['deviceList']; const devices = ['deviceList'];
const mode = distributedKVStore.SyncMode.PULL_ONLY; const mode = distributedKVStore.SyncMode.PULL_ONLY;
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
...@@ -4652,7 +4651,7 @@ try { ...@@ -4652,7 +4651,7 @@ try {
console.log(`syncComplete ${data}`); console.log(`syncComplete ${data}`);
}); });
kvStore.put(KEY_TEST_FLOAT_ELEMENT, VALUE_TEST_FLOAT_ELEMENT).then((data) => { kvStore.put(KEY_TEST_FLOAT_ELEMENT, VALUE_TEST_FLOAT_ELEMENT).then((data) => {
console.log('Put data successfully.'); console.log('succeeded in putting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4793,7 +4792,7 @@ try { ...@@ -4793,7 +4792,7 @@ try {
console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained securityLevel successfully'); console.log('Succeeded in getting securityLevel');
}); });
} catch (e) { } catch (e) {
console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`);
...@@ -4828,7 +4827,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err ...@@ -4828,7 +4827,7 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err
let kvStore; let kvStore;
try { try {
kvStore.getSecurityLevel().then((data) => { kvStore.getSecurityLevel().then((data) => {
console.log('Obtained securityLevel successfully'); console.log('Succeeded in getting securityLevel');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4884,13 +4883,13 @@ try { ...@@ -4884,13 +4883,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log("Put data successfully."); console.log("Succeeded in putting");
kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}); });
}); });
} catch (e) { } catch (e) {
...@@ -4936,9 +4935,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; ...@@ -4936,9 +4935,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => {
console.log(`Put data successfully. data=${data}`); console.log(`Succeeded in putting data.data=${data}`);
kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => {
console.log(`Obtained data successfully. data=${data}`); console.log(`Succeeded in getting data.data=${data}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
}); });
...@@ -4988,13 +4987,13 @@ try { ...@@ -4988,13 +4987,13 @@ try {
console.error(`Fail to put.code is ${err.code},message is ${err.message}`); console.error(`Fail to put.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Put data successfully.'); console.log('Succeeded in putting');
kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT, function (err, data) { kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained data successfully'); console.log('Succeeded in getting');
}); });
}) })
} catch (e) { } catch (e) {
...@@ -5041,9 +5040,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; ...@@ -5041,9 +5040,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2';
const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002';
try { try {
kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then(async (data) => { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then(async (data) => {
console.log('Put data successfully.'); console.log('Succeeded in putting');
kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT).then((data) => { kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT).then((data) => {
console.log('Obtained data successfully'); console.log('Succeeded in getting');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get.code is ${err.code},message is ${err.message}`); console.error(`Fail to get.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5102,13 +5101,13 @@ try { ...@@ -5102,13 +5101,13 @@ try {
console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key', function (err, entries) { kvStore.getEntries('batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -5166,9 +5165,9 @@ try { ...@@ -5166,9 +5165,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (entries) => { kvStore.putBatch(entries).then(async (entries) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
kvStore.getEntries('batch_test_string_key').then((entries) => { kvStore.getEntries('batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`PutBatch ${entries}`); console.log(`PutBatch ${entries}`);
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
...@@ -5229,13 +5228,13 @@ try { ...@@ -5229,13 +5228,13 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err, entries) { kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err, entries) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -5294,9 +5293,9 @@ try { ...@@ -5294,9 +5293,9 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => { kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
console.log(`entries[0].value: ${entries[0].value}`); console.log(`entries[0].value: ${entries[0].value}`);
...@@ -5324,7 +5323,7 @@ Obtains all KV pairs that match the specified **Query** object for this device. ...@@ -5324,7 +5323,7 @@ Obtains all KV pairs that match the specified **Query** object for this device.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ----------------------------------------------------- | | -------- | -------------------------------------- | ---- | ----------------------------------------------------- |
| query | [Query](query) | Yes | Key prefix to match. | | query | [Query](#query) | Yes | Key prefix to match. |
| callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.| | callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.|
**Error codes** **Error codes**
...@@ -5356,7 +5355,7 @@ try { ...@@ -5356,7 +5355,7 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query, function (err, entries) { kvStore.getEntries(query, function (err, entries) {
...@@ -5364,7 +5363,7 @@ try { ...@@ -5364,7 +5363,7 @@ try {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}); });
...@@ -5386,7 +5385,7 @@ Obtains all KV pairs that match the specified **Query** object for this device. ...@@ -5386,7 +5385,7 @@ Obtains all KV pairs that match the specified **Query** object for this device.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -5423,18 +5422,18 @@ try { ...@@ -5423,18 +5422,18 @@ try {
} }
console.log(`entries: {entries}`); console.log(`entries: {entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting Batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries(query).then((entries) => { kvStore.getEntries(query).then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`);
}); });
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`)
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting Entries');
} catch (e) { } catch (e) {
console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -5453,7 +5452,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th ...@@ -5453,7 +5452,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------- | ---- | ------------------------------------------------------- | | -------- | -------------------------------------- | ---- | ------------------------------------------------------- |
| deviceId | string | Yes | ID of the target device. | | deviceId | string | Yes | ID of the target device. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.| | callback | AsyncCallback&lt;[Entry](#entry)[]&gt; | Yes | Callback invoked to return the KV pairs obtained.|
**Error codes** **Error codes**
...@@ -5489,7 +5488,7 @@ try { ...@@ -5489,7 +5488,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
var query = new distributedKVStore.Query(); var query = new distributedKVStore.Query();
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
query.prefixKey("batch_test"); query.prefixKey("batch_test");
...@@ -5498,12 +5497,12 @@ try { ...@@ -5498,12 +5497,12 @@ try {
console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
console.log(`entries.length: ${entries.length}`); console.log(`entries.length: ${entries.length}`);
console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0]: ${entries[0]}`);
}) })
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
} catch (e) { } catch (e) {
console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -5522,7 +5521,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th ...@@ -5522,7 +5521,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | -------------------- | | -------- | -------------- | ---- | -------------------- |
| deviceId | string | Yes | ID of the target device.| | deviceId | string | Yes | ID of the target device.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -5559,19 +5558,19 @@ try { ...@@ -5559,19 +5558,19 @@ try {
} }
console.log(`entries: ${entries}`); console.log(`entries: ${entries}`);
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
var query = new distributedKVStore.Query(); var query = new distributedKVStore.Query();
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getEntries('localDeviceId', query).then((entries) => { kvStore.getEntries('localDeviceId', query).then((entries) => {
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`);
}); });
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
console.log('Obtained the entries successfully.'); console.log('Succeeded in getting entries');
} catch (e) { } catch (e) {
console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`);
} }
...@@ -5624,20 +5623,20 @@ try { ...@@ -5624,20 +5623,20 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
kvStore.getResultSet('batch_test_string_key', async function (err, result) { kvStore.getResultSet('batch_test_string_key', async function (err, result) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
}); });
...@@ -5694,18 +5693,18 @@ try { ...@@ -5694,18 +5693,18 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
kvStore.getResultSet('batch_test_string_key').then((result) => { kvStore.getResultSet('batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5750,14 +5749,14 @@ try { ...@@ -5750,14 +5749,14 @@ try {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -5802,13 +5801,13 @@ let kvStore; ...@@ -5802,13 +5801,13 @@ let kvStore;
try { try {
let resultSet; let resultSet;
kvStore.getResultSet('localDeviceId', 'batch_test_string_key').then((result) => { kvStore.getResultSet('localDeviceId', 'batch_test_string_key').then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5830,7 +5829,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * ...@@ -5830,7 +5829,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;[KVStoreResultSet](#kvstoreresultset)&gt; | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.| | callback | AsyncCallback&lt;[KVStoreResultSet](#kvstoreresultset)&gt; | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.|
**Error codes** **Error codes**
...@@ -5865,7 +5864,7 @@ try { ...@@ -5865,7 +5864,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet('localDeviceId', query, async function (err, result) { kvStore.getResultSet('localDeviceId', query, async function (err, result) {
...@@ -5873,14 +5872,14 @@ try { ...@@ -5873,14 +5872,14 @@ try {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}) })
}); });
}); });
...@@ -5902,7 +5901,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * ...@@ -5902,7 +5901,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | ---------------------------------- | | -------- | -------------- | ---- | ---------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -5938,14 +5937,14 @@ try { ...@@ -5938,14 +5937,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet('localDeviceId', query).then((result) => { kvStore.getResultSet('localDeviceId', query).then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -5953,7 +5952,7 @@ try { ...@@ -5953,7 +5952,7 @@ try {
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
console.log("GetResultSet " + query.getSqlLike()); console.log("GetResultSet " + query.getSqlLike());
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
}); });
...@@ -5975,7 +5974,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec ...@@ -5975,7 +5974,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -6011,14 +6010,14 @@ try { ...@@ -6011,14 +6010,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet(query).then((result) => { kvStore.getResultSet(query).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
...@@ -6041,7 +6040,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * ...@@ -6041,7 +6040,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and *
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | ---------------------------------- | | -------- | -------------- | ---- | ---------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -6077,14 +6076,14 @@ try { ...@@ -6077,14 +6076,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSet('localDeviceId', query).then((result) => { kvStore.getResultSet('localDeviceId', query).then((result) => {
console.log('Obtained the result set successfully.'); console.log('Succeeded in getting resultSet');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`);
...@@ -6092,7 +6091,7 @@ try { ...@@ -6092,7 +6091,7 @@ try {
query.deviceId('localDeviceId'); query.deviceId('localDeviceId');
console.log("GetResultSet " + query.getSqlLike()); console.log("GetResultSet " + query.getSqlLike());
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully.'); console.log('Succeeded in closing resultSet');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6143,14 +6142,14 @@ try { ...@@ -6143,14 +6142,14 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -6200,13 +6199,13 @@ try { ...@@ -6200,13 +6199,13 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.prefixKey("batch_test_string_key"); predicates.prefixKey("batch_test_string_key");
kvStore.getResultSet(predicates).then((result) => { kvStore.getResultSet(predicates).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6257,14 +6256,14 @@ try { ...@@ -6257,14 +6256,14 @@ try {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
kvStore.closeResultSet(resultSet, function (err, data) { kvStore.closeResultSet(resultSet, function (err, data) {
if (err != undefined) { if (err != undefined) {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}) })
}); });
} catch (e) { } catch (e) {
...@@ -6314,13 +6313,13 @@ try { ...@@ -6314,13 +6313,13 @@ try {
let predicates = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
predicates.prefixKey("batch_test_string_key"); predicates.prefixKey("batch_test_string_key");
kvStore.getResultSet('localDeviceId', predicates).then((result) => { kvStore.getResultSet('localDeviceId', predicates).then((result) => {
console.log('Obtained the result set successfully'); console.log('Succeeded in getting result set');
resultSet = result; resultSet = result;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`);
}); });
kvStore.closeResultSet(resultSet).then((err) => { kvStore.closeResultSet(resultSet).then((err) => {
console.log('Closed the result set successfully'); console.log('Succeeded in closing result set');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6341,7 +6340,7 @@ Obtains the number of results that match the specified **Query** object for this ...@@ -6341,7 +6340,7 @@ Obtains the number of results that match the specified **Query** object for this
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ------------------------------------------------- | | -------- | --------------------------- | ---- | ------------------------------------------------- |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results that match the specified **Query** object.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results that match the specified **Query** object.|
**Error codes** **Error codes**
...@@ -6371,7 +6370,7 @@ try { ...@@ -6371,7 +6370,7 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries, async function (err, data) { kvStore.putBatch(entries, async function (err, data) {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query, async function (err, resultSize) { kvStore.getResultSize(query, async function (err, resultSize) {
...@@ -6379,7 +6378,7 @@ try { ...@@ -6379,7 +6378,7 @@ try {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}); });
}); });
} catch (e) { } catch (e) {
...@@ -6399,7 +6398,7 @@ Obtains the number of results that match the specified **Query** object for this ...@@ -6399,7 +6398,7 @@ Obtains the number of results that match the specified **Query** object for this
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | -------------- | ---- | -------------- | | ------ | -------------- | ---- | -------------- |
| query | [Query](query) | Yes | **Query** object to match.| | query | [Query](#query) | Yes | **Query** object to match.|
**Return value** **Return value**
...@@ -6434,14 +6433,14 @@ try { ...@@ -6434,14 +6433,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize(query).then((resultSize) => { kvStore.getResultSize(query).then((resultSize) => {
console.log('Obtained the result set size successfully'); console.log('Succeeded in getting result set size');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`);
}); });
...@@ -6463,7 +6462,7 @@ Obtains the number of results that matches the specified device ID and **Query** ...@@ -6463,7 +6462,7 @@ Obtains the number of results that matches the specified device ID and **Query**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | --------------------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. |
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of results obtained.|
**Error codes** **Error codes**
...@@ -6497,7 +6496,7 @@ try { ...@@ -6497,7 +6496,7 @@ try {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
const query = new distributedKVStore.Query(); const query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize('localDeviceId', query, async function (err, resultSize) { kvStore.getResultSize('localDeviceId', query, async function (err, resultSize) {
...@@ -6505,7 +6504,7 @@ try { ...@@ -6505,7 +6504,7 @@ try {
console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`);
return; return;
} }
console.log('Obtained resultSize successfully'); console.log('Succeeded in getting resultSize');
; ;
}); });
}); });
...@@ -6527,7 +6526,7 @@ Obtains the number of results that matches the specified device ID and **Query** ...@@ -6527,7 +6526,7 @@ Obtains the number of results that matches the specified device ID and **Query**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------- | ---- | ---------------------------------- | | -------- | -------------- | ---- | ---------------------------------- |
| deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.|
| query | [Query](query) | Yes | **Query** object to match. | | query | [Query](#query) | Yes | **Query** object to match. |
**Return value** **Return value**
...@@ -6562,14 +6561,14 @@ try { ...@@ -6562,14 +6561,14 @@ try {
entries.push(entry); entries.push(entry);
} }
kvStore.putBatch(entries).then(async (err) => { kvStore.putBatch(entries).then(async (err) => {
console.log('Batch put data successfully.'); console.log('Succeeded in putting batch');
}).catch((err) => { }).catch((err) => {
console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`);
}); });
var query = new distributedKVStore.Query(); var query = new distributedKVStore.Query();
query.prefixKey("batch_test"); query.prefixKey("batch_test");
kvStore.getResultSize('localDeviceId', query).then((resultSize) => { kvStore.getResultSize('localDeviceId', query).then((resultSize) => {
console.log('Obtained resultSize successfully'); console.log('Succeeded in getting resultSize');
; ;
}).catch((err) => { }).catch((err) => {
console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`);
......
...@@ -67,7 +67,8 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t ...@@ -67,7 +67,8 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t
**Example** **Example**
```js ```js
securityLabel.setSecurityLabel(path, "s0").then(() => { let filePath = pathDir + '/test.txt';
securityLabel.setSecurityLabel(filePath, "s0").then(() => {
console.info("setSecurityLabel successfully"); console.info("setSecurityLabel successfully");
}).catch((err) => { }).catch((err) => {
console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
...@@ -93,7 +94,8 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro ...@@ -93,7 +94,8 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro
**Example** **Example**
```js ```js
securityLabel.setSecurityLabel(path, "s0", (err) => { let filePath = pathDir + '/test.txt';
securityLabel.setSecurityLabel(filePath, "s0", (err) => {
if (err) { if (err) {
console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
} else { } else {
...@@ -120,7 +122,8 @@ Sets a security label for a file in synchronous mode. ...@@ -120,7 +122,8 @@ Sets a security label for a file in synchronous mode.
**Example** **Example**
```js ```js
securityLabel.setSecurityLabelSync(path, "s0"); let filePath = pathDir + '/test.txt';
securityLabel.setSecurityLabelSync(filePath, "s0");
``` ```
## securityLabel.getSecurityLabel ## securityLabel.getSecurityLabel
...@@ -146,7 +149,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a promi ...@@ -146,7 +149,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a promi
**Example** **Example**
```js ```js
securityLabel.getSecurityLabel(path).then((type) => { let filePath = pathDir + '/test.txt';
securityLabel.getSecurityLabel(filePath).then((type) => {
console.log("getSecurityLabel successfully, Label: " + type); console.log("getSecurityLabel successfully, Label: " + type);
}).catch((err) => { }).catch((err) => {
console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
...@@ -171,7 +175,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a callb ...@@ -171,7 +175,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a callb
**Example** **Example**
```js ```js
securityLabel.getSecurityLabel(path, (err, type) => { let filePath = pathDir + '/test.txt';
securityLabel.getSecurityLabel(filePath, (err, type) => {
if (err) { if (err) {
console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code);
} else { } else {
...@@ -202,6 +207,7 @@ Obtains the security label of a file in synchronous mode. ...@@ -202,6 +207,7 @@ Obtains the security label of a file in synchronous mode.
**Example** **Example**
```js ```js
let type = securityLabel.getSecurityLabelSync(path); let filePath = pathDir + '/test.txt';
let type = securityLabel.getSecurityLabelSync(filePath);
console.log("getSecurityLabel successfully, Label: " + type); console.log("getSecurityLabel successfully, Label: " + type);
``` ```
# @system.bluetooth (Bluetooth) # @system.bluetooth (Bluetooth)
> **NOTE**<br/> > **NOTE**
> >
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.bluetooth`](js-apis-bluetooth.md). > - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.bluetooth`](js-apis-bluetooth.md).
> >
...@@ -19,11 +19,10 @@ import bluetooth from '@system.bluetooth'; ...@@ -19,11 +19,10 @@ import bluetooth from '@system.bluetooth';
Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes system resources. Call [bluetooth.stopBLEScan](#bluetoothstopblescanobject) to stop the scan after a BLE device is detected and connected. Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes system resources. Call [bluetooth.stopBLEScan](#bluetoothstopblescanobject) to stop the scan after a BLE device is detected and connected.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters** **Parameters**
**Table 1** StartBLEScanOptions **Table 1** StartBLEScanOptions
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -42,7 +41,7 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys ...@@ -42,7 +41,7 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
console.log('call bluetooth.startBLEScan success.'); console.log('call bluetooth.startBLEScan success.');
}, },
fail(code, data) { fail(code, data) {
console.log('call bluetooth.startBLEScan failed, code: ${code}, data: ${data}.'); console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data);
}, },
complete() { complete() {
console.log('call bluetooth.startBLEScan complete.'); console.log('call bluetooth.startBLEScan complete.');
...@@ -55,11 +54,10 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys ...@@ -55,11 +54,10 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLEScan(OBJECT)](#bluetoothstartblescanobject) in pairs. Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLEScan(OBJECT)](#bluetoothstartblescanobject) in pairs.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters** **Parameters**
**Table 2** StopBLEScanOptions **Table 2** StopBLEScanOptions
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
...@@ -76,7 +74,7 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE ...@@ -76,7 +74,7 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
console.log('call bluetooth.stopBLEScan success.'); console.log('call bluetooth.stopBLEScan success.');
}, },
fail(data, code) { fail(data, code) {
console.log('call bluethooth.stopBLEScan fail, code: ${code}, data: ${data}.'); console.log('call bluethooth.stopBLEScan fail, code:' + code + ', data:' + data);
}, },
complete() { complete() {
console.log('call bluethooth.stopBLEScan complete.'); console.log('call bluethooth.stopBLEScan complete.');
...@@ -89,8 +87,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE ...@@ -89,8 +87,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
Subscribes to the newly detected BLE device. If this API is called multiple times, the last call takes effect. Subscribes to the newly detected BLE device. If this API is called multiple times, the last call takes effect.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters** **Parameters**
...@@ -122,10 +118,10 @@ Subscribes to the newly detected BLE device. If this API is called multiple time ...@@ -122,10 +118,10 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
``` ```
bluetooth.subscribeBLEFound({ bluetooth.subscribeBLEFound({
success(data) { success(data) {
console.log('Called bluetooth.subscribeBLEFound successsully, data: ${data}.'); console.log('call bluetooth.subscribeBLEFound success, data: ${data}.');
}, },
fail(data, code) { fail(data, code) {
console.log('Failed to call bluetooth.startBLEScan, data: ${data}, code: ${code}.'); console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data);
} }
}); });
``` ```
...@@ -135,8 +131,6 @@ Subscribes to the newly detected BLE device. If this API is called multiple time ...@@ -135,8 +131,6 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
Unsubscribes from the newly detected devices. Unsubscribes from the newly detected devices.
**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
**System capability**: SystemCapability.Communication.Bluetooth.Lite **System capability**: SystemCapability.Communication.Bluetooth.Lite
**Example** **Example**
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 3. 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 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>- The APIs provided by this module are deprecated since API version 9. You are advised to use [cryptoFramework-Cipher](js-apis-cryptoFramework.md#Cipher).
## Modules to Import ## Modules to Import
...@@ -18,9 +18,10 @@ Defines the response to the cipher interface called. ...@@ -18,9 +18,10 @@ Defines the response to the cipher interface called.
**System capability**: SystemCapability.Security.Cipher **System capability**: SystemCapability.Security.Cipher
| Name| Type | Mandatory| Description | | Name| Type | Readable| Writable|Description |
| ------ | ------ | ---- | ------------ | | ------ | ------ | ---- | ---- | ------------ |
| text | string | Yes | Response content.| | text | string | Yes | No | Response content.|
## CipherRsaOptions ## CipherRsaOptions
...@@ -88,10 +89,10 @@ export default { ...@@ -88,10 +89,10 @@ export default {
'+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' + '+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' +
'jBpApTJ3TeneOo6Z5QIDAQAB', 'jBpApTJ3TeneOo6Z5QIDAQAB',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
...@@ -121,10 +122,10 @@ export default { ...@@ -121,10 +122,10 @@ export default {
'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' +
'8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==', '8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
...@@ -165,10 +166,10 @@ export default { ...@@ -165,10 +166,10 @@ export default {
ivOffset: '0', ivOffset: '0',
ivLen: '16', ivLen: '16',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
...@@ -185,10 +186,10 @@ export default { ...@@ -185,10 +186,10 @@ export default {
ivOffset: '0', ivOffset: '0',
ivLen: '16', ivLen: '16',
success: function(data) { success: function(data) {
console.log(`Handling successful:${data.text}`); console.log(`handling success:${data.text}`);
}, },
fail: function(data, code) { fail: function(data, code) {
console.log(`### cipher.aes encryption failed ### ${code}:${data}`); console.log(`### cipher.aes encrypt fail ### ${code}:${data}`);
}, },
complete: function() { complete: function() {
console.log(`operation complete!`); console.log(`operation complete!`);
......
...@@ -22,8 +22,8 @@ Defines the authentication result. ...@@ -22,8 +22,8 @@ Defines the authentication result.
| ------------ | ---------- | ---- | -------------------- | | ------------ | ---------- | ---- | -------------------- |
| result | number | Yes | Authentication result. | | result | number | Yes | Authentication result. |
| token | Uint8Array | No | Token that has passed the user identity authentication.| | token | Uint8Array | No | Token that has passed the user identity authentication.|
| remainAttempts | number | No | Number of remaining authentication times allowed.| | remainAttempts | number | No | Number of remaining authentication attempts.|
| lockoutDuration | number | No | Time for which the authentication operation is frozen.| | lockoutDuration | number | No | Lock duration of the authentication operation, in milliseconds.|
## TipInfo<sup>9+</sup> ## TipInfo<sup>9+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册