From ba1c821977035de396ba08fcac00b814349dde64 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Wed, 11 May 2022 10:36:43 +0800 Subject: [PATCH 01/10] Update Docs Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 2fd26a2db4..a878b48977 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1163,6 +1163,19 @@ 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}. + * + * @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:'dataChange', observer?: Callback): void; + /** * Subscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. * @@ -1174,10 +1187,11 @@ declare namespace distributedData { * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ on(event: 'syncComplete', syncCallback: Callback>): void; - + /** - * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * + * + * Unegisters 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 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1186,7 +1200,7 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ - off(event:'dataChange', observer?: Callback): void; + off(event:'syncComplete', observer?: Callback): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. -- Gitee From 796a55d04f23af1e391532f8d0c6a1fb53554d63 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Wed, 11 May 2022 10:38:00 +0800 Subject: [PATCH 02/10] Update Docs Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index a878b48977..a207bf5cf1 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1200,7 +1200,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:'syncComplete', observer?: Callback): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. -- Gitee From d047d9d074852fd47828e923b8efda7de42ecf8c Mon Sep 17 00:00:00 2001 From: wufengshan Date: Wed, 11 May 2022 11:08:11 +0800 Subject: [PATCH 03/10] Update Docs Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index a207bf5cf1..e0b03d2594 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1200,7 +1200,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:'syncComplete', observer?: Callback>): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. -- Gitee From e2903451d77f802cd6d9994f93ecf10b16ba91dd Mon Sep 17 00:00:00 2001 From: wufengshan Date: Wed, 11 May 2022 14:16:16 +0800 Subject: [PATCH 04/10] Update Docs Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index e0b03d2594..5afc9afc29 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1190,7 +1190,7 @@ declare namespace distributedData { /** * - * Unegisters a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * Unregister 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 8 -- Gitee From e0f436fbc5ff136827e64f831ac421083e7df917 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Wed, 11 May 2022 14:22:54 +0800 Subject: [PATCH 05/10] Update Docs Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 5afc9afc29..572da80426 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1200,7 +1200,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:'syncComplete', syncCallback?: Callback>): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. -- Gitee From 2059a5d16504690ce9b0c0f81dd7c97dc31f0ed9 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Mon, 16 May 2022 15:53:09 +0800 Subject: [PATCH 06/10] Signed-off-by: wufengshan modified: api/@ohos.data.distributedData.d.ts --- api/@ohos.data.distributedData.d.ts | 68 ++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 572da80426..04cff72be5 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -14,6 +14,9 @@ */ import { AsyncCallback, Callback } from './basic'; +import ValuesBucket from './@ohos.data.DatashareValuesBucket'; +import Predicates from './@ohos.data.DatasharePredicates'; +import DataShareResultSet from './@ohos.data.DataShareResultSet'; /** * Providers interfaces to creat a {@link KVManager} istances. @@ -1133,6 +1136,21 @@ declare namespace distributedData { put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; put(key: string, value: Uint8Array | string | number | boolean): Promise; + /** + * Writes a value of the valuesbucket type into the {@code KvStore} database. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param value Indicates the datasharePredicates. + * Spaces before and after the key will be cleared. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}. + */ + put(value: Array, callback: AsyncCallback): void; + put(value: Array): Promise; + /** * Deletes the key-value pair based on a specified key. * @@ -1148,6 +1166,21 @@ declare namespace distributedData { delete(key: string, callback: AsyncCallback): void; delete(key: string): Promise; + /** + * Deletes the key-value pair based on a specified key. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param predicates Indicates the datasharePredicates. + * Spaces before and after the key will be cleared. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}. + */ + delete(predicates: Predicates, callback: AsyncCallback); + delete(predicates: Predicates): Promise; + /** * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. @@ -1364,7 +1397,7 @@ declare namespace distributedData { */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; - + /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. * @@ -1378,6 +1411,21 @@ declare namespace distributedData { getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; + /** + * Obtains the KvStoreResultSet object matching the specified Predicate object.. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param predicates Indicates the key. + * Spaces before and after the key will be cleared. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}. + */ + getResultSet(predicates: Predicates, callback: AsyncCallback): void; + getResultSet(predicates: Predicates): Promise; + /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * @@ -1424,12 +1472,14 @@ declare namespace distributedData { * @param deviceIdList Indicates the list of devices to which to synchronize the database. * @param mode Indicates the synchronization mode. The value can be {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. * @param allowedDelayMs Indicates the delay allowed for the synchronization, in milliseconds. + * @param query Indicates the {@code Query} object. * @throws Throws this exception if any of the following errors * @permission ohos.permission.DISTRIBUTED_DATASYNC * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. */ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; + sync(deviceIdList: string[], query: Query, mode: SyncMode, allowedDelayMs?: number): void; /** * Register Synchronizes SingleKvStore databases callback. @@ -1597,6 +1647,21 @@ declare namespace distributedData { getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSet(deviceId: string, query: Query): Promise; + /** + * Obtains the KvStoreResultSet object matching the specified Predicate object.. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param predicates Indicates the key. + * Spaces before and after the key will be cleared. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}. + */ + getResultSet(predicates: Predicates, callback: AsyncCallback): void; + getResultSet(predicates: Predicates): Promise; + /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * @@ -1667,6 +1732,7 @@ declare namespace distributedData { * @throws Throws this exception if no DeviceKVStore database is available. */ sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; + sync(deviceIdList: string[], query: Query, mode: SyncMode, allowedDelayMs?: number): void; /** * Register Synchronizes DeviceKVStore databases callback. -- Gitee From 243c6bce9d42eed809d9c325b0f6c5564d4c1eb5 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Mon, 16 May 2022 20:59:02 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wufengshan --- api/@ohos.data.distributedData.d.ts | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 04cff72be5..61a9203d15 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1196,19 +1196,6 @@ 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}. - * - * @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:'dataChange', observer?: Callback): void; - /** * Subscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. * @@ -1220,11 +1207,10 @@ declare namespace distributedData { * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ on(event: 'syncComplete', syncCallback: Callback>): void; - + /** - * - * Unregister a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. + * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * * @note N/A * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1233,7 +1219,7 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ - off(event:'syncComplete', syncCallback?: Callback>): void; + off(event:'dataChange', observer?: Callback): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. -- Gitee From 73e38249f317953a0a1c32016eb7608de51d7669 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Tue, 17 May 2022 09:47:33 +0800 Subject: [PATCH 08/10] Signed-off-by: wufengshan Changes to be committed: --- api/@ohos.data.distributedData.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 61a9203d15..ba4d0f7e59 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1617,8 +1617,8 @@ declare namespace distributedData { * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. */ - getResultSet(query: Query, callback: AsyncCallback): void; - getResultSet(query: Query): Promise; + getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSet(deviceId: string, query: Query): Promise; /** * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. -- Gitee From 531ab119b3210e3c915e32ef87d8b73ed6738ca0 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Tue, 17 May 2022 09:50:30 +0800 Subject: [PATCH 09/10] Signed-off-by: wufengshan Changes to be committed: --- 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 ba4d0f7e59..6138c569e2 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1617,8 +1617,8 @@ declare namespace distributedData { * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. */ - getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSet(deviceId: string, query: Query): Promise; + getResultSet(query: Query, callback: AsyncCallback): void; + getResultSet(query: Query): Promise; /** * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. @@ -1645,8 +1645,8 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and * {@code DB_ERROR}. */ - getResultSet(predicates: Predicates, callback: AsyncCallback): void; - getResultSet(predicates: Predicates): Promise; + getResultSet(deviceId: string, predicates: Predicates, callback: AsyncCallback): void; + getResultSet(deviceId: string, predicates: Predicates): Promise; /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. -- Gitee From 073b802d71a83bd4e0980374f443b6747bb8e323 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Tue, 17 May 2022 11:29:57 +0800 Subject: [PATCH 10/10] Signed-off-by: wufengshan Changes to be committed: --- api/@ohos.data.distributedData.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 6138c569e2..c260171ffe 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -1645,6 +1645,21 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and * {@code DB_ERROR}. */ + getResultSet(predicates: Predicates, callback: AsyncCallback): void; + getResultSet(predicates: Predicates): Promise; + + /** + * Obtains the KvStoreResultSet object matching a specified Device ID and Predicate object. + * + * @note N/A + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param predicates Indicates the key. + * Spaces before and after the key will be cleared. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}. + */ getResultSet(deviceId: string, predicates: Predicates, callback: AsyncCallback): void; getResultSet(deviceId: string, predicates: Predicates): Promise; -- Gitee