提交 46eb39da 编写于 作者: Y ylq121

xiugai

Signed-off-by: Nylq121 <yangqing89@huawei.com>
上级 1cff2e79
# @ohos.data.cloudData (端云协同) # @ohos.data.cloudData (端云协同)
端云协同提供结构化数据(RDB Store)端云同步的能力。即:云作为数据的中心节点,通过与云的数据同步,实现数据云备份、同帐号设备间的数据一致性。 端云协同提供结构化数据(RDB Store端云同步的能力。即:云作为数据的中心节点,通过与云的数据同步,实现数据云备份、同帐号设备间的数据一致性。
该模块提供以下端云协同相关的常用功能: 该模块提供以下端云协同相关的常用功能:
...@@ -18,7 +18,7 @@ import cloudData from '@ohos.data.cloudData'; ...@@ -18,7 +18,7 @@ import cloudData from '@ohos.data.cloudData';
## Action ## Action
清除本地数据云信息的行为枚举。 清除本地保存的云端数据的行为枚举。
**系统接口:** 此接口为系统接口。 **系统接口:** 此接口为系统接口。
...@@ -27,7 +27,7 @@ import cloudData from '@ohos.data.cloudData'; ...@@ -27,7 +27,7 @@ import cloudData from '@ohos.data.cloudData';
| 名称 | 说明 | | 名称 | 说明 |
| --------- | ---------------------------- | | --------- | ---------------------------- |
| CLEAR_CLOUD_INFO | 清除云标识信息。 | | CLEAR_CLOUD_INFO | 清除云标识信息。 |
| CLEAR_CLOUD_DATA_AND_INFO |清除所有云相关数据,包括云标识信息以及从云端下载的数据(不包括本地已修改或生成的数据)。 | | CLEAR_CLOUD_DATA_AND_INFO |清除本地保存的所有云端数据,包括云标识信息以及从云端下载的数据(不包括本地已修改或生成的数据)。 |
## Config ## Config
...@@ -49,7 +49,7 @@ static enableCloud(accountId: string, switches: {[bundleName: string]: boolean}, ...@@ -49,7 +49,7 @@ static enableCloud(accountId: string, switches: {[bundleName: string]: boolean},
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------- | ---- | ------------------------------------------------------------ | | --------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| switches | {[bundleName: string]: boolean} | 是 | 各应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 | | switches | {[bundleName: string]: boolean} | 是 | 各应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
...@@ -87,7 +87,7 @@ static enableCloud(accountId: string, switches: {[bundleName: string]: boolean}) ...@@ -87,7 +87,7 @@ static enableCloud(accountId: string, switches: {[bundleName: string]: boolean})
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------- | ---- | ------------------------------------------------------------ | | --------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| switches | {[bundleName: string]: boolean} | 是 | 各应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 | | switches | {[bundleName: string]: boolean} | 是 | 各应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 |
**返回值:** **返回值:**
...@@ -127,8 +127,8 @@ static disableCloud(accountId: string, callback: AsyncCallback&lt;void&gt;):void ...@@ -127,8 +127,8 @@ static disableCloud(accountId: string, callback: AsyncCallback&lt;void&gt;):void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------- | ---- | ---------------- | | --------- | ------------------------- | ---- | -------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:** **示例:**
...@@ -163,8 +163,8 @@ static disableCloud(accountId: string): Promise&lt;void&gt; ...@@ -163,8 +163,8 @@ static disableCloud(accountId: string): Promise&lt;void&gt;
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ---------------- | | --------- | ------ | ---- | -------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
**返回值:** **返回值:**
...@@ -203,8 +203,8 @@ static changeAppCloudSwitch(accountId: string,bundleName:string,status:boolean, ...@@ -203,8 +203,8 @@ static changeAppCloudSwitch(accountId: string,bundleName:string,status:boolean,
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------- | ---- | ---------------------------- | | --------- | ------------------------------- | ---- | ---------------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| bundleName| string | 是 | 应用名 | | bundleName| string | 是 | 应用名 |
| status | boolean | 是 | 应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 | | status | boolean | 是 | 应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
...@@ -242,8 +242,8 @@ static changeAppCloudSwitch(accountId: string,bundleName:string,status:boolean): ...@@ -242,8 +242,8 @@ static changeAppCloudSwitch(accountId: string,bundleName:string,status:boolean):
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------- | ---- | ---------------------------- | | --------- | ------------------------------- | ---- | ---------------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| bundleName| string | 是 | 应用名 | | bundleName| string | 是 | 应用名 |
| status | boolean | 是 | 应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 | | status | boolean | 是 | 应用的端云协同开关信息,true为打开该应用端云开关,false为关闭该应用端云开关。 |
**返回值:** **返回值:**
...@@ -283,9 +283,9 @@ static notifyDataChange(accountId: string,bundleName:string, callback: AsyncCall ...@@ -283,9 +283,9 @@ static notifyDataChange(accountId: string,bundleName:string, callback: AsyncCall
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ---------------- | | ---------- | ------------------------- | ---- | -------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| bundleName | string | 是 | 应用名 | | bundleName | string | 是 | 应用名 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:** **示例:**
...@@ -321,9 +321,9 @@ static notifyDataChange(accountId: string,bundleName:string): Promise&lt;void&gt ...@@ -321,9 +321,9 @@ static notifyDataChange(accountId: string,bundleName:string): Promise&lt;void&gt
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ---------------- | | ---------- | ------ | ---- | -------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| bundleName | string | 是 | 应用名 | | bundleName | string | 是 | 应用名 |
**返回值:** **返回值:**
...@@ -362,9 +362,9 @@ static clean(accountId: string, appActions: {[bundleName: string]: Action}, cal ...@@ -362,9 +362,9 @@ static clean(accountId: string, appActions: {[bundleName: string]: Action}, cal
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------------------------- | ---- | -------------------- | | ---------- | ----------------------------------------- | ---- | ---------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| appActions | {[bundleName: string]: [Action](#action)} | 是 | 要清除数据的应用信息 | | appActions | {[bundleName: string]: [Action](#action)} | 是 | 要清除数据的应用信息 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。 |
**示例:** **示例:**
...@@ -376,14 +376,14 @@ let bundleName1 = "test_bundleName1"; ...@@ -376,14 +376,14 @@ let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2"; let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO }; let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try { try {
cloudData.Config.clean(account, appActions, function (err, data) { cloudData.Config.clean(account, appActions, function (err) {
if (err == undefined) { if (err === undefined) {
console.info('Succeeding in cleaning cloud data'); console.info('Succeeding in cleaning cloud data');
} else { } else {
console.error(`Failed to clean. Code: ${err.code}, message: ${err.message}`); console.error(`Failed to clean cloud data. Code: ${err.code}, message: ${err.message}`);
} }
}); });
} catch (e) { } catch (error) {
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`); console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
} }
``` ```
...@@ -403,9 +403,9 @@ static clean(accountId: string, appActions: {[bundleName: string]: Action}): Pro ...@@ -403,9 +403,9 @@ static clean(accountId: string, appActions: {[bundleName: string]: Action}): Pro
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------------------------- | ---- | -------------------- | | ---------- | ----------------------------------------- | ---- | ---------------------- |
| accountId | string | 是 | 具体打开的云ID。 | | accountId | string | 是 | 具体打开的云帐号ID。 |
| appActions | {[bundleName: string]: [Action](#action)} | 是 | 要清除数据的应用信息 | | appActions | {[bundleName: string]: [Action](#action)} | 是 | 要清除数据的应用信息 |
**返回值:** **返回值:**
...@@ -422,12 +422,12 @@ let bundleName1 = "test_bundleName1"; ...@@ -422,12 +422,12 @@ let bundleName1 = "test_bundleName1";
let bundleName2 = "test_bundleName2"; let bundleName2 = "test_bundleName2";
let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO }; let appActions = { [bundleName1]: action.CLEAR_CLOUD_INFO, [bundleName2]: action.CLEAR_CLOUD_DATA_AND_INFO };
try { try {
cloudData.Config.clean(account, appActions).then((data) => { cloudData.Config.clean(account, appActions).then(() => {
console.info('Succeeding in cleaning cloud data'); console.info('Succeeding in cleaning cloud data');
}).catch((error) => { }).catch((err) => {
console.error(`Failed to clean. Code: ${err.code}, message: ${err.message}`); console.error(`Failed to clean cloud data. Code: ${err.code}, message: ${err.message}`);
}); });
} catch (e) { } catch (error) {
console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`); console.error(`An unexpected error occurred. Code: ${error.code}, message: ${error.message}`);
} }
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册