From 077a063d71fcd33eb80b800a0c319ecc673eeb05 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Thu, 19 May 2022 16:04:50 +0800 Subject: [PATCH 1/4] Bug Fix Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 59 ++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 2fd26a2db4..3761d6132d 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1417,6 +1417,21 @@ declare namespace distributedData { */ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @note N/A + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param observer Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + on(event: 'syncComplete', type: SubscribeType, observer: Callback): void; + /** * Register Synchronizes SingleKvStore databases callback. * @@ -1429,6 +1444,19 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; + /** + * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @note N/A + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param observer Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + off(event:'syncComplete', observer?: Callback): void; + /** * UnRegister Synchronizes SingleKvStore databases callback. * @note N/A @@ -1438,7 +1466,6 @@ declare namespace distributedData { */ off(event: 'syncComplete', syncCallback?: Callback>): void; - /** * Sets the default delay allowed for database synchronization * @@ -1665,6 +1692,34 @@ declare namespace distributedData { * @throws Throws this exception if no DeviceKVStore database is available. */ on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @note N/A + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param observer Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + on(event: 'syncComplete', type: SubscribeType, observer: Callback): void; + + /** + * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @note N/A + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param observer Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + */ + off(event:'syncComplete', observer?: Callback): void; /** * UnRegister Synchronizes DeviceKVStore databases callback. @@ -1673,7 +1728,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws Throws this exception if no DeviceKVStore database is available. */ - off(event: 'syncComplete', syncCallback?: Callback>): void; + off(event: 'syncComplete', syncCallback?: Callback>): void; } /** -- Gitee From 628bb7308b6201767cae9e2c58f111e1b8375eaa Mon Sep 17 00:00:00 2001 From: wufengshan Date: Thu, 19 May 2022 16:11:46 +0800 Subject: [PATCH 2/4] Bug Fix Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 3761d6132d..b7d608e9c7 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1430,7 +1430,7 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ - on(event: 'syncComplete', type: SubscribeType, observer: Callback): void; + on(event: 'dataChange', type: SubscribeType, observer: Callback): void; /** * Register Synchronizes SingleKvStore databases callback. @@ -1455,7 +1455,7 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ - off(event:'syncComplete', observer?: Callback): void; + off(event:'dataChange', observer?: Callback): void; /** * UnRegister Synchronizes SingleKvStore databases callback. @@ -1706,7 +1706,7 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ - on(event: 'syncComplete', type: SubscribeType, observer: Callback): void; + on(event: 'dataChange', type: SubscribeType, observer: Callback): void; /** * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. @@ -1719,7 +1719,7 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ - off(event:'syncComplete', observer?: Callback): void; + off(event:'dataChange', observer?: Callback): void; /** * UnRegister Synchronizes DeviceKVStore databases callback. -- Gitee From 4c089040a866c24a8359babbffc31c2a888672b8 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Thu, 19 May 2022 16:45:24 +0800 Subject: [PATCH 3/4] Bug Fix Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index b7d608e9c7..b0ef7dc8a3 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1188,6 +1188,15 @@ declare namespace distributedData { */ off(event:'dataChange', observer?: Callback): void; + /** + * UnRegister Synchronizes {@code KvStore} database callback. + * @note N/A + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @throws Throws this exception if no {@code SingleKvStore} database is available. + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + /** * Inserts key-value pairs into the {@code KvStore} database in batches. * @@ -1728,7 +1737,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws Throws this exception if no DeviceKVStore database is available. */ - off(event: 'syncComplete', syncCallback?: Callback>): void; + off(event: 'syncComplete', syncCallback?: Callback>): void; } /** -- Gitee From d008f62b6e153371d057c5125cd01faeaef0f85b Mon Sep 17 00:00:00 2001 From: wufengshan Date: Thu, 19 May 2022 17:24:20 +0800 Subject: [PATCH 4/4] Bug Fix Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index b0ef7dc8a3..6ace478bee 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1191,9 +1191,12 @@ declare namespace distributedData { /** * UnRegister Synchronizes {@code KvStore} database callback. * @note N/A - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -1431,12 +1434,11 @@ declare namespace distributedData { * {@code KvStoreObserver} will be invoked. * * @note N/A - * @since 7 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param observer Indicates the observer of data change events in the distributed database. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * @throws Throws this exception if no {@code SingleKvStore} database is available. * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ on(event: 'dataChange', type: SubscribeType, observer: Callback): void; @@ -1454,10 +1456,10 @@ declare namespace distributedData { on(event: 'syncComplete', syncCallback: Callback>): void; /** - * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. * * @note N/A - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param observer Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws Throws this exception if any of the following errors @@ -1707,7 +1709,7 @@ declare namespace distributedData { * {@code KvStoreObserver} will be invoked. * * @note N/A - * @since 7 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param observer Indicates the observer of data change events in the distributed database. @@ -1718,10 +1720,10 @@ declare namespace distributedData { on(event: 'dataChange', type: SubscribeType, observer: Callback): void; /** - * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. * * @note N/A - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param observer Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws Throws this exception if any of the following errors -- Gitee