From c411ddb05f279de4de468494c42bb068fc2a2bfa Mon Sep 17 00:00:00 2001 From: dboy190 Date: Fri, 16 Sep 2022 00:33:57 +0800 Subject: [PATCH 01/22] add error code for kvdb d.ts Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 1506 ++++++++++++++++++++++++++- 1 file changed, 1485 insertions(+), 21 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index e020a04031..f531718ce4 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -766,10 +766,25 @@ declare namespace distributedData { * Obtains a key-value pair. * * @since 8 + * @deprecated since 9 + * @useinstead getEntryV9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns a key-value pair. */ getEntry(): Entry; + /** + * Obtains a key-value pair. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns a key-value pair. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100006 + * @errorcode 15100008 + */ + getEntryV9(): Entry; } /** @@ -781,6 +796,8 @@ declare namespace distributedData { *

This class also provides methods for adding predicates to the {@code Query} instance. * * @since 8 + * @deprecated since 9 + * @useinstead QueryV9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A */ @@ -1094,6 +1111,366 @@ declare namespace distributedData { getSqlLike():string; } + /** + * Represents a database query using a predicate. + * + *

This class provides a constructor used to create a {@code QueryV9} instance, which is used to query data matching specified + * conditions in the database. + * + *

This class also provides methods for adding predicates to the {@code QueryV9} instance. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + */ + class QueryV9 { + /** + * A constructor used to create a Query instance. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + */ + constructor() + /** + * Resets this {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the reset {@code QueryV9} object. + */ + reset(): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is equal to the specified long value. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value IIndicates the long value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + equalTo(field: string, value: number|string|boolean): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not equal to the specified int value. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + notEqualTo(field: string, value: number|string|boolean): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is greater than or equal to the + * specified int value. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + greaterThan(field: string, value: number|string|boolean): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is less than the specified int value. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + lessThan(field: string, value: number|string): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is greater than or equal to the + * specified int value. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + greaterThanOrEqualTo(field: string, value: number|string): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is less than or equal to the + * specified int value. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + lessThanOrEqualTo(field: string, value: number|string): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is null. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + isNull(field: string): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is within the specified int value list. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the int value list. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + inNumber(field: string, valueList: number[]): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is within the specified string value list. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the string value list. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + inString(field: string, valueList: string[]): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not within the specified int value list. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the int value list. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + notInNumber(field: string, valueList: number[]): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not within the specified string value list. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the string value list. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + notInString(field: string, valueList: string[]): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is similar to the specified string value. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the string value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + like(field: string, value: string): QueryV9; + /** + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not similar to the specified string value. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the string value. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + unlike(field: string, value: string): QueryV9; + /** + * Constructs a {@code QueryV9} object with the and condition. + * + *

Multiple predicates should be connected using the and or or condition. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed QueryV9} object. + */ + and(): QueryV9; + /** + * Constructs a {@code QueryV9} object with the or condition. + * + *

Multiple predicates should be connected using the and or or condition. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed QueryV9} object. + */ + or(): QueryV9; + /** + * Constructs a {@code QueryV9} object to sort the query results in ascending order. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + orderByAsc(field: string): QueryV9; + /** + * Constructs a {@code QueryV9} object to sort the query results in descending order. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + orderByDesc(field: string): QueryV9; + /** + * Constructs a {@code QueryV9} object to specify the number of results and the start position. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param total Indicates the number of results. + * @param offset Indicates the start position. + * @returns Returns the {@coed QueryV9} object. + */ + limit(total: number, offset: number): QueryV9; + /** + * Creates a {@code QueryV9} condition with a specified field that is not null. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the specified field. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + isNotNull(field: string): QueryV9; + /** + * Creates a query condition group with a left bracket. + * + *

Multiple query conditions in an {@code QueryV9} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed QueryV9} object. + */ + beginGroup(): QueryV9; + /** + * Creates a query condition group with a right bracket. + * + *

Multiple query conditions in an {@code QueryV9} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed QueryV9} object. + */ + endGroup(): QueryV9; + /** + * Creates a query condition with a specified key prefix. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param prefix Indicates the specified key prefix. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + prefixKey(prefix: string): QueryV9; + /** + * Sets a specified index that will be preferentially used for query. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param index Indicates the index to set. + * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + setSuggestIndex(index: string): QueryV9; + /** + * Add device ID key prefix.Used by {@code DeviceKVStore}. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param deviceId Specify device id to query from. + * @return Returns the {@code QueryV9} object with device ID prefix added. + * @throws throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + deviceId(deviceId:string):QueryV9; + /** + * Get a String that repreaents this {@code QueryV9}. + * + *

The String would be parsed to DB query format. + * The String length should be no longer than 500kb. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @return String representing this {@code QueryV9}. + */ + getSqlLike():string; + } + /** * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, * and subscribing to distributed data. @@ -1103,6 +1480,8 @@ declare namespace distributedData { * including {@code SingleKVStore}. * * @since 7 + * @deprecated since 9 + * @useinstead KVStoreV9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 @@ -1329,34 +1708,334 @@ declare namespace distributedData { } /** - * Provides methods related to single-version distributed databases. + * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, + * and subscribing to distributed data. * - *

To create a {@code SingleKVStore} database, - * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method - * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. - * This database synchronizes data to other databases in time sequence. - * The {@code SingleKVStore} database does not support - * synchronous transactions, or data search using snapshots. + *

You can create distributed databases of different types by {@link KVManagerV9#getKVStore (Options, String)} + * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, + * including {@code SingleKVStoreV9}. * - * @since 7 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 */ - interface SingleKVStore extends KVStore { + interface KVStoreV9 { /** - * Obtains the {@code String} value of a specified key. - * - * @since 7 + * Writes a key-value pair of the string type into the {@code KvStoreV9} database. + * + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @param key Indicates the key of the boolean value to be queried. - * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 */ - get(key: string, callback: AsyncCallback): void; - get(key: string): Promise; - + 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 KvStoreV9} database. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @param value Indicates the data record to put. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + putBatch(value: Array, callback: AsyncCallback): void; + putBatch(value: Array): Promise; + + /** + * Deletes the key-value pair based on a specified key. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 15100008 + * @errorcode 401 + */ + delete(key: string, callback: AsyncCallback): void; + delete(key: string): Promise; + + /** + * Deletes the key-value pair based on a specified key. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @param predicates Indicates the datasharePredicates. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 15100008 + * @errorcode 401 + */ + delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); + delete(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Backs up a database in a specified name. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param file Indicates the name that saves the database backup. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100007 + * @errorcode 15100008 + * @errorcode 401 + */ + backup(file:string, callback: AsyncCallback):void; + backup(file:string): Promise; + + /** + * Restores a database from a specified database file. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param file Indicates the name that saves the database file. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100007 + * @errorcode 15100008 + * @errorcode 401 + */ + restore(file:string, callback: AsyncCallback):void; + restore(file:string): Promise; + + /** + * Delete a backup files based on a specified name. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param files list Indicates the name that backup file to delete. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + deleteBackup(files:Array, callback: AsyncCallback>):void; + deleteBackup(files:Array): Promise>; + + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 15100009 + * @errorcode 401 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** + * Subscribes from the {@code KvStoreV9} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Unsubscribes from the {@code KvStoreV9} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 15100010 + * @errorcode 401 + */ + off(event:'dataChange', listener?: Callback): void; + + /** + * UnRegister Synchronizes {@code KvStoreV9} database callback. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + + /** + * Inserts key-value pairs into the {@code KvStoreV9} database in batches. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param entries Indicates the key-value pairs to be inserted in batches. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + putBatch(entries: Entry[], callback: AsyncCallback): void; + putBatch(entries: Entry[]): Promise; + + /** + * Deletes key-value pairs in batches from the {@code KvStoreV9} database. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param keys Indicates the key-value pairs to be deleted in batches. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 15100008 + * @errorcode 401 + */ + deleteBatch(keys: string[], callback: AsyncCallback): void; + deleteBatch(keys: string[]): Promise; + + /** + * Starts a transaction operation in the {@code KvStoreV9} database. + * + *

After the database transaction is started, you can submit or roll back the operation. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100008 + */ + startTransaction(callback: AsyncCallback): void; + startTransaction(): Promise; + + /** + * Submits a transaction operation in the {@code KvStoreV9} database. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param callback + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100008 + */ + commit(callback: AsyncCallback): void; + commit(): Promise; + + /** + * Rolls back a transaction operation in the {@code KvStoreV9} database. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100008 + */ + rollback(callback: AsyncCallback): void; + rollback(): Promise; + + /** + * Sets whether to enable synchronization. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param enabled Specifies whether to enable synchronization. The value true means to enable + * synchronization, and false means the opposite. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 401 + */ + enableSync(enabled: boolean, callback: AsyncCallback): void; + enableSync(enabled: boolean): Promise; + + /** + * Sets synchronization range labels. + * + *

The labels determine the devices with which data will be synchronized. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param localLabels Indicates the synchronization labels of the local device. + * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 401 + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; + setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; + } + + /** + * Provides methods related to single-version distributed databases. + * + *

To create a {@code SingleKVStore} database, + * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method + * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. + * This database synchronizes data to other databases in time sequence. + * The {@code SingleKVStore} database does not support + * synchronous transactions, or data search using snapshots. + * + * @since 7 + * @deprecated since 9 + * @useinstead SingleKVStoreV9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @version 1 + */ + interface SingleKVStore extends KVStore { + /** + * Obtains the {@code String} value of a specified key. + * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param key Indicates the key of the boolean value to be queried. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + */ + get(key: string, callback: AsyncCallback): void; + get(key: string): Promise; + /** * Obtains all key-value pairs that match a specified key prefix. * @@ -1566,6 +2245,305 @@ declare namespace distributedData { getSecurityLevel(): Promise; } + /** + * Provides methods related to single-version distributed databases. + * + *

To create a {@code SingleKVStoreV9} database, + * you can use the {@link data.distributed.common.KVManagerV9#getKVStore​(Options, String)} method + * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. + * This database synchronizes data to other databases in time sequence. + * The {@code SingleKVStoreV9} database does not support + * synchronous transactions, or data search using snapshots. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @version 1 + */ + interface SingleKVStoreV9 extends KVStoreV9 { + /** + * Obtains the {@code String} value of a specified key. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 15100008 + * @errorcode 401 + */ + get(key: string, callback: AsyncCallback): void; + get(key: string): Promise; + + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the list of all key-value pairs that match the specified key prefix. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + getEntries(keyPrefix: string): Promise; + + /** + * Obtains the list of key-value pairs matching the specified {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100007 + * @errorcode 15100008 + * @errorcode 401 + */ + getEntries(query: QueryV9, callback: AsyncCallback): void; + getEntries(query: QueryV9): Promise; + + /** + * Obtains the result sets with a specified prefix from a {@code KvStoreV9} database. The {@code KvStoreResultSet} object can be used to + * query all key-value pairs that meet the search criteria. Each {@code KvStoreV9} instance can have a maximum of four + * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a + * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects + * in a timely manner. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param keyPrefix Indicates the key prefix to match. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + getResultSet(keyPrefix: string): Promise; + + /** + * Obtains the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param query Indicates the {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(query: QueryV9, callback: AsyncCallback): void; + getResultSet(query: QueryV9): Promise; + + /** + * Obtains the KvStoreResultSet object matching the specified Predicate object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @param predicates Indicates the datasharePredicates. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param resultSet Indicates the {@code KvStoreResultSet} object to close. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 401 + */ + closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KvStoreResultSet): Promise; + + /** + * Obtains the number of results matching the specified {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the number of results matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSize(query: QueryV9, callback: AsyncCallback): void; + getResultSize(query: QueryV9): Promise; + + /** + * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param deviceId Indicates the device to be removed data. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 401 + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; + + /** + * Synchronizes the database to the specified devices with the specified delay allowed. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 401 + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void + + /** + * Synchronizes the database to the specified devices with the specified delay allowed. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * @param query Indicates the {@code QueryV9} object. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 401 + */ + sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; + + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 15100009 + * @errorcode 401 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** + * Register Synchronizes SingleKvStore databases callback. + *

Sync result is returned through asynchronous callback. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 15100010 + * @errorcode 401 + */ + off(event:'dataChange', listener?: Callback): void; + + /** + * UnRegister Synchronizes SingleKvStore databases callback. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + + + /** + * Sets the default delay allowed for database synchronization + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 401 + */ + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + setSyncParam(defaultAllowedDelayMs: number): Promise; + + /** + * Get the security level of the database. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns SecurityLevel {@code SecurityLevel} the security level of the database. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100008 + */ + getSecurityLevel(callback: AsyncCallback): void; + getSecurityLevel(): Promise; + } + /** * Manages distributed data by device in a distributed system. * @@ -1575,6 +2553,8 @@ declare namespace distributedData { * into the database, the system automatically adds the ID of the device running the application to the key. * * @since 8 + * @deprecated since 9 + * @useinstead DeviceKVStoreV9 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A */ @@ -1835,6 +2815,356 @@ declare namespace distributedData { */ off(event: 'syncComplete', syncCallback?: Callback>): void; } + + /** + * Manages distributed data by device in a distributed system. + * + *

To create a {@code DeviceKVStoreV9} database, you can use the {@link data.distributed.common.KVManagerV9.getKvStore(Options, String)} + * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed + * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry + * into the database, the system automatically adds the ID of the device running the application to the key. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @import N/A + */ + interface DeviceKVStoreV9 extends KVStoreV9 { + /** + * Obtains the {@code String} value matching a specified device ID and key. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Indicates the device to be queried. + * @param key Indicates the key of the value to be queried. + * @return Returns the value matching the given criteria. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 15100008 + * @errorcode 401 + */ + get(deviceId: string, key: string, callback: AsyncCallback): void; + get(deviceId: string, key: string): Promise; + + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the list of all key-value pairs meeting the given criteria. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getEntries(deviceId: string, keyPrefix: string): Promise; + + /** + * Obtains the list of key-value pairs matching the specified {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100007 + * @errorcode 15100008 + * @errorcode 401 + */ + getEntries(query: QueryV9, callback: AsyncCallback): void; + getEntries(query: QueryV9): Promise; + + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Indicates the ID of the device to which the key-value pairs belong. + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100007 + * @errorcode 15100008 + * @errorcode 401 + */ + getEntries(deviceId: string, query: QueryV9, callback: AsyncCallback): void; + getEntries(deviceId: string, query: QueryV9): Promise; + + /** + * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. + * + *

The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStoreV9} + * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KvStoreResultSet} objects in a timely manner. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the {@code KvStoreResultSet} objects. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getResultSet(deviceId: string, keyPrefix: string): Promise; + + /** + * Obtains the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(query: QueryV9, callback: AsyncCallback): void; + getResultSet(query: QueryV9): Promise; + + /** + * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(deviceId: string, query: QueryV9, callback: AsyncCallback): void; + getResultSet(deviceId: string, query: QueryV9): Promise; + + /** + * Obtains the KvStoreResultSet object matching the specified Predicate object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param predicates Indicates the datasharePredicates. + * @systemapi + * Spaces before and after the key will be cleared. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Obtains the KvStoreResultSet object matching a specified Device ID and Predicate object. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @param predicates Indicates the key. + * @param deviceId Indicates the ID of the device to which the results belong. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param resultSet Indicates the {@code KvStoreResultSet} object to close. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 401 + */ + closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KvStoreResultSet): Promise; + + /** + * Obtains the number of results matching the specified {@code QueryV9} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the number of results matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSize(query: QueryV9, callback: AsyncCallback): void; + getResultSize(query: QueryV9): Promise; + + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Indicates the ID of the device to which the results belong. + * @param query Indicates the {@code QueryV9} object. + * @returns Returns the number of results matching the specified {@code QueryV9} object. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100008 + * @errorcode 401 + */ + getResultSize(deviceId: string, query: QueryV9, callback: AsyncCallback): void; + getResultSize(deviceId: string, query: QueryV9): Promise; + + /** + * Removes data of a specified device from the current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 401 + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; + + /** + * Synchronizes {@code DeviceKVStore} databases. + * + *

This method returns immediately and sync result will be returned through asynchronous callback. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param deviceIds Indicates the list of IDs of devices whose + * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * {@code DeviceKVStore} databases are to be synchronized. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or + * {@code PUSH_PULL}. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 401 + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + + /** + * Synchronizes {@code DeviceKVStore} databases. + * + *

This method returns immediately and sync result will be returned through asynchronous callback. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param deviceIds Indicates the list of IDs of devices whose + * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * {@code DeviceKVStore} databases are to be synchronized. + * @param query Indicates the {@code Query} object. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or + * {@code PUSH_PULL}. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 15100006 + * @errorcode 401 + */ + sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; + + /** + * Register Synchronizes DeviceKVStore databases callback. + * + *

Sync result is returned through asynchronous callback. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + 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. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 15100009 + * @errorcode 401 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** + * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100008 + * @errorcode 15100010 + * @errorcode 401 + */ + off(event:'dataChange', listener?: Callback): void; + + /** + * UnRegister Synchronizes DeviceKVStore databases callback. + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + } /** * Creates a {@link KVManager} instance based on the configuration information. @@ -1842,7 +3172,9 @@ declare namespace distributedData { *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * - * @since 7 + * @since 9 + * @deprecated since 9 + * @useinstead createKVManagerV9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param config Indicates the {@link KVStore} configuration information, * including the user information and package name. @@ -1852,10 +3184,30 @@ declare namespace distributedData { function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManager(config: KVManagerConfig): Promise; + /** + * Creates a {@link KVManagerV9} instance based on the configuration information. + * + *

You must pass {@link KVManagerConfig} to provide configuration information + * for creating the {@link KVManagerV9} instance. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param config Indicates the {@link KVStoreV9} configuration information, + * including the user information and package name. + * @return Returns the {@code KVManagerV9} instance. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + function createKVManagerV9(config: KVManagerConfig, callback: AsyncCallback): void; + function createKVManagerV9(config: KVManagerConfig): Promise; + /** * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. * - * @since 7 + * @since 9 + * @deprecated since 9 + * @useinstead KVManagerV9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 @@ -1950,6 +3302,118 @@ declare namespace distributedData { */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } + + /** + * Provides interfaces to manage a {@code KVStoreV9} database, including obtaining, closing, and deleting the {@code KVStoreV9}. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @version 1 + */ + interface KVManagerV9 { + /** + * Creates and obtains a {@code KVStoreV9} database by specifying {@code Options} and {@code storeId}. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param options Indicates the options used for creating and obtaining the {@code KVStoreV9} database, + * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. + * @param storeId Identifies the {@code KVStoreV9} database. + * The value of this parameter must be unique for the same application, + * and different applications can share the same value. + * @return Returns a {@code KVStoreV9}, or {@code SingleKVStoreV9}. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100003 + * @errorcode 15100004 + * @errorcode 15100005 + * @errorcode 401 + */ + getKVStore(storeId: string, options: Options): Promise; + getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; + + /** + * Closes the {@code KvStoreV9} database. + * + *

Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your + * thread may crash. + * + *

The {@code KvStoreV9} database to close must be an object created by using the {@code getKvStoreV9} method. Before using this + * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStoreV9}, + * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error + * will be returned. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param kvStore Indicates the {@code KvStoreV9} database to close. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9, callback: AsyncCallback): void; + closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9): Promise; + + /** + * Deletes the {@code KvStoreV9} database identified by storeId. + * + *

Before using this method, close all {@code KvStoreV9} instances in use that are identified by the same storeId. + * + *

You can use this method to delete a {@code KvStoreV9} database not in use. After the database is deleted, all its data will be + * lost. + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param storeId Identifies the {@code KvStoreV9} database to delete. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 15100006 + * @errorcode 401 + */ + deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + deleteKVStore(appId: string, storeId: string): Promise; + + /** + * Obtains the storeId of all {@code KvStoreV9} databases that are created by using the {@code getKvStoreV9} method and not deleted by + * calling the {@code deleteKvStore} method. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns the storeId of all created {@code KvStore} databases. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 15100002 + * @errorcode 15100004 + * @errorcode 401 + */ + getAllKVStoreId(appId: string, callback: AsyncCallback): void; + getAllKVStoreId(appId: string): Promise; + + /** + * register DeviceChangeCallback to get notification when device's status changed + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deathCallback device change callback {@code DeviceChangeCallback} + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + on(event: 'distributedDataServiceDie', deathCallback: Callback): void; + + /** + * unRegister DeviceChangeCallback and can not receive notification + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. + * @throws {BusinessError} if process failed. + * @errorcode 15100001 + * @errorcode 401 + */ + off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; + } } export default distributedData; \ No newline at end of file -- Gitee From 406606d43db572226a85f3d2aece8b8c52b02e1f Mon Sep 17 00:00:00 2001 From: dboy190 Date: Fri, 16 Sep 2022 00:39:18 +0800 Subject: [PATCH 02/22] since fix Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index f531718ce4..be10b3903e 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -3344,7 +3344,7 @@ declare namespace distributedData { * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error * will be returned. * - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param kvStore Indicates the {@code KvStoreV9} database to close. * @throws {BusinessError} if process failed. @@ -3361,7 +3361,7 @@ declare namespace distributedData { * *

You can use this method to delete a {@code KvStoreV9} database not in use. After the database is deleted, all its data will be * lost. - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param storeId Identifies the {@code KvStoreV9} database to delete. * @throws {BusinessError} if process failed. @@ -3378,7 +3378,7 @@ declare namespace distributedData { * Obtains the storeId of all {@code KvStoreV9} databases that are created by using the {@code getKvStoreV9} method and not deleted by * calling the {@code deleteKvStore} method. * - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns the storeId of all created {@code KvStore} databases. * @throws {BusinessError} if process failed. @@ -3393,7 +3393,7 @@ declare namespace distributedData { /** * register DeviceChangeCallback to get notification when device's status changed * - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} * @throws {BusinessError} if process failed. @@ -3405,7 +3405,7 @@ declare namespace distributedData { /** * unRegister DeviceChangeCallback and can not receive notification * - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. * @throws {BusinessError} if process failed. -- Gitee From 19f7c65a41af2d7162af6ecb01c8b354092aad2e Mon Sep 17 00:00:00 2001 From: dboy190 Date: Tue, 27 Sep 2022 15:01:44 +0800 Subject: [PATCH 03/22] fix new errorcode Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 231 ++++++++-------------------- 1 file changed, 67 insertions(+), 164 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index be10b3903e..c42ebba9ea 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -782,7 +782,6 @@ declare namespace distributedData { * @errorcode 15100001 * @errorcode 15100004 * @errorcode 15100006 - * @errorcode 15100008 */ getEntryV9(): Entry; } @@ -1150,7 +1149,6 @@ declare namespace distributedData { * @param value IIndicates the long value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ equalTo(field: string, value: number|string|boolean): QueryV9; @@ -1164,7 +1162,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ notEqualTo(field: string, value: number|string|boolean): QueryV9; @@ -1179,7 +1176,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ greaterThan(field: string, value: number|string|boolean): QueryV9; @@ -1193,7 +1189,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ lessThan(field: string, value: number|string): QueryV9; @@ -1207,7 +1202,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ greaterThanOrEqualTo(field: string, value: number|string): QueryV9; @@ -1222,7 +1216,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ lessThanOrEqualTo(field: string, value: number|string): QueryV9; @@ -1235,7 +1228,6 @@ declare namespace distributedData { * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ isNull(field: string): QueryV9; @@ -1249,7 +1241,6 @@ declare namespace distributedData { * @param valueList Indicates the int value list. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ inNumber(field: string, valueList: number[]): QueryV9; @@ -1263,7 +1254,6 @@ declare namespace distributedData { * @param valueList Indicates the string value list. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ inString(field: string, valueList: string[]): QueryV9; @@ -1276,7 +1266,6 @@ declare namespace distributedData { * @param valueList Indicates the int value list. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ notInNumber(field: string, valueList: number[]): QueryV9; @@ -1290,7 +1279,6 @@ declare namespace distributedData { * @param valueList Indicates the string value list. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ notInString(field: string, valueList: string[]): QueryV9; @@ -1304,7 +1292,6 @@ declare namespace distributedData { * @param value Indicates the string value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ like(field: string, value: string): QueryV9; @@ -1318,7 +1305,6 @@ declare namespace distributedData { * @param value Indicates the string value. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ unlike(field: string, value: string): QueryV9; @@ -1353,7 +1339,6 @@ declare namespace distributedData { * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ orderByAsc(field: string): QueryV9; @@ -1366,7 +1351,6 @@ declare namespace distributedData { * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ orderByDesc(field: string): QueryV9; @@ -1390,7 +1374,6 @@ declare namespace distributedData { * @param field Indicates the specified field. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ isNotNull(field: string): QueryV9; @@ -1427,7 +1410,6 @@ declare namespace distributedData { * @param prefix Indicates the specified key prefix. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ prefixKey(prefix: string): QueryV9; @@ -1440,7 +1422,6 @@ declare namespace distributedData { * @param index Indicates the index to set. * @returns Returns the {@coed QueryV9} object. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ setSuggestIndex(index: string): QueryV9; @@ -1453,7 +1434,6 @@ declare namespace distributedData { * @param deviceId Specify device id to query from. * @return Returns the {@code QueryV9} object with device ID prefix added. * @throws throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ deviceId(deviceId:string):QueryV9; @@ -1733,9 +1713,8 @@ declare namespace distributedData { * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; @@ -1751,9 +1730,8 @@ declare namespace distributedData { * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ putBatch(value: Array, callback: AsyncCallback): void; @@ -1768,10 +1746,9 @@ declare namespace distributedData { * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. * @errorcode 15100001 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 * @errorcode 15100006 - * @errorcode 15100008 * @errorcode 401 */ delete(key: string, callback: AsyncCallback): void; @@ -1786,10 +1763,9 @@ declare namespace distributedData { * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. * @errorcode 15100001 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 * @errorcode 15100006 - * @errorcode 15100008 * @errorcode 401 */ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); @@ -1803,9 +1779,8 @@ declare namespace distributedData { * @param file Indicates the name that saves the database backup. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100007 - * @errorcode 15100008 + * @errorcode 15100005 + * @errorcode 15100006 * @errorcode 401 */ backup(file:string, callback: AsyncCallback):void; @@ -1819,9 +1794,8 @@ declare namespace distributedData { * @param file Indicates the name that saves the database file. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100007 - * @errorcode 15100008 + * @errorcode 15100005 + * @errorcode 15100006 * @errorcode 401 */ restore(file:string, callback: AsyncCallback):void; @@ -1834,7 +1808,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param files list Indicates the name that backup file to delete. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ deleteBackup(files:Array, callback: AsyncCallback>):void; @@ -1850,10 +1823,8 @@ declare namespace distributedData { * @param listener Indicates the observer of data change events in the distributed database. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 - * @errorcode 15100008 - * @errorcode 15100009 + * @errorcode 15100006 + * @errorcode 15100007 * @errorcode 401 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -1864,7 +1835,6 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -1877,10 +1847,7 @@ declare namespace distributedData { * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 - * @errorcode 15100008 - * @errorcode 15100010 + * @errorcode 15100006 * @errorcode 401 */ off(event:'dataChange', listener?: Callback): void; @@ -1891,7 +1858,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param syncCallback Indicates the callback used to send the synchronization result to caller. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -1904,9 +1870,8 @@ declare namespace distributedData { * @param entries Indicates the key-value pairs to be inserted in batches. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ putBatch(entries: Entry[], callback: AsyncCallback): void; @@ -1920,10 +1885,9 @@ declare namespace distributedData { * @param keys Indicates the key-value pairs to be deleted in batches. * @throws {BusinessError} if process failed. * @errorcode 15100001 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 * @errorcode 15100006 - * @errorcode 15100008 * @errorcode 401 */ deleteBatch(keys: string[], callback: AsyncCallback): void; @@ -1938,9 +1902,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 - * @errorcode 15100008 + * @errorcode 15100006 */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; @@ -1953,8 +1915,7 @@ declare namespace distributedData { * @param callback * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100008 + * @errorcode 15100006 */ commit(callback: AsyncCallback): void; commit(): Promise; @@ -1966,8 +1927,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100008 + * @errorcode 15100006 */ rollback(callback: AsyncCallback): void; rollback(): Promise; @@ -1981,7 +1941,6 @@ declare namespace distributedData { * synchronization, and false means the opposite. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 * @errorcode 401 */ enableSync(enabled: boolean, callback: AsyncCallback): void; @@ -1998,7 +1957,6 @@ declare namespace distributedData { * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 * @errorcode 401 */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; @@ -2269,10 +2227,9 @@ declare namespace distributedData { * @import N/A * @throws {BusinessError} if process failed. * @errorcode 15100001 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 * @errorcode 15100006 - * @errorcode 15100008 * @errorcode 401 */ get(key: string, callback: AsyncCallback): void; @@ -2288,9 +2245,8 @@ declare namespace distributedData { * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getEntries(keyPrefix: string, callback: AsyncCallback): void; @@ -2306,10 +2262,9 @@ declare namespace distributedData { * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 + * @errorcode 15100003 * @errorcode 15100005 - * @errorcode 15100007 - * @errorcode 15100008 + * @errorcode 15100006 * @errorcode 401 */ getEntries(query: QueryV9, callback: AsyncCallback): void; @@ -2328,9 +2283,8 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; @@ -2345,9 +2299,8 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(query: QueryV9, callback: AsyncCallback): void; @@ -2363,9 +2316,8 @@ declare namespace distributedData { * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; @@ -2380,7 +2332,6 @@ declare namespace distributedData { * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 * @errorcode 401 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; @@ -2396,9 +2347,8 @@ declare namespace distributedData { * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSize(query: QueryV9, callback: AsyncCallback): void; @@ -2413,8 +2363,7 @@ declare namespace distributedData { * @param deviceId Indicates the device to be removed data. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100008 + * @errorcode 15100006 * @errorcode 401 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; @@ -2431,10 +2380,8 @@ declare namespace distributedData { * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100006 * @errorcode 401 */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void @@ -2451,10 +2398,8 @@ declare namespace distributedData { * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100006 * @errorcode 401 */ sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; @@ -2469,10 +2414,8 @@ declare namespace distributedData { * @param listener Indicates the observer of data change events in the distributed database. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 - * @errorcode 15100008 - * @errorcode 15100009 + * @errorcode 15100006 + * @errorcode 15100007 * @errorcode 401 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -2484,7 +2427,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -2496,10 +2438,7 @@ declare namespace distributedData { * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 - * @errorcode 15100008 - * @errorcode 15100010 + * @errorcode 15100006 * @errorcode 401 */ off(event:'dataChange', listener?: Callback): void; @@ -2509,7 +2448,6 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -2523,7 +2461,6 @@ declare namespace distributedData { * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 * @errorcode 401 */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; @@ -2537,8 +2474,7 @@ declare namespace distributedData { * @returns SecurityLevel {@code SecurityLevel} the security level of the database. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100008 + * @errorcode 15100006 */ getSecurityLevel(callback: AsyncCallback): void; getSecurityLevel(): Promise; @@ -2839,10 +2775,9 @@ declare namespace distributedData { * @return Returns the value matching the given criteria. * @throws {BusinessError} if process failed. * @errorcode 15100001 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 * @errorcode 15100006 - * @errorcode 15100008 * @errorcode 401 */ get(deviceId: string, key: string, callback: AsyncCallback): void; @@ -2858,9 +2793,8 @@ declare namespace distributedData { * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; @@ -2875,10 +2809,9 @@ declare namespace distributedData { * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 + * @errorcode 15100003 * @errorcode 15100005 - * @errorcode 15100007 - * @errorcode 15100008 + * @errorcode 15100006 * @errorcode 401 */ getEntries(query: QueryV9, callback: AsyncCallback): void; @@ -2894,10 +2827,9 @@ declare namespace distributedData { * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 + * @errorcode 15100003 * @errorcode 15100005 - * @errorcode 15100007 - * @errorcode 15100008 + * @errorcode 15100006 * @errorcode 401 */ getEntries(deviceId: string, query: QueryV9, callback: AsyncCallback): void; @@ -2918,9 +2850,8 @@ declare namespace distributedData { * @returns Returns the {@code KvStoreResultSet} objects. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; @@ -2935,9 +2866,8 @@ declare namespace distributedData { * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(query: QueryV9, callback: AsyncCallback): void; @@ -2953,9 +2883,8 @@ declare namespace distributedData { * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(deviceId: string, query: QueryV9, callback: AsyncCallback): void; @@ -2971,9 +2900,8 @@ declare namespace distributedData { * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; @@ -2989,9 +2917,8 @@ declare namespace distributedData { * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; @@ -3005,7 +2932,6 @@ declare namespace distributedData { * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 * @errorcode 401 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; @@ -3020,9 +2946,8 @@ declare namespace distributedData { * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSize(query: QueryV9, callback: AsyncCallback): void; @@ -3038,9 +2963,8 @@ declare namespace distributedData { * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100008 + * @errorcode 15100003 + * @errorcode 15100006 * @errorcode 401 */ getResultSize(deviceId: string, query: QueryV9, callback: AsyncCallback): void; @@ -3056,8 +2980,7 @@ declare namespace distributedData { * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100004 - * @errorcode 15100008 + * @errorcode 15100006 * @errorcode 401 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; @@ -3077,10 +3000,8 @@ declare namespace distributedData { * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100006 * @errorcode 401 */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; @@ -3100,10 +3021,8 @@ declare namespace distributedData { * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 + * @errorcode 15100003 * @errorcode 15100004 - * @errorcode 15100005 - * @errorcode 15100006 * @errorcode 401 */ sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; @@ -3116,7 +3035,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -3131,10 +3049,8 @@ declare namespace distributedData { * @param listener Indicates the observer of data change events in the distributed database. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 - * @errorcode 15100008 - * @errorcode 15100009 + * @errorcode 15100006 + * @errorcode 15100007 * @errorcode 401 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -3147,10 +3063,7 @@ declare namespace distributedData { * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 - * @errorcode 15100008 - * @errorcode 15100010 + * @errorcode 15100006 * @errorcode 401 */ off(event:'dataChange', listener?: Callback): void; @@ -3160,7 +3073,6 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -3196,7 +3108,6 @@ declare namespace distributedData { * including the user information and package name. * @return Returns the {@code KVManagerV9} instance. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ function createKVManagerV9(config: KVManagerConfig, callback: AsyncCallback): void; @@ -3325,9 +3236,8 @@ declare namespace distributedData { * @return Returns a {@code KVStoreV9}, or {@code SingleKVStoreV9}. * @throws {BusinessError} if process failed. * @errorcode 15100001 + * @errorcode 15100002 * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 15100005 * @errorcode 401 */ getKVStore(storeId: string, options: Options): Promise; @@ -3348,7 +3258,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param kvStore Indicates the {@code KvStoreV9} database to close. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9, callback: AsyncCallback): void; @@ -3366,9 +3275,7 @@ declare namespace distributedData { * @param storeId Identifies the {@code KvStoreV9} database to delete. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 * @errorcode 15100004 - * @errorcode 15100006 * @errorcode 401 */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; @@ -3383,8 +3290,6 @@ declare namespace distributedData { * @returns Returns the storeId of all created {@code KvStore} databases. * @throws {BusinessError} if process failed. * @errorcode 15100001 - * @errorcode 15100002 - * @errorcode 15100004 * @errorcode 401 */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; @@ -3397,7 +3302,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; @@ -3409,7 +3313,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; -- Gitee From 6a1ed05461b8f9c7f14766df1a01f3baafb87f94 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Tue, 27 Sep 2022 16:40:57 +0800 Subject: [PATCH 04/22] add missed 401 errorcode Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index c42ebba9ea..53d1e0ad94 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -718,6 +718,8 @@ declare namespace distributedData { * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the * final position is invalid, false will be returned. * @returns Returns true if the operation succeeds; return false otherwise. + * @throws throws {BusinessError} if process failed. + * @errorcode 401 */ move(offset: number): boolean; /** @@ -727,6 +729,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param position Indicates the absolute position. * @returns Returns true if the operation succeeds; return false otherwise. + * @throws throws {BusinessError} if process failed. + * @errorcode 401 */ moveToPosition(position: number): boolean; /** @@ -1363,6 +1367,8 @@ declare namespace distributedData { * @param total Indicates the number of results. * @param offset Indicates the start position. * @returns Returns the {@coed QueryV9} object. + * @throws throws {BusinessError} if process failed. + * @errorcode 401 */ limit(total: number, offset: number): QueryV9; /** -- Gitee From 2177dee68ae061a2118da0054651be7e82cf7e83 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Wed, 28 Sep 2022 17:35:15 +0800 Subject: [PATCH 05/22] fix move v9 Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 30 +++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 53d1e0ad94..733000b591 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -711,6 +711,21 @@ declare namespace distributedData { * Moves the read position by a relative offset to the current position. * * @since 8 + * @deprecated since 9 + * @useinstead moveV9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a + * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, + * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, + * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the + * final position is invalid, false will be returned. + * @returns Returns true if the operation succeeds; return false otherwise. + */ + move(offset: number): boolean; + /** + * Moves the read position by a relative offset to the current position. + * + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, @@ -721,18 +736,29 @@ declare namespace distributedData { * @throws throws {BusinessError} if process failed. * @errorcode 401 */ - move(offset: number): boolean; + moveV9(offset: number): boolean; /** * Moves the read position from 0 to an absolute position. * * @since 8 + * @deprecated since 9 + * @useinstead moveToPositionV9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param position Indicates the absolute position. + * @returns Returns true if the operation succeeds; return false otherwise. + */ + moveToPosition(position: number): boolean; + /** + * Moves the read position from 0 to an absolute position. + * + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param position Indicates the absolute position. * @returns Returns true if the operation succeeds; return false otherwise. * @throws throws {BusinessError} if process failed. * @errorcode 401 */ - moveToPosition(position: number): boolean; + moveToPositionV9(position: number): boolean; /** * Checks whether the read position is the first line. * -- Gitee From ae5ce6147efa6c0bc005c0b5c068663a21626bc8 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Thu, 29 Sep 2022 16:03:11 +0800 Subject: [PATCH 06/22] api bugfix Signed-off-by: dboy190 --- 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 733000b591..4880dfb235 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -3047,7 +3047,7 @@ declare namespace distributedData { * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. - * @param query Indicates the {@code Query} object. + * @param query Indicates the {@code QueryV9} object. * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or * {@code PUSH_PULL}. * @permission ohos.permission.DISTRIBUTED_DATASYNC @@ -3057,7 +3057,7 @@ declare namespace distributedData { * @errorcode 15100004 * @errorcode 401 */ - sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; + sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; /** * Register Synchronizes DeviceKVStore databases callback. -- Gitee From 96442b73b608d185c0690ebe3c720eefde421142 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Mon, 10 Oct 2022 10:31:54 +0800 Subject: [PATCH 07/22] fix errorcode Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 51 ----------------------------- 1 file changed, 51 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 4880dfb235..b5e5087313 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -809,7 +809,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns a key-value pair. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100004 * @errorcode 15100006 */ @@ -1744,7 +1743,6 @@ declare namespace distributedData { * Spaces before and after the key will be cleared. * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -1761,7 +1759,6 @@ declare namespace distributedData { * @param value Indicates the data record to put. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -1777,7 +1774,6 @@ declare namespace distributedData { * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 15100006 @@ -1794,7 +1790,6 @@ declare namespace distributedData { * @param predicates Indicates the datasharePredicates. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 15100006 @@ -1810,7 +1805,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param file Indicates the name that saves the database backup. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100005 * @errorcode 15100006 * @errorcode 401 @@ -1825,7 +1819,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param file Indicates the name that saves the database file. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100005 * @errorcode 15100006 * @errorcode 401 @@ -1856,7 +1849,6 @@ declare namespace distributedData { * @throws {BusinessError} if process failed. * @errorcode 15100001 * @errorcode 15100006 - * @errorcode 15100007 * @errorcode 401 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -1878,7 +1870,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 * @errorcode 401 */ @@ -1901,7 +1892,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param entries Indicates the key-value pairs to be inserted in batches. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -1916,7 +1906,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param keys Indicates the key-value pairs to be deleted in batches. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 15100006 @@ -1933,7 +1922,6 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 */ startTransaction(callback: AsyncCallback): void; @@ -1946,7 +1934,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param callback * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 */ commit(callback: AsyncCallback): void; @@ -1958,7 +1945,6 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 */ rollback(callback: AsyncCallback): void; @@ -1972,7 +1958,6 @@ declare namespace distributedData { * @param enabled Specifies whether to enable synchronization. The value true means to enable * synchronization, and false means the opposite. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ enableSync(enabled: boolean, callback: AsyncCallback): void; @@ -1988,7 +1973,6 @@ declare namespace distributedData { * @param localLabels Indicates the synchronization labels of the local device. * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; @@ -2258,7 +2242,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 15100006 @@ -2276,7 +2259,6 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2293,7 +2275,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100005 * @errorcode 15100006 @@ -2314,7 +2295,6 @@ declare namespace distributedData { * @import N/A * @param keyPrefix Indicates the key prefix to match. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2330,7 +2310,6 @@ declare namespace distributedData { * @import N/A * @param query Indicates the {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2347,7 +2326,6 @@ declare namespace distributedData { * @param predicates Indicates the datasharePredicates. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2363,7 +2341,6 @@ declare namespace distributedData { * @import N/A * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; @@ -2378,7 +2355,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2394,7 +2370,6 @@ declare namespace distributedData { * @import N/A * @param deviceId Indicates the device to be removed data. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 * @errorcode 401 */ @@ -2411,7 +2386,6 @@ declare namespace distributedData { * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 401 @@ -2429,7 +2403,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 401 @@ -2447,7 +2420,6 @@ declare namespace distributedData { * @throws {BusinessError} if process failed. * @errorcode 15100001 * @errorcode 15100006 - * @errorcode 15100007 * @errorcode 401 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -2469,7 +2441,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 * @errorcode 401 */ @@ -2492,7 +2463,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; @@ -2505,7 +2475,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns SecurityLevel {@code SecurityLevel} the security level of the database. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 */ getSecurityLevel(callback: AsyncCallback): void; @@ -2806,7 +2775,6 @@ declare namespace distributedData { * @param key Indicates the key of the value to be queried. * @return Returns the value matching the given criteria. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 15100006 @@ -2824,7 +2792,6 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2840,7 +2807,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100005 * @errorcode 15100006 @@ -2858,7 +2824,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100005 * @errorcode 15100006 @@ -2881,7 +2846,6 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @returns Returns the {@code KvStoreResultSet} objects. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2897,7 +2861,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2914,7 +2877,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2931,7 +2893,6 @@ declare namespace distributedData { * @systemapi * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2948,7 +2909,6 @@ declare namespace distributedData { * @param deviceId Indicates the ID of the device to which the results belong. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2963,7 +2923,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; @@ -2977,7 +2936,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -2994,7 +2952,6 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100006 * @errorcode 401 @@ -3011,7 +2968,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 * @errorcode 401 */ @@ -3031,7 +2987,6 @@ declare namespace distributedData { * {@code PUSH_PULL}. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 401 @@ -3052,7 +3007,6 @@ declare namespace distributedData { * {@code PUSH_PULL}. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100003 * @errorcode 15100004 * @errorcode 401 @@ -3082,7 +3036,6 @@ declare namespace distributedData { * @throws {BusinessError} if process failed. * @errorcode 15100001 * @errorcode 15100006 - * @errorcode 15100007 * @errorcode 401 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -3094,7 +3047,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100006 * @errorcode 401 */ @@ -3267,7 +3219,6 @@ declare namespace distributedData { * and different applications can share the same value. * @return Returns a {@code KVStoreV9}, or {@code SingleKVStoreV9}. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100002 * @errorcode 15100003 * @errorcode 401 @@ -3306,7 +3257,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param storeId Identifies the {@code KvStoreV9} database to delete. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 15100004 * @errorcode 401 */ @@ -3321,7 +3271,6 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns the storeId of all created {@code KvStore} databases. * @throws {BusinessError} if process failed. - * @errorcode 15100001 * @errorcode 401 */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; -- Gitee From 4c611380454ada53c6f3d7e8e41fbe9e4b2bc986 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Thu, 13 Oct 2022 15:06:15 +0800 Subject: [PATCH 08/22] fix errorcodes descption Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 1460 ++++++++++++--------------- 1 file changed, 621 insertions(+), 839 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index b5e5087313..54bb425b82 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -20,43 +20,42 @@ import DataShareResultSet from './@ohos.data.DataShareResultSet'; import Context from './application/Context'; /** - * Providers interfaces to creat a {@link KVManager} istances. - * @since 7 + * Providers interfaces to creat a {@link KVManager} or {@link KVManagerV9} istances. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ - declare namespace distributedData { /** - * Provides configuration information for {@link KVManager} instances, + * Provides configuration information for {@link KVManager} or {@link KVManagerV9} instances, * including the caller's package name and distributed network type. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface KVManagerConfig { /** * Indicates the user information - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ userInfo: UserInfo; /** * Indicates the bundleName - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ bundleName: string; /** * Indicates the ability or hap context - * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @Note: if swap the area, you should close all the KV store and use the new Context to create the KVManager + * @since 9 */ context: Context; } @@ -67,24 +66,24 @@ declare namespace distributedData { *

This class provides methods for obtaining the user ID and type, setting the user ID and type, * and checking whether two users are the same. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface UserInfo { /** * Indicates the user ID to set - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ userId?: string; /** * Indicates the user type to set - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ userType?: UserType; } @@ -92,72 +91,73 @@ declare namespace distributedData { /** * Enumerates user types. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum UserType { /** * Indicates a user that logs in to different devices using the same account. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SAME_USER_ID = 0 } /** * KVStore constants - * @since 7 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ namespace Constants { /** * max key length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_KEY_LENGTH = 1024; /** * max value length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_VALUE_LENGTH = 4194303; /** * max device coordinate key length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_KEY_LENGTH_DEVICE = 896; /** * max store id length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_STORE_ID_LENGTH = 128; /** * max query length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_QUERY_LENGTH = 512000; /** * max batch operation size. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_BATCH_SIZE = 128; } @@ -167,83 +167,83 @@ declare namespace distributedData { * *

{@code ValueType} is obtained based on the value. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum ValueType { /** * Indicates that the value type is string. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ STRING = 0, /** * Indicates that the value type is int. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ INTEGER = 1, /** * Indicates that the value type is float. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ FLOAT = 2, /** * Indicates that the value type is byte array. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 * */ BYTE_ARRAY = 3, /** * Indicates that the value type is boolean. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 * */ BOOLEAN = 4, /** * Indicates that the value type is double. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ DOUBLE = 5 } /** - * Obtains {@code Value} objects stored in a {@link KVStore} database. + * Obtains {@code Value} objects stored in a {@link KVStore} or {@link KVStoreV9} database. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface Value { /** * Indicates value type - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @see ValueType * @type {number} * @memberof Value + * @since 7 */ type: ValueType; /** * Indicates value - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ value: Uint8Array | string | number | boolean; } @@ -251,23 +251,23 @@ declare namespace distributedData { /** * Provides key-value pairs stored in the distributed database. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface Entry { /** * Indicates key - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ key: string; /** * Indicates value - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ value: Value; } @@ -275,40 +275,40 @@ declare namespace distributedData { /** * Receives notifications of all data changes, including data insertion, update, and deletion. * - *

If you have subscribed to {@code KVStore}, you will receive data change notifications and obtain the changed data - * from the parameters in callback methods upon data insertion, update, or deletion. + *

If you have subscribed to {@code KVStore} or {@code KVStoreV9}, you will receive data change notifications and + * obtain the changed data from the parameters in callback methods upon data insertion, update, or deletion. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface ChangeNotification { /** * Indicates data addition records. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ insertEntries: Entry[]; /** * Indicates data update records. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ updateEntries: Entry[]; /** * Indicates data deletion records. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ deleteEntries: Entry[]; /** * Indicates from device id. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ deviceId: string; } @@ -316,30 +316,30 @@ declare namespace distributedData { /** * Indicates the database synchronization mode. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum SyncMode { /** * Indicates that data is only pulled from the remote end. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ PULL_ONLY = 0, /** * Indicates that data is only pushed from the local end. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ PUSH_ONLY = 1, /** * Indicates that data is pushed from the local end, and then pulled from the remote end. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ PUSH_PULL = 2 } @@ -347,83 +347,83 @@ declare namespace distributedData { /** * Describes the subscription type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum SubscribeType { /** * Subscription to local data changes - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SUBSCRIBE_TYPE_LOCAL = 0, /** * Subscription to remote data changes - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SUBSCRIBE_TYPE_REMOTE = 1, /** * Subscription to both local and remote data changes - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SUBSCRIBE_TYPE_ALL = 2, } /** - * Describes the {@code KVStore} type. + * Describes the {@code KVStore} or {@code KVStoreV9}type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum KVStoreType { /** - * Device-collaborated database, as specified by {@code DeviceKVStore} - * @since 7 + * Device-collaborated database, as specified by {@code DeviceKVStore} or {@code DeviceKVStoreV9} * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ DEVICE_COLLABORATION = 0, /** * Single-version database, as specified by {@code SingleKVStore} - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SINGLE_VERSION = 1, /** * Multi-version database, as specified by {@code MultiKVStore} - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ MULTI_VERSION = 2, } /** - * Describes the {@code KVStore} type. + * Describes the {@code KVStore} or {@code KVStoreV9} type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum SecurityLevel { /** * NO_LEVEL: mains not set the security level. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ NO_LEVEL = 0, @@ -431,9 +431,9 @@ declare namespace distributedData { * S0: mains the db is public. * There is no impact even if the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S0 = 1, @@ -441,9 +441,9 @@ declare namespace distributedData { * S1: mains the db is low level security * There are some low impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S1 = 2, @@ -451,9 +451,9 @@ declare namespace distributedData { * S2: mains the db is middle level security * There are some major impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S2 = 3, @@ -461,9 +461,9 @@ declare namespace distributedData { * S3: mains the db is high level security * There are some severity impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S3 = 5, @@ -471,72 +471,72 @@ declare namespace distributedData { * S4: mains the db is critical level security * There are some critical impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S4 = 6, } /** - * Provides configuration options for creating a {@code KVStore}. + * Provides configuration options for creating a {@code KVStore} or {@code KVStoreV9}. * - *

You can determine whether to create another database if a {@code KVStore} database is missing, - * whether to encrypt the database, and the database type. + *

You can determine whether to create another database if a {@code KVStore} or {@code KVStoreV9} database is + * missing, whether to encrypt the database, and the database type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface Options { /** * Indicates whether to createa database when the database file does not exist - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ createIfMissing?: boolean; /** * Indicates setting whether database files are encrypted - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ encrypt?: boolean; /** * Indicates setting whether to back up database files - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ backup?: boolean; /** * Indicates setting whether database files are automatically synchronized - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ autoSync?: boolean; /** * Indicates setting the databse type - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ kvStoreType?: KVStoreType; /** * Indicates setting the database security level - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ securityLevel?: SecurityLevel; /** * Indicates schema object - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 8 */ schema?: Schema; } @@ -546,44 +546,44 @@ declare namespace distributedData { * * You can create Schema objects and put them in Options when creating or opening the database. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 8 */ class Schema { /** * A constructor used to create a Schema instance. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ constructor() /** * Indicates the root json object. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ root: FieldNode; /** * Indicates the string array of json. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ indexes: Array; /** * Indicates the mode of schema. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ mode: number; /** * Indicates the skipsize of schema. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ skip: number; } @@ -597,17 +597,17 @@ declare namespace distributedData { * *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 8 */ class FieldNode { /** * A constructor used to create a FieldNode instance with the specified field. * name Indicates the field node name. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ constructor(name: string) /** @@ -615,514 +615,516 @@ declare namespace distributedData { * *

Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param child The field node to append. + * @param child The field node to append. * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ appendChild(child: FieldNode): boolean; /** * Indicates the default value of fieldnode. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ default: string; /** * Indicates the nullable of database field. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ nullable: boolean; /** * Indicates the type of value. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ type: number; } /** - * Provide methods to obtain the result set of the {@code KvStore} database. + * Provide methods to obtain the result set of the {@code KvStore} or {@code KvStoreV9} database. * - *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} class. This interface also provides - * methods for moving the data read position in the result set. + *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} or + * {@code DeviceKVStoreV9} class. This interface also provides methods for moving the data read position in the result set. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface KvStoreResultSet { /** * Obtains the number of lines in a result set. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns the number of lines. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getCount(): number; /** * Obtains the current read position in a result set. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns the current read position. The read position starts with 0. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getPosition(): number; /** * Moves the read position to the first line. * *

If the result set is empty, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToFirst(): boolean; /** * Moves the read position to the last line. * *

If the result set is empty, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToLast(): boolean; /** * Moves the read position to the next line. * *

If the result set is empty or the data in the last line is being read, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToNext(): boolean; /** * Moves the read position to the previous line. * *

If the result set is empty or the data in the first line is being read, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToPrevious(): boolean; /** * Moves the read position by a relative offset to the current position. * - * @since 8 - * @deprecated since 9 - * @useinstead moveV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the * final position is invalid, false will be returned. * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead moveV9 */ move(offset: number): boolean; /** * Moves the read position by a relative offset to the current position. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the * final position is invalid, false will be returned. * @returns Returns true if the operation succeeds; return false otherwise. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ moveV9(offset: number): boolean; /** * Moves the read position from 0 to an absolute position. * + * @param position Indicates the absolute position. + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 * @useinstead moveToPositionV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param position Indicates the absolute position. - * @returns Returns true if the operation succeeds; return false otherwise. */ moveToPosition(position: number): boolean; /** * Moves the read position from 0 to an absolute position. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param position Indicates the absolute position. * @returns Returns true if the operation succeeds; return false otherwise. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ moveToPositionV9(position: number): boolean; /** * Checks whether the read position is the first line. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns true if the read position is the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isFirst(): boolean; /** * Checks whether the read position is the last line. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns true if the read position is the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isLast(): boolean; /** * Checks whether the read position is before the last line. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns true if the read position is before the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isBeforeFirst(): boolean; /** * Checks whether the read position is after the last line. * - * @since 8 + * @returns Returns true if the read position is after the last line; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns true if the read position is after the last line; returns false otherwise. + * @since 8 */ isAfterLast(): boolean; /** * Obtains a key-value pair. * + * @returns Returns a key-value pair. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 * @useinstead getEntryV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns a key-value pair. */ getEntry(): Entry; /** * Obtains a key-value pair. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns a key-value pair. - * @throws {BusinessError} if process failed. - * @errorcode 15100004 - * @errorcode 15100006 + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getEntryV9(): Entry; } /** * Represents a database query using a predicate. - * + * *

This class provides a constructor used to create a {@code Query} instance, which is used to query data matching specified * conditions in the database. - * + * *

This class also provides methods for adding predicates to the {@code Query} instance. - * + * + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 * @useinstead QueryV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A */ class Query { /** * A constructor used to create a Query instance. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ - constructor() + constructor() /** * Resets this {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the reset {@code Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ reset(): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value IIndicates the long value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ equalTo(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ notEqualTo(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ greaterThan(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ lessThan(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ greaterThanOrEqualTo(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the * specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ lessThanOrEqualTo(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is null. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isNull(field: string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ inNumber(field: string, valueList: number[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ inString(field: string, valueList: string[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ notInNumber(field: string, valueList: number[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ notInString(field: string, valueList: string[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ like(field: string, value: string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ unlike(field: string, value: string): Query; /** * Constructs a {@code Query} object with the and condition. - * + * *

Multiple predicates should be connected using the and or or condition. - * - * @since 8 + * + * @returns Returns the {@coed Query} object. + * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @returns Returns the {@coed Query} object. + * @since 8 */ and(): Query; /** * Constructs a {@code Query} object with the or condition. - * + * *

Multiple predicates should be connected using the and or or condition. - * - * @since 8 + * + * @returns Returns the {@coed Query} object. + * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @returns Returns the {@coed Query} object. + * @since 8 */ or(): Query; /** * Constructs a {@code Query} object to sort the query results in ascending order. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ orderByAsc(field: string): Query; /** * Constructs a {@code Query} object to sort the query results in descending order. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ orderByDesc(field: string): Query; /** * Constructs a {@code Query} object to specify the number of results and the start position. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param total Indicates the number of results. * @param offset Indicates the start position. * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ limit(total: number, offset: number): Query; /** * Creates a {@code query} condition with a specified field that is not null. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the specified field. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isNotNull(field: string): Query; /** * Creates a query condition group with a left bracket. - * + * *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ beginGroup(): Query; /** * Creates a query condition group with a right bracket. - * + * *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ endGroup(): Query; /** * Creates a query condition with a specified key prefix. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param prefix Indicates the specified key prefix. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ prefixKey(prefix: string): Query; /** * Sets a specified index that will be preferentially used for query. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param index Indicates the index to set. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ setSuggestIndex(index: string): Query; /** * Add device ID key prefix.Used by {@code DeviceKVStore}. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param deviceId Specify device id to query from. * @return Returns the {@code Query} object with device ID prefix added. * @throw Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ deviceId(deviceId:string):Query; /** @@ -1130,11 +1132,11 @@ declare namespace distributedData { * *

The String would be parsed to DB query format. * The String length should be no longer than 500kb. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * + * @return String representing this {@code Query}. * @import N/A - * @return String representing this {@code Query}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getSqlLike():string; } @@ -1142,199 +1144,188 @@ declare namespace distributedData { /** * Represents a database query using a predicate. * - *

This class provides a constructor used to create a {@code QueryV9} instance, which is used to query data matching specified - * conditions in the database. + *

This class provides a constructor used to create a {@code QueryV9} instance, which is used to query data + * matching specified conditions in the database. * *

This class also provides methods for adding predicates to the {@code QueryV9} instance. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ class QueryV9 { /** * A constructor used to create a Query instance. * - * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ constructor() /** * Resets this {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @returns Returns the reset {@code QueryV9} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ reset(): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is equal to the specified long value. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value IIndicates the long value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ equalTo(field: string, value: number|string|boolean): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not equal to the specified int value. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ notEqualTo(field: string, value: number|string|boolean): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is greater than or equal to the * specified int value. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ greaterThan(field: string, value: number|string|boolean): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is less than the specified int value. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ lessThan(field: string, value: number|string): QueryV9; /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is greater than or equal to the - * specified int value. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * Constructs a {@code QueryV9} object to query entries with the specified field whose value is greater than or + * equal to the specified int value. + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ greaterThanOrEqualTo(field: string, value: number|string): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is less than or equal to the * specified int value. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ lessThanOrEqualTo(field: string, value: number|string): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is null. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ isNull(field: string): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is within the specified int value list. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ inNumber(field: string, valueList: number[]): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is within the specified string value list. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ inString(field: string, valueList: string[]): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not within the specified int value list. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ notInNumber(field: string, valueList: number[]): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not within the specified string value list. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ notInString(field: string, valueList: string[]): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is similar to the specified string value. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ like(field: string, value: string): QueryV9; /** * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not similar to the specified string value. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ unlike(field: string, value: string): QueryV9; /** @@ -1342,10 +1333,10 @@ declare namespace distributedData { * *

Multiple predicates should be connected using the and or or condition. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @returns Returns the {@coed QueryV9} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ and(): QueryV9; /** @@ -1353,59 +1344,55 @@ declare namespace distributedData { * *

Multiple predicates should be connected using the and or or condition. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @returns Returns the {@coed QueryV9} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ or(): QueryV9; /** * Constructs a {@code QueryV9} object to sort the query results in ascending order. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ orderByAsc(field: string): QueryV9; /** * Constructs a {@code QueryV9} object to sort the query results in descending order. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ orderByDesc(field: string): QueryV9; /** * Constructs a {@code QueryV9} object to specify the number of results and the start position. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param total Indicates the number of results. * @param offset Indicates the start position. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ limit(total: number, offset: number): QueryV9; /** * Creates a {@code QueryV9} condition with a specified field that is not null. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param field Indicates the specified field. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ isNotNull(field: string): QueryV9; /** @@ -1414,10 +1401,10 @@ declare namespace distributedData { *

Multiple query conditions in an {@code QueryV9} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @returns Returns the {@coed QueryV9} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ beginGroup(): QueryV9; /** @@ -1426,46 +1413,43 @@ declare namespace distributedData { *

Multiple query conditions in an {@code QueryV9} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @returns Returns the {@coed QueryV9} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ endGroup(): QueryV9; /** * Creates a query condition with a specified key prefix. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param prefix Indicates the specified key prefix. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ prefixKey(prefix: string): QueryV9; /** * Sets a specified index that will be preferentially used for query. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param index Indicates the index to set. * @returns Returns the {@coed QueryV9} object. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ setSuggestIndex(index: string): QueryV9; /** * Add device ID key prefix.Used by {@code DeviceKVStore}. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param deviceId Specify device id to query from. * @return Returns the {@code QueryV9} object with device ID prefix added. - * @throws throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ deviceId(deviceId:string):QueryV9; /** @@ -1474,10 +1458,10 @@ declare namespace distributedData { *

The String would be parsed to DB query format. * The String length should be no longer than 500kb. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @return String representing this {@code QueryV9}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getSqlLike():string; } @@ -1490,229 +1474,159 @@ declare namespace distributedData { * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, * including {@code SingleKVStore}. * + * + * @import N/A + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 * @useinstead KVStoreV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @version 1 */ interface KVStore { /** * Writes a key-value pair of the string type into the {@code KvStore} database. * *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ 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. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param value Indicates the data record to put. - * 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}. - */ - putBatch(value: Array, callback: AsyncCallback): void; - putBatch(value: Array): Promise; - /** * Deletes the key-value pair based on a specified key. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. - * 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}, and {@code KEY_NOT_FOUND}. - */ - delete(key: string, callback: AsyncCallback): void; - delete(key: string): Promise; - - /** - * Deletes the key-value pair based on a specified key. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @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: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); - delete(predicates: dataSharePredicates.DataSharePredicates): Promise; - - /** - * Backs up a database in a specified name. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param file Indicates the name that saves the database backup. - */ - backup(file:string, callback: AsyncCallback):void; - backup(file:string): Promise; - - /** - * Restores a database from a specified database file. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param file Indicates the name that saves the database file. - */ - restore(file:string, callback: AsyncCallback):void; - restore(file:string): Promise; - - /** - * Delete a backup files based on a specified name. - * - * @since 9 + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * 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}, and {@code KEY_NOT_FOUND}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param files list Indicates the name that backup file to delete. + * @since 7 */ - deleteBackup(files:Array, callback: AsyncCallback>):void; - deleteBackup(files:Array): Promise>; + delete(key: string, callback: AsyncCallback): void; + delete(key: string): Promise; /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws Throws this exception if any of the following errors + * @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}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** * Subscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws Throws this exception if any of the following errors + * + * @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}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ on(event: 'syncComplete', syncCallback: Callback>): void; - + /** * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws Throws this exception if any of the following errors + * @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', listener?: Callback): void; - - /** - * UnRegister Synchronizes {@code KvStore} database callback. - * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @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}. + * @since 8 */ - off(event: 'syncComplete', syncCallback?: Callback>): void; + off(event: 'dataChange', listener?: Callback): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param entries Indicates the key-value pairs to be inserted in batches. * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ putBatch(entries: Entry[], callback: AsyncCallback): void; putBatch(entries: Entry[]): Promise; /** * Deletes key-value pairs in batches from the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param keys Indicates the key-value pairs to be deleted in batches. * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ deleteBatch(keys: string[], callback: AsyncCallback): void; deleteBatch(keys: string[]): Promise; /** * Starts a transaction operation in the {@code KvStore} database. - * + * *

After the database transaction is started, you can submit or roll back the operation. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; /** * Submits a transaction operation in the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param callback + * + * @param callback * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ commit(callback: AsyncCallback): void; commit(): Promise; /** * Rolls back a transaction operation in the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ rollback(callback: AsyncCallback): void; rollback(): Promise; /** * Sets whether to enable synchronization. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param enabled Specifies whether to enable synchronization. The value true means to enable * synchronization, and false means the opposite. * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ enableSync(enabled: boolean, callback: AsyncCallback): void; enableSync(enabled: boolean): Promise; /** * Sets synchronization range labels. - * + * *

The labels determine the devices with which data will be synchronized. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param localLabels Indicates the synchronization labels of the local device. * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; @@ -1726,10 +1640,10 @@ declare namespace distributedData { * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, * including {@code SingleKVStoreV9}. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ interface KVStoreV9 { /** @@ -1737,15 +1651,14 @@ declare namespace distributedData { * *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. - * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; put(key: string, value: Uint8Array | string | number | boolean): Promise; @@ -1753,15 +1666,14 @@ declare namespace distributedData { /** * Writes a value of the valuesbucket type into the {@code KvStoreV9} database. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi * @param value Indicates the data record to put. * Spaces before and after the key will be cleared. - * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 */ putBatch(value: Array, callback: AsyncCallback): void; putBatch(value: Array): Promise; @@ -1769,15 +1681,14 @@ declare namespace distributedData { /** * Deletes the key-value pair based on a specified key. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. - * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ delete(key: string, callback: AsyncCallback): void; delete(key: string): Promise; @@ -1790,10 +1701,10 @@ declare namespace distributedData { * @param predicates Indicates the datasharePredicates. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); delete(predicates: dataSharePredicates.DataSharePredicates): Promise; @@ -1805,9 +1716,9 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param file Indicates the name that saves the database backup. * @throws {BusinessError} if process failed. - * @errorcode 15100005 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ backup(file:string, callback: AsyncCallback):void; backup(file:string): Promise; @@ -1819,9 +1730,9 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param file Indicates the name that saves the database file. * @throws {BusinessError} if process failed. - * @errorcode 15100005 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ restore(file:string, callback: AsyncCallback):void; restore(file:string): Promise; @@ -1833,7 +1744,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param files list Indicates the name that backup file to delete. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ deleteBackup(files:Array, callback: AsyncCallback>):void; deleteBackup(files:Array): Promise>; @@ -1847,9 +1758,9 @@ declare namespace distributedData { * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. * @throws {BusinessError} if process failed. - * @errorcode 15100001 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -1859,7 +1770,7 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -1870,8 +1781,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ off(event:'dataChange', listener?: Callback): void; @@ -1881,7 +1792,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param syncCallback Indicates the callback used to send the synchronization result to caller. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -1892,9 +1803,9 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param entries Indicates the key-value pairs to be inserted in batches. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ putBatch(entries: Entry[], callback: AsyncCallback): void; putBatch(entries: Entry[]): Promise; @@ -1906,10 +1817,10 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param keys Indicates the key-value pairs to be deleted in batches. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ deleteBatch(keys: string[], callback: AsyncCallback): void; deleteBatch(keys: string[]): Promise; @@ -1922,7 +1833,7 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 15100006 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; @@ -1934,7 +1845,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param callback * @throws {BusinessError} if process failed. - * @errorcode 15100006 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. */ commit(callback: AsyncCallback): void; commit(): Promise; @@ -1945,7 +1856,7 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 15100006 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. */ rollback(callback: AsyncCallback): void; rollback(): Promise; @@ -1958,7 +1869,7 @@ declare namespace distributedData { * @param enabled Specifies whether to enable synchronization. The value true means to enable * synchronization, and false means the opposite. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ enableSync(enabled: boolean, callback: AsyncCallback): void; enableSync(enabled: boolean): Promise; @@ -1968,12 +1879,12 @@ declare namespace distributedData { * *

The labels determine the devices with which data will be synchronized. * - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param localLabels Indicates the synchronization labels of the local device. * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; @@ -1999,7 +1910,7 @@ declare namespace distributedData { interface SingleKVStore extends KVStore { /** * Obtains the {@code String} value of a specified key. - * + * * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -2012,7 +1923,7 @@ declare namespace distributedData { /** * Obtains all key-value pairs that match a specified key prefix. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -2026,7 +1937,7 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching the specified {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -2044,10 +1955,10 @@ declare namespace distributedData { * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects * in a timely manner. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @import N/A * @param keyPrefix Indicates the key prefix to match. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. @@ -2057,10 +1968,10 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @import N/A * @param query Indicates the {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. @@ -2068,27 +1979,12 @@ declare namespace distributedData { getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; - /** - * Obtains the KvStoreResultSet object matching the specified Predicate object. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @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}. - */ - getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; - /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @import N/A * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. @@ -2098,10 +1994,10 @@ declare namespace distributedData { /** * Obtains the number of results matching the specified {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @import N/A * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, @@ -2112,7 +2008,7 @@ declare namespace distributedData { /** * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -2130,42 +2026,13 @@ declare namespace distributedData { * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * @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(deviceIds: string[], mode: SyncMode, delayMs?: number): void - - /** - * Synchronizes the database to the specified devices with the specified delay allowed. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param deviceIds 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 delayMs 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}, + * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. */ - sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; - - /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener Indicates the observer of data change events in the distributed database. - * @throws Throws this exception if no {@code SingleKvStore} database is available. - * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. - */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; /** - * Register Synchronizes SingleKvStore databases callback. + * Register Synchronizes SingleKvStore databases callback. *

Sync result is returned through asynchronous callback. * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -2174,17 +2041,6 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; - /** - * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param listener 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', listener?: Callback): void; - /** * UnRegister Synchronizes SingleKvStore databases callback. * @since 8 @@ -2192,11 +2048,10 @@ declare namespace distributedData { * @throws Throws this exception if no {@code SingleKvStore} database is available. */ off(event: 'syncComplete', syncCallback?: Callback>): void; - - + /** * Sets the default delay allowed for database synchronization - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. @@ -2208,7 +2063,7 @@ declare namespace distributedData { /** * Get the security level of the database. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns SecurityLevel {@code SecurityLevel} the security level of the database. @@ -2242,10 +2097,10 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ get(key: string, callback: AsyncCallback): void; get(key: string): Promise; @@ -2259,9 +2114,9 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getEntries(keyPrefix: string, callback: AsyncCallback): void; getEntries(keyPrefix: string): Promise; @@ -2275,10 +2130,10 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100005 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getEntries(query: QueryV9, callback: AsyncCallback): void; getEntries(query: QueryV9): Promise; @@ -2295,9 +2150,9 @@ declare namespace distributedData { * @import N/A * @param keyPrefix Indicates the key prefix to match. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; @@ -2310,9 +2165,9 @@ declare namespace distributedData { * @import N/A * @param query Indicates the {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(query: QueryV9, callback: AsyncCallback): void; getResultSet(query: QueryV9): Promise; @@ -2326,9 +2181,9 @@ declare namespace distributedData { * @param predicates Indicates the datasharePredicates. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; @@ -2341,7 +2196,7 @@ declare namespace distributedData { * @import N/A * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -2355,9 +2210,9 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSize(query: QueryV9, callback: AsyncCallback): void; getResultSize(query: QueryV9): Promise; @@ -2370,8 +2225,8 @@ declare namespace distributedData { * @import N/A * @param deviceId Indicates the device to be removed data. * @throws {BusinessError} if process failed. - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -2386,9 +2241,9 @@ declare namespace distributedData { * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 401 - if parameter check failed. */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void @@ -2403,9 +2258,9 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 401 - if parameter check failed. */ sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; @@ -2418,9 +2273,9 @@ declare namespace distributedData { * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. * @throws {BusinessError} if process failed. - * @errorcode 15100001 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -2431,7 +2286,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -2441,8 +2296,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ off(event:'dataChange', listener?: Callback): void; @@ -2451,7 +2306,7 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -2463,7 +2318,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; setSyncParam(defaultAllowedDelayMs: number): Promise; @@ -2471,11 +2326,11 @@ declare namespace distributedData { /** * Get the security level of the database. * - * @since 8 + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns SecurityLevel {@code SecurityLevel} the security level of the database. * @throws {BusinessError} if process failed. - * @errorcode 15100006 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. */ getSecurityLevel(callback: AsyncCallback): void; getSecurityLevel(): Promise; @@ -2483,12 +2338,12 @@ declare namespace distributedData { /** * Manages distributed data by device in a distributed system. - * + * *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. - * + * * @since 8 * @deprecated since 9 * @useinstead DeviceKVStoreV9 @@ -2512,7 +2367,7 @@ declare namespace distributedData { /** * Obtains all key-value pairs matching a specified device ID and key prefix. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. @@ -2526,7 +2381,7 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching the specified {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. @@ -2539,9 +2394,9 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. - * + * * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the key-value pairs belong. * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. @@ -2551,12 +2406,12 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. - * + * *

The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary * {@code KvStoreResultSet} objects in a timely manner. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. @@ -2570,7 +2425,7 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. @@ -2583,7 +2438,7 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. @@ -2593,39 +2448,9 @@ 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. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param predicates Indicates the datasharePredicates. - * @systemapi - * 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: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; - - /** - * Obtains the KvStoreResultSet object matching a specified Device ID and Predicate object. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param predicates Indicates the key. - * @param deviceId Indicates the ID of the device to which the results belong. - * 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: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; - /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param resultSet Indicates the {@code KvStoreResultSet} object to close. @@ -2637,7 +2462,7 @@ declare namespace distributedData { /** * Obtains the number of results matching the specified {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. @@ -2650,7 +2475,7 @@ declare namespace distributedData { /** * Obtains the number of results matching a specified device ID and {@code Query} object. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the results belong. @@ -2664,7 +2489,7 @@ declare namespace distributedData { * Removes data of a specified device from the current database. This method is used to remove only the data * synchronized from remote devices. This operation does not synchronize data to other databases or affect * subsequent data synchronization. - * + * * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. @@ -2673,7 +2498,7 @@ declare namespace distributedData { */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; - + /** * Synchronizes {@code DeviceKVStore} databases. * @@ -2690,26 +2515,9 @@ declare namespace distributedData { */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; - /** - * Synchronizes {@code DeviceKVStore} databases. - * - *

This method returns immediately and sync result will be returned through asynchronous callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param deviceIds Indicates the list of IDs of devices whose - * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * {@code DeviceKVStore} databases are to be synchronized. - * @param query Indicates the {@code Query} object. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or - * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws Throws this exception if no DeviceKVStore database is available. - */ - sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; - /** * Register Synchronizes DeviceKVStore databases callback. - * + * *

Sync result is returned through asynchronous callback. * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -2717,32 +2525,6 @@ 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. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener 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: 'dataChange', type: SubscribeType, listener: Callback): void; - - /** - * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param listener 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', listener?: Callback): void; /** * UnRegister Synchronizes DeviceKVStore databases callback. @@ -2775,10 +2557,10 @@ declare namespace distributedData { * @param key Indicates the key of the value to be queried. * @return Returns the value matching the given criteria. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ get(deviceId: string, key: string, callback: AsyncCallback): void; get(deviceId: string, key: string): Promise; @@ -2792,9 +2574,9 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getEntries(deviceId: string, keyPrefix: string): Promise; @@ -2807,10 +2589,10 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100005 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getEntries(query: QueryV9, callback: AsyncCallback): void; getEntries(query: QueryV9): Promise; @@ -2824,10 +2606,10 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100005 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getEntries(deviceId: string, query: QueryV9, callback: AsyncCallback): void; getEntries(deviceId: string, query: QueryV9): Promise; @@ -2846,9 +2628,9 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @returns Returns the {@code KvStoreResultSet} objects. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getResultSet(deviceId: string, keyPrefix: string): Promise; @@ -2861,9 +2643,9 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(query: QueryV9, callback: AsyncCallback): void; getResultSet(query: QueryV9): Promise; @@ -2877,9 +2659,9 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(deviceId: string, query: QueryV9, callback: AsyncCallback): void; getResultSet(deviceId: string, query: QueryV9): Promise; @@ -2893,9 +2675,9 @@ declare namespace distributedData { * @systemapi * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; @@ -2909,9 +2691,9 @@ declare namespace distributedData { * @param deviceId Indicates the ID of the device to which the results belong. * Spaces before and after the key will be cleared. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; @@ -2923,7 +2705,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -2936,9 +2718,9 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSize(query: QueryV9, callback: AsyncCallback): void; getResultSize(query: QueryV9): Promise; @@ -2952,9 +2734,9 @@ declare namespace distributedData { * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ getResultSize(deviceId: string, query: QueryV9, callback: AsyncCallback): void; getResultSize(deviceId: string, query: QueryV9): Promise; @@ -2968,8 +2750,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. * @throws {BusinessError} if process failed. - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -2987,9 +2769,9 @@ declare namespace distributedData { * {@code PUSH_PULL}. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 401 - if parameter check failed. */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; @@ -3007,9 +2789,9 @@ declare namespace distributedData { * {@code PUSH_PULL}. * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws {BusinessError} if process failed. - * @errorcode 15100003 - * @errorcode 15100004 - * @errorcode 401 + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 401 - if parameter check failed. */ sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; @@ -3021,7 +2803,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -3034,9 +2816,9 @@ declare namespace distributedData { * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. * @throws {BusinessError} if process failed. - * @errorcode 15100001 - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -3047,8 +2829,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. * @throws {BusinessError} if process failed. - * @errorcode 15100006 - * @errorcode 401 + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @throws {BusinessError} 401 - if parameter check failed. */ off(event:'dataChange', listener?: Callback): void; @@ -3057,7 +2839,7 @@ declare namespace distributedData { * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ off(event: 'syncComplete', syncCallback?: Callback>): void; } @@ -3068,7 +2850,7 @@ declare namespace distributedData { *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * - * @since 9 + * @since 7 * @deprecated since 9 * @useinstead createKVManagerV9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -3092,7 +2874,7 @@ declare namespace distributedData { * including the user information and package name. * @return Returns the {@code KVManagerV9} instance. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ function createKVManagerV9(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManagerV9(config: KVManagerConfig): Promise; @@ -3100,7 +2882,7 @@ declare namespace distributedData { /** * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. * - * @since 9 + * @since 7 * @deprecated since 9 * @useinstead KVManagerV9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -3219,9 +3001,9 @@ declare namespace distributedData { * and different applications can share the same value. * @return Returns a {@code KVStoreV9}, or {@code SingleKVStoreV9}. * @throws {BusinessError} if process failed. - * @errorcode 15100002 - * @errorcode 15100003 - * @errorcode 401 + * @throws {BusinessError} 15100002 - if open existed database with changed options. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 401 - if parameter check failed. */ getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; @@ -3241,7 +3023,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param kvStore Indicates the {@code KvStoreV9} database to close. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9, callback: AsyncCallback): void; closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9): Promise; @@ -3257,8 +3039,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param storeId Identifies the {@code KvStoreV9} database to delete. * @throws {BusinessError} if process failed. - * @errorcode 15100004 - * @errorcode 401 + * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 401 - if parameter check failed. */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; deleteKVStore(appId: string, storeId: string): Promise; @@ -3271,7 +3053,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns the storeId of all created {@code KvStore} databases. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; getAllKVStoreId(appId: string): Promise; @@ -3283,7 +3065,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; @@ -3294,7 +3076,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. * @throws {BusinessError} if process failed. - * @errorcode 401 + * @throws {BusinessError} 401 - if parameter check failed. */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } -- Gitee From 5f4c40ef1e351bcf3bd51159e44cf19175ac505f Mon Sep 17 00:00:00 2001 From: dboy190 Date: Thu, 13 Oct 2022 16:44:50 +0800 Subject: [PATCH 09/22] fix d.ts by new standard Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 654 +++++++++++++--------------- 1 file changed, 305 insertions(+), 349 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 54bb425b82..df8c5411d5 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -807,7 +807,7 @@ declare namespace distributedData { * Obtains a key-value pair. * * @returns Returns a key-value pair. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100004 - if the data not exist when get entry. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -1654,9 +1654,9 @@ declare namespace distributedData { * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1668,9 +1668,9 @@ declare namespace distributedData { * * @param value Indicates the data record to put. * Spaces before and after the key will be cleared. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi * @since 9 @@ -1683,10 +1683,10 @@ declare namespace distributedData { * * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1695,16 +1695,17 @@ declare namespace distributedData { /** * Deletes the key-value pair based on a specified key. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi + * * @param predicates Indicates the datasharePredicates. * Spaces before and after the key will be cleared. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); delete(predicates: dataSharePredicates.DataSharePredicates): Promise; @@ -1712,13 +1713,12 @@ declare namespace distributedData { /** * Backs up a database in a specified name. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param file Indicates the name that saves the database backup. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ backup(file:string, callback: AsyncCallback):void; backup(file:string): Promise; @@ -1726,13 +1726,12 @@ declare namespace distributedData { /** * Restores a database from a specified database file. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param file Indicates the name that saves the database file. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ restore(file:string, callback: AsyncCallback):void; restore(file:string): Promise; @@ -1740,11 +1739,10 @@ declare namespace distributedData { /** * Delete a backup files based on a specified name. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param files list Indicates the name that backup file to delete. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ deleteBackup(files:Array, callback: AsyncCallback>):void; deleteBackup(files:Array): Promise>; @@ -1753,59 +1751,55 @@ declare namespace distributedData { * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** * Subscribes from the {@code KvStoreV9} database based on the specified subscribeType and {@code KvStoreObserver}. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ on(event: 'syncComplete', syncCallback: Callback>): void; /** * Unsubscribes from the {@code KvStoreV9} database based on the specified subscribeType and {@code KvStoreObserver}. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ off(event:'dataChange', listener?: Callback): void; /** * UnRegister Synchronizes {@code KvStoreV9} database callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to caller. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ off(event: 'syncComplete', syncCallback?: Callback>): void; /** * Inserts key-value pairs into the {@code KvStoreV9} database in batches. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param entries Indicates the key-value pairs to be inserted in batches. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ putBatch(entries: Entry[], callback: AsyncCallback): void; putBatch(entries: Entry[]): Promise; @@ -1813,14 +1807,13 @@ declare namespace distributedData { /** * Deletes key-value pairs in batches from the {@code KvStoreV9} database. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param keys Indicates the key-value pairs to be deleted in batches. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ deleteBatch(keys: string[], callback: AsyncCallback): void; deleteBatch(keys: string[]): Promise; @@ -1830,10 +1823,9 @@ declare namespace distributedData { * *

After the database transaction is started, you can submit or roll back the operation. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws {BusinessError} if process failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; @@ -1841,11 +1833,10 @@ declare namespace distributedData { /** * Submits a transaction operation in the {@code KvStoreV9} database. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param callback - * @throws {BusinessError} if process failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ commit(callback: AsyncCallback): void; commit(): Promise; @@ -1853,10 +1844,9 @@ declare namespace distributedData { /** * Rolls back a transaction operation in the {@code KvStoreV9} database. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws {BusinessError} if process failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ rollback(callback: AsyncCallback): void; rollback(): Promise; @@ -1864,12 +1854,11 @@ declare namespace distributedData { /** * Sets whether to enable synchronization. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param enabled Specifies whether to enable synchronization. The value true means to enable * synchronization, and false means the opposite. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ enableSync(enabled: boolean, callback: AsyncCallback): void; enableSync(enabled: boolean): Promise; @@ -1879,12 +1868,11 @@ declare namespace distributedData { * *

The labels determine the devices with which data will be synchronized. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param localLabels Indicates the synchronization labels of the local device. * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; @@ -1900,23 +1888,23 @@ declare namespace distributedData { * The {@code SingleKVStore} database does not support * synchronous transactions, or data search using snapshots. * + * @import N/A + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 * @useinstead SingleKVStoreV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @version 1 */ interface SingleKVStore extends KVStore { /** * Obtains the {@code String} value of a specified key. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param key Indicates the key of the boolean value to be queried. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ get(key: string, callback: AsyncCallback): void; get(key: string): Promise; @@ -1924,13 +1912,13 @@ declare namespace distributedData { /** * Obtains all key-value pairs that match a specified key prefix. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getEntries(keyPrefix: string, callback: AsyncCallback): void; getEntries(keyPrefix: string): Promise; @@ -1938,13 +1926,13 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching the specified {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; @@ -1956,12 +1944,12 @@ declare namespace distributedData { * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects * in a timely manner. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param keyPrefix Indicates the key prefix to match. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; @@ -1969,12 +1957,12 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param query Indicates the {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; @@ -1982,12 +1970,12 @@ declare namespace distributedData { /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -1995,13 +1983,13 @@ declare namespace distributedData { /** * Obtains the number of results matching the specified {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; @@ -2009,9 +1997,9 @@ declare namespace distributedData { /** * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -2019,8 +2007,6 @@ declare namespace distributedData { /** * Synchronizes the database to the specified devices with the specified delay allowed. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. @@ -2028,35 +2014,39 @@ declare namespace distributedData { * @permission ohos.permission.DISTRIBUTED_DATASYNC * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; /** * Register Synchronizes SingleKvStore databases callback. *

Sync result is returned through asynchronous callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ on(event: 'syncComplete', syncCallback: Callback>): void; /** * UnRegister Synchronizes SingleKvStore databases callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ off(event: 'syncComplete', syncCallback?: Callback>): void; /** * Sets the default delay allowed for database synchronization * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; setSyncParam(defaultAllowedDelayMs: number): Promise; @@ -2064,11 +2054,11 @@ declare namespace distributedData { /** * Get the security level of the database. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns SecurityLevel {@code SecurityLevel} the security level of the database. * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, * {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getSecurityLevel(callback: AsyncCallback): void; getSecurityLevel(): Promise; @@ -2084,23 +2074,22 @@ declare namespace distributedData { * The {@code SingleKVStoreV9} database does not support * synchronous transactions, or data search using snapshots. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ interface SingleKVStoreV9 extends KVStoreV9 { /** * Obtains the {@code String} value of a specified key. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100004 - if the data not exist when query data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ get(key: string, callback: AsyncCallback): void; get(key: string): Promise; @@ -2108,15 +2097,14 @@ declare namespace distributedData { /** * Obtains all key-value pairs that match a specified key prefix. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs that match the specified key prefix. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getEntries(keyPrefix: string, callback: AsyncCallback): void; getEntries(keyPrefix: string): Promise; @@ -2124,35 +2112,33 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching the specified {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getEntries(query: QueryV9, callback: AsyncCallback): void; getEntries(query: QueryV9): Promise; /** - * Obtains the result sets with a specified prefix from a {@code KvStoreV9} database. The {@code KvStoreResultSet} object can be used to - * query all key-value pairs that meet the search criteria. Each {@code KvStoreV9} instance can have a maximum of four - * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a - * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects - * in a timely manner. + * Obtains the result sets with a specified prefix from a {@code KvStoreV9} database. The {@code KvStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStoreV9} + * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KvStoreResultSet} objects in a timely manner. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param keyPrefix Indicates the key prefix to match. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; @@ -2160,14 +2146,13 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param query Indicates the {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getResultSet(query: QueryV9, callback: AsyncCallback): void; getResultSet(query: QueryV9): Promise; @@ -2175,15 +2160,14 @@ declare namespace distributedData { /** * Obtains the KvStoreResultSet object matching the specified Predicate object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi * @param predicates Indicates the datasharePredicates. * Spaces before and after the key will be cleared. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 */ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; @@ -2191,12 +2175,11 @@ declare namespace distributedData { /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param resultSet Indicates the {@code KvStoreResultSet} object to close. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -2204,15 +2187,14 @@ declare namespace distributedData { /** * Obtains the number of results matching the specified {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getResultSize(query: QueryV9, callback: AsyncCallback): void; getResultSize(query: QueryV9): Promise; @@ -2220,13 +2202,12 @@ declare namespace distributedData { /** * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param deviceId Indicates the device to be removed data. - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -2234,33 +2215,31 @@ declare namespace distributedData { /** * Synchronizes the database to the specified devices with the specified delay allowed. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void /** * Synchronizes the database to the specified devices with the specified delay allowed. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. * @param query Indicates the {@code QueryV9} object. - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; @@ -2268,45 +2247,44 @@ declare namespace distributedData { * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** * Register Synchronizes SingleKvStore databases callback. *

Sync result is returned through asynchronous callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ on(event: 'syncComplete', syncCallback: Callback>): void; /** * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ off(event:'dataChange', listener?: Callback): void; /** * UnRegister Synchronizes SingleKvStore databases callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws {BusinessError} if process failed. + * * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -2314,11 +2292,10 @@ declare namespace distributedData { /** * Sets the default delay allowed for database synchronization * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; setSyncParam(defaultAllowedDelayMs: number): Promise; @@ -2326,11 +2303,10 @@ declare namespace distributedData { /** * Get the security level of the database. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns SecurityLevel {@code SecurityLevel} the security level of the database. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getSecurityLevel(callback: AsyncCallback): void; getSecurityLevel(): Promise; @@ -2344,23 +2320,23 @@ declare namespace distributedData { * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. * + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 * @deprecated since 9 * @useinstead DeviceKVStoreV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A */ interface DeviceKVStore extends KVStore { /** * Obtains the {@code String} value matching a specified device ID and key. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the device to be queried. * @param key Indicates the key of the value to be queried. * @return Returns the value matching the given criteria. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ get(deviceId: string, key: string, callback: AsyncCallback): void; get(deviceId: string, key: string): Promise; @@ -2368,13 +2344,13 @@ declare namespace distributedData { /** * Obtains all key-value pairs matching a specified device ID and key prefix. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getEntries(deviceId: string, keyPrefix: string): Promise; @@ -2382,24 +2358,24 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching the specified {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deviceId Indicates the ID of the device to which the key-value pairs belong. * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; getEntries(deviceId: string, query: Query): Promise; @@ -2412,13 +2388,13 @@ declare namespace distributedData { * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary * {@code KvStoreResultSet} objects in a timely manner. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the {@code KvStoreResultSet} objects. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getResultSet(deviceId: string, keyPrefix: string): Promise; @@ -2426,12 +2402,12 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; @@ -2439,11 +2415,11 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. * @param query Indicates the {@code Query} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSet(deviceId: string, query: Query): Promise; @@ -2451,11 +2427,11 @@ declare namespace distributedData { /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -2463,12 +2439,12 @@ declare namespace distributedData { /** * Obtains the number of results matching the specified {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; @@ -2476,11 +2452,11 @@ declare namespace distributedData { /** * Obtains the number of results matching a specified device ID and {@code Query} object. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the results belong. * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSize(deviceId: string, query: Query): Promise; @@ -2490,11 +2466,11 @@ declare namespace distributedData { * synchronized from remote devices. This operation does not synchronize data to other databases or affect * subsequent data synchronization. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -2503,15 +2479,16 @@ declare namespace distributedData { * Synchronizes {@code DeviceKVStore} databases. * *

This method returns immediately and sync result will be returned through asynchronous callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; @@ -2519,18 +2496,20 @@ declare namespace distributedData { * Register Synchronizes DeviceKVStore databases callback. * *

Sync result is returned through asynchronous callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ on(event: 'syncComplete', syncCallback: Callback>): void; /** * UnRegister Synchronizes DeviceKVStore databases callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ off(event: 'syncComplete', syncCallback?: Callback>): void; } @@ -2543,24 +2522,23 @@ declare namespace distributedData { * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ interface DeviceKVStoreV9 extends KVStoreV9 { /** * Obtains the {@code String} value matching a specified device ID and key. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the device to be queried. * @param key Indicates the key of the value to be queried. * @return Returns the value matching the given criteria. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @throws {BusinessError} 15100004 - if the data not exist when query data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ get(deviceId: string, key: string, callback: AsyncCallback): void; get(deviceId: string, key: string): Promise; @@ -2568,15 +2546,14 @@ declare namespace distributedData { /** * Obtains all key-value pairs matching a specified device ID and key prefix. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs meeting the given criteria. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getEntries(deviceId: string, keyPrefix: string): Promise; @@ -2584,15 +2561,14 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching the specified {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getEntries(query: QueryV9, callback: AsyncCallback): void; getEntries(query: QueryV9): Promise; @@ -2600,16 +2576,15 @@ declare namespace distributedData { /** * Obtains the list of key-value pairs matching a specified device ID and {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the key-value pairs belong. * @param query Indicates the {@code QueryV9} object. * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getEntries(deviceId: string, query: QueryV9, callback: AsyncCallback): void; getEntries(deviceId: string, query: QueryV9): Promise; @@ -2622,15 +2597,14 @@ declare namespace distributedData { * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary * {@code KvStoreResultSet} objects in a timely manner. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the {@code KvStoreResultSet} objects. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getResultSet(deviceId: string, keyPrefix: string): Promise; @@ -2638,14 +2612,13 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code QueryV9} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getResultSet(query: QueryV9, callback: AsyncCallback): void; getResultSet(query: QueryV9): Promise; @@ -2653,15 +2626,14 @@ declare namespace distributedData { /** * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. * @param query Indicates the {@code QueryV9} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getResultSet(deviceId: string, query: QueryV9, callback: AsyncCallback): void; getResultSet(deviceId: string, query: QueryV9): Promise; @@ -2669,31 +2641,28 @@ declare namespace distributedData { /** * Obtains the KvStoreResultSet object matching the specified Predicate object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param predicates Indicates the datasharePredicates. - * @systemapi - * Spaces before and after the key will be cleared. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 */ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; /** * Obtains the KvStoreResultSet object matching a specified Device ID and Predicate object. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi + * * @param predicates Indicates the key. * @param deviceId Indicates the ID of the device to which the results belong. - * Spaces before and after the key will be cleared. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 */ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; @@ -2701,11 +2670,10 @@ declare namespace distributedData { /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param resultSet Indicates the {@code KvStoreResultSet} object to close. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -2713,14 +2681,13 @@ declare namespace distributedData { /** * Obtains the number of results matching the specified {@code QueryV9} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getResultSize(query: QueryV9, callback: AsyncCallback): void; getResultSize(query: QueryV9): Promise; @@ -2728,15 +2695,14 @@ declare namespace distributedData { /** * Obtains the number of results matching a specified device ID and {@code Query} object. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the results belong. * @param query Indicates the {@code QueryV9} object. * @returns Returns the number of results matching the specified {@code QueryV9} object. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ getResultSize(deviceId: string, query: QueryV9, callback: AsyncCallback): void; getResultSize(deviceId: string, query: QueryV9): Promise; @@ -2746,12 +2712,11 @@ declare namespace distributedData { * synchronized from remote devices. This operation does not synchronize data to other databases or affect * subsequent data synchronization. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -2760,18 +2725,17 @@ declare namespace distributedData { * Synchronizes {@code DeviceKVStore} databases. * *

This method returns immediately and sync result will be returned through asynchronous callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or - * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; @@ -2779,19 +2743,18 @@ declare namespace distributedData { * Synchronizes {@code DeviceKVStore} databases. * *

This method returns immediately and sync result will be returned through asynchronous callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. * @param query Indicates the {@code QueryV9} object. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or - * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; @@ -2799,11 +2762,11 @@ declare namespace distributedData { * Register Synchronizes DeviceKVStore databases callback. * *

Sync result is returned through asynchronous callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -2811,35 +2774,33 @@ declare namespace distributedData { * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ off(event:'dataChange', listener?: Callback): void; /** * UnRegister Synchronizes DeviceKVStore databases callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws {BusinessError} if process failed. + * * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ off(event: 'syncComplete', syncCallback?: Callback>): void; } @@ -2850,14 +2811,14 @@ declare namespace distributedData { *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * - * @since 7 - * @deprecated since 9 - * @useinstead createKVManagerV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param config Indicates the {@link KVStore} configuration information, * including the user information and package name. * @return Returns the {@code KVManager} instance. * @throws Throws exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead createKVManagerV9 */ function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManager(config: KVManagerConfig): Promise; @@ -2868,13 +2829,12 @@ declare namespace distributedData { *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManagerV9} instance. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param config Indicates the {@link KVStoreV9} configuration information, * including the user information and package name. * @return Returns the {@code KVManagerV9} instance. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ function createKVManagerV9(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManagerV9(config: KVManagerConfig): Promise; @@ -2882,25 +2842,25 @@ declare namespace distributedData { /** * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. * + * @import N/A + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 * @useinstead KVManagerV9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @version 1 */ interface KVManager { /** * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. * @param storeId Identifies the {@code KVStore} database. * The value of this parameter must be unique for the same application, * and different applications can share the same value. * @return Returns a {@code KVStore}, or {@code SingleKVStore}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; @@ -2915,14 +2875,14 @@ declare namespace distributedData { * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStore}, * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error * will be returned. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param kvStore Indicates the {@code KvStore} database to close. * @throws Throws this exception if any of the following errors * occurs:{@code INVALID_ARGUMENT}, {@code ERVER_UNAVAILABLE}, * {@code STORE_NOT_OPEN}, {@code STORE_NOT_FOUND}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; @@ -2934,13 +2894,14 @@ declare namespace distributedData { * *

You can use this method to delete a {@code KvStore} database not in use. After the database is deleted, all its data will be * lost. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param storeId Identifies the {@code KvStore} database to delete. * @throws Throws this exception if any of the following errors * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code STORE_NOT_FOUND}, * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; deleteKVStore(appId: string, storeId: string): Promise; @@ -2949,12 +2910,12 @@ declare namespace distributedData { * Obtains the storeId of all {@code KvStore} databases that are created by using the {@code getKvStore} method and not deleted by * calling the {@code deleteKvStore} method. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns the storeId of all created {@code KvStore} databases. + * @returns Returns the storeId of all created {@code KvStore} databases. * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; getAllKVStoreId(appId: string): Promise; @@ -2962,20 +2923,20 @@ declare namespace distributedData { /** * register DeviceChangeCallback to get notification when device's status changed * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; /** * unRegister DeviceChangeCallback and can not receive notification * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } @@ -2983,27 +2944,26 @@ declare namespace distributedData { /** * Provides interfaces to manage a {@code KVStoreV9} database, including obtaining, closing, and deleting the {@code KVStoreV9}. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ interface KVManagerV9 { /** * Creates and obtains a {@code KVStoreV9} database by specifying {@code Options} and {@code storeId}. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param options Indicates the options used for creating and obtaining the {@code KVStoreV9} database, * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. * @param storeId Identifies the {@code KVStoreV9} database. * The value of this parameter must be unique for the same application, * and different applications can share the same value. * @return Returns a {@code KVStoreV9}, or {@code SingleKVStoreV9}. - * @throws {BusinessError} if process failed. + * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100002 - if open existed database with changed options. * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; @@ -3014,16 +2974,15 @@ declare namespace distributedData { *

Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your * thread may crash. * - *

The {@code KvStoreV9} database to close must be an object created by using the {@code getKvStoreV9} method. Before using this + *

The {@code KvStoreV9} database to close must be an object created by using the {@code getKvStore} method. Before using this * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStoreV9}, * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error * will be returned. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param kvStore Indicates the {@code KvStoreV9} database to close. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9, callback: AsyncCallback): void; closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9): Promise; @@ -3035,25 +2994,24 @@ declare namespace distributedData { * *

You can use this method to delete a {@code KvStoreV9} database not in use. After the database is deleted, all its data will be * lost. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param storeId Identifies the {@code KvStoreV9} database to delete. - * @throws {BusinessError} if process failed. - * @throws {BusinessError} 15100004 - if the database not exist when delete database or the data not exist when query or delete data. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100004 - if the database not exist when delete database. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; deleteKVStore(appId: string, storeId: string): Promise; /** - * Obtains the storeId of all {@code KvStoreV9} databases that are created by using the {@code getKvStoreV9} method and not deleted by + * Obtains the storeId of all {@code KvStoreV9} databases that are created by using the {@code getKvStore} method and not deleted by * calling the {@code deleteKvStore} method. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns the storeId of all created {@code KvStore} databases. - * @throws {BusinessError} if process failed. + * @returns Returns the storeId of all created {@code KvStoreV9} databases. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; getAllKVStoreId(appId: string): Promise; @@ -3061,22 +3019,20 @@ declare namespace distributedData { /** * register DeviceChangeCallback to get notification when device's status changed * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; /** * unRegister DeviceChangeCallback and can not receive notification * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. - * @throws {BusinessError} if process failed. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } -- Gitee From 466a8caad725e106df720d3cc7985608da4ac7f2 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Thu, 13 Oct 2022 21:56:33 +0800 Subject: [PATCH 10/22] add new package kvstore Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 2314 +++++++-------------------- api/@ohos.data.kvStore.d.ts | 1976 +++++++++++++++++++++++ 2 files changed, 2590 insertions(+), 1700 deletions(-) create mode 100644 api/@ohos.data.kvStore.d.ts diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index df8c5411d5..e020a04031 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -20,42 +20,43 @@ import DataShareResultSet from './@ohos.data.DataShareResultSet'; import Context from './application/Context'; /** - * Providers interfaces to creat a {@link KVManager} or {@link KVManagerV9} istances. + * Providers interfaces to creat a {@link KVManager} istances. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A - * @since 7 */ + declare namespace distributedData { /** - * Provides configuration information for {@link KVManager} or {@link KVManagerV9} instances, + * Provides configuration information for {@link KVManager} instances, * including the caller's package name and distributed network type. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ interface KVManagerConfig { /** * Indicates the user information + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ userInfo: UserInfo; /** * Indicates the bundleName + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ bundleName: string; /** * Indicates the ability or hap context + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @Note: if swap the area, you should close all the KV store and use the new Context to create the KVManager - * @since 9 */ context: Context; } @@ -66,24 +67,24 @@ declare namespace distributedData { *

This class provides methods for obtaining the user ID and type, setting the user ID and type, * and checking whether two users are the same. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ interface UserInfo { /** * Indicates the user ID to set + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ userId?: string; /** * Indicates the user type to set + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ userType?: UserType; } @@ -91,73 +92,72 @@ declare namespace distributedData { /** * Enumerates user types. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ enum UserType { /** * Indicates a user that logs in to different devices using the same account. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ SAME_USER_ID = 0 } /** * KVStore constants - * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ namespace Constants { /** * max key length. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ const MAX_KEY_LENGTH = 1024; /** * max value length. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ const MAX_VALUE_LENGTH = 4194303; /** * max device coordinate key length. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ const MAX_KEY_LENGTH_DEVICE = 896; /** * max store id length. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ const MAX_STORE_ID_LENGTH = 128; /** * max query length. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ const MAX_QUERY_LENGTH = 512000; /** * max batch operation size. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ const MAX_BATCH_SIZE = 128; } @@ -167,83 +167,83 @@ declare namespace distributedData { * *

{@code ValueType} is obtained based on the value. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ enum ValueType { /** * Indicates that the value type is string. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ STRING = 0, /** * Indicates that the value type is int. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ INTEGER = 1, /** * Indicates that the value type is float. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ FLOAT = 2, /** * Indicates that the value type is byte array. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 * */ BYTE_ARRAY = 3, /** * Indicates that the value type is boolean. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 * */ BOOLEAN = 4, /** * Indicates that the value type is double. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ DOUBLE = 5 } /** - * Obtains {@code Value} objects stored in a {@link KVStore} or {@link KVStoreV9} database. + * Obtains {@code Value} objects stored in a {@link KVStore} database. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ interface Value { /** * Indicates value type + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @see ValueType * @type {number} * @memberof Value - * @since 7 */ type: ValueType; /** * Indicates value + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ value: Uint8Array | string | number | boolean; } @@ -251,23 +251,23 @@ declare namespace distributedData { /** * Provides key-value pairs stored in the distributed database. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ interface Entry { /** * Indicates key + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ key: string; /** * Indicates value + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ value: Value; } @@ -275,40 +275,40 @@ declare namespace distributedData { /** * Receives notifications of all data changes, including data insertion, update, and deletion. * - *

If you have subscribed to {@code KVStore} or {@code KVStoreV9}, you will receive data change notifications and - * obtain the changed data from the parameters in callback methods upon data insertion, update, or deletion. + *

If you have subscribed to {@code KVStore}, you will receive data change notifications and obtain the changed data + * from the parameters in callback methods upon data insertion, update, or deletion. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ interface ChangeNotification { /** * Indicates data addition records. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ insertEntries: Entry[]; /** * Indicates data update records. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ updateEntries: Entry[]; /** * Indicates data deletion records. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ deleteEntries: Entry[]; /** * Indicates from device id. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ deviceId: string; } @@ -316,30 +316,30 @@ declare namespace distributedData { /** * Indicates the database synchronization mode. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ enum SyncMode { /** * Indicates that data is only pulled from the remote end. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ PULL_ONLY = 0, /** * Indicates that data is only pushed from the local end. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ PUSH_ONLY = 1, /** * Indicates that data is pushed from the local end, and then pulled from the remote end. + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ PUSH_PULL = 2 } @@ -347,83 +347,83 @@ declare namespace distributedData { /** * Describes the subscription type. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ enum SubscribeType { /** * Subscription to local data changes + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ SUBSCRIBE_TYPE_LOCAL = 0, /** * Subscription to remote data changes + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ SUBSCRIBE_TYPE_REMOTE = 1, /** * Subscription to both local and remote data changes + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ SUBSCRIBE_TYPE_ALL = 2, } /** - * Describes the {@code KVStore} or {@code KVStoreV9}type. + * Describes the {@code KVStore} type. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ enum KVStoreType { /** - * Device-collaborated database, as specified by {@code DeviceKVStore} or {@code DeviceKVStoreV9} + * Device-collaborated database, as specified by {@code DeviceKVStore} + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A - * @since 7 */ DEVICE_COLLABORATION = 0, /** * Single-version database, as specified by {@code SingleKVStore} + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ SINGLE_VERSION = 1, /** * Multi-version database, as specified by {@code MultiKVStore} + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A - * @since 7 */ MULTI_VERSION = 2, } /** - * Describes the {@code KVStore} or {@code KVStoreV9} type. + * Describes the {@code KVStore} type. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ enum SecurityLevel { /** * NO_LEVEL: mains not set the security level. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A - * @since 7 */ NO_LEVEL = 0, @@ -431,9 +431,9 @@ declare namespace distributedData { * S0: mains the db is public. * There is no impact even if the data is leaked. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ S0 = 1, @@ -441,9 +441,9 @@ declare namespace distributedData { * S1: mains the db is low level security * There are some low impact, when the data is leaked. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ S1 = 2, @@ -451,9 +451,9 @@ declare namespace distributedData { * S2: mains the db is middle level security * There are some major impact, when the data is leaked. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ S2 = 3, @@ -461,9 +461,9 @@ declare namespace distributedData { * S3: mains the db is high level security * There are some severity impact, when the data is leaked. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ S3 = 5, @@ -471,72 +471,72 @@ declare namespace distributedData { * S4: mains the db is critical level security * There are some critical impact, when the data is leaked. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ S4 = 6, } /** - * Provides configuration options for creating a {@code KVStore} or {@code KVStoreV9}. + * Provides configuration options for creating a {@code KVStore}. * - *

You can determine whether to create another database if a {@code KVStore} or {@code KVStoreV9} database is - * missing, whether to encrypt the database, and the database type. + *

You can determine whether to create another database if a {@code KVStore} database is missing, + * whether to encrypt the database, and the database type. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ interface Options { /** * Indicates whether to createa database when the database file does not exist + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ createIfMissing?: boolean; /** * Indicates setting whether database files are encrypted + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ encrypt?: boolean; /** * Indicates setting whether to back up database files + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ backup?: boolean; /** * Indicates setting whether database files are automatically synchronized - * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @import N/A - * @since 7 */ autoSync?: boolean; /** * Indicates setting the databse type + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ kvStoreType?: KVStoreType; /** * Indicates setting the database security level + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ securityLevel?: SecurityLevel; /** * Indicates schema object + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A - * @since 8 */ schema?: Schema; } @@ -546,44 +546,44 @@ declare namespace distributedData { * * You can create Schema objects and put them in Options when creating or opening the database. * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A - * @since 8 */ class Schema { /** * A constructor used to create a Schema instance. * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ constructor() /** * Indicates the root json object. * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ root: FieldNode; /** * Indicates the string array of json. * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ indexes: Array; /** * Indicates the mode of schema. * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ mode: number; /** * Indicates the skipsize of schema. * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ skip: number; } @@ -597,17 +597,17 @@ declare namespace distributedData { * *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A - * @since 8 */ class FieldNode { /** * A constructor used to create a FieldNode instance with the specified field. * name Indicates the field node name. * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ constructor(name: string) /** @@ -615,516 +615,469 @@ declare namespace distributedData { * *

Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. * - * @param child The field node to append. - * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param child The field node to append. + * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. */ appendChild(child: FieldNode): boolean; /** * Indicates the default value of fieldnode. - * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ default: string; /** * Indicates the nullable of database field. - * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ nullable: boolean; /** * Indicates the type of value. - * - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore */ type: number; } /** - * Provide methods to obtain the result set of the {@code KvStore} or {@code KvStoreV9} database. + * Provide methods to obtain the result set of the {@code KvStore} database. * - *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} or - * {@code DeviceKVStoreV9} class. This interface also provides methods for moving the data read position in the result set. + *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} class. This interface also provides + * methods for moving the data read position in the result set. * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A - * @since 7 */ interface KvStoreResultSet { /** * Obtains the number of lines in a result set. * - * @returns Returns the number of lines. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns the number of lines. */ getCount(): number; /** * Obtains the current read position in a result set. * - * @returns Returns the current read position. The read position starts with 0. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns the current read position. The read position starts with 0. */ getPosition(): number; /** * Moves the read position to the first line. * *

If the result set is empty, false is returned. - * - * @returns Returns true if the operation succeeds; return false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns true if the operation succeeds; return false otherwise. */ moveToFirst(): boolean; /** * Moves the read position to the last line. * *

If the result set is empty, false is returned. - * - * @returns Returns true if the operation succeeds; return false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns true if the operation succeeds; return false otherwise. */ moveToLast(): boolean; /** * Moves the read position to the next line. * *

If the result set is empty or the data in the last line is being read, false is returned. - * - * @returns Returns true if the operation succeeds; return false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns true if the operation succeeds; return false otherwise. */ moveToNext(): boolean; /** * Moves the read position to the previous line. * *

If the result set is empty or the data in the first line is being read, false is returned. - * - * @returns Returns true if the operation succeeds; return false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns true if the operation succeeds; return false otherwise. */ moveToPrevious(): boolean; /** * Moves the read position by a relative offset to the current position. * - * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a - * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, - * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, - * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the - * final position is invalid, false will be returned. - * @returns Returns true if the operation succeeds; return false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 - * @deprecated since 9 - * @useinstead moveV9 - */ - move(offset: number): boolean; - /** - * Moves the read position by a relative offset to the current position. - * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the * final position is invalid, false will be returned. * @returns Returns true if the operation succeeds; return false otherwise. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 */ - moveV9(offset: number): boolean; + move(offset: number): boolean; /** * Moves the read position from 0 to an absolute position. * - * @param position Indicates the absolute position. - * @returns Returns true if the operation succeeds; return false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 - * @deprecated since 9 - * @useinstead moveToPositionV9 - */ - moveToPosition(position: number): boolean; - /** - * Moves the read position from 0 to an absolute position. - * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param position Indicates the absolute position. * @returns Returns true if the operation succeeds; return false otherwise. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 */ - moveToPositionV9(position: number): boolean; + moveToPosition(position: number): boolean; /** * Checks whether the read position is the first line. * - * @returns Returns true if the read position is the first line; returns false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + + * @returns Returns true if the read position is the first line; returns false otherwise. */ isFirst(): boolean; /** * Checks whether the read position is the last line. * - * @returns Returns true if the read position is the last line; returns false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns true if the read position is the last line; returns false otherwise. */ isLast(): boolean; /** * Checks whether the read position is before the last line. * - * @returns Returns true if the read position is before the first line; returns false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns true if the read position is before the first line; returns false otherwise. */ isBeforeFirst(): boolean; /** * Checks whether the read position is after the last line. * - * @returns Returns true if the read position is after the last line; returns false otherwise. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns true if the read position is after the last line; returns false otherwise. */ isAfterLast(): boolean; /** * Obtains a key-value pair. * - * @returns Returns a key-value pair. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 - * @deprecated since 9 - * @useinstead getEntryV9 - */ - getEntry(): Entry; - /** - * Obtains a key-value pair. - * - * @returns Returns a key-value pair. - * @throws {BusinessError} 15100004 - if the data not exist when get entry. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @returns Returns a key-value pair. */ - getEntryV9(): Entry; + getEntry(): Entry; } /** * Represents a database query using a predicate. - * + * *

This class provides a constructor used to create a {@code Query} instance, which is used to query data matching specified * conditions in the database. - * + * *

This class also provides methods for adding predicates to the {@code Query} instance. - * - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 - * @deprecated since 9 - * @useinstead QueryV9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A */ class Query { /** * A constructor used to create a Query instance. - * - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core */ - constructor() + constructor() /** * Resets this {@code Query} object. - * - * @returns Returns the reset {@code Query} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the reset {@code Query} object. */ reset(): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value IIndicates the long value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ equalTo(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ notEqualTo(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ greaterThan(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ lessThan(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ greaterThanOrEqualTo(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the * specified int value. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ lessThanOrEqualTo(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is null. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ isNull(field: string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ inNumber(field: string, valueList: number[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. - * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ inString(field: string, valueList: string[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. - * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @throws Throws this exception if input is invalid. */ notInNumber(field: string, valueList: number[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. */ notInString(field: string, valueList: string[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. */ like(field: string, value: string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. */ unlike(field: string, value: string): Query; /** * Constructs a {@code Query} object with the and condition. - * + * *

Multiple predicates should be connected using the and or or condition. - * - * @returns Returns the {@coed Query} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed Query} object. */ and(): Query; /** * Constructs a {@code Query} object with the or condition. - * + * *

Multiple predicates should be connected using the and or or condition. - * - * @returns Returns the {@coed Query} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed Query} object. */ or(): Query; /** * Constructs a {@code Query} object to sort the query results in ascending order. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. */ orderByAsc(field: string): Query; /** * Constructs a {@code Query} object to sort the query results in descending order. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @throws Throws this exception if input is invalid. */ orderByDesc(field: string): Query; /** * Constructs a {@code Query} object to specify the number of results and the start position. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param total Indicates the number of results. * @param offset Indicates the start position. * @returns Returns the {@coed Query} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ limit(total: number, offset: number): Query; /** * Creates a {@code query} condition with a specified field that is not null. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param field Indicates the specified field. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @throws Throws this exception if input is invalid. */ isNotNull(field: string): Query; /** * Creates a query condition group with a left bracket. - * + * *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @returns Returns the {@coed Query} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed Query} object. */ beginGroup(): Query; /** * Creates a query condition group with a right bracket. - * + * *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @returns Returns the {@coed Query} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @returns Returns the {@coed Query} object. */ endGroup(): Query; /** * Creates a query condition with a specified key prefix. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param prefix Indicates the specified key prefix. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @throws Throws this exception if input is invalid. */ prefixKey(prefix: string): Query; /** * Sets a specified index that will be preferentially used for query. * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param index Indicates the index to set. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @throws Throws this exception if input is invalid. */ setSuggestIndex(index: string): Query; /** * Add device ID key prefix.Used by {@code DeviceKVStore}. * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param deviceId Specify device id to query from. * @return Returns the {@code Query} object with device ID prefix added. * @throw Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ deviceId(deviceId:string):Query; /** @@ -1132,593 +1085,95 @@ declare namespace distributedData { * *

The String would be parsed to DB query format. * The String length should be no longer than 500kb. - * - * @return String representing this {@code Query}. - * @import N/A + * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @import N/A + * @return String representing this {@code Query}. */ getSqlLike():string; } /** - * Represents a database query using a predicate. - * - *

This class provides a constructor used to create a {@code QueryV9} instance, which is used to query data - * matching specified conditions in the database. + * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, + * and subscribing to distributed data. * - *

This class also provides methods for adding predicates to the {@code QueryV9} instance. + *

You can create distributed databases of different types by {@link KVManager#getKVStore (Options, String)} + * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, + * including {@code SingleKVStore}. * - * @import N/A + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @import N/A + * @version 1 */ - class QueryV9 { + interface KVStore { /** - * A constructor used to create a Query instance. + * Writes a key-value pair of the string type into the {@code KvStore} database. * + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}. */ - constructor() - /** - * Resets this {@code QueryV9} object. - * - * @returns Returns the reset {@code QueryV9} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + 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. + * * @since 9 - */ - reset(): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is equal to the specified long value. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value IIndicates the long value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @systemapi + * @param value Indicates the data record to put. + * 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}. */ - equalTo(field: string, value: number|string|boolean): QueryV9; + putBatch(value: Array, callback: AsyncCallback): void; + putBatch(value: Array): Promise; + /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not equal to the specified int value. + * Deletes the key-value pair based on a specified key. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - notEqualTo(field: string, value: number|string|boolean): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is greater than or equal to the - * specified int value. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - greaterThan(field: string, value: number|string|boolean): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is less than the specified int value. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - lessThan(field: string, value: number|string): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is greater than or - * equal to the specified int value. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - greaterThanOrEqualTo(field: string, value: number|string): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is less than or equal to the - * specified int value. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - lessThanOrEqualTo(field: string, value: number|string): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is null. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - isNull(field: string): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is within the specified int value list. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the int value list. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - inNumber(field: string, valueList: number[]): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is within the specified string value list. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the string value list. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - inString(field: string, valueList: string[]): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not within the specified int value list. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the int value list. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - notInNumber(field: string, valueList: number[]): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not within the specified string value list. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the string value list. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - notInString(field: string, valueList: string[]): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is similar to the specified string value. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the string value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - like(field: string, value: string): QueryV9; - /** - * Constructs a {@code QueryV9} object to query entries with the specified field whose value is not similar to the specified string value. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the string value. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - unlike(field: string, value: string): QueryV9; - /** - * Constructs a {@code QueryV9} object with the and condition. - * - *

Multiple predicates should be connected using the and or or condition. - * - * @returns Returns the {@coed QueryV9} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - and(): QueryV9; - /** - * Constructs a {@code QueryV9} object with the or condition. - * - *

Multiple predicates should be connected using the and or or condition. - * - * @returns Returns the {@coed QueryV9} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - or(): QueryV9; - /** - * Constructs a {@code QueryV9} object to sort the query results in ascending order. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - orderByAsc(field: string): QueryV9; - /** - * Constructs a {@code QueryV9} object to sort the query results in descending order. - * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - orderByDesc(field: string): QueryV9; - /** - * Constructs a {@code QueryV9} object to specify the number of results and the start position. - * - * @param total Indicates the number of results. - * @param offset Indicates the start position. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - limit(total: number, offset: number): QueryV9; - /** - * Creates a {@code QueryV9} condition with a specified field that is not null. - * - * @param field Indicates the specified field. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - isNotNull(field: string): QueryV9; - /** - * Creates a query condition group with a left bracket. - * - *

Multiple query conditions in an {@code QueryV9} object can be grouped. The query conditions in a group can be used as a - * whole to combine with other query conditions. - * - * @returns Returns the {@coed QueryV9} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - beginGroup(): QueryV9; - /** - * Creates a query condition group with a right bracket. - * - *

Multiple query conditions in an {@code QueryV9} object can be grouped. The query conditions in a group can be used as a - * whole to combine with other query conditions. - * - * @returns Returns the {@coed QueryV9} object. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - endGroup(): QueryV9; - /** - * Creates a query condition with a specified key prefix. - * - * @param prefix Indicates the specified key prefix. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - prefixKey(prefix: string): QueryV9; - /** - * Sets a specified index that will be preferentially used for query. - * - * @param index Indicates the index to set. - * @returns Returns the {@coed QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - setSuggestIndex(index: string): QueryV9; - /** - * Add device ID key prefix.Used by {@code DeviceKVStore}. - * - * @param deviceId Specify device id to query from. - * @return Returns the {@code QueryV9} object with device ID prefix added. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - deviceId(deviceId:string):QueryV9; - /** - * Get a String that repreaents this {@code QueryV9}. - * - *

The String would be parsed to DB query format. - * The String length should be no longer than 500kb. - * - * @return String representing this {@code QueryV9}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getSqlLike():string; - } - - /** - * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, - * and subscribing to distributed data. - * - *

You can create distributed databases of different types by {@link KVManager#getKVStore (Options, String)} - * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, - * including {@code SingleKVStore}. - * - * - * @import N/A - * @version 1 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - * @deprecated since 9 - * @useinstead KVStoreV9 - */ - interface KVStore { - /** - * Writes a key-value pair of the string type into the {@code KvStore} database. - * - *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. - * * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. - * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - */ - put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; - put(key: string, value: Uint8Array | string | number | boolean): Promise; - - /** - * Deletes the key-value pair based on a specified key. - * - * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. - * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and * {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 */ delete(key: string, callback: AsyncCallback): void; delete(key: string): Promise; - /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. - * - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener 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}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; - - /** - * Subscribes from the {@code KvStore} database based on the specified subscribeType and {@code 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}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - */ - on(event: 'syncComplete', syncCallback: Callback>): void; - - /** - * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @param listener 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}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - off(event: 'dataChange', listener?: Callback): void; - - /** - * Inserts key-value pairs into the {@code KvStore} database in batches. - * - * @param entries Indicates the key-value pairs to be inserted in batches. - * @throws Throws this exception if a database error occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - putBatch(entries: Entry[], callback: AsyncCallback): void; - putBatch(entries: Entry[]): Promise; - - /** - * Deletes key-value pairs in batches from the {@code KvStore} database. - * - * @param keys Indicates the key-value pairs to be deleted in batches. - * @throws Throws this exception if a database error occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - deleteBatch(keys: string[], callback: AsyncCallback): void; - deleteBatch(keys: string[]): Promise; - - /** - * Starts a transaction operation in the {@code KvStore} database. - * - *

After the database transaction is started, you can submit or roll back the operation. - * - * @throws Throws this exception if a database error occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - startTransaction(callback: AsyncCallback): void; - startTransaction(): Promise; - - /** - * Submits a transaction operation in the {@code KvStore} database. - * - * @param callback - * @throws Throws this exception if a database error occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - commit(callback: AsyncCallback): void; - commit(): Promise; - - /** - * Rolls back a transaction operation in the {@code KvStore} database. - * - * @throws Throws this exception if a database error occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - rollback(callback: AsyncCallback): void; - rollback(): Promise; - - /** - * Sets whether to enable synchronization. - * - * @param enabled Specifies whether to enable synchronization. The value true means to enable - * synchronization, and false means the opposite. - * @throws Throws this exception if an internal service error occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - enableSync(enabled: boolean, callback: AsyncCallback): void; - enableSync(enabled: boolean): Promise; - - /** - * Sets synchronization range labels. - * - *

The labels determine the devices with which data will be synchronized. - * - * @param localLabels Indicates the synchronization labels of the local device. - * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. - * @throws Throws this exception if an internal service error occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; - setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; - } - - /** - * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, - * and subscribing to distributed data. - * - *

You can create distributed databases of different types by {@link KVManagerV9#getKVStore (Options, String)} - * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, - * including {@code SingleKVStoreV9}. - * - * @import N/A - * @version 1 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - interface KVStoreV9 { - /** - * Writes a key-value pair of the string type into the {@code KvStoreV9} database. - * - *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. - * - * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. - * Spaces before and after the key will be cleared. - * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + /** + * Deletes the key-value pair based on a specified key. * @since 9 - */ - 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 KvStoreV9} database. - * - * @param value Indicates the data record to put. - * Spaces before and after the key will be cleared. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi - * @since 9 - */ - putBatch(value: Array, callback: AsyncCallback): void; - putBatch(value: Array): Promise; - - /** - * Deletes the key-value pair based on a specified key. - * - * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. - * Spaces before and after the key will be cleared. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - delete(key: string, callback: AsyncCallback): void; - delete(key: string): Promise; - - /** - * Deletes the key-value pair based on a specified key. - * * @param predicates Indicates the datasharePredicates. * Spaces before and after the key will be cleared. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @since 9 - + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and + * {@code DB_ERROR}. */ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); delete(predicates: dataSharePredicates.DataSharePredicates): Promise; - + /** * Backs up a database in a specified name. * - * @param file Indicates the name that saves the database backup. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param file Indicates the name that saves the database backup. */ backup(file:string, callback: AsyncCallback):void; backup(file:string): Promise; @@ -1726,12 +1181,9 @@ declare namespace distributedData { /** * Restores a database from a specified database file. * - * @param file Indicates the name that saves the database file. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param file Indicates the name that saves the database file. */ restore(file:string, callback: AsyncCallback):void; restore(file:string): Promise; @@ -1739,140 +1191,138 @@ declare namespace distributedData { /** * Delete a backup files based on a specified name. * - * @param files list Indicates the name that backup file to delete. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param files list Indicates the name that backup file to delete. */ deleteBackup(files:Array, callback: AsyncCallback>):void; deleteBackup(files:Array): Promise>; /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @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: 'dataChange', type: SubscribeType, listener: Callback): void; /** - * Subscribes from the {@code KvStoreV9} database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @throws {BusinessError} 401 - if parameter check failed. + * Subscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @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', syncCallback: Callback>): void; - + /** - * Unsubscribes from the {@code KvStoreV9} database based on the specified subscribeType and {@code KvStoreObserver}. + * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param listener 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', listener?: Callback): void; /** - * UnRegister Synchronizes {@code KvStoreV9} database callback. - * - * @param syncCallback Indicates the callback used to send the synchronization result to caller. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * UnRegister Synchronizes {@code KvStore} database callback. * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @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; /** - * Inserts key-value pairs into the {@code KvStoreV9} database in batches. - * - * @param entries Indicates the key-value pairs to be inserted in batches. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * Inserts key-value pairs into the {@code KvStore} database in batches. + * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param entries Indicates the key-value pairs to be inserted in batches. + * @throws Throws this exception if a database error occurs. */ putBatch(entries: Entry[], callback: AsyncCallback): void; putBatch(entries: Entry[]): Promise; /** - * Deletes key-value pairs in batches from the {@code KvStoreV9} database. - * - * @param keys Indicates the key-value pairs to be deleted in batches. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when delete data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * Deletes key-value pairs in batches from the {@code KvStore} database. + * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param keys Indicates the key-value pairs to be deleted in batches. + * @throws Throws this exception if a database error occurs. */ deleteBatch(keys: string[], callback: AsyncCallback): void; deleteBatch(keys: string[]): Promise; /** - * Starts a transaction operation in the {@code KvStoreV9} database. - * + * Starts a transaction operation in the {@code KvStore} database. + * *

After the database transaction is started, you can submit or roll back the operation. - * - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @throws Throws this exception if a database error occurs. */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; /** - * Submits a transaction operation in the {@code KvStoreV9} database. - * - * @param callback - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * Submits a transaction operation in the {@code KvStore} database. + * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param callback + * @throws Throws this exception if a database error occurs. */ commit(callback: AsyncCallback): void; commit(): Promise; /** - * Rolls back a transaction operation in the {@code KvStoreV9} database. - * - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * Rolls back a transaction operation in the {@code KvStore} database. + * + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @throws Throws this exception if a database error occurs. */ rollback(callback: AsyncCallback): void; rollback(): Promise; /** * Sets whether to enable synchronization. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param enabled Specifies whether to enable synchronization. The value true means to enable * synchronization, and false means the opposite. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @throws Throws this exception if an internal service error occurs. */ enableSync(enabled: boolean, callback: AsyncCallback): void; enableSync(enabled: boolean): Promise; /** * Sets synchronization range labels. - * + * *

The labels determine the devices with which data will be synchronized. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param localLabels Indicates the synchronization labels of the local device. * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @throws Throws this exception if an internal service error occurs. */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; @@ -1888,51 +1338,49 @@ declare namespace distributedData { * The {@code SingleKVStore} database does not support * synchronous transactions, or data search using snapshots. * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - * @deprecated since 9 - * @useinstead SingleKVStoreV9 */ interface SingleKVStore extends KVStore { /** * Obtains the {@code String} value of a specified key. - * + * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param key Indicates the key of the boolean value to be queried. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 */ get(key: string, callback: AsyncCallback): void; get(key: string): Promise; /** * Obtains all key-value pairs that match a specified key prefix. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ getEntries(keyPrefix: string, callback: AsyncCallback): void; getEntries(keyPrefix: string): Promise; /** * Obtains the list of key-value pairs matching the specified {@code Query} object. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; @@ -1943,63 +1391,78 @@ declare namespace distributedData { * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects * in a timely manner. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param keyPrefix Indicates the key prefix to match. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param query Indicates the {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; /** - * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * Obtains the KvStoreResultSet object matching the specified Predicate object. * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @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}. + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; /** * Obtains the number of results matching the specified {@code Query} object. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; /** * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} - * - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -2007,735 +1470,306 @@ declare namespace distributedData { /** * Synchronizes the database to the specified devices with the specified delay allowed. * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. * @throws Throws this exception if any of the following errors * @permission ohos.permission.DISTRIBUTED_DATASYNC - * occurs: {@code INVALID_ARGUMENT}, + * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - */ - sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; - - /** - * Register Synchronizes SingleKvStore databases callback. - *

Sync result is returned through asynchronous callback. - * - * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws Throws this exception if no {@code SingleKvStore} database is available. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - on(event: 'syncComplete', syncCallback: Callback>): void; - - /** - * UnRegister Synchronizes SingleKvStore databases callback. - * - * @throws Throws this exception if no {@code SingleKvStore} database is available. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - off(event: 'syncComplete', syncCallback?: Callback>): void; - - /** - * Sets the default delay allowed for database synchronization - * - * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. - * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; - setSyncParam(defaultAllowedDelayMs: number): Promise; - - /** - * Get the security level of the database. - * - * @returns SecurityLevel {@code SecurityLevel} the security level of the database. - * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, - * {@code IPC_ERROR}, and {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - getSecurityLevel(callback: AsyncCallback): void; - getSecurityLevel(): Promise; - } - - /** - * Provides methods related to single-version distributed databases. - * - *

To create a {@code SingleKVStoreV9} database, - * you can use the {@link data.distributed.common.KVManagerV9#getKVStore​(Options, String)} method - * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. - * This database synchronizes data to other databases in time sequence. - * The {@code SingleKVStoreV9} database does not support - * synchronous transactions, or data search using snapshots. - * - * @import N/A - * @version 1 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - interface SingleKVStoreV9 extends KVStoreV9 { - /** - * Obtains the {@code String} value of a specified key. - * - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - get(key: string, callback: AsyncCallback): void; - get(key: string): Promise; - - /** - * Obtains all key-value pairs that match a specified key prefix. - * - * @param keyPrefix Indicates the key prefix to match. - * @returns Returns the list of all key-value pairs that match the specified key prefix. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getEntries(keyPrefix: string, callback: AsyncCallback): void; - getEntries(keyPrefix: string): Promise; - - /** - * Obtains the list of key-value pairs matching the specified {@code QueryV9} object. - * - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getEntries(query: QueryV9, callback: AsyncCallback): void; - getEntries(query: QueryV9): Promise; - - /** - * Obtains the result sets with a specified prefix from a {@code KvStoreV9} database. The {@code KvStoreResultSet} - * object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStoreV9} - * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created - * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet - * method to close unnecessary {@code KvStoreResultSet} objects in a timely manner. - * - * @param keyPrefix Indicates the key prefix to match. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getResultSet(keyPrefix: string, callback: AsyncCallback): void; - getResultSet(keyPrefix: string): Promise; - - /** - * Obtains the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. - * - * @param query Indicates the {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getResultSet(query: QueryV9, callback: AsyncCallback): void; - getResultSet(query: QueryV9): Promise; - - /** - * Obtains the KvStoreResultSet object matching the specified Predicate object. - * - * @param predicates Indicates the datasharePredicates. - * Spaces before and after the key will be cleared. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @since 9 - */ - getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; - - /** - * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * - * @param resultSet Indicates the {@code KvStoreResultSet} object to close. - * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; - - /** - * Obtains the number of results matching the specified {@code QueryV9} object. - * - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the number of results matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getResultSize(query: QueryV9, callback: AsyncCallback): void; - getResultSize(query: QueryV9): Promise; - - /** - * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} - * - * @param deviceId Indicates the device to be removed data. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; - - /** - * Synchronizes the database to the specified devices with the specified delay allowed. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when sync data. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 */ - sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void /** * Synchronizes the database to the specified devices with the specified delay allowed. * - * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * @param query Indicates the {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when sync data. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @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(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; - + sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; + /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** - * Register Synchronizes SingleKvStore databases callback. + * Register Synchronizes SingleKvStore databases callback. *

Sync result is returned through asynchronous callback. - * - * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws {BusinessError} 401 - if parameter check failed. + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws Throws this exception if no {@code SingleKvStore} database is available. */ - on(event: 'syncComplete', syncCallback: Callback>): void; + on(event: 'syncComplete', syncCallback: Callback>): void; /** * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 - */ - off(event:'dataChange', listener?: Callback): void; - - /** - * UnRegister Synchronizes SingleKvStore databases callback. - * - * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param listener 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', syncCallback?: Callback>): void; - + off(event:'dataChange', listener?: Callback): void; /** - * Sets the default delay allowed for database synchronization - * - * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. - * @throws {BusinessError} 401 - if parameter check failed. + * UnRegister Synchronizes SingleKvStore databases callback. + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @throws Throws this exception if no {@code SingleKvStore} database is available. */ - setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; - setSyncParam(defaultAllowedDelayMs: number): Promise; + off(event: 'syncComplete', syncCallback?: Callback>): void; + + + /** + * Sets the default delay allowed for database synchronization + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + */ + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + setSyncParam(defaultAllowedDelayMs: number): Promise; - /** - * Get the security level of the database. - * - * @returns SecurityLevel {@code SecurityLevel} the security level of the database. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getSecurityLevel(callback: AsyncCallback): void; - getSecurityLevel(): Promise; + /** + * Get the security level of the database. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns SecurityLevel {@code SecurityLevel} the security level of the database. + * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, + * {@code IPC_ERROR}, and {@code DB_ERROR}. + */ + getSecurityLevel(callback: AsyncCallback): void; + getSecurityLevel(): Promise; } /** * Manages distributed data by device in a distributed system. - * + * *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. - * - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @since 8 - * @deprecated since 9 - * @useinstead DeviceKVStoreV9 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @import N/A */ interface DeviceKVStore extends KVStore { /** * Obtains the {@code String} value matching a specified device ID and key. * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the device to be queried. * @param key Indicates the key of the value to be queried. * @return Returns the value matching the given criteria. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 */ get(deviceId: string, key: string, callback: AsyncCallback): void; get(deviceId: string, key: string): Promise; /** * Obtains all key-value pairs matching a specified device ID and key prefix. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getEntries(deviceId: string, keyPrefix: string): Promise; /** * Obtains the list of key-value pairs matching the specified {@code Query} object. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the ID of the device to which the key-value pairs belong. * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 */ getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; getEntries(deviceId: string, query: Query): Promise; /** * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. - * + * *

The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary * {@code KvStoreResultSet} objects in a timely manner. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the {@code KvStoreResultSet} objects. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getResultSet(deviceId: string, keyPrefix: string): Promise; /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param query Indicates the {@code Query} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; - /** - * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. - * - * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. - * @param query Indicates the {@code Query} object. - * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 - */ - getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSet(deviceId: string, query: Query): Promise; - - /** - * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * - * @param resultSet Indicates the {@code KvStoreResultSet} object to close. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 - */ - closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; - - /** - * Obtains the number of results matching the specified {@code Query} object. - * - * @param query Indicates the {@code Query} object. - * @returns Returns the number of results matching the specified {@code Query} object. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 - */ - getResultSize(query: Query, callback: AsyncCallback): void; - getResultSize(query: Query): Promise; - - /** - * Obtains the number of results matching a specified device ID and {@code Query} object. - * - * @param deviceId Indicates the ID of the device to which the results belong. - * @param query Indicates the {@code Query} object. - * @returns Returns the number of results matching the specified {@code Query} object. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 - */ - getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSize(deviceId: string, query: Query): Promise; - - /** - * Removes data of a specified device from the current database. This method is used to remove only the data - * synchronized from remote devices. This operation does not synchronize data to other databases or affect - * subsequent data synchronization. - * - * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 - */ - removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; - - /** - * Synchronizes {@code DeviceKVStore} databases. - * - *

This method returns immediately and sync result will be returned through asynchronous callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param deviceIds Indicates the list of IDs of devices whose - * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * {@code DeviceKVStore} databases are to be synchronized. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or - * {@code PUSH_PULL}. - * @throws Throws this exception if no DeviceKVStore database is available. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; - - /** - * Register Synchronizes DeviceKVStore databases callback. - * - *

Sync result is returned through asynchronous callback. - * - * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws Throws this exception if no DeviceKVStore database is available. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - on(event: 'syncComplete', syncCallback: Callback>): void; - - /** - * UnRegister Synchronizes DeviceKVStore databases callback. - * - * @throws Throws this exception if no DeviceKVStore database is available. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 - */ - off(event: 'syncComplete', syncCallback?: Callback>): void; - } - - /** - * Manages distributed data by device in a distributed system. - * - *

To create a {@code DeviceKVStoreV9} database, you can use the {@link data.distributed.common.KVManagerV9.getKvStore(Options, String)} - * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed - * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry - * into the database, the system automatically adds the ID of the device running the application to the key. - * - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - interface DeviceKVStoreV9 extends KVStoreV9 { - /** - * Obtains the {@code String} value matching a specified device ID and key. - * - * @param deviceId Indicates the device to be queried. - * @param key Indicates the key of the value to be queried. - * @return Returns the value matching the given criteria. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the data not exist when query data. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - get(deviceId: string, key: string, callback: AsyncCallback): void; - get(deviceId: string, key: string): Promise; - - /** - * Obtains all key-value pairs matching a specified device ID and key prefix. - * - * @param deviceId Identifies the device whose data is to be queried. - * @param keyPrefix Indicates the key prefix to match. - * @returns Returns the list of all key-value pairs meeting the given criteria. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getEntries(deviceId: string, keyPrefix: string): Promise; - - /** - * Obtains the list of key-value pairs matching the specified {@code QueryV9} object. - * - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getEntries(query: QueryV9, callback: AsyncCallback): void; - getEntries(query: QueryV9): Promise; - - /** - * Obtains the list of key-value pairs matching a specified device ID and {@code QueryV9} object. - * - * @param deviceId Indicates the ID of the device to which the key-value pairs belong. - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the list of key-value pairs matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getEntries(deviceId: string, query: QueryV9, callback: AsyncCallback): void; - getEntries(deviceId: string, query: QueryV9): Promise; - - /** - * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. - * - *

The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStoreV9} - * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, - * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary - * {@code KvStoreResultSet} objects in a timely manner. - * - * @param deviceId Identifies the device whose data is to be queried. - * @param keyPrefix Indicates the key prefix to match. - * @returns Returns the {@code KvStoreResultSet} objects. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getResultSet(deviceId: string, keyPrefix: string): Promise; - - /** - * Obtains the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. - * - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getResultSet(query: QueryV9, callback: AsyncCallback): void; - getResultSet(query: QueryV9): Promise; - - /** - * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code QueryV9} object. - * - * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getResultSet(deviceId: string, query: QueryV9, callback: AsyncCallback): void; - getResultSet(deviceId: string, query: QueryV9): Promise; + /** + * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. + * @param query Indicates the {@code Query} object. + * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. + */ + getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSet(deviceId: string, query: Query): Promise; /** * Obtains the KvStoreResultSet object matching the specified Predicate object. * - * @param predicates Indicates the datasharePredicates. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param predicates Indicates the datasharePredicates. * @systemapi - * @since 9 + * 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: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; /** * Obtains the KvStoreResultSet object matching a specified Device ID and Predicate object. - * - * @param predicates Indicates the key. - * @param deviceId Indicates the ID of the device to which the results belong. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi - * @since 9 - */ - getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; - - /** - * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * - * @param resultSet Indicates the {@code KvStoreResultSet} object to close. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; - - /** - * Obtains the number of results matching the specified {@code QueryV9} object. - * - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the number of results matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getResultSize(query: QueryV9, callback: AsyncCallback): void; - getResultSize(query: QueryV9): Promise; - - /** - * Obtains the number of results matching a specified device ID and {@code Query} object. - * + * @param predicates Indicates the key. * @param deviceId Indicates the ID of the device to which the results belong. - * @param query Indicates the {@code QueryV9} object. - * @returns Returns the number of results matching the specified {@code QueryV9} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 + * 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}. */ - getResultSize(deviceId: string, query: QueryV9, callback: AsyncCallback): void; - getResultSize(deviceId: string, query: QueryV9): Promise; + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param resultSet Indicates the {@code KvStoreResultSet} object to close. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + */ + closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KvStoreResultSet): Promise; - /** - * Removes data of a specified device from the current database. This method is used to remove only the data - * synchronized from remote devices. This operation does not synchronize data to other databases or affect - * subsequent data synchronization. - * - * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + */ + getResultSize(query: Query, callback: AsyncCallback): void; + getResultSize(query: Query): Promise; + + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Indicates the ID of the device to which the results belong. + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + */ + getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSize(deviceId: string, query: Query): Promise; + /** + * Removes data of a specified device from the current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; + /** * Synchronizes {@code DeviceKVStore} databases. * *

This method returns immediately and sync result will be returned through asynchronous callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when sync data. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or + * {@code PUSH_PULL}. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @throws Throws this exception if no DeviceKVStore database is available. */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; @@ -2743,64 +1777,61 @@ declare namespace distributedData { * Synchronizes {@code DeviceKVStore} databases. * *

This method returns immediately and sync result will be returned through asynchronous callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. - * @param query Indicates the {@code QueryV9} object. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when sync data. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param query Indicates the {@code Query} object. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or + * {@code PUSH_PULL}. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @throws Throws this exception if no DeviceKVStore database is available. */ - sync(deviceIds: string[], query: QueryV9, mode: SyncMode, delayMs?: number): void; + sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; /** * Register Synchronizes DeviceKVStore databases callback. - * + * *

Sync result is returned through asynchronous callback. - * - * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws {BusinessError} 401 - if parameter check failed. + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @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 + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @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: 'dataChange', type: SubscribeType, listener: Callback): void; + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @param listener 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', listener?: Callback): void; + off(event:'dataChange', listener?: Callback): void; /** * UnRegister Synchronizes DeviceKVStore databases callback. - * - * @throws {BusinessError} 401 - if parameter check failed. + * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 + * @throws Throws this exception if no DeviceKVStore database is available. */ off(event: 'syncComplete', syncCallback?: Callback>): void; } @@ -2811,56 +1842,36 @@ declare namespace distributedData { *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param config Indicates the {@link KVStore} configuration information, * including the user information and package name. * @return Returns the {@code KVManager} instance. * @throws Throws exception if input is invalid. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - * @deprecated since 9 - * @useinstead createKVManagerV9 */ function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManager(config: KVManagerConfig): Promise; - /** - * Creates a {@link KVManagerV9} instance based on the configuration information. - * - *

You must pass {@link KVManagerConfig} to provide configuration information - * for creating the {@link KVManagerV9} instance. - * - * @param config Indicates the {@link KVStoreV9} configuration information, - * including the user information and package name. - * @return Returns the {@code KVManagerV9} instance. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - function createKVManagerV9(config: KVManagerConfig, callback: AsyncCallback): void; - function createKVManagerV9(config: KVManagerConfig): Promise; - /** * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 - * @deprecated since 9 - * @useinstead KVManagerV9 */ interface KVManager { /** * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. * + * @since 7 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. * @param storeId Identifies the {@code KVStore} database. * The value of this parameter must be unique for the same application, * and different applications can share the same value. * @return Returns a {@code KVStore}, or {@code SingleKVStore}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 7 */ getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; @@ -2875,14 +1886,14 @@ declare namespace distributedData { * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStore}, * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error * will be returned. - * + * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param kvStore Indicates the {@code KvStore} database to close. * @throws Throws this exception if any of the following errors * occurs:{@code INVALID_ARGUMENT}, {@code ERVER_UNAVAILABLE}, * {@code STORE_NOT_OPEN}, {@code STORE_NOT_FOUND}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; @@ -2894,14 +1905,13 @@ declare namespace distributedData { * *

You can use this method to delete a {@code KvStore} database not in use. After the database is deleted, all its data will be * lost. - * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param storeId Identifies the {@code KvStore} database to delete. * @throws Throws this exception if any of the following errors * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code STORE_NOT_FOUND}, * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; deleteKVStore(appId: string, storeId: string): Promise; @@ -2910,12 +1920,12 @@ declare namespace distributedData { * Obtains the storeId of all {@code KvStore} databases that are created by using the {@code getKvStore} method and not deleted by * calling the {@code deleteKvStore} method. * - * @returns Returns the storeId of all created {@code KvStore} databases. + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @returns Returns the storeId of all created {@code KvStore} databases. * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; getAllKVStoreId(appId: string): Promise; @@ -2923,116 +1933,20 @@ declare namespace distributedData { /** * register DeviceChangeCallback to get notification when device's status changed * + * @since 8 + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} * @throws exception maybe occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 8 */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; /** * unRegister DeviceChangeCallback and can not receive notification * - * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. - * @throws exception maybe occurs. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 - */ - off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; - } - - /** - * Provides interfaces to manage a {@code KVStoreV9} database, including obtaining, closing, and deleting the {@code KVStoreV9}. - * - * @import N/A - * @version 1 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - interface KVManagerV9 { - /** - * Creates and obtains a {@code KVStoreV9} database by specifying {@code Options} and {@code storeId}. - * - * @param options Indicates the options used for creating and obtaining the {@code KVStoreV9} database, - * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. - * @param storeId Identifies the {@code KVStoreV9} database. - * The value of this parameter must be unique for the same application, - * and different applications can share the same value. - * @return Returns a {@code KVStoreV9}, or {@code SingleKVStoreV9}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100002 - if open existed database with changed options. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getKVStore(storeId: string, options: Options): Promise; - getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; - - /** - * Closes the {@code KvStoreV9} database. - * - *

Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your - * thread may crash. - * - *

The {@code KvStoreV9} database to close must be an object created by using the {@code getKvStore} method. Before using this - * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStoreV9}, - * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error - * will be returned. - * - * @param kvStore Indicates the {@code KvStoreV9} database to close. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9, callback: AsyncCallback): void; - closeKVStore(appId: string, storeId: string, kvStore: KVStoreV9): Promise; - - /** - * Deletes the {@code KvStoreV9} database identified by storeId. - * - *

Before using this method, close all {@code KvStoreV9} instances in use that are identified by the same storeId. - * - *

You can use this method to delete a {@code KvStoreV9} database not in use. After the database is deleted, all its data will be - * lost. - * - * @param storeId Identifies the {@code KvStoreV9} database to delete. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100004 - if the database not exist when delete database. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; - deleteKVStore(appId: string, storeId: string): Promise; - - /** - * Obtains the storeId of all {@code KvStoreV9} databases that are created by using the {@code getKvStore} method and not deleted by - * calling the {@code deleteKvStore} method. - * - * @returns Returns the storeId of all created {@code KvStoreV9} databases. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - getAllKVStoreId(appId: string, callback: AsyncCallback): void; - getAllKVStoreId(appId: string): Promise; - - /** - * register DeviceChangeCallback to get notification when device's status changed - * - * @param deathCallback device change callback {@code DeviceChangeCallback} - * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - on(event: 'distributedDataServiceDie', deathCallback: Callback): void; - - /** - * unRegister DeviceChangeCallback and can not receive notification - * * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 + * @throws exception maybe occurs. */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } diff --git a/api/@ohos.data.kvStore.d.ts b/api/@ohos.data.kvStore.d.ts new file mode 100644 index 0000000000..a72691b335 --- /dev/null +++ b/api/@ohos.data.kvStore.d.ts @@ -0,0 +1,1976 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback, Callback } from './basic'; +import { ValuesBucket } from './@ohos.data.ValuesBucket'; +import dataSharePredicates from './@ohos.data.dataSharePredicates'; +import DataShareResultSet from './@ohos.data.DataShareResultSet'; +import Context from './application/Context'; + +/** + * Providers interfaces to creat a {@link KVManager} istances. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @import N/A + * @since 9 + */ +declare namespace kvStore { + /** + * Provides configuration information for {@link KVManager} instances, + * including the caller's package name and distributed network type. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + interface KVManagerConfig { + /** + * Indicates the user information + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + userInfo: UserInfo; + + /** + * Indicates the bundleName + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + bundleName: string; + + /** + * Indicates the ability or hap context + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @Note: if swap the area, you should close all the KV store and use the new Context to create the KVManager + * @since 9 + */ + context: Context; + } + + /** + * Manages user information. + * + *

This class provides methods for obtaining the user ID and type, setting the user ID and type, + * and checking whether two users are the same. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + interface UserInfo { + /** + * Indicates the user ID to set + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + userId?: string; + + /** + * Indicates the user type to set + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + userType?: UserType; + } + + /** + * Enumerates user types. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + enum UserType { + /** + * Indicates a user that logs in to different devices using the same account. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + SAME_USER_ID = 0 + } + + /** + * KVStore constants + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + namespace Constants { + /** + * max key length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + const MAX_KEY_LENGTH = 1024; + + /** + * max value length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + const MAX_VALUE_LENGTH = 4194303; + + /** + * max device coordinate key length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + const MAX_KEY_LENGTH_DEVICE = 896; + + /** + * max store id length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + const MAX_STORE_ID_LENGTH = 128; + + /** + * max query length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + const MAX_QUERY_LENGTH = 512000; + + /** + * max batch operation size. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + const MAX_BATCH_SIZE = 128; + } + + /** + * Indicates the {@code ValueType}. + * + *

{@code ValueType} is obtained based on the value. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + enum ValueType { + /** + * Indicates that the value type is string. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + STRING = 0, + + /** + * Indicates that the value type is int. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + INTEGER = 1, + + /** + * Indicates that the value type is float. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + FLOAT = 2, + + /** + * Indicates that the value type is byte array. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + * */ + BYTE_ARRAY = 3, + + /** + * Indicates that the value type is boolean. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + * */ + BOOLEAN = 4, + + /** + * Indicates that the value type is double. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + DOUBLE = 5 + } + + /** + * Obtains {@code Value} objects stored in a {@link KVStore} or {@link KVStore} database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + interface Value { + /** + * Indicates value type + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @see ValueType + * @type {number} + * @memberof Value + * @since 9 + */ + type: ValueType; + /** + * Indicates value + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + value: Uint8Array | string | number | boolean; + } + + /** + * Provides key-value pairs stored in the distributed database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + interface Entry { + /** + * Indicates key + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + key: string; + /** + * Indicates value + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + value: Value; + } + + /** + * Receives notifications of all data changes, including data insertion, update, and deletion. + * + *

If you have subscribed to {@code KVStore} or {@code KVStore}, you will receive data change notifications and + * obtain the changed data from the parameters in callback methods upon data insertion, update, or deletion. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + interface ChangeNotification { + /** + * Indicates data addition records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + insertEntries: Entry[]; + /** + * Indicates data update records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + updateEntries: Entry[]; + /** + * Indicates data deletion records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + deleteEntries: Entry[]; + /** + * Indicates from device id. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + deviceId: string; + } + + /** + * Indicates the database synchronization mode. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + enum SyncMode { + /** + * Indicates that data is only pulled from the remote end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + PULL_ONLY = 0, + /** + * Indicates that data is only pushed from the local end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + PUSH_ONLY = 1, + /** + * Indicates that data is pushed from the local end, and then pulled from the remote end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + PUSH_PULL = 2 + } + + /** + * Describes the subscription type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + enum SubscribeType { + /** + * Subscription to local data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + SUBSCRIBE_TYPE_LOCAL = 0, + + /** + * Subscription to remote data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + SUBSCRIBE_TYPE_REMOTE = 1, + + /** + * Subscription to both local and remote data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + SUBSCRIBE_TYPE_ALL = 2, + } + + /** + * Describes the {@code KVStore} or {@code KVStore}type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + enum KVStoreType { + /** + * Device-collaborated database, as specified by {@code DeviceKVStore} or {@code DeviceKVStore} + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @import N/A + * @since 9 + */ + DEVICE_COLLABORATION = 0, + + /** + * Single-version database, as specified by {@code SingleKVStore} + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + SINGLE_VERSION = 1, + } + + /** + * Describes the {@code KVStore} or {@code KVStore} type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + enum SecurityLevel { + /** + * S1: mains the db is low level security + * There are some low impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + S1 = 2, + + /** + * S2: mains the db is middle level security + * There are some major impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + S2 = 3, + + /** + * S3: mains the db is high level security + * There are some severity impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + S3 = 5, + + /** + * S4: mains the db is critical level security + * There are some critical impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + S4 = 6, + } + + /** + * Provides configuration options for creating a {@code KVStore} or {@code KVStore}. + * + *

You can determine whether to create another database if a {@code KVStore} or {@code KVStore} database is + * missing, whether to encrypt the database, and the database type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + interface Options { + /** + * Indicates whether to createa database when the database file does not exist + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + createIfMissing?: boolean; + /** + * Indicates setting whether database files are encrypted + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + encrypt?: boolean; + /** + * Indicates setting whether to back up database files + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + backup?: boolean; + /** + * Indicates setting whether database files are automatically synchronized + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + autoSync?: boolean; + /** + * Indicates setting the databse type + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + kvStoreType?: KVStoreType; + /** + * Indicates setting the database security level + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + securityLevel: SecurityLevel; + /** + * Indicates schema object + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @import N/A + * @since 9 + */ + schema?: Schema; + } + + /** + * Represents the database schema. + * + * You can create Schema objects and put them in Options when creating or opening the database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @import N/A + * @since 9 + */ + class Schema { + /** + * A constructor used to create a Schema instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + constructor() + /** + * Indicates the root json object. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + root: FieldNode; + /** + * Indicates the string array of json. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + indexes: Array; + /** + * Indicates the mode of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + mode: number; + /** + * Indicates the skipsize of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + skip: number; + } + + /** + * Represents a node of a {@link Schema} instance. + * + *

Through the {@link Schema} instance, you can define the fields contained in the values stored in a database. + * + *

A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. + * + *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @import N/A + * @since 9 + */ + class FieldNode { + /** + * A constructor used to create a FieldNode instance with the specified field. + * name Indicates the field node name. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + constructor(name: string) + /** + * Adds a child node to this {@code FieldNode}. + * + *

Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. + * + * @param child The field node to append. + * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + appendChild(child: FieldNode): boolean; + /** + * Indicates the default value of fieldnode. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + default: string; + /** + * Indicates the nullable of database field. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + nullable: boolean; + /** + * Indicates the type of value. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + type: number; + } + + /** + * Provide methods to obtain the result set of the {@code KvStore} or {@code KVStore} database. + * + *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} or + * {@code DeviceKVStore} class. This interface also provides methods for moving the data read position in the result set. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @import N/A + * @since 9 + */ + interface KVStoreResultSet { + /** + * Obtains the number of lines in a result set. + * + * @returns Returns the number of lines. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getCount(): number; + /** + * Obtains the current read position in a result set. + * + * @returns Returns the current read position. The read position starts with 0. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getPosition(): number; + /** + * Moves the read position to the first line. + * + *

If the result set is empty, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToFirst(): boolean; + /** + * Moves the read position to the last line. + * + *

If the result set is empty, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToLast(): boolean; + /** + * Moves the read position to the next line. + * + *

If the result set is empty or the data in the last line is being read, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToNext(): boolean; + /** + * Moves the read position to the previous line. + * + *

If the result set is empty or the data in the first line is being read, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToPrevious(): boolean; + /** + * Moves the read position by a relative offset to the current position. + * + * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a + * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, + * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, + * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the + * final position is invalid, false will be returned. + * @returns Returns true if the operation succeeds; return false otherwise. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + move(offset: number): boolean; + /** + * Moves the read position from 0 to an absolute position. + * + * @param position Indicates the absolute position. + * @returns Returns true if the operation succeeds; return false otherwise. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToPosition(position: number): boolean; + /** + * Checks whether the read position is the first line. + * + * @returns Returns true if the read position is the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isFirst(): boolean; + /** + * Checks whether the read position is the last line. + * + * @returns Returns true if the read position is the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isLast(): boolean; + /** + * Checks whether the read position is before the last line. + * + * @returns Returns true if the read position is before the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isBeforeFirst(): boolean; + /** + * Checks whether the read position is after the last line. + * + * @returns Returns true if the read position is after the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isAfterLast(): boolean; + /** + * Obtains a key-value pair. + * + * @returns Returns a key-value pair. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntry(): Entry; + } + + /** + * Represents a database query using a predicate. + * + *

This class provides a constructor used to create a {@code Query} instance, which is used to query data + * matching specified conditions in the database. + * + *

This class also provides methods for adding predicates to the {@code Query} instance. + * + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + class Query { + /** + * A constructor used to create a Query instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + constructor() + /** + * Resets this {@code Query} object. + * + * @returns Returns the reset {@code Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + reset(): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value IIndicates the long value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + equalTo(field: string, value: number|string|boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notEqualTo(field: string, value: number|string|boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the + * specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + greaterThan(field: string, value: number|string|boolean): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + lessThan(field: string, value: number|string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or + * equal to the specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + greaterThanOrEqualTo(field: string, value: number|string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the + * specified int value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the int value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + lessThanOrEqualTo(field: string, value: number|string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is null. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isNull(field: string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the int value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + inNumber(field: string, valueList: number[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the string value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + inString(field: string, valueList: string[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the int value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notInNumber(field: string, valueList: number[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param valueList Indicates the string value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notInString(field: string, valueList: string[]): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the string value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + like(field: string, value: string): Query; + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param value Indicates the string value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + unlike(field: string, value: string): Query; + /** + * Constructs a {@code Query} object with the and condition. + * + *

Multiple predicates should be connected using the and or or condition. + * + * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + and(): Query; + /** + * Constructs a {@code Query} object with the or condition. + * + *

Multiple predicates should be connected using the and or or condition. + * + * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + or(): Query; + /** + * Constructs a {@code Query} object to sort the query results in ascending order. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + orderByAsc(field: string): Query; + /** + * Constructs a {@code Query} object to sort the query results in descending order. + * + * @param field Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + orderByDesc(field: string): Query; + /** + * Constructs a {@code Query} object to specify the number of results and the start position. + * + * @param total Indicates the number of results. + * @param offset Indicates the start position. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + limit(total: number, offset: number): Query; + /** + * Creates a {@code Query} condition with a specified field that is not null. + * + * @param field Indicates the specified field. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isNotNull(field: string): Query; + /** + * Creates a query condition group with a left bracket. + * + *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + beginGroup(): Query; + /** + * Creates a query condition group with a right bracket. + * + *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + endGroup(): Query; + /** + * Creates a query condition with a specified key prefix. + * + * @param prefix Indicates the specified key prefix. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + prefixKey(prefix: string): Query; + /** + * Sets a specified index that will be preferentially used for query. + * + * @param index Indicates the index to set. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSuggestIndex(index: string): Query; + /** + * Add device ID key prefix.Used by {@code DeviceKVStore}. + * + * @param deviceId Specify device id to query from. + * @return Returns the {@code Query} object with device ID prefix added. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deviceId(deviceId:string):Query; + /** + * Get a String that repreaents this {@code Query}. + * + *

The String would be parsed to DB query format. + * The String length should be no longer than 500kb. + * + * @return String representing this {@code Query}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSqlLike():string; + } + + /** + * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, + * and subscribing to distributed data. + * + *

You can create distributed databases of different types by {@link KVManager#getKVStore (Options, String)} + * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, + * including {@code SingleKVStore}. + * + * @import N/A + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVStore { + /** + * Writes a key-value pair of the string type into the {@code KVStore} database. + * + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + 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. + * + * @param value Indicates the data record to put. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ + putBatch(value: Array, callback: AsyncCallback): void; + putBatch(value: Array): Promise; + + /** + * Deletes the key-value pair based on a specified key. + * + * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + delete(key: string, callback: AsyncCallback): void; + delete(key: string): Promise; + + /** + * Deletes the key-value pair based on a specified key. + * + * @param predicates Indicates the datasharePredicates. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + + */ + delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); + delete(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Backs up a database in a specified name. + * + * @param file Indicates the name that saves the database backup. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + backup(file:string, callback: AsyncCallback):void; + backup(file:string): Promise; + + /** + * Restores a database from a specified database file. + * + * @param file Indicates the name that saves the database file. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + restore(file:string, callback: AsyncCallback):void; + restore(file:string): Promise; + + /** + * Delete a backup files based on a specified name. + * + * @param files list Indicates the name that backup file to delete. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBackup(files:Array, callback: AsyncCallback>):void; + deleteBackup(files:Array): Promise>; + + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** + * Subscribes from the {@code KVStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Unsubscribes from the {@code KVStore} database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event:'dataChange', listener?: Callback): void; + + /** + * UnRegister Synchronizes {@code KVStore} database callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + + /** + * Inserts key-value pairs into the {@code KVStore} database in batches. + * + * @param entries Indicates the key-value pairs to be inserted in batches. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + putBatch(entries: Entry[], callback: AsyncCallback): void; + putBatch(entries: Entry[]): Promise; + + /** + * Deletes key-value pairs in batches from the {@code KVStore} database. + * + * @param keys Indicates the key-value pairs to be deleted in batches. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBatch(keys: string[], callback: AsyncCallback): void; + deleteBatch(keys: string[]): Promise; + + /** + * Starts a transaction operation in the {@code KVStore} database. + * + *

After the database transaction is started, you can submit or roll back the operation. + * + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + startTransaction(callback: AsyncCallback): void; + startTransaction(): Promise; + + /** + * Submits a transaction operation in the {@code KVStore} database. + * + * @param callback + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + commit(callback: AsyncCallback): void; + commit(): Promise; + + /** + * Rolls back a transaction operation in the {@code KVStore} database. + * + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + rollback(callback: AsyncCallback): void; + rollback(): Promise; + + /** + * Sets whether to enable synchronization. + * + * @param enabled Specifies whether to enable synchronization. The value true means to enable + * synchronization, and false means the opposite. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enableSync(enabled: boolean, callback: AsyncCallback): void; + enableSync(enabled: boolean): Promise; + + /** + * Sets synchronization range labels. + * + *

The labels determine the devices with which data will be synchronized. + * + * @param localLabels Indicates the synchronization labels of the local device. + * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; + setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; + } + + /** + * Provides methods related to single-version distributed databases. + * + *

To create a {@code SingleKVStore} database, + * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method + * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. + * This database synchronizes data to other databases in time sequence. + * The {@code SingleKVStore} database does not support + * synchronous transactions, or data search using snapshots. + * + * @import N/A + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface SingleKVStore extends KVStore { + /** + * Obtains the {@code String} value of a specified key. + * + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + get(key: string): Promise; + + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the list of all key-value pairs that match the specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + getEntries(keyPrefix: string): Promise; + + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + getEntries(query: Query): Promise; + + /** + * Obtains the result sets with a specified prefix from a {@code KVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code KVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param keyPrefix Indicates the key prefix to match. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + getResultSet(keyPrefix: string): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + getResultSet(query: Query): Promise; + + /** + * Obtains the KVStoreResultSet object matching the specified Predicate object. + * + * @param predicates Indicates the datasharePredicates. + * Spaces before and after the key will be cleared. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Closes a {@code KVStoreResultSet} object returned by getResultSet. + * + * @param resultSet Indicates the {@code KVStoreResultSet} object to close. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KVStoreResultSet): Promise; + + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + getResultSize(query: Query): Promise; + + /** + * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} + * + * @param deviceId Indicates the device to be removed data. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; + + /** + * Synchronizes the database to the specified devices with the specified delay allowed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void + + /** + * Synchronizes the database to the specified devices with the specified delay allowed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * @param query Indicates the {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; + + /** + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** + * Register Synchronizes SingleKvStore databases callback. + *

Sync result is returned through asynchronous callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event:'dataChange', listener?: Callback): void; + + /** + * UnRegister Synchronizes SingleKvStore databases callback. + * + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + + + /** + * Sets the default delay allowed for database synchronization + * + * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + setSyncParam(defaultAllowedDelayMs: number): Promise; + + /** + * Get the security level of the database. + * + * @returns SecurityLevel {@code SecurityLevel} the security level of the database. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSecurityLevel(callback: AsyncCallback): void; + getSecurityLevel(): Promise; + } + + /** + * Manages distributed data by device in a distributed system. + * + *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} + * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed + * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry + * into the database, the system automatically adds the ID of the device running the application to the key. + * + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + interface DeviceKVStore extends KVStore { + /** + * Obtains the {@code String} value matching a specified device ID and key. + * + * @param deviceId Indicates the device to be queried. + * @param key Indicates the key of the value to be queried. + * @return Returns the value matching the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + get(deviceId: string, key: string, callback: AsyncCallback): void; + get(deviceId: string, key: string): Promise; + + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the list of all key-value pairs meeting the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getEntries(deviceId: string, keyPrefix: string): Promise; + + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + getEntries(query: Query): Promise; + + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the key-value pairs belong. + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; + getEntries(deviceId: string, query: Query): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + * + *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the {@code KVStoreResultSet} objects. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getResultSet(deviceId: string, keyPrefix: string): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + getResultSet(query: Query): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param query Indicates the {@code Query} object. + * @returns Returns the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSet(deviceId: string, query: Query): Promise; + + /** + * Obtains the KVStoreResultSet object matching the specified Predicate object. + * + * @param predicates Indicates the datasharePredicates. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. + * + * @param predicates Indicates the key. + * @param deviceId Indicates the ID of the device to which the results belong. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Closes a {@code KVStoreResultSet} object returned by getResultSet. + * + * @param resultSet Indicates the {@code KVStoreResultSet} object to close. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KVStoreResultSet): Promise; + + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + getResultSize(query: Query): Promise; + + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the results belong. + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSize(deviceId: string, query: Query): Promise; + + /** + * Removes data of a specified device from the current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; + + /** + * Synchronizes {@code DeviceKVStore} databases. + * + *

This method returns immediately and sync result will be returned through asynchronous callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param deviceIds Indicates the list of IDs of devices whose + * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * {@code DeviceKVStore} databases are to be synchronized. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + + /** + * Synchronizes {@code DeviceKVStore} databases. + * + *

This method returns immediately and sync result will be returned through asynchronous callback. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param deviceIds Indicates the list of IDs of devices whose + * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * {@code DeviceKVStore} databases are to be synchronized. + * @param query Indicates the {@code Query} object. + * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; + + /** + * Register Synchronizes DeviceKVStore databases callback. + * + *

Sync result is returned through asynchronous callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + 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. + * + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** + * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event:'dataChange', listener?: Callback): void; + + /** + * UnRegister Synchronizes DeviceKVStore databases callback. + * + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + } + + /** + * Creates a {@link KVManager} instance based on the configuration information. + * + *

You must pass {@link KVManagerConfig} to provide configuration information + * for creating the {@link KVManager} instance. + * + * @param config Indicates the {@link KVStore} configuration information, + * including the user information and package name. + * @return Returns the {@code KVManager} instance. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; + function createKVManager(config: KVManagerConfig): Promise; + + /** + * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. + * + * @import N/A + * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVManager { + /** + * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. + * + * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, + * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. + * @param storeId Identifies the {@code KVStore} database. + * The value of this parameter must be unique for the same application, + * and different applications can share the same value. + * @return Returns a {@code KVStore}, or {@code SingleKVStore}. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100002 - if open existed database with changed options. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getKVStore(storeId: string, options: Options): Promise; + getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; + + /** + * Closes the {@code KVStore} database. + * + *

Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your + * thread may crash. + * + *

The {@code KVStore} database to close must be an object created by using the {@code getKvStore} method. Before using this + * method, release the resources created for the database, for example, {@code KVStoreResultSet} for {@code SingleKVStore}, + * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error + * will be returned. + * + * @param kvStore Indicates the {@code KVStore} database to close. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; + closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; + + /** + * Deletes the {@code KVStore} database identified by storeId. + * + *

Before using this method, close all {@code KVStore} instances in use that are identified by the same storeId. + * + *

You can use this method to delete a {@code KVStore} database not in use. After the database is deleted, all its data will be + * lost. + * + * @param storeId Identifies the {@code KVStore} database to delete. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100004 - if the database not exist when delete database. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + deleteKVStore(appId: string, storeId: string): Promise; + + /** + * Obtains the storeId of all {@code KVStore} databases that are created by using the {@code getKvStore} method and not deleted by + * calling the {@code deleteKvStore} method. + * + * @returns Returns the storeId of all created {@code KVStore} databases. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getAllKVStoreId(appId: string, callback: AsyncCallback): void; + getAllKVStoreId(appId: string): Promise; + + /** + * register DeviceChangeCallback to get notification when device's status changed + * + * @param deathCallback device change callback {@code DeviceChangeCallback} + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + on(event: 'distributedDataServiceDie', deathCallback: Callback): void; + + /** + * unRegister DeviceChangeCallback and can not receive notification + * + * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; + } +} + +export default kvStore; \ No newline at end of file -- Gitee From 5f35a8bcdb8ed3d283560080fc141eddf65f754e Mon Sep 17 00:00:00 2001 From: dboy190 Date: Fri, 14 Oct 2022 08:30:31 +0800 Subject: [PATCH 11/22] distributedData delete api9 interface Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 211 ---------------------------- 1 file changed, 211 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index e020a04031..77ee7f6942 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -14,10 +14,6 @@ */ import { AsyncCallback, Callback } from './basic'; -import { ValuesBucket } from './@ohos.data.ValuesBucket'; -import dataSharePredicates from './@ohos.data.dataSharePredicates'; -import DataShareResultSet from './@ohos.data.DataShareResultSet'; -import Context from './application/Context'; /** * Providers interfaces to creat a {@link KVManager} istances. @@ -50,15 +46,6 @@ declare namespace distributedData { * @import N/A */ bundleName: string; - - /** - * Indicates the ability or hap context - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @Note: if swap the area, you should close all the KV store and use the new Context to create the KVManager - */ - context: Context; } /** @@ -1125,21 +1112,6 @@ 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. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param value Indicates the data record to put. - * 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}. - */ - putBatch(value: Array, callback: AsyncCallback): void; - putBatch(value: Array): Promise; - /** * Deletes the key-value pair based on a specified key. * @@ -1154,50 +1126,6 @@ declare namespace distributedData { delete(key: string, callback: AsyncCallback): void; delete(key: string): Promise; - /** - * Deletes the key-value pair based on a specified key. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @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: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); - delete(predicates: dataSharePredicates.DataSharePredicates): Promise; - - /** - * Backs up a database in a specified name. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param file Indicates the name that saves the database backup. - */ - backup(file:string, callback: AsyncCallback):void; - backup(file:string): Promise; - - /** - * Restores a database from a specified database file. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param file Indicates the name that saves the database file. - */ - restore(file:string, callback: AsyncCallback):void; - restore(file:string): Promise; - - /** - * Delete a backup files based on a specified name. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param files list Indicates the name that backup file to delete. - */ - deleteBackup(files:Array, callback: AsyncCallback>):void; - deleteBackup(files:Array): Promise>; - /** * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. @@ -1235,17 +1163,6 @@ declare namespace distributedData { */ off(event:'dataChange', listener?: Callback): void; - /** - * UnRegister Synchronizes {@code KvStore} database callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @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; - /** * Inserts key-value pairs into the {@code KvStore} database in batches. * @@ -1415,21 +1332,6 @@ declare namespace distributedData { getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; - /** - * Obtains the KvStoreResultSet object matching the specified Predicate object. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @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}. - */ - getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; - /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * @@ -1482,35 +1384,6 @@ declare namespace distributedData { */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void - /** - * Synchronizes the database to the specified devices with the specified delay allowed. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param deviceIds 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 delayMs 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(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; - - /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener Indicates the observer of data change events in the distributed database. - * @throws Throws this exception if no {@code SingleKvStore} database is available. - * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. - */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; - /** * Register Synchronizes SingleKvStore databases callback. *

Sync result is returned through asynchronous callback. @@ -1521,17 +1394,6 @@ declare namespace distributedData { */ on(event: 'syncComplete', syncCallback: Callback>): void; - /** - * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param listener 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', listener?: Callback): void; - /** * UnRegister Synchronizes SingleKvStore databases callback. * @since 8 @@ -1676,36 +1538,6 @@ 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. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param predicates Indicates the datasharePredicates. - * @systemapi - * 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: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; - - /** - * Obtains the KvStoreResultSet object matching a specified Device ID and Predicate object. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param predicates Indicates the key. - * @param deviceId Indicates the ID of the device to which the results belong. - * 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: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; - /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. * @@ -1773,23 +1605,6 @@ declare namespace distributedData { */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; - /** - * Synchronizes {@code DeviceKVStore} databases. - * - *

This method returns immediately and sync result will be returned through asynchronous callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param deviceIds Indicates the list of IDs of devices whose - * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * {@code DeviceKVStore} databases are to be synchronized. - * @param query Indicates the {@code Query} object. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or - * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws Throws this exception if no DeviceKVStore database is available. - */ - sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; - /** * Register Synchronizes DeviceKVStore databases callback. * @@ -1801,32 +1616,6 @@ declare namespace distributedData { */ 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. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener 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: 'dataChange', type: SubscribeType, listener: Callback): void; - - /** - * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param listener 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', listener?: Callback): void; - /** * UnRegister Synchronizes DeviceKVStore databases callback. * @since 8 -- Gitee From 36fb390691590b58e87093e1e34feeade7a70055 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Fri, 14 Oct 2022 09:40:00 +0800 Subject: [PATCH 12/22] fix since problem Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 834 ++++++++++++++-------------- 1 file changed, 431 insertions(+), 403 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 77ee7f6942..9ba4e2fdfa 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -17,33 +17,32 @@ import { AsyncCallback, Callback } from './basic'; /** * Providers interfaces to creat a {@link KVManager} istances. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ - declare namespace distributedData { /** * Provides configuration information for {@link KVManager} instances, * including the caller's package name and distributed network type. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface KVManagerConfig { /** * Indicates the user information - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ userInfo: UserInfo; /** * Indicates the bundleName - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ bundleName: string; } @@ -54,24 +53,24 @@ declare namespace distributedData { *

This class provides methods for obtaining the user ID and type, setting the user ID and type, * and checking whether two users are the same. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface UserInfo { /** * Indicates the user ID to set - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ userId?: string; /** * Indicates the user type to set - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ userType?: UserType; } @@ -79,72 +78,73 @@ declare namespace distributedData { /** * Enumerates user types. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum UserType { /** * Indicates a user that logs in to different devices using the same account. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SAME_USER_ID = 0 } /** * KVStore constants - * @since 7 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ namespace Constants { /** * max key length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_KEY_LENGTH = 1024; /** * max value length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_VALUE_LENGTH = 4194303; /** * max device coordinate key length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_KEY_LENGTH_DEVICE = 896; /** * max store id length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_STORE_ID_LENGTH = 128; /** * max query length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_QUERY_LENGTH = 512000; /** * max batch operation size. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ const MAX_BATCH_SIZE = 128; } @@ -154,56 +154,56 @@ declare namespace distributedData { * *

{@code ValueType} is obtained based on the value. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum ValueType { /** * Indicates that the value type is string. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ STRING = 0, /** * Indicates that the value type is int. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ INTEGER = 1, /** * Indicates that the value type is float. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ FLOAT = 2, /** * Indicates that the value type is byte array. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 * */ BYTE_ARRAY = 3, /** * Indicates that the value type is boolean. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 * */ BOOLEAN = 4, /** * Indicates that the value type is double. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ DOUBLE = 5 } @@ -211,26 +211,26 @@ declare namespace distributedData { /** * Obtains {@code Value} objects stored in a {@link KVStore} database. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface Value { /** * Indicates value type - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @see ValueType * @type {number} * @memberof Value + * @since 7 */ type: ValueType; /** * Indicates value - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ value: Uint8Array | string | number | boolean; } @@ -238,23 +238,23 @@ declare namespace distributedData { /** * Provides key-value pairs stored in the distributed database. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface Entry { /** * Indicates key - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ key: string; /** * Indicates value - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ value: Value; } @@ -265,37 +265,37 @@ declare namespace distributedData { *

If you have subscribed to {@code KVStore}, you will receive data change notifications and obtain the changed data * from the parameters in callback methods upon data insertion, update, or deletion. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface ChangeNotification { /** * Indicates data addition records. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ insertEntries: Entry[]; /** * Indicates data update records. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ updateEntries: Entry[]; /** * Indicates data deletion records. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ deleteEntries: Entry[]; /** * Indicates from device id. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ deviceId: string; } @@ -303,30 +303,30 @@ declare namespace distributedData { /** * Indicates the database synchronization mode. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum SyncMode { /** * Indicates that data is only pulled from the remote end. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ PULL_ONLY = 0, /** * Indicates that data is only pushed from the local end. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ PUSH_ONLY = 1, /** * Indicates that data is pushed from the local end, and then pulled from the remote end. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ PUSH_PULL = 2 } @@ -334,32 +334,32 @@ declare namespace distributedData { /** * Describes the subscription type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum SubscribeType { /** * Subscription to local data changes - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SUBSCRIBE_TYPE_LOCAL = 0, /** * Subscription to remote data changes - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SUBSCRIBE_TYPE_REMOTE = 1, /** * Subscription to both local and remote data changes - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SUBSCRIBE_TYPE_ALL = 2, } @@ -367,32 +367,32 @@ declare namespace distributedData { /** * Describes the {@code KVStore} type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum KVStoreType { /** * Device-collaborated database, as specified by {@code DeviceKVStore} - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ DEVICE_COLLABORATION = 0, /** * Single-version database, as specified by {@code SingleKVStore} - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ SINGLE_VERSION = 1, /** * Multi-version database, as specified by {@code MultiKVStore} - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ MULTI_VERSION = 2, } @@ -400,17 +400,17 @@ declare namespace distributedData { /** * Describes the {@code KVStore} type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ enum SecurityLevel { /** * NO_LEVEL: mains not set the security level. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 7 */ NO_LEVEL = 0, @@ -418,9 +418,9 @@ declare namespace distributedData { * S0: mains the db is public. * There is no impact even if the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S0 = 1, @@ -428,9 +428,9 @@ declare namespace distributedData { * S1: mains the db is low level security * There are some low impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S1 = 2, @@ -438,9 +438,9 @@ declare namespace distributedData { * S2: mains the db is middle level security * There are some major impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S2 = 3, @@ -448,9 +448,9 @@ declare namespace distributedData { * S3: mains the db is high level security * There are some severity impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S3 = 5, @@ -458,9 +458,9 @@ declare namespace distributedData { * S4: mains the db is critical level security * There are some critical impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ S4 = 6, } @@ -471,59 +471,59 @@ declare namespace distributedData { *

You can determine whether to create another database if a {@code KVStore} database is missing, * whether to encrypt the database, and the database type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface Options { /** * Indicates whether to createa database when the database file does not exist - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ createIfMissing?: boolean; /** * Indicates setting whether database files are encrypted - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ encrypt?: boolean; /** * Indicates setting whether to back up database files - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ backup?: boolean; /** * Indicates setting whether database files are automatically synchronized - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ autoSync?: boolean; /** * Indicates setting the databse type - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ kvStoreType?: KVStoreType; /** * Indicates setting the database security level - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ securityLevel?: SecurityLevel; /** * Indicates schema object - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 8 */ schema?: Schema; } @@ -533,44 +533,44 @@ declare namespace distributedData { * * You can create Schema objects and put them in Options when creating or opening the database. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 8 */ class Schema { /** * A constructor used to create a Schema instance. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ constructor() /** * Indicates the root json object. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ root: FieldNode; /** * Indicates the string array of json. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ indexes: Array; /** * Indicates the mode of schema. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ mode: number; /** * Indicates the skipsize of schema. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ skip: number; } @@ -584,17 +584,17 @@ declare namespace distributedData { * *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A + * @since 8 */ class FieldNode { /** * A constructor used to create a FieldNode instance with the specified field. * name Indicates the field node name. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ constructor(name: string) /** @@ -602,31 +602,31 @@ declare namespace distributedData { * *

Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param child The field node to append. + * @param child The field node to append. * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ appendChild(child: FieldNode): boolean; /** * Indicates the default value of fieldnode. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ default: string; /** * Indicates the nullable of database field. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ nullable: boolean; /** * Indicates the type of value. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ type: number; } @@ -637,434 +637,447 @@ declare namespace distributedData { *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} class. This interface also provides * methods for moving the data read position in the result set. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A + * @since 7 */ interface KvStoreResultSet { /** * Obtains the number of lines in a result set. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns the number of lines. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getCount(): number; /** * Obtains the current read position in a result set. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns the current read position. The read position starts with 0. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getPosition(): number; /** * Moves the read position to the first line. * *

If the result set is empty, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToFirst(): boolean; /** * Moves the read position to the last line. * *

If the result set is empty, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToLast(): boolean; /** * Moves the read position to the next line. * *

If the result set is empty or the data in the last line is being read, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToNext(): boolean; /** * Moves the read position to the previous line. * *

If the result set is empty or the data in the first line is being read, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ moveToPrevious(): boolean; /** * Moves the read position by a relative offset to the current position. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the * final position is invalid, false will be returned. * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead moveV9 */ move(offset: number): boolean; /** * Moves the read position from 0 to an absolute position. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param position Indicates the absolute position. * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead moveToPositionV9 */ moveToPosition(position: number): boolean; /** * Checks whether the read position is the first line. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns true if the read position is the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isFirst(): boolean; /** * Checks whether the read position is the last line. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns true if the read position is the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isLast(): boolean; /** * Checks whether the read position is before the last line. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns true if the read position is before the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isBeforeFirst(): boolean; /** * Checks whether the read position is after the last line. * - * @since 8 + * @returns Returns true if the read position is after the last line; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns true if the read position is after the last line; returns false otherwise. + * @since 8 */ isAfterLast(): boolean; /** * Obtains a key-value pair. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @returns Returns a key-value pair. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead getEntryV9 */ getEntry(): Entry; } /** * Represents a database query using a predicate. - * + * *

This class provides a constructor used to create a {@code Query} instance, which is used to query data matching specified * conditions in the database. - * + * *

This class also provides methods for adding predicates to the {@code Query} instance. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead QueryV9 */ class Query { /** * A constructor used to create a Query instance. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ - constructor() + constructor() /** * Resets this {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the reset {@code Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ reset(): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value IIndicates the long value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ equalTo(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ notEqualTo(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - */ - greaterThan(field: string, value: number|string|boolean): Query; + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + */ + greaterThan(field: string, value: number|string|boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ lessThan(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ greaterThanOrEqualTo(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the * specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ lessThanOrEqualTo(field: string, value: number|string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is null. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isNull(field: string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ inNumber(field: string, valueList: number[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ inString(field: string, valueList: string[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ notInNumber(field: string, valueList: number[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ notInString(field: string, valueList: string[]): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ like(field: string, value: string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ unlike(field: string, value: string): Query; /** * Constructs a {@code Query} object with the and condition. - * + * *

Multiple predicates should be connected using the and or or condition. - * - * @since 8 + * + * @returns Returns the {@coed Query} object. + * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @returns Returns the {@coed Query} object. + * @since 8 */ and(): Query; /** * Constructs a {@code Query} object with the or condition. - * + * *

Multiple predicates should be connected using the and or or condition. - * - * @since 8 + * + * @returns Returns the {@coed Query} object. + * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @returns Returns the {@coed Query} object. + * @since 8 */ or(): Query; /** * Constructs a {@code Query} object to sort the query results in ascending order. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ orderByAsc(field: string): Query; /** * Constructs a {@code Query} object to sort the query results in descending order. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ orderByDesc(field: string): Query; /** * Constructs a {@code Query} object to specify the number of results and the start position. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param total Indicates the number of results. * @param offset Indicates the start position. * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ limit(total: number, offset: number): Query; /** * Creates a {@code query} condition with a specified field that is not null. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the specified field. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ isNotNull(field: string): Query; /** * Creates a query condition group with a left bracket. - * + * *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ beginGroup(): Query; /** * Creates a query condition group with a right bracket. - * + * *

Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the {@coed Query} object. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ endGroup(): Query; /** * Creates a query condition with a specified key prefix. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param prefix Indicates the specified key prefix. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ prefixKey(prefix: string): Query; /** * Sets a specified index that will be preferentially used for query. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param index Indicates the index to set. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ setSuggestIndex(index: string): Query; /** * Add device ID key prefix.Used by {@code DeviceKVStore}. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param deviceId Specify device id to query from. * @return Returns the {@code Query} object with device ID prefix added. * @throw Throws this exception if input is invalid. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ deviceId(deviceId:string):Query; /** @@ -1072,11 +1085,11 @@ declare namespace distributedData { * *

The String would be parsed to DB query format. * The String length should be no longer than 500kb. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * + * @return String representing this {@code Query}. * @import N/A - * @return String representing this {@code Query}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getSqlLike():string; } @@ -1089,25 +1102,27 @@ declare namespace distributedData { * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, * including {@code SingleKVStore}. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead KVStoreV9 */ interface KVStore { /** * Writes a key-value pair of the string type into the {@code KvStore} database. * *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; put(key: string, value: Uint8Array | string | number | boolean): Promise; @@ -1115,131 +1130,131 @@ declare namespace distributedData { /** * Deletes the key-value pair based on a specified key. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and * {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ delete(key: string, callback: AsyncCallback): void; delete(key: string): Promise; /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KvStoreObserver} will be invoked. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws Throws this exception if any of the following errors + * @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}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** * Subscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws Throws this exception if any of the following errors + * + * @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}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ on(event: 'syncComplete', syncCallback: Callback>): void; - + /** * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws Throws this exception if any of the following errors + * @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}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ - off(event:'dataChange', listener?: Callback): void; + off(event: 'dataChange', listener?: Callback): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param entries Indicates the key-value pairs to be inserted in batches. * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ putBatch(entries: Entry[], callback: AsyncCallback): void; putBatch(entries: Entry[]): Promise; /** * Deletes key-value pairs in batches from the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param keys Indicates the key-value pairs to be deleted in batches. * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ deleteBatch(keys: string[], callback: AsyncCallback): void; deleteBatch(keys: string[]): Promise; /** * Starts a transaction operation in the {@code KvStore} database. - * + * *

After the database transaction is started, you can submit or roll back the operation. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; /** * Submits a transaction operation in the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param callback + * + * @param callback * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ commit(callback: AsyncCallback): void; commit(): Promise; /** * Rolls back a transaction operation in the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ rollback(callback: AsyncCallback): void; rollback(): Promise; /** * Sets whether to enable synchronization. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param enabled Specifies whether to enable synchronization. The value true means to enable * synchronization, and false means the opposite. * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ enableSync(enabled: boolean, callback: AsyncCallback): void; enableSync(enabled: boolean): Promise; /** * Sets synchronization range labels. - * + * *

The labels determine the devices with which data will be synchronized. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param localLabels Indicates the synchronization labels of the local device. * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; @@ -1255,49 +1270,51 @@ declare namespace distributedData { * The {@code SingleKVStore} database does not support * synchronous transactions, or data search using snapshots. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead SingleKVStoreV9 */ interface SingleKVStore extends KVStore { /** * Obtains the {@code String} value of a specified key. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param key Indicates the key of the boolean value to be queried. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ get(key: string, callback: AsyncCallback): void; get(key: string): Promise; /** * Obtains all key-value pairs that match a specified key prefix. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getEntries(keyPrefix: string, callback: AsyncCallback): void; getEntries(keyPrefix: string): Promise; /** * Obtains the list of key-value pairs matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; @@ -1308,63 +1325,63 @@ declare namespace distributedData { * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects * in a timely manner. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param keyPrefix Indicates the key prefix to match. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param query Indicates the {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; /** * Obtains the number of results matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; /** * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -1372,57 +1389,58 @@ declare namespace distributedData { /** * Synchronizes the database to the specified devices with the specified delay allowed. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. * @throws Throws this exception if any of the following errors * @permission ohos.permission.DISTRIBUTED_DATASYNC - * occurs: {@code INVALID_ARGUMENT}, + * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ - sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; /** - * Register Synchronizes SingleKvStore databases callback. + * Register Synchronizes SingleKvStore databases callback. *

Sync result is returned through asynchronous callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ on(event: 'syncComplete', syncCallback: Callback>): void; /** * UnRegister Synchronizes SingleKvStore databases callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ off(event: 'syncComplete', syncCallback?: Callback>): void; - - + /** * Sets the default delay allowed for database synchronization - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; setSyncParam(defaultAllowedDelayMs: number): Promise; /** * Get the security level of the database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns SecurityLevel {@code SecurityLevel} the security level of the database. * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, * {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getSecurityLevel(callback: AsyncCallback): void; getSecurityLevel(): Promise; @@ -1430,147 +1448,149 @@ declare namespace distributedData { /** * Manages distributed data by device in a distributed system. - * + * *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead DeviceKVStoreV9 */ interface DeviceKVStore extends KVStore { /** * Obtains the {@code String} value matching a specified device ID and key. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the device to be queried. * @param key Indicates the key of the value to be queried. * @return Returns the value matching the given criteria. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ get(deviceId: string, key: string, callback: AsyncCallback): void; get(deviceId: string, key: string): Promise; /** * Obtains all key-value pairs matching a specified device ID and key prefix. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getEntries(deviceId: string, keyPrefix: string): Promise; /** * Obtains the list of key-value pairs matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deviceId Indicates the ID of the device to which the key-value pairs belong. * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; getEntries(deviceId: string, query: Query): Promise; /** * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. - * + * *

The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary * {@code KvStoreResultSet} objects in a timely manner. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deviceId Identifies the device whose data is to be queried. * @param keyPrefix Indicates the key prefix to match. * @returns Returns the {@code KvStoreResultSet} objects. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getResultSet(deviceId: string, keyPrefix: string): Promise; /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param query Indicates the {@code Query} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; /** * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. * @param query Indicates the {@code Query} object. * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSet(deviceId: string, query: Query): Promise; /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; /** * Obtains the number of results matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; /** * Obtains the number of results matching a specified device ID and {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deviceId Indicates the ID of the device to which the results belong. * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSize(deviceId: string, query: Query): Promise; @@ -1579,64 +1599,69 @@ declare namespace distributedData { * Removes data of a specified device from the current database. This method is used to remove only the data * synchronized from remote devices. This operation does not synchronize data to other databases or affect * subsequent data synchronization. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; - + /** * Synchronizes {@code DeviceKVStore} databases. * *

This method returns immediately and sync result will be returned through asynchronous callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; /** * Register Synchronizes DeviceKVStore databases callback. - * + * *

Sync result is returned through asynchronous callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ on(event: 'syncComplete', syncCallback: Callback>): void; - + /** * UnRegister Synchronizes DeviceKVStore databases callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ off(event: 'syncComplete', syncCallback?: Callback>): void; } - + /** * Creates a {@link KVManager} instance based on the configuration information. * *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param config Indicates the {@link KVStore} configuration information, * including the user information and package name. * @return Returns the {@code KVManager} instance. * @throws Throws exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead createKVManagerV9 */ function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManager(config: KVManagerConfig): Promise; @@ -1644,23 +1669,25 @@ declare namespace distributedData { /** * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead KVManagerV9 */ interface KVManager { /** * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. * @param storeId Identifies the {@code KVStore} database. * The value of this parameter must be unique for the same application, * and different applications can share the same value. * @return Returns a {@code KVStore}, or {@code SingleKVStore}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 */ getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; @@ -1675,14 +1702,14 @@ declare namespace distributedData { * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStore}, * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error * will be returned. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param kvStore Indicates the {@code KvStore} database to close. * @throws Throws this exception if any of the following errors * occurs:{@code INVALID_ARGUMENT}, {@code ERVER_UNAVAILABLE}, * {@code STORE_NOT_OPEN}, {@code STORE_NOT_FOUND}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; @@ -1694,13 +1721,14 @@ declare namespace distributedData { * *

You can use this method to delete a {@code KvStore} database not in use. After the database is deleted, all its data will be * lost. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param storeId Identifies the {@code KvStore} database to delete. * @throws Throws this exception if any of the following errors * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code STORE_NOT_FOUND}, * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; deleteKVStore(appId: string, storeId: string): Promise; @@ -1709,12 +1737,12 @@ declare namespace distributedData { * Obtains the storeId of all {@code KvStore} databases that are created by using the {@code getKvStore} method and not deleted by * calling the {@code deleteKvStore} method. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns the storeId of all created {@code KvStore} databases. + * @returns Returns the storeId of all created {@code KvStore} databases. * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; getAllKVStoreId(appId: string): Promise; @@ -1722,20 +1750,20 @@ declare namespace distributedData { /** * register DeviceChangeCallback to get notification when device's status changed * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; /** * unRegister DeviceChangeCallback and can not receive notification * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } -- Gitee From 5c1c0ddc1e2c971fe1520fe36d65effc44d9d828 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Fri, 14 Oct 2022 13:47:38 +0800 Subject: [PATCH 13/22] fix codes Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 4 + ....ts => @ohos.data.distributedKVStore.d.ts} | 514 ++++++------------ 2 files changed, 170 insertions(+), 348 deletions(-) rename api/{@ohos.data.kvStore.d.ts => @ohos.data.distributedKVStore.d.ts} (88%) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 9ba4e2fdfa..db85d859d1 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -20,6 +20,8 @@ import { AsyncCallback, Callback } from './basic'; * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.kvStore */ declare namespace distributedData { /** @@ -28,6 +30,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.kvStore.KVManagerConfig */ interface KVManagerConfig { /** diff --git a/api/@ohos.data.kvStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts similarity index 88% rename from api/@ohos.data.kvStore.d.ts rename to api/@ohos.data.distributedKVStore.d.ts index a72691b335..de74faaa95 100644 --- a/api/@ohos.data.kvStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,16 +16,15 @@ import { AsyncCallback, Callback } from './basic'; import { ValuesBucket } from './@ohos.data.ValuesBucket'; import dataSharePredicates from './@ohos.data.dataSharePredicates'; -import DataShareResultSet from './@ohos.data.DataShareResultSet'; import Context from './application/Context'; /** - * Providers interfaces to creat a {@link KVManager} istances. + * Providers interfaces to create a {@link KVManager} istances. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 9 */ -declare namespace kvStore { +declare namespace distributedKVStore { /** * Provides configuration information for {@link KVManager} instances, * including the caller's package name and distributed network type. @@ -34,14 +33,6 @@ declare namespace kvStore { * @since 9 */ interface KVManagerConfig { - /** - * Indicates the user information - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @since 9 - */ - userInfo: UserInfo; - /** * Indicates the bundleName * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -60,51 +51,6 @@ declare namespace kvStore { context: Context; } - /** - * Manages user information. - * - *

This class provides methods for obtaining the user ID and type, setting the user ID and type, - * and checking whether two users are the same. - * - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @since 9 - */ - interface UserInfo { - /** - * Indicates the user ID to set - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @since 9 - */ - userId?: string; - - /** - * Indicates the user type to set - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @since 9 - */ - userType?: UserType; - } - - /** - * Enumerates user types. - * - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @since 9 - */ - enum UserType { - /** - * Indicates a user that logs in to different devices using the same account. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @since 9 - */ - SAME_USER_ID = 0 - } - /** * KVStore constants * @@ -178,7 +124,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - STRING = 0, + STRING, /** * Indicates that the value type is int. @@ -186,7 +132,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - INTEGER = 1, + INTEGER, /** * Indicates that the value type is float. @@ -194,7 +140,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - FLOAT = 2, + FLOAT, /** * Indicates that the value type is byte array. @@ -202,7 +148,7 @@ declare namespace kvStore { * @import N/A * @since 9 * */ - BYTE_ARRAY = 3, + BYTE_ARRAY, /** * Indicates that the value type is boolean. @@ -210,7 +156,7 @@ declare namespace kvStore { * @import N/A * @since 9 * */ - BOOLEAN = 4, + BOOLEAN, /** * Indicates that the value type is double. @@ -218,7 +164,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - DOUBLE = 5 + DOUBLE, } /** @@ -327,21 +273,21 @@ declare namespace kvStore { * @import N/A * @since 9 */ - PULL_ONLY = 0, + PULL_ONLY, /** * Indicates that data is only pushed from the local end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 9 */ - PUSH_ONLY = 1, + PUSH_ONLY, /** * Indicates that data is pushed from the local end, and then pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 9 */ - PUSH_PULL = 2 + PUSH_PULL, } /** @@ -358,7 +304,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - SUBSCRIBE_TYPE_LOCAL = 0, + SUBSCRIBE_TYPE_LOCAL, /** * Subscription to remote data changes @@ -366,7 +312,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - SUBSCRIBE_TYPE_REMOTE = 1, + SUBSCRIBE_TYPE_REMOTE, /** * Subscription to both local and remote data changes @@ -374,7 +320,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - SUBSCRIBE_TYPE_ALL = 2, + SUBSCRIBE_TYPE_ALL, } /** @@ -391,7 +337,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - DEVICE_COLLABORATION = 0, + DEVICE_COLLABORATION, /** * Single-version database, as specified by {@code SingleKVStore} @@ -399,7 +345,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - SINGLE_VERSION = 1, + SINGLE_VERSION, } /** @@ -418,7 +364,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - S1 = 2, + S1, /** * S2: mains the db is middle level security @@ -428,7 +374,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - S2 = 3, + S2, /** * S3: mains the db is high level security @@ -438,7 +384,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - S3 = 5, + S3, /** * S4: mains the db is critical level security @@ -448,7 +394,7 @@ declare namespace kvStore { * @import N/A * @since 9 */ - S4 = 6, + S4, } /** @@ -618,7 +564,7 @@ declare namespace kvStore { } /** - * Provide methods to obtain the result set of the {@code KvStore} or {@code KVStore} database. + * Provide methods to obtain the result set of the {@code KVStore} or {@code KVStore} database. * *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} or * {@code DeviceKVStore} class. This interface also provides methods for moving the data read position in the result set. @@ -1076,19 +1022,21 @@ declare namespace kvStore { } /** - * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, - * and subscribing to distributed data. + * Provides methods related to single-version distributed databases. * - *

You can create distributed databases of different types by {@link KVManager#getKVStore (Options, String)} - * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, - * including {@code SingleKVStore}. + *

To create a {@code SingleKVStore} database, + * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method + * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. + * This database synchronizes data to other databases in time sequence. + * The {@code SingleKVStore} database does not support + * synchronous transactions, or data search using snapshots. * * @import N/A * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - interface KVStore { + interface SingleKVStore { /** * Writes a key-value pair of the string type into the {@code KVStore} database. * @@ -1106,6 +1054,19 @@ declare namespace kvStore { put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; put(key: string, value: Uint8Array | string | number | boolean): Promise; + /** + * Inserts key-value pairs into the {@code KVStore} database in batches. + * + * @param entries Indicates the key-value pairs to be inserted in batches. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + putBatch(entries: Entry[], callback: AsyncCallback): void; + putBatch(entries: Entry[]): Promise; + /** * Writes a value of the valuesbucket type into the {@code KVStore} database. * @@ -1153,100 +1114,6 @@ declare namespace kvStore { delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); delete(predicates: dataSharePredicates.DataSharePredicates): Promise; - /** - * Backs up a database in a specified name. - * - * @param file Indicates the name that saves the database backup. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - backup(file:string, callback: AsyncCallback):void; - backup(file:string): Promise; - - /** - * Restores a database from a specified database file. - * - * @param file Indicates the name that saves the database file. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - restore(file:string, callback: AsyncCallback):void; - restore(file:string): Promise; - - /** - * Delete a backup files based on a specified name. - * - * @param files list Indicates the name that backup file to delete. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - deleteBackup(files:Array, callback: AsyncCallback>):void; - deleteBackup(files:Array): Promise>; - - /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. - * - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; - - /** - * Subscribes from the {@code KVStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - on(event: 'syncComplete', syncCallback: Callback>): void; - - /** - * Unsubscribes from the {@code KVStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - off(event:'dataChange', listener?: Callback): void; - - /** - * UnRegister Synchronizes {@code KVStore} database callback. - * - * @param syncCallback Indicates the callback used to send the synchronization result to caller. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - off(event: 'syncComplete', syncCallback?: Callback>): void; - - /** - * Inserts key-value pairs into the {@code KVStore} database in batches. - * - * @param entries Indicates the key-value pairs to be inserted in batches. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - putBatch(entries: Entry[], callback: AsyncCallback): void; - putBatch(entries: Entry[]): Promise; - /** * Deletes key-value pairs in batches from the {@code KVStore} database. * @@ -1262,81 +1129,18 @@ declare namespace kvStore { deleteBatch(keys: string[]): Promise; /** - * Starts a transaction operation in the {@code KVStore} database. - * - *

After the database transaction is started, you can submit or roll back the operation. - * - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - startTransaction(callback: AsyncCallback): void; - startTransaction(): Promise; - - /** - * Submits a transaction operation in the {@code KVStore} database. - * - * @param callback - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - commit(callback: AsyncCallback): void; - commit(): Promise; - - /** - * Rolls back a transaction operation in the {@code KVStore} database. - * - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - rollback(callback: AsyncCallback): void; - rollback(): Promise; - - /** - * Sets whether to enable synchronization. + * void removeDeviceData​({@link String} deviceId) throws {@link BusinessError} * - * @param enabled Specifies whether to enable synchronization. The value true means to enable - * synchronization, and false means the opposite. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - enableSync(enabled: boolean, callback: AsyncCallback): void; - enableSync(enabled: boolean): Promise; - - /** - * Sets synchronization range labels. - * - *

The labels determine the devices with which data will be synchronized. - * - * @param localLabels Indicates the synchronization labels of the local device. - * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. + * @param deviceId Indicates the device to be removed data. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; - setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; - } + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; - /** - * Provides methods related to single-version distributed databases. - * - *

To create a {@code SingleKVStore} database, - * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method - * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. - * This database synchronizes data to other databases in time sequence. - * The {@code SingleKVStore} database does not support - * synchronous transactions, or data search using snapshots. - * - * @import N/A - * @version 1 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - interface SingleKVStore extends KVStore { /** * Obtains the {@code String} value of a specified key. * @@ -1457,17 +1261,111 @@ declare namespace kvStore { getResultSize(query: Query): Promise; /** - * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} + * Backs up a database in a specified name. * - * @param deviceId Indicates the device to be removed data. + * @param file Indicates the name that saves the database backup. * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; + backup(file:string, callback: AsyncCallback):void; + backup(file:string): Promise; + + /** + * Restores a database from a specified database file. + * + * @param file Indicates the name that saves the database file. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + restore(file:string, callback: AsyncCallback):void; + restore(file:string): Promise; + + /** + * Delete a backup files based on a specified name. + * + * @param files list Indicates the name that backup file to delete. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBackup(files:Array, callback: AsyncCallback>):void; + deleteBackup(files:Array): Promise>; + + /** + * Starts a transaction operation in the {@code KVStore} database. + * + *

After the database transaction is started, you can submit or roll back the operation. + * + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + startTransaction(callback: AsyncCallback): void; + startTransaction(): Promise; + + /** + * Submits a transaction operation in the {@code KVStore} database. + * + * @param callback + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + commit(callback: AsyncCallback): void; + commit(): Promise; + + /** + * Rolls back a transaction operation in the {@code KVStore} database. + * + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + rollback(callback: AsyncCallback): void; + rollback(): Promise; + + /** + * Sets whether to enable synchronization. + * + * @param enabled Specifies whether to enable synchronization. The value true means to enable + * synchronization, and false means the opposite. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enableSync(enabled: boolean, callback: AsyncCallback): void; + enableSync(enabled: boolean): Promise; + + /** + * Sets synchronization range labels. + * + *

The labels determine the devices with which data will be synchronized. + * + * @param localLabels Indicates the synchronization labels of the local device. + * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; + setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; + + /** + * Sets the default delay allowed for database synchronization + * + * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + setSyncParam(defaultAllowedDelayMs: number): Promise; /** * Synchronizes the database to the specified devices with the specified delay allowed. @@ -1501,8 +1399,8 @@ declare namespace kvStore { sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. + * Registers a {@code KVStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KVStoreObserver} will be invoked. * * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. @@ -1515,7 +1413,7 @@ declare namespace kvStore { on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** - * Register Synchronizes SingleKvStore databases callback. + * Register Synchronizes SingleKVStore databases callback. *

Sync result is returned through asynchronous callback. * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. @@ -1526,9 +1424,9 @@ declare namespace kvStore { on(event: 'syncComplete', syncCallback: Callback>): void; /** - * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * Unsubscribes from the SingleKVStore database based on the specified subscribeType and {@code KVStoreObserver}. * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KVStoreObserver)}. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1537,7 +1435,7 @@ declare namespace kvStore { off(event:'dataChange', listener?: Callback): void; /** - * UnRegister Synchronizes SingleKvStore databases callback. + * UnRegister Synchronizes SingleKVStore databases callback. * * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1545,18 +1443,6 @@ declare namespace kvStore { */ off(event: 'syncComplete', syncCallback?: Callback>): void; - - /** - * Sets the default delay allowed for database synchronization - * - * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; - setSyncParam(defaultAllowedDelayMs: number): Promise; - /** * Get the security level of the database. * @@ -1572,8 +1458,8 @@ declare namespace kvStore { /** * Manages distributed data by device in a distributed system. * - *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} - * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed + *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKVStore(Options, String)} + * method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. * @@ -1581,7 +1467,7 @@ declare namespace kvStore { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ - interface DeviceKVStore extends KVStore { + interface DeviceKVStore extends SingleKVStore { /** * Obtains the {@code String} value matching a specified device ID and key. * @@ -1613,21 +1499,6 @@ declare namespace kvStore { getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getEntries(deviceId: string, keyPrefix: string): Promise; - /** - * Obtains the list of key-value pairs matching the specified {@code Query} object. - * - * @param query Indicates the {@code Query} object. - * @returns Returns the list of key-value pairs matching the specified {@code Query} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100005 - if not support the operation. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getEntries(query: Query, callback: AsyncCallback): void; - getEntries(query: Query): Promise; - /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. * @@ -1664,20 +1535,6 @@ declare namespace kvStore { getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getResultSet(deviceId: string, keyPrefix: string): Promise; - /** - * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. - * - * @param query Indicates the {@code Query} object. - * @returns Returns the {@code KVStoreResultSet} object matching the specified {@code Query} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getResultSet(query: Query, callback: AsyncCallback): void; - getResultSet(query: Query): Promise; - /** * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. * @@ -1693,20 +1550,6 @@ declare namespace kvStore { getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSet(deviceId: string, query: Query): Promise; - /** - * Obtains the KVStoreResultSet object matching the specified Predicate object. - * - * @param predicates Indicates the datasharePredicates. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @since 9 - */ - getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; - /** * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. * @@ -1722,31 +1565,6 @@ declare namespace kvStore { getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; - /** - * Closes a {@code KVStoreResultSet} object returned by getResultSet. - * - * @param resultSet Indicates the {@code KVStoreResultSet} object to close. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KVStoreResultSet): Promise; - - /** - * Obtains the number of results matching the specified {@code Query} object. - * - * @param query Indicates the {@code Query} object. - * @returns Returns the number of results matching the specified {@code Query} object. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - getResultSize(query: Query, callback: AsyncCallback): void; - getResultSize(query: Query): Promise; - /** * Obtains the number of results matching a specified device ID and {@code Query} object. * @@ -1826,8 +1644,8 @@ declare namespace kvStore { 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. + * Registers a {@code KVStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KVStoreObserver} will be invoked. * * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. @@ -1840,9 +1658,9 @@ declare namespace kvStore { on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** - * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KVStoreObserver}. * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KVStoreObserver)}. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1906,10 +1724,10 @@ declare namespace kvStore { /** * Closes the {@code KVStore} database. * - *

Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your + *

Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your * thread may crash. * - *

The {@code KVStore} database to close must be an object created by using the {@code getKvStore} method. Before using this + *

The {@code KVStore} database to close must be an object created by using the {@code getKVStore} method. Before using this * method, release the resources created for the database, for example, {@code KVStoreResultSet} for {@code SingleKVStore}, * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error * will be returned. @@ -1940,8 +1758,8 @@ declare namespace kvStore { deleteKVStore(appId: string, storeId: string): Promise; /** - * Obtains the storeId of all {@code KVStore} databases that are created by using the {@code getKvStore} method and not deleted by - * calling the {@code deleteKvStore} method. + * Obtains the storeId of all {@code KVStore} databases that are created by using the {@code getKVStore} method and not deleted by + * calling the {@code deleteKVStore} method. * * @returns Returns the storeId of all created {@code KVStore} databases. * @throws {BusinessError} 401 - if parameter check failed. @@ -1973,4 +1791,4 @@ declare namespace kvStore { } } -export default kvStore; \ No newline at end of file +export default distributedKVStore; \ No newline at end of file -- Gitee From 27d59b2a2ea404e2b464468c55d8ed088a32dc31 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Sat, 15 Oct 2022 10:19:51 +0800 Subject: [PATCH 14/22] fix interface Signed-off-by: dboy190 --- api/@ohos.data.distributedKVStore.d.ts | 91 ++------------------------ 1 file changed, 4 insertions(+), 87 deletions(-) diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index de74faaa95..7e84a4644c 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -1593,89 +1593,6 @@ declare namespace distributedKVStore { */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; - - /** - * Synchronizes {@code DeviceKVStore} databases. - * - *

This method returns immediately and sync result will be returned through asynchronous callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param deviceIds Indicates the list of IDs of devices whose - * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * {@code DeviceKVStore} databases are to be synchronized. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when sync data. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; - - /** - * Synchronizes {@code DeviceKVStore} databases. - * - *

This method returns immediately and sync result will be returned through asynchronous callback. - * - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param deviceIds Indicates the list of IDs of devices whose - * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * {@code DeviceKVStore} databases are to be synchronized. - * @param query Indicates the {@code Query} object. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100003 - if the database is corrupted. - * @throws {BusinessError} 15100004 - if the database not exist when sync data. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; - - /** - * Register Synchronizes DeviceKVStore databases callback. - * - *

Sync result is returned through asynchronous callback. - * - * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - 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. - * - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener Indicates the observer of data change events in the distributed database. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; - - /** - * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KVStoreObserver}. - * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KVStoreObserver)}. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - off(event:'dataChange', listener?: Callback): void; - - /** - * UnRegister Synchronizes DeviceKVStore databases callback. - * - * @throws {BusinessError} 401 - if parameter check failed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 9 - */ - off(event: 'syncComplete', syncCallback?: Callback>): void; } /** @@ -1718,8 +1635,8 @@ declare namespace distributedKVStore { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - getKVStore(storeId: string, options: Options): Promise; - getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; + getKVStore(storeId: string, options: Options): Promise; + getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; /** * Closes the {@code KVStore} database. @@ -1737,8 +1654,8 @@ declare namespace distributedKVStore { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; - closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; + closeKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + closeKVStore(appId: string, storeId: string): Promise; /** * Deletes the {@code KVStore} database identified by storeId. -- Gitee From b6f7f4977c00aafcd0efc0b3500a3adeef328801 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Sat, 15 Oct 2022 16:27:07 +0800 Subject: [PATCH 15/22] add deprecated Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 99 ++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 2 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index db85d859d1..7cfb7522a4 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -21,7 +21,7 @@ import { AsyncCallback, Callback } from './basic'; * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.kvStore + * @useinstead ohos.data.distributedKVStore */ declare namespace distributedData { /** @@ -31,7 +31,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.kvStore.KVManagerConfig + * @useinstead ohos.data.distributedKVStore.KVManagerConfig */ interface KVManagerConfig { /** @@ -39,6 +39,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 */ userInfo: UserInfo; @@ -47,6 +48,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManagerConfig.bundleName */ bundleName: string; } @@ -60,6 +63,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 */ interface UserInfo { /** @@ -67,6 +71,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 */ userId?: string; @@ -75,6 +80,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 */ userType?: UserType; } @@ -85,6 +91,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 */ enum UserType { /** @@ -92,6 +99,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 */ SAME_USER_ID = 0 } @@ -102,6 +110,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants */ namespace Constants { /** @@ -109,6 +119,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants.MAX_KEY_LENGTH */ const MAX_KEY_LENGTH = 1024; @@ -117,6 +129,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants.MAX_VALUE_LENGTH */ const MAX_VALUE_LENGTH = 4194303; @@ -125,6 +139,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants.MAX_KEY_LENGTH_DEVICEs */ const MAX_KEY_LENGTH_DEVICE = 896; @@ -133,6 +149,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants.MAX_STORE_ID_LENGTH */ const MAX_STORE_ID_LENGTH = 128; @@ -141,6 +159,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants.MAX_QUERY_LENGTH */ const MAX_QUERY_LENGTH = 512000; @@ -149,6 +169,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants.MAX_BATCH_SIZE */ const MAX_BATCH_SIZE = 128; } @@ -161,6 +183,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType */ enum ValueType { /** @@ -168,6 +192,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType.STRING */ STRING = 0, @@ -176,6 +202,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType.INTEGER */ INTEGER = 1, @@ -184,6 +212,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType.FLOAT */ FLOAT = 2, @@ -192,6 +222,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType.BYTE_ARRAY * */ BYTE_ARRAY = 3, @@ -200,6 +232,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType.BOOLEAN * */ BOOLEAN = 4, @@ -208,6 +242,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType.DOUBLE */ DOUBLE = 5 } @@ -218,6 +254,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value */ interface Value { /** @@ -228,6 +266,8 @@ declare namespace distributedData { * @type {number} * @memberof Value * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value.type */ type: ValueType; /** @@ -235,6 +275,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value.value */ value: Uint8Array | string | number | boolean; } @@ -245,6 +287,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry */ interface Entry { /** @@ -252,6 +296,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry.key */ key: string; /** @@ -259,6 +305,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry.value */ value: Value; } @@ -272,6 +320,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification */ interface ChangeNotification { /** @@ -279,6 +329,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification.insertEntries */ insertEntries: Entry[]; /** @@ -286,6 +338,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification.updateEntries */ updateEntries: Entry[]; /** @@ -293,6 +347,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification.deleteEntries */ deleteEntries: Entry[]; /** @@ -300,6 +356,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification.deviceId */ deviceId: string; } @@ -310,6 +368,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode */ enum SyncMode { /** @@ -317,6 +377,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode.PULL_ONLY */ PULL_ONLY = 0, /** @@ -324,6 +386,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode.PUSH_ONLY */ PUSH_ONLY = 1, /** @@ -331,6 +395,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode.PUSH_PULL */ PUSH_PULL = 2 } @@ -341,6 +407,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType */ enum SubscribeType { /** @@ -348,6 +416,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_LOCAL */ SUBSCRIBE_TYPE_LOCAL = 0, @@ -356,6 +426,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE */ SUBSCRIBE_TYPE_REMOTE = 1, @@ -364,6 +436,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_ALL */ SUBSCRIBE_TYPE_ALL = 2, } @@ -374,6 +448,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType */ enum KVStoreType { /** @@ -381,6 +457,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType.DEVICE_COLLABORATION */ DEVICE_COLLABORATION = 0, @@ -389,6 +467,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType.SINGLE_VERSION */ SINGLE_VERSION = 1, @@ -397,6 +477,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 7 + * @deprecated since 9 */ MULTI_VERSION = 2, } @@ -407,6 +488,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel */ enum SecurityLevel { /** @@ -415,6 +498,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 7 + * @deprecated since 9 */ NO_LEVEL = 0, @@ -425,6 +509,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 */ S0 = 1, @@ -435,6 +520,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel.S1 */ S1 = 2, @@ -445,6 +532,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel.S2 */ S2 = 3, @@ -455,6 +544,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel.S3 */ S3 = 5, @@ -465,6 +556,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel.S4 */ S4 = 6, } @@ -478,6 +571,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options */ interface Options { /** -- Gitee From 92ffc4d9e9b6530093b94a19bca5e527ff447c1f Mon Sep 17 00:00:00 2001 From: dboy190 Date: Sat, 15 Oct 2022 19:15:16 +0800 Subject: [PATCH 16/22] add deprecated comments Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 294 +++++++++++++++++++++++----- 1 file changed, 249 insertions(+), 45 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 7cfb7522a4..33cca8bc0d 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -49,7 +49,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.KVManagerConfig.bundleName + * @useinstead ohos.data.distributedKVStore.KVManagerConfig#bundleName */ bundleName: string; } @@ -120,7 +120,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Constants.MAX_KEY_LENGTH + * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH */ const MAX_KEY_LENGTH = 1024; @@ -130,7 +130,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Constants.MAX_VALUE_LENGTH + * @useinstead ohos.data.distributedKVStore.Constants#MAX_VALUE_LENGTH */ const MAX_VALUE_LENGTH = 4194303; @@ -140,7 +140,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Constants.MAX_KEY_LENGTH_DEVICEs + * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH_DEVICEs */ const MAX_KEY_LENGTH_DEVICE = 896; @@ -150,7 +150,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Constants.MAX_STORE_ID_LENGTH + * @useinstead ohos.data.distributedKVStore.Constants#MAX_STORE_ID_LENGTH */ const MAX_STORE_ID_LENGTH = 128; @@ -160,7 +160,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Constants.MAX_QUERY_LENGTH + * @useinstead ohos.data.distributedKVStore.Constants#MAX_QUERY_LENGTH */ const MAX_QUERY_LENGTH = 512000; @@ -170,7 +170,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Constants.MAX_BATCH_SIZE + * @useinstead ohos.data.distributedKVStore.Constants#MAX_BATCH_SIZE */ const MAX_BATCH_SIZE = 128; } @@ -193,7 +193,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ValueType.STRING + * @useinstead ohos.data.distributedKVStore.ValueType#STRING */ STRING = 0, @@ -203,7 +203,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ValueType.INTEGER + * @useinstead ohos.data.distributedKVStore.ValueType#INTEGER */ INTEGER = 1, @@ -213,7 +213,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ValueType.FLOAT + * @useinstead ohos.data.distributedKVStore.ValueType#FLOAT */ FLOAT = 2, @@ -223,7 +223,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ValueType.BYTE_ARRAY + * @useinstead ohos.data.distributedKVStore.ValueTypeB#YTE_ARRAY * */ BYTE_ARRAY = 3, @@ -233,7 +233,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ValueType.BOOLEAN + * @useinstead ohos.data.distributedKVStore.ValueType#BOOLEAN * */ BOOLEAN = 4, @@ -243,7 +243,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ValueType.DOUBLE + * @useinstead ohos.data.distributedKVStore.ValueType#DOUBLE */ DOUBLE = 5 } @@ -267,7 +267,7 @@ declare namespace distributedData { * @memberof Value * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Value.type + * @useinstead ohos.data.distributedKVStore.Value#type */ type: ValueType; /** @@ -276,7 +276,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Value.value + * @useinstead ohos.data.distributedKVStore.Value#value */ value: Uint8Array | string | number | boolean; } @@ -297,7 +297,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Entry.key + * @useinstead ohos.data.distributedKVStore.Entry#key */ key: string; /** @@ -306,7 +306,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.Entry.value + * @useinstead ohos.data.distributedKVStore.Entry#value */ value: Value; } @@ -330,7 +330,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ChangeNotification.insertEntries + * @useinstead ohos.data.distributedKVStore.ChangeNotification#insertEntries */ insertEntries: Entry[]; /** @@ -339,7 +339,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ChangeNotification.updateEntries + * @useinstead ohos.data.distributedKVStore.ChangeNotification#updateEntries */ updateEntries: Entry[]; /** @@ -348,7 +348,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ChangeNotification.deleteEntries + * @useinstead ohos.data.distributedKVStore.ChangeNotification#deleteEntries */ deleteEntries: Entry[]; /** @@ -357,7 +357,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.ChangeNotification.deviceId + * @useinstead ohos.data.distributedKVStore.ChangeNotification#deviceId */ deviceId: string; } @@ -378,7 +378,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SyncMode.PULL_ONLY + * @useinstead ohos.data.distributedKVStore.SyncMode#PULL_ONLY */ PULL_ONLY = 0, /** @@ -387,7 +387,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SyncMode.PUSH_ONLY + * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_ONLY */ PUSH_ONLY = 1, /** @@ -396,7 +396,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SyncMode.PUSH_PULL + * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_PULL */ PUSH_PULL = 2 } @@ -417,7 +417,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_LOCAL + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_LOCAL */ SUBSCRIBE_TYPE_LOCAL = 0, @@ -427,7 +427,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_REMOTE */ SUBSCRIBE_TYPE_REMOTE = 1, @@ -437,7 +437,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_ALL + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_ALL */ SUBSCRIBE_TYPE_ALL = 2, } @@ -458,7 +458,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.KVStoreType.DEVICE_COLLABORATION + * @useinstead ohos.data.distributedKVStore.KVStoreType#DEVICE_COLLABORATION */ DEVICE_COLLABORATION = 0, @@ -468,7 +468,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.KVStoreType.SINGLE_VERSION + * @useinstead ohos.data.distributedKVStore.KVStoreType#SINGLE_VERSION */ SINGLE_VERSION = 1, @@ -521,7 +521,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SecurityLevel.S1 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S1 */ S1 = 2, @@ -533,7 +533,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SecurityLevel.S2 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S2 */ S2 = 3, @@ -545,7 +545,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SecurityLevel.S3 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S3 */ S3 = 5, @@ -557,7 +557,7 @@ declare namespace distributedData { * @import N/A * @since 7 * @deprecated since 9 - * @useinstead ohos.data.distributedKVStore.SecurityLevel.S4 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S4 */ S4 = 6, } @@ -580,6 +580,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#createIfMissing */ createIfMissing?: boolean; /** @@ -587,6 +589,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#encrypt */ encrypt?: boolean; /** @@ -594,6 +598,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#backup */ backup?: boolean; /** @@ -602,6 +608,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#autoSync */ autoSync?: boolean; /** @@ -609,6 +617,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#kvStoreType */ kvStoreType?: KVStoreType; /** @@ -616,6 +626,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#securityLevel */ securityLevel?: SecurityLevel; /** @@ -623,6 +635,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#schema */ schema?: Schema; } @@ -635,6 +649,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema */ class Schema { /** @@ -642,6 +658,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#constructor */ constructor() /** @@ -649,6 +667,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#root */ root: FieldNode; /** @@ -656,6 +676,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#indexes */ indexes: Array; /** @@ -663,6 +685,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#mode */ mode: number; /** @@ -670,6 +694,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#skip */ skip: number; } @@ -686,6 +712,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode */ class FieldNode { /** @@ -694,6 +722,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#constructor */ constructor(name: string) /** @@ -705,6 +735,8 @@ declare namespace distributedData { * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#appendChild */ appendChild(child: FieldNode): boolean; /** @@ -712,6 +744,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#default */ default: string; /** @@ -719,6 +753,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#nullable */ nullable: boolean; /** @@ -726,6 +762,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#type */ type: number; } @@ -739,6 +777,8 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet */ interface KvStoreResultSet { /** @@ -747,6 +787,8 @@ declare namespace distributedData { * @returns Returns the number of lines. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getCount */ getCount(): number; /** @@ -755,6 +797,8 @@ declare namespace distributedData { * @returns Returns the current read position. The read position starts with 0. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getPosition */ getPosition(): number; /** @@ -765,6 +809,8 @@ declare namespace distributedData { * @returns Returns true if the operation succeeds; return false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToFirst */ moveToFirst(): boolean; /** @@ -775,6 +821,8 @@ declare namespace distributedData { * @returns Returns true if the operation succeeds; return false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToLast */ moveToLast(): boolean; /** @@ -785,6 +833,8 @@ declare namespace distributedData { * @returns Returns true if the operation succeeds; return false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToNext */ moveToNext(): boolean; /** @@ -795,6 +845,8 @@ declare namespace distributedData { * @returns Returns true if the operation succeeds; return false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPrevious */ moveToPrevious(): boolean; /** @@ -809,7 +861,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 - * @useinstead moveV9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#move */ move(offset: number): boolean; /** @@ -820,7 +872,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 - * @useinstead moveToPositionV9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPosition */ moveToPosition(position: number): boolean; /** @@ -829,6 +881,8 @@ declare namespace distributedData { * @returns Returns true if the read position is the first line; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isFirst */ isFirst(): boolean; /** @@ -837,6 +891,8 @@ declare namespace distributedData { * @returns Returns true if the read position is the last line; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isLast */ isLast(): boolean; /** @@ -845,6 +901,8 @@ declare namespace distributedData { * @returns Returns true if the read position is before the first line; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isBeforeFirst */ isBeforeFirst(): boolean; /** @@ -853,6 +911,8 @@ declare namespace distributedData { * @returns Returns true if the read position is after the last line; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isAfterLast */ isAfterLast(): boolean; /** @@ -862,7 +922,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 - * @useinstead getEntryV9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getEntry */ getEntry(): Entry; } @@ -879,7 +939,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 - * @useinstead QueryV9 + * @useinstead ohos.data.distributedKVStore.Query */ class Query { /** @@ -887,6 +947,8 @@ declare namespace distributedData { * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#constructor */ constructor() /** @@ -896,6 +958,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#reset */ reset(): Query; /** @@ -908,6 +972,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#equalTo */ equalTo(field: string, value: number|string|boolean): Query; /** @@ -920,6 +986,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notEqualTo */ notEqualTo(field: string, value: number|string|boolean): Query; /** @@ -933,6 +1001,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#greaterThan */ greaterThan(field: string, value: number|string|boolean): Query; /** @@ -945,6 +1015,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#lessThan */ lessThan(field: string, value: number|string): Query; /** @@ -958,6 +1030,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#greaterThanOrEqualTo */ greaterThanOrEqualTo(field: string, value: number|string): Query; /** @@ -971,6 +1045,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#lessThanOrEqualTo */ lessThanOrEqualTo(field: string, value: number|string): Query; /** @@ -982,6 +1058,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#isNull */ isNull(field: string): Query; /** @@ -994,6 +1072,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#inNumber */ inNumber(field: string, valueList: number[]): Query; /** @@ -1006,6 +1086,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#inString */ inString(field: string, valueList: string[]): Query; /** @@ -1018,6 +1100,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notInNumber */ notInNumber(field: string, valueList: number[]): Query; /** @@ -1030,6 +1114,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notInString */ notInString(field: string, valueList: string[]): Query; /** @@ -1042,6 +1128,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#like */ like(field: string, value: string): Query; /** @@ -1054,6 +1142,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#unlike */ unlike(field: string, value: string): Query; /** @@ -1065,6 +1155,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#and */ and(): Query; /** @@ -1076,6 +1168,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#or */ or(): Query; /** @@ -1087,6 +1181,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#orderByAsc */ orderByAsc(field: string): Query; /** @@ -1098,6 +1194,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#orderByDesc */ orderByDesc(field: string): Query; /** @@ -1109,6 +1207,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#limit */ limit(total: number, offset: number): Query; /** @@ -1120,6 +1220,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#isNotNull */ isNotNull(field: string): Query; /** @@ -1132,6 +1234,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#beginGroup */ beginGroup(): Query; /** @@ -1144,6 +1248,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#endGroup */ endGroup(): Query; /** @@ -1155,6 +1261,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#prefixKey */ prefixKey(prefix: string): Query; /** @@ -1166,6 +1274,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#setSuggestIndex */ setSuggestIndex(index: string): Query; /** @@ -1174,9 +1284,11 @@ declare namespace distributedData { * @param deviceId Specify device id to query from. * @return Returns the {@code Query} object with device ID prefix added. * @throw Throws this exception if input is invalid. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @since 8 + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#deviceId */ deviceId(deviceId:string):Query; /** @@ -1189,6 +1301,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#getSqlLike */ getSqlLike():string; } @@ -1207,7 +1321,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 - * @useinstead KVStoreV9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore */ interface KVStore { /** @@ -1222,6 +1336,8 @@ declare namespace distributedData { * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#put */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; put(key: string, value: Uint8Array | string | number | boolean): Promise; @@ -1236,6 +1352,8 @@ declare namespace distributedData { * {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#delete */ delete(key: string, callback: AsyncCallback): void; delete(key: string): Promise; @@ -1251,6 +1369,8 @@ declare namespace distributedData { * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on */ on(event: 'dataChange', type: SubscribeType, listener: Callback): void; @@ -1262,6 +1382,8 @@ declare namespace distributedData { * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -1274,6 +1396,8 @@ declare namespace distributedData { * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off */ off(event: 'dataChange', listener?: Callback): void; @@ -1284,6 +1408,8 @@ declare namespace distributedData { * @throws Throws this exception if a database error occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#putBatch */ putBatch(entries: Entry[], callback: AsyncCallback): void; putBatch(entries: Entry[]): Promise; @@ -1295,6 +1421,8 @@ declare namespace distributedData { * @throws Throws this exception if a database error occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#deleteBatch */ deleteBatch(keys: string[], callback: AsyncCallback): void; deleteBatch(keys: string[]): Promise; @@ -1307,6 +1435,8 @@ declare namespace distributedData { * @throws Throws this exception if a database error occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#startTransaction */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; @@ -1318,6 +1448,8 @@ declare namespace distributedData { * @throws Throws this exception if a database error occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#commit */ commit(callback: AsyncCallback): void; commit(): Promise; @@ -1328,6 +1460,8 @@ declare namespace distributedData { * @throws Throws this exception if a database error occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#rollback */ rollback(callback: AsyncCallback): void; rollback(): Promise; @@ -1340,6 +1474,8 @@ declare namespace distributedData { * @throws Throws this exception if an internal service error occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#enableSync */ enableSync(enabled: boolean, callback: AsyncCallback): void; enableSync(enabled: boolean): Promise; @@ -1354,6 +1490,8 @@ declare namespace distributedData { * @throws Throws this exception if an internal service error occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncRange */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; @@ -1374,7 +1512,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 - * @useinstead SingleKVStoreV9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore */ interface SingleKVStore extends KVStore { /** @@ -1386,6 +1524,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#get */ get(key: string, callback: AsyncCallback): void; get(key: string): Promise; @@ -1400,6 +1540,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(keyPrefix: string, callback: AsyncCallback): void; getEntries(keyPrefix: string): Promise; @@ -1414,6 +1556,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; @@ -1431,6 +1575,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; @@ -1444,6 +1590,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; @@ -1457,6 +1605,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#closeResultSet */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -1471,6 +1621,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSize */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; @@ -1481,6 +1633,8 @@ declare namespace distributedData { * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#removeDeviceData */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -1497,6 +1651,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#sync */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; @@ -1508,6 +1664,8 @@ declare namespace distributedData { * @throws Throws this exception if no {@code SingleKvStore} database is available. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -1517,6 +1675,8 @@ declare namespace distributedData { * @throws Throws this exception if no {@code SingleKvStore} database is available. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off */ off(event: 'syncComplete', syncCallback?: Callback>): void; @@ -1528,6 +1688,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncParam */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; setSyncParam(defaultAllowedDelayMs: number): Promise; @@ -1540,6 +1702,8 @@ declare namespace distributedData { * {@code IPC_ERROR}, and {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getSecurityLevel */ getSecurityLevel(callback: AsyncCallback): void; getSecurityLevel(): Promise; @@ -1557,7 +1721,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 * @deprecated since 9 - * @useinstead DeviceKVStoreV9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore */ interface DeviceKVStore extends KVStore { /** @@ -1570,6 +1734,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#get */ get(deviceId: string, key: string, callback: AsyncCallback): void; get(deviceId: string, key: string): Promise; @@ -1584,6 +1750,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getEntries(deviceId: string, keyPrefix: string): Promise; @@ -1597,6 +1765,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; @@ -1609,6 +1779,8 @@ declare namespace distributedData { * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; getEntries(deviceId: string, query: Query): Promise; @@ -1628,6 +1800,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; getResultSet(deviceId: string, keyPrefix: string): Promise; @@ -1641,6 +1815,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; @@ -1653,6 +1829,8 @@ declare namespace distributedData { * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet */ getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSet(deviceId: string, query: Query): Promise; @@ -1665,6 +1843,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#closeResultSet */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; @@ -1678,6 +1858,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; @@ -1690,6 +1872,8 @@ declare namespace distributedData { * @returns Returns the number of results matching the specified {@code Query} object. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize */ getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSize(deviceId: string, query: Query): Promise; @@ -1704,6 +1888,8 @@ declare namespace distributedData { * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#removeDeviceData */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; @@ -1722,6 +1908,8 @@ declare namespace distributedData { * @throws Throws this exception if no DeviceKVStore database is available. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#sync */ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; @@ -1734,6 +1922,8 @@ declare namespace distributedData { * @throws Throws this exception if no DeviceKVStore database is available. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on */ on(event: 'syncComplete', syncCallback: Callback>): void; @@ -1743,6 +1933,8 @@ declare namespace distributedData { * @throws Throws this exception if no DeviceKVStore database is available. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off */ off(event: 'syncComplete', syncCallback?: Callback>): void; } @@ -1760,7 +1952,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 - * @useinstead createKVManagerV9 + * @useinstead ohos.data.distributedKVStore#createKVManager */ function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManager(config: KVManagerConfig): Promise; @@ -1773,7 +1965,7 @@ declare namespace distributedData { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 - * @useinstead KVManagerV9 + * @useinstead ohos.data.distributedKVStore.KVManager */ interface KVManager { /** @@ -1787,6 +1979,8 @@ declare namespace distributedData { * @return Returns a {@code KVStore}, or {@code SingleKVStore}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#getKVStore */ getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; @@ -1809,6 +2003,8 @@ declare namespace distributedData { * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#closeKVStore */ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; @@ -1828,6 +2024,8 @@ declare namespace distributedData { * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#deleteKVStore */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; deleteKVStore(appId: string, storeId: string): Promise; @@ -1842,6 +2040,8 @@ declare namespace distributedData { * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#getAllKVStoreId */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; getAllKVStoreId(appId: string): Promise; @@ -1853,6 +2053,8 @@ declare namespace distributedData { * @throws exception maybe occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#on */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; @@ -1863,6 +2065,8 @@ declare namespace distributedData { * @throws exception maybe occurs. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#off */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } -- Gitee From 96a605431480f323066305aa375272c1816fba12 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Sun, 16 Oct 2022 21:45:24 +0800 Subject: [PATCH 17/22] remove KVStore code reference Signed-off-by: dboy190 --- api/@ohos.data.distributedKVStore.d.ts | 104 +++++++++++-------------- 1 file changed, 45 insertions(+), 59 deletions(-) diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index 7e84a4644c..9695ac2c50 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -168,7 +168,7 @@ declare namespace distributedKVStore { } /** - * Obtains {@code Value} objects stored in a {@link KVStore} or {@link KVStore} database. + * Obtains {@code Value} objects stored in a {@link SingleKVStore} or {@link DeviceKVStore} database. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -221,8 +221,9 @@ declare namespace distributedKVStore { /** * Receives notifications of all data changes, including data insertion, update, and deletion. * - *

If you have subscribed to {@code KVStore} or {@code KVStore}, you will receive data change notifications and - * obtain the changed data from the parameters in callback methods upon data insertion, update, or deletion. + *

If you have subscribed to {@code SingleKVStore} or {@code DeviceKVStore}, you will receive + * data change notifications and obtain the changed data from the parameters in callback methods + * upon data insertion, update, or deletion. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -324,7 +325,7 @@ declare namespace distributedKVStore { } /** - * Describes the {@code KVStore} or {@code KVStore}type. + * Describes the KVStore type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -332,7 +333,7 @@ declare namespace distributedKVStore { */ enum KVStoreType { /** - * Device-collaborated database, as specified by {@code DeviceKVStore} or {@code DeviceKVStore} + * Device-collaborated database, as specified by {@code DeviceKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @import N/A * @since 9 @@ -349,7 +350,7 @@ declare namespace distributedKVStore { } /** - * Describes the {@code KVStore} or {@code KVStore} type. + * Describes the KVStore security level. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -398,10 +399,10 @@ declare namespace distributedKVStore { } /** - * Provides configuration options for creating a {@code KVStore} or {@code KVStore}. + * Provides configuration options for creating a {@code SingleKVStore} or {@code DeviceKVStore}. * - *

You can determine whether to create another database if a {@code KVStore} or {@code KVStore} database is - * missing, whether to encrypt the database, and the database type. + *

You can determine whether to create another database if a KVStore database is missing, + * whether to encrypt the database, and the database type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -564,10 +565,11 @@ declare namespace distributedKVStore { } /** - * Provide methods to obtain the result set of the {@code KVStore} or {@code KVStore} database. + * Provide methods to obtain the result set of the {@code SingleKVStore} or {@code SingleKVStore} database. * - *

The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} or - * {@code DeviceKVStore} class. This interface also provides methods for moving the data read position in the result set. + *

The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or + * {@code DeviceKVStore} class. This interface also provides methods for moving the data read + * position in the result set. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @import N/A @@ -1038,7 +1040,7 @@ declare namespace distributedKVStore { */ interface SingleKVStore { /** - * Writes a key-value pair of the string type into the {@code KVStore} database. + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. * *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. * @@ -1055,7 +1057,7 @@ declare namespace distributedKVStore { put(key: string, value: Uint8Array | string | number | boolean): Promise; /** - * Inserts key-value pairs into the {@code KVStore} database in batches. + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. * * @param entries Indicates the key-value pairs to be inserted in batches. * @throws {BusinessError} 401 - if parameter check failed. @@ -1068,7 +1070,7 @@ declare namespace distributedKVStore { putBatch(entries: Entry[]): Promise; /** - * Writes a value of the valuesbucket type into the {@code KVStore} database. + * Writes a value of the valuesbucket type into the {@code SingleKVStore} database. * * @param value Indicates the data record to put. * Spaces before and after the key will be cleared. @@ -1109,13 +1111,12 @@ declare namespace distributedKVStore { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @systemapi * @since 9 - */ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); delete(predicates: dataSharePredicates.DataSharePredicates): Promise; /** - * Deletes key-value pairs in batches from the {@code KVStore} database. + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. * * @param keys Indicates the key-value pairs to be deleted in batches. * @throws {BusinessError} 401 - if parameter check failed. @@ -1129,13 +1130,14 @@ declare namespace distributedKVStore { deleteBatch(keys: string[]): Promise; /** - * void removeDeviceData​({@link String} deviceId) throws {@link BusinessError} + * Removes data of a specified device from the current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. * - * @param deviceId Indicates the device to be removed data. + * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; @@ -1187,8 +1189,8 @@ declare namespace distributedKVStore { getEntries(query: Query): Promise; /** - * Obtains the result sets with a specified prefix from a {@code KVStore} database. The {@code KVStoreResultSet} - * object can be used to query all key-value pairs that meet the search criteria. Each {@code KVStore} + * Obtains the result sets with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. @@ -1298,7 +1300,7 @@ declare namespace distributedKVStore { deleteBackup(files:Array): Promise>; /** - * Starts a transaction operation in the {@code KVStore} database. + * Starts a transaction operation in the {@code SingleKVStore} database. * *

After the database transaction is started, you can submit or roll back the operation. * @@ -1310,7 +1312,7 @@ declare namespace distributedKVStore { startTransaction(): Promise; /** - * Submits a transaction operation in the {@code KVStore} database. + * Submits a transaction operation in the {@code SingleKVStore} database. * * @param callback * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1321,7 +1323,7 @@ declare namespace distributedKVStore { commit(): Promise; /** - * Rolls back a transaction operation in the {@code KVStore} database. + * Rolls back a transaction operation in the {@code SingleKVStore} database. * * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1518,7 +1520,7 @@ declare namespace distributedKVStore { /** * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. * - *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KVStore} + *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary * {@code KVStoreResultSet} objects in a timely manner. @@ -1579,20 +1581,6 @@ declare namespace distributedKVStore { */ getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; getResultSize(deviceId: string, query: Query): Promise; - - /** - * Removes data of a specified device from the current database. This method is used to remove only the data - * synchronized from remote devices. This operation does not synchronize data to other databases or affect - * subsequent data synchronization. - * - * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. - * @throws {BusinessError} 401 - if parameter check failed. - * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @since 9 - */ - removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; } /** @@ -1601,7 +1589,7 @@ declare namespace distributedKVStore { *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * - * @param config Indicates the {@link KVStore} configuration information, + * @param config Indicates the KVStore configuration information, * including the user information and package name. * @return Returns the {@code KVManager} instance. * @throws {BusinessError} 401 - if parameter check failed. @@ -1612,7 +1600,7 @@ declare namespace distributedKVStore { function createKVManager(config: KVManagerConfig): Promise; /** - * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. + * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}. * * @import N/A * @version 1 @@ -1621,14 +1609,14 @@ declare namespace distributedKVStore { */ interface KVManager { /** - * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. + * Creates and obtains a {@code SingleKVStore} database by specifying {@code Options} and {@code storeId}. * - * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, + * @param options Indicates the options used for creating and obtaining the KVStore database, * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. - * @param storeId Identifies the {@code KVStore} database. + * @param storeId Identifies the KVStore database. * The value of this parameter must be unique for the same application, * and different applications can share the same value. - * @return Returns a {@code KVStore}, or {@code SingleKVStore}. + * @return Returns a {@code SingleKVStore}, or {@code DeviceKVStore}. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100002 - if open existed database with changed options. * @throws {BusinessError} 15100003 - if the database is corrupted. @@ -1639,17 +1627,15 @@ declare namespace distributedKVStore { getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; /** - * Closes the {@code KVStore} database. + * Closes the KVStore database. * *

Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your * thread may crash. * - *

The {@code KVStore} database to close must be an object created by using the {@code getKVStore} method. Before using this - * method, release the resources created for the database, for example, {@code KVStoreResultSet} for {@code SingleKVStore}, - * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error - * will be returned. + *

The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this + * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise + * closing the database will fail. If you are attempting to close a database that is already closed, an error will be returned. * - * @param kvStore Indicates the {@code KVStore} database to close. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -1658,14 +1644,14 @@ declare namespace distributedKVStore { closeKVStore(appId: string, storeId: string): Promise; /** - * Deletes the {@code KVStore} database identified by storeId. + * Deletes the KVStore database identified by storeId. * - *

Before using this method, close all {@code KVStore} instances in use that are identified by the same storeId. + *

Before using this method, close all KVStore instances in use that are identified by the same storeId. * - *

You can use this method to delete a {@code KVStore} database not in use. After the database is deleted, all its data will be + *

You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be * lost. * - * @param storeId Identifies the {@code KVStore} database to delete. + * @param storeId Identifies the KVStore database to delete. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100004 - if the database not exist when delete database. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1675,10 +1661,10 @@ declare namespace distributedKVStore { deleteKVStore(appId: string, storeId: string): Promise; /** - * Obtains the storeId of all {@code KVStore} databases that are created by using the {@code getKVStore} method and not deleted by + * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by * calling the {@code deleteKVStore} method. * - * @returns Returns the storeId of all created {@code KVStore} databases. + * @returns Returns the storeId of all created KVStore databases. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 -- Gitee From d8cccb86c9ea24a3d719b2457eea7ecbca5e445d Mon Sep 17 00:00:00 2001 From: dboy190 Date: Mon, 17 Oct 2022 09:07:28 +0800 Subject: [PATCH 18/22] fix code comments Signed-off-by: dboy190 --- api/@ohos.data.distributedKVStore.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index 9695ac2c50..fe3e9d1eee 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -1609,7 +1609,7 @@ declare namespace distributedKVStore { */ interface KVManager { /** - * Creates and obtains a {@code SingleKVStore} database by specifying {@code Options} and {@code storeId}. + * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. * * @param options Indicates the options used for creating and obtaining the KVStore database, * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. -- Gitee From 320e2dc2db9787ecad784b0382b933f51c3da9fe Mon Sep 17 00:00:00 2001 From: dboy190 Date: Tue, 18 Oct 2022 02:15:11 +0800 Subject: [PATCH 19/22] fix js doc Signed-off-by: dboy190 --- api/@ohos.data.distributedKVStore.d.ts | 809 +++++++++++++++++++++---- 1 file changed, 683 insertions(+), 126 deletions(-) diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index fe3e9d1eee..6281012593 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -535,7 +535,7 @@ declare namespace distributedKVStore { * *

Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. * - * @param child The field node to append. + * @param {FieldNode} child - The field node to append. * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 @@ -565,7 +565,7 @@ declare namespace distributedKVStore { } /** - * Provide methods to obtain the result set of the {@code SingleKVStore} or {@code SingleKVStore} database. + * Provide methods to obtain the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database. * *

The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or * {@code DeviceKVStore} class. This interface also provides methods for moving the data read @@ -635,9 +635,9 @@ declare namespace distributedKVStore { /** * Moves the read position by a relative offset to the current position. * - * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a - * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, - * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, + * @param {number} offset - Indicates the relative offset to the current position. Anegative offset indicates moving + * backwards, and a positive offset indicates moving forewards. Forexample, if the current position is entry 1 and + * thisoffset is 2, the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the * final position is invalid, false will be returned. * @returns Returns true if the operation succeeds; return false otherwise. @@ -649,7 +649,7 @@ declare namespace distributedKVStore { /** * Moves the read position from 0 to an absolute position. * - * @param position Indicates the absolute position. + * @param {number} position - Indicates the absolute position. * @returns Returns true if the operation succeeds; return false otherwise. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -730,82 +730,82 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value IIndicates the long value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string|boolean} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - equalTo(field: string, value: number|string|boolean): Query; + equalTo(field: string, value: number | string | boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string|boolean} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - notEqualTo(field: string, value: number|string|boolean): Query; + notEqualTo(field: string, value: number | string | boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string|boolean} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - greaterThan(field: string, value: number|string|boolean): Query; + greaterThan(field: string, value: number | string | boolean): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - lessThan(field: string, value: number|string): Query; + lessThan(field: string, value: number | string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or * equal to the specified int value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - greaterThanOrEqualTo(field: string, value: number|string): Query; + greaterThanOrEqualTo(field: string, value: number | string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the * specified int value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the int value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - lessThanOrEqualTo(field: string, value: number|string): Query; + lessThanOrEqualTo(field: string, value: number | string): Query; /** * Constructs a {@code Query} object to query entries with the specified field whose value is null. * - * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -816,8 +816,8 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the int value list. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number[]} valueList - Indicates the int value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -828,8 +828,8 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the string value list. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string[]} valueList - Indicates the string value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -840,8 +840,8 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the int value list. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number[]} valueList - Indicates the int value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -852,8 +852,8 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param valueList Indicates the string value list. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string[]} valueList - Indicates the string value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -864,8 +864,8 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the string value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string} value - Indicates the string value. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -876,8 +876,8 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. * - * @param field Indicates the field, which must start with $. and cannot contain ^. - * @param value Indicates the string value. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string} value - Indicates the string value. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -910,7 +910,7 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to sort the query results in ascending order. * - * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -921,7 +921,7 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to sort the query results in descending order. * - * @param field Indicates the field, which must start with $. and cannot contain ^. + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -932,8 +932,8 @@ declare namespace distributedKVStore { /** * Constructs a {@code Query} object to specify the number of results and the start position. * - * @param total Indicates the number of results. - * @param offset Indicates the start position. + * @param {number} total - Indicates the number of results. + * @param {number} offset - Indicates the start position. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -944,7 +944,7 @@ declare namespace distributedKVStore { /** * Creates a {@code Query} condition with a specified field that is not null. * - * @param field Indicates the specified field. + * @param {string} field - Indicates the specified field. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -979,7 +979,7 @@ declare namespace distributedKVStore { /** * Creates a query condition with a specified key prefix. * - * @param prefix Indicates the specified key prefix. + * @param {string} prefix - Indicates the specified key prefix. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -990,7 +990,7 @@ declare namespace distributedKVStore { /** * Sets a specified index that will be preferentially used for query. * - * @param index Indicates the index to set. + * @param {string} index - Indicates the index to set. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -1001,7 +1001,7 @@ declare namespace distributedKVStore { /** * Add device ID key prefix.Used by {@code DeviceKVStore}. * - * @param deviceId Specify device id to query from. + * @param {string} deviceId - Specify device id to query from. * @return Returns the {@code Query} object with device ID prefix added. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A @@ -1044,9 +1044,10 @@ declare namespace distributedKVStore { * *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. * - * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. - * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. + * @param {Uint8Array|string|number|boolean} value - Indicates the value to be inserted. + * @param {AsyncCallback} callback - the callback of put. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1054,12 +1055,29 @@ declare namespace distributedKVStore { * @since 9 */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; + + /** + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. + * + *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param {Uint8Array|string|number|boolean} value - Indicates the value to be inserted. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ put(key: string, value: Uint8Array | string | number | boolean): Promise; /** * Inserts key-value pairs into the {@code SingleKVStore} database in batches. * - * @param entries Indicates the key-value pairs to be inserted in batches. + * @param {Entry[]} entries - Indicates the key-value pairs to be inserted in batches. + * @param {AsyncCallback} callback - the callback of putBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1067,13 +1085,25 @@ declare namespace distributedKVStore { * @since 9 */ putBatch(entries: Entry[], callback: AsyncCallback): void; + + /** + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. + * + * @param {Entry[]} entries - Indicates the key-value pairs to be inserted in batches. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ putBatch(entries: Entry[]): Promise; /** - * Writes a value of the valuesbucket type into the {@code SingleKVStore} database. + * Writes a value of the ValuesBucket type into the {@code SingleKVStore} database. * - * @param value Indicates the data record to put. - * Spaces before and after the key will be cleared. + * @param {Array} value - Indicates the ValuesBucket array to be inserted. + * @param {AsyncCallback} callback - the callback of putBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1082,13 +1112,27 @@ declare namespace distributedKVStore { * @since 9 */ putBatch(value: Array, callback: AsyncCallback): void; + + /** + * Writes a value of the ValuesBucket type into the {@code SingleKVStore} database. + * + * @param {Array} value - Indicates the ValuesBucket array to be inserted. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ putBatch(value: Array): Promise; /** * Deletes the key-value pair based on a specified key. * - * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. + * @param {AsyncCallback} callback - the callback of delete. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when delete data. @@ -1097,13 +1141,27 @@ declare namespace distributedKVStore { * @since 9 */ delete(key: string, callback: AsyncCallback): void; - delete(key: string): Promise; /** * Deletes the key-value pair based on a specified key. * - * @param predicates Indicates the datasharePredicates. + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + delete(key: string): Promise; + + /** + * Deletes the key-value pairs based on the dataSharePredicates. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @param {AsyncCallback} callback - the callback of delete. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when delete data. @@ -1113,12 +1171,27 @@ declare namespace distributedKVStore { * @since 9 */ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); + + /** + * Deletes the key-value pairs based on the dataSharePredicates. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ delete(predicates: dataSharePredicates.DataSharePredicates): Promise; /** * Deletes key-value pairs in batches from the {@code SingleKVStore} database. * - * @param keys Indicates the key-value pairs to be deleted in batches. + * @param {string[]} keys - Indicates the key-value pairs to be deleted in batches. + * @param {AsyncCallback} callback - the callback of deleteBatch. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when delete data. @@ -1127,6 +1200,19 @@ declare namespace distributedKVStore { * @since 9 */ deleteBatch(keys: string[], callback: AsyncCallback): void; + + /** + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. + * + * @param {string[]} keys - Indicates the key-value pairs to be deleted in batches. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when delete data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ deleteBatch(keys: string[]): Promise; /** @@ -1134,18 +1220,51 @@ declare namespace distributedKVStore { * synchronized from remote devices. This operation does not synchronize data to other databases or affect * subsequent data synchronization. * - * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @param {string} deviceId - Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @param {AsyncCallback} callback - the callback of removeDeviceData. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; + + /** + * Removes data of a specified device from the current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @param {string} deviceId - Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ removeDeviceData(deviceId: string): Promise; /** - * Obtains the {@code String} value of a specified key. + * Obtains the value of a specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {AsyncCallback} callback - + * {Uint8Array|string|boolean|number}: the returned value specified by the key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + + /** + * Obtains the value of a specified key. * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns {Promise} + * {Uint8Array|string|boolean|number}: the returned value specified by the key. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. @@ -1154,14 +1273,14 @@ declare namespace distributedKVStore { * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - get(key: string, callback: AsyncCallback): void; - get(key: string): Promise; + get(key: string): Promise; /** * Obtains all key-value pairs that match a specified key prefix. * - * @param keyPrefix Indicates the key prefix to match. - * @returns Returns the list of all key-value pairs that match the specified key prefix. + * @param {string} keyPrefix - Indicates the key prefix to match. + \* @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * that match the specified key prefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1170,13 +1289,28 @@ declare namespace distributedKVStore { * @since 9 */ getEntries(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {Entry[]}: the list of all key-value pairs that match the + * specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ getEntries(keyPrefix: string): Promise; /** * Obtains the list of key-value pairs matching the specified {@code Query} object. * - * @param query Indicates the {@code Query} object. - * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100005 - if not support the operation. @@ -1186,6 +1320,21 @@ declare namespace distributedKVStore { * @since 9 */ getEntries(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {Entry[]}: the list of all key-value pairs matching the + * specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ getEntries(query: Query): Promise; /** @@ -1195,7 +1344,9 @@ declare namespace distributedKVStore { * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. * - * @param keyPrefix Indicates the key prefix to match. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1204,12 +1355,32 @@ declare namespace distributedKVStore { * @since 9 */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains the result sets with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ getResultSet(keyPrefix: string): Promise; /** * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. * - * @param query Indicates the {@code Query} object. + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1218,13 +1389,28 @@ declare namespace distributedKVStore { * @since 9 */ getResultSet(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ getResultSet(query: Query): Promise; /** * Obtains the KVStoreResultSet object matching the specified Predicate object. * - * @param predicates Indicates the datasharePredicates. - * Spaces before and after the key will be cleared. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1233,25 +1419,52 @@ declare namespace distributedKVStore { * @since 9 */ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Obtains the KVStoreResultSet object matching the specified Predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; /** * Closes a {@code KVStoreResultSet} object returned by getResultSet. * - * @param resultSet Indicates the {@code KVStoreResultSet} object to close. + * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. + * @param {AsyncCallback} callback - the callback of closeResultSet. * @throws {BusinessError} 401 - if parameter check failed. * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback): void; + + /** + * Closes a {@code KVStoreResultSet} object returned by getResultSet. + * + * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ closeResultSet(resultSet: KVStoreResultSet): Promise; /** * Obtains the number of results matching the specified {@code Query} object. * - * @param query Indicates the {@code Query} object. - * @returns Returns the number of results matching the specified {@code Query} object. + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {number}: the number of results matching the + * specified {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1260,12 +1473,27 @@ declare namespace distributedKVStore { * @since 9 */ getResultSize(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {number}: the number of results matching the specified + * {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ getResultSize(query: Query): Promise; /** * Backs up a database in a specified name. * - * @param file Indicates the name that saves the database backup. + * @param {string} file - Indicates the name that saves the database backup. + * @param {AsyncCallback} callback - the callback of backup. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1273,12 +1501,25 @@ declare namespace distributedKVStore { * @since 9 */ backup(file:string, callback: AsyncCallback):void; + + /** + * Backs up a database in a specified name. + * + * @param {string} file - Indicates the name that saves the database backup. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ backup(file:string): Promise; /** * Restores a database from a specified database file. * - * @param file Indicates the name that saves the database file. + * @param {string} file - Indicates the name that saves the database file. + * @param {AsyncCallback} callback - the callback of restore. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1286,17 +1527,43 @@ declare namespace distributedKVStore { * @since 9 */ restore(file:string, callback: AsyncCallback):void; + + /** + * Restores a database from a specified database file. + * + * @param {string} file - Indicates the name that saves the database file. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ restore(file:string): Promise; /** * Delete a backup files based on a specified name. * - * @param files list Indicates the name that backup file to delete. + * @param {Array} files - Indicates the backup files to be deleted. + * @param {AsyncCallback>} callback - {Array<[string, number]>}: + * the list of backup file and it's corresponding delete result which 0 means delete success + * and otherwise failed. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ deleteBackup(files:Array, callback: AsyncCallback>):void; + + /** + * Delete a backup files based on a specified name. + * + * @param {Array} files - Indicates the backup files to be deleted. + * @returns {Promise>} {Array<[string, number]>}: the list of backup + * file and it's corresponding delete result which 0 means delete success and otherwise failed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ deleteBackup(files:Array): Promise>; /** @@ -1304,44 +1571,87 @@ declare namespace distributedKVStore { * *

After the database transaction is started, you can submit or roll back the operation. * + * @param {AsyncCallback} callback - the callback of startTransaction. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ startTransaction(callback: AsyncCallback): void; + + /** + * Starts a transaction operation in the {@code SingleKVStore} database. + * + *

After the database transaction is started, you can submit or roll back the operation. + * + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ startTransaction(): Promise; /** * Submits a transaction operation in the {@code SingleKVStore} database. * - * @param callback + * @param {AsyncCallback} callback - the callback of commit. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ commit(callback: AsyncCallback): void; + + /** + * Submits a transaction operation in the {@code SingleKVStore} database. + * + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ commit(): Promise; /** * Rolls back a transaction operation in the {@code SingleKVStore} database. * + * @param {AsyncCallback} callback - the callback of rollback. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ rollback(callback: AsyncCallback): void; + + /** + * Rolls back a transaction operation in the {@code SingleKVStore} database. + * + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ rollback(): Promise; /** * Sets whether to enable synchronization. * - * @param enabled Specifies whether to enable synchronization. The value true means to enable - * synchronization, and false means the opposite. + * @param {boolean} enabled - Specifies whether to enable synchronization. The value true + * means to enable synchronization, and false means the opposite. + * @param {AsyncCallback} callback - the callback of enableSync. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ enableSync(enabled: boolean, callback: AsyncCallback): void; + + /** + * Sets whether to enable synchronization. + * + * @param {boolean} enabled - Specifies whether to enable synchronization. The value true + * means to enable synchronization, and false means the opposite. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ enableSync(enabled: boolean): Promise; /** @@ -1349,33 +1659,63 @@ declare namespace distributedKVStore { * *

The labels determine the devices with which data will be synchronized. * - * @param localLabels Indicates the synchronization labels of the local device. - * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. + * @param {string[]} localLabels - Indicates the synchronization labels of the local device. + * @param {string[]} remoteSupportLabels - Indicates the labels of the devices with which + * data will be synchronized. + * @param {AsyncCallback} callback - the callback of setSyncRange. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; + + /** + * Sets synchronization range labels. + * + *

The labels determine the devices with which data will be synchronized. + * + * @param {string[]} localLabels - Indicates the synchronization labels of the local device. + * @param {string[]} remoteSupportLabels - Indicates the labels of the devices with which + * data will be synchronized. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; /** * Sets the default delay allowed for database synchronization * - * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. + * @param {number} defaultAllowedDelayMs - Indicates the default delay allowed for the + * database synchronization, in milliseconds. + * @param {AsyncCallback} callback - the callback of setSyncParam. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + + /** + * Sets the default delay allowed for database synchronization + * + * @param {number} defaultAllowedDelayMs - Indicates the default delay allowed for the + * database synchronization, in milliseconds. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ setSyncParam(defaultAllowedDelayMs: number): Promise; /** * Synchronizes the database to the specified devices with the specified delay allowed. * * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. + * @param {string[]} deviceIds - Indicates the list of devices to which to synchronize the database. + * @param {SyncMode} mode - Indicates the synchronization mode. The value can be {@code PUSH}, + * {@code PULL}, or {@code PUSH_PULL}. + * @param {number} delayMs - Indicates the delay allowed for the synchronization, in milliseconds. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the database not exist when sync data. @@ -1388,10 +1728,11 @@ declare namespace distributedKVStore { * Synchronizes the database to the specified devices with the specified delay allowed. * * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @param deviceIds 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 delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * @param query Indicates the {@code Query} object. + * @param {string[]} deviceIds - Indicates the list of devices to which to synchronize the database. + * @param {Query} query - Indicates the {@code Query} object. + * @param {SyncMode} mode - Indicates the synchronization mode. The value can be {@code PUSH}, + * {@code PULL}, or {@code PUSH_PULL}. + * @param {number} delayMs - Indicates the delay allowed for the synchronization, in milliseconds. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the database not exist when sync data. @@ -1404,8 +1745,9 @@ declare namespace distributedKVStore { * Registers a {@code KVStoreObserver} for the database. When data in the distributed database changes, the callback in * {@code KVStoreObserver} will be invoked. * - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener Indicates the observer of data change events in the distributed database. + * @param {SubscribeType} type - Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} + * object indicates the data change events in the distributed database. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1418,7 +1760,9 @@ declare namespace distributedKVStore { * Register Synchronizes SingleKVStore databases callback. *

Sync result is returned through asynchronous callback. * - * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @param {Callback>} syncCallback - {Array<[string, number]>}: the + * deviceId and it's corresponding synchronization result which 0 means synchronization success + * and otherwise failed. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -1428,7 +1772,8 @@ declare namespace distributedKVStore { /** * Unsubscribes from the SingleKVStore database based on the specified subscribeType and {@code KVStoreObserver}. * - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KVStoreObserver)}. + * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} + * object indicates the data change events in the distributed database. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1439,6 +1784,9 @@ declare namespace distributedKVStore { /** * UnRegister Synchronizes SingleKVStore databases callback. * + * @param {Callback>} syncCallback - {Array<[string, number]>}: the + * deviceId and it's corresponding synchronization result which 0 means synchronization success + * and otherwise failed. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -1448,12 +1796,23 @@ declare namespace distributedKVStore { /** * Get the security level of the database. * - * @returns SecurityLevel {@code SecurityLevel} the security level of the database. + * @param {AsyncCallback} callback - {SecurityLevel}: the {@code SecurityLevel} + * object indicates the security level of the database. * @throws {BusinessError} 15100006 - if the database or result set has been closed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ getSecurityLevel(callback: AsyncCallback): void; + + /** + * Get the security level of the database. + * + * @returns {Promise} {SecurityLevel}: the {@code SecurityLevel} object indicates + * the security level of the database. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ getSecurityLevel(): Promise; } @@ -1473,8 +1832,10 @@ declare namespace distributedKVStore { /** * Obtains the {@code String} value matching a specified device ID and key. * - * @param deviceId Indicates the device to be queried. - * @param key Indicates the key of the value to be queried. + * @param {string} deviceId - Indicates the device to be queried. + * @param {string} key - Indicates the key of the value to be queried. + * @param {AsyncCallback} callback - + * {boolean|string|number|Uint8Array}: the returned value specified by the deviceId and key. * @return Returns the value matching the given criteria. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. @@ -1483,14 +1844,32 @@ declare namespace distributedKVStore { * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ - get(deviceId: string, key: string, callback: AsyncCallback): void; - get(deviceId: string, key: string): Promise; + get(deviceId: string, key: string, callback: AsyncCallback): void; + + /** + * Obtains the {@code String} value matching a specified device ID and key. + * + * @param {string} deviceId - Indicates the device to be queried. + * @param {string} key - Indicates the key of the value to be queried. + * @returns {Promise} + * {Uint8Array|string|boolean|number}: the returned value specified by the deviceId and key. + * @return Returns the value matching the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + get(deviceId: string, key: string): Promise; /** * Obtains all key-value pairs matching a specified device ID and key prefix. * - * @param deviceId Identifies the device whose data is to be queried. - * @param keyPrefix Indicates the key prefix to match. + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * that match the specified deviceId and key prefix. * @returns Returns the list of all key-value pairs meeting the given criteria. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. @@ -1499,14 +1878,30 @@ declare namespace distributedKVStore { * @since 9 */ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {Entry[]}: the list of all key-value pairs that match the + * specified deviceId and key prefix. + * @returns Returns the list of all key-value pairs meeting the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ getEntries(deviceId: string, keyPrefix: string): Promise; /** * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. * - * @param deviceId Indicates the ID of the device to which the key-value pairs belong. - * @param query Indicates the {@code Query} object. - * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @param {string} deviceId - Indicates the ID of the device to which the key-value pairs belong. + * @param {string} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100005 - if not support the operation. @@ -1515,6 +1910,21 @@ declare namespace distributedKVStore { * @since 9 */ getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; + + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the key-value pairs belong. + * @param {string} query - Indicates the {@code Query} object. + * @returns {Promise} {Entry[]}: the list of all key-value pairs matching the + * specified deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if not support the operation. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ getEntries(deviceId: string, query: Query): Promise; /** @@ -1525,9 +1935,10 @@ declare namespace distributedKVStore { * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary * {@code KVStoreResultSet} objects in a timely manner. * - * @param deviceId Identifies the device whose data is to be queried. - * @param keyPrefix Indicates the key prefix to match. - * @returns Returns the {@code KVStoreResultSet} objects. + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1535,14 +1946,34 @@ declare namespace distributedKVStore { * @since 9 */ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + * + *

The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ getResultSet(deviceId: string, keyPrefix: string): Promise; /** * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. * - * @param deviceId Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. - * @param query Indicates the {@code Query} object. - * @returns Returns the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * @param {string} deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1550,13 +1981,29 @@ declare namespace distributedKVStore { * @since 9 */ getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ getResultSet(deviceId: string, query: Query): Promise; /** * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. * - * @param predicates Indicates the key. * @param deviceId Indicates the ID of the device to which the results belong. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1565,14 +2012,30 @@ declare namespace distributedKVStore { * @since 9 */ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. + * + * @param deviceId Indicates the ID of the device to which the results belong. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; /** * Obtains the number of results matching a specified device ID and {@code Query} object. * - * @param deviceId Indicates the ID of the device to which the results belong. - * @param query Indicates the {@code Query} object. - * @returns Returns the number of results matching the specified {@code Query} object. + * @param {string} deviceId - Indicates the ID of the device to which the results belong. + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {number}: the number of results matching the + * specified deviceId and {@code Query} object. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1580,6 +2043,20 @@ declare namespace distributedKVStore { * @since 9 */ getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; + + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the results belong. + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {number}: the number of results matching the specified + * deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100006 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ getResultSize(deviceId: string, query: Query): Promise; } @@ -1589,14 +2066,28 @@ declare namespace distributedKVStore { *

You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * - * @param config Indicates the KVStore configuration information, + * @param {KVManagerConfig} config - Indicates the KVStore configuration information, * including the user information and package name. - * @return Returns the {@code KVManager} instance. + * @param {AsyncCallback} callback - {KVManager}: the {@code KVManager} instance. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; + + /** + * Creates a {@link KVManager} instance based on the configuration information. + * + *

You must pass {@link KVManagerConfig} to provide configuration information + * for creating the {@link KVManager} instance. + * + * @param {KVManagerConfig} config - Indicates the KVStore configuration information, + * including the user information and package name. + * @returns {Promise} {KVManager}: the {@code KVManager} instance. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ function createKVManager(config: KVManagerConfig): Promise; /** @@ -1611,21 +2102,35 @@ declare namespace distributedKVStore { /** * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. * - * @param options Indicates the options used for creating and obtaining the KVStore database, - * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. - * @param storeId Identifies the KVStore database. - * The value of this parameter must be unique for the same application, - * and different applications can share the same value. - * @return Returns a {@code SingleKVStore}, or {@code DeviceKVStore}. + * @param {string} storeId - Identifies the KVStore database. The value of this parameter must be unique + * for the same application, and different applications can share the same value. + * @param {Options} options - Indicates the {@code Options} object used for creating and + * obtaining the KVStore database. + * @param {AsyncCallback} callback - {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100002 - if open existed database with changed options. * @throws {BusinessError} 15100003 - if the database is corrupted. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ - getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; + /** + * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. + * + * @param {string} storeId - Identifies the KVStore database. The value of this parameter must be unique + * for the same application, and different applications can share the same value. + * @param {Options} options - Indicates the {@code Options} object used for creating and + * obtaining the KVStore database. + * @returns {Promise} {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100002 - if open existed database with changed options. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getKVStore(storeId: string, options: Options): Promise; + /** * Closes the KVStore database. * @@ -1636,11 +2141,32 @@ declare namespace distributedKVStore { * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise * closing the database will fail. If you are attempting to close a database that is already closed, an error will be returned. * + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to close. + * @param {AsyncCallback} callback - the callback of closeKVStore. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ closeKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + + /** + * Closes the KVStore database. + * + *

Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your + * thread may crash. + * + *

The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this + * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise + * closing the database will fail. If you are attempting to close a database that is already closed, an error will be returned. + * + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to close. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ closeKVStore(appId: string, storeId: string): Promise; /** @@ -1651,41 +2177,72 @@ declare namespace distributedKVStore { *

You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be * lost. * - * @param storeId Identifies the KVStore database to delete. + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to delete. + * @param {AsyncCallback} callback - the callback of deleteKVStore. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100004 - if the database not exist when delete database. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + + /** + * Deletes the KVStore database identified by storeId. + * + *

Before using this method, close all KVStore instances in use that are identified by the same storeId. + * + *

You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be + * lost. + * + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to delete. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100004 - if the database not exist when delete database. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ deleteKVStore(appId: string, storeId: string): Promise; /** * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by * calling the {@code deleteKVStore} method. * - * @returns Returns the storeId of all created KVStore databases. + * @param {string} appId - Identifies the application that obtains the databases. + * @param {AsyncCallback} callback - {string[]}: the storeId of all created KVStore databases. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; - getAllKVStoreId(appId: string): Promise; /** - * register DeviceChangeCallback to get notification when device's status changed + * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by + * calling the {@code deleteKVStore} method. * - * @param deathCallback device change callback {@code DeviceChangeCallback} + * @param {string} appId - Identifies the application that obtains the databases. + * @returns {Promise} {string[]}: the storeId of all created KVStore databases. * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getAllKVStoreId(appId: string): Promise; + + /** + * register DeathCallback to get notification when service died. + * + * @param {Callback} deathCallback - the service died callback. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @throws {BusinessError} 401 - if parameter check failed. * @since 9 */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; /** - * unRegister DeviceChangeCallback and can not receive notification + * unRegister DeathCallback and can not receive service died notification. * - * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. + * @param {Callback} deathCallback - the service died callback which has been registered. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 -- Gitee From 2231edb39ca2566d27fba9fe66cb06740995c5c4 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Tue, 18 Oct 2022 11:00:38 +0800 Subject: [PATCH 20/22] fix datashare syscap Signed-off-by: dboy190 --- api/@ohos.data.distributedKVStore.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index 6281012593..a76094f411 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -1166,7 +1166,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when delete data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ @@ -1181,7 +1181,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when delete data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ @@ -1414,7 +1414,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ @@ -1429,7 +1429,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ @@ -2007,7 +2007,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ @@ -2023,7 +2023,7 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @systemapi * @since 9 */ -- Gitee From 37c37fb507f1cd8b9a16ea392bd7eb6ae72751e0 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Tue, 18 Oct 2022 21:06:26 +0800 Subject: [PATCH 21/22] delete import Signed-off-by: dboy190 --- api/@ohos.data.distributedData.d.ts | 103 ------------------------- api/@ohos.data.distributedKVStore.d.ts | 100 ------------------------ 2 files changed, 203 deletions(-) diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index 33cca8bc0d..9231cbc643 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -18,7 +18,6 @@ import { AsyncCallback, Callback } from './basic'; /** * Providers interfaces to creat a {@link KVManager} istances. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore @@ -28,7 +27,6 @@ declare namespace distributedData { * Provides configuration information for {@link KVManager} instances, * including the caller's package name and distributed network type. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.KVManagerConfig @@ -37,7 +35,6 @@ declare namespace distributedData { /** * Indicates the user information * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 */ @@ -46,7 +43,6 @@ declare namespace distributedData { /** * Indicates the bundleName * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.KVManagerConfig#bundleName @@ -61,7 +57,6 @@ declare namespace distributedData { * and checking whether two users are the same. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 */ @@ -69,7 +64,6 @@ declare namespace distributedData { /** * Indicates the user ID to set * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 */ @@ -78,7 +72,6 @@ declare namespace distributedData { /** * Indicates the user type to set * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 */ @@ -89,7 +82,6 @@ declare namespace distributedData { * Enumerates user types. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 */ @@ -97,7 +89,6 @@ declare namespace distributedData { /** * Indicates a user that logs in to different devices using the same account. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 */ @@ -108,7 +99,6 @@ declare namespace distributedData { * KVStore constants * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Constants @@ -117,7 +107,6 @@ declare namespace distributedData { /** * max key length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH @@ -127,7 +116,6 @@ declare namespace distributedData { /** * max value length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Constants#MAX_VALUE_LENGTH @@ -137,7 +125,6 @@ declare namespace distributedData { /** * max device coordinate key length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH_DEVICEs @@ -147,7 +134,6 @@ declare namespace distributedData { /** * max store id length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Constants#MAX_STORE_ID_LENGTH @@ -157,7 +143,6 @@ declare namespace distributedData { /** * max query length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Constants#MAX_QUERY_LENGTH @@ -167,7 +152,6 @@ declare namespace distributedData { /** * max batch operation size. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Constants#MAX_BATCH_SIZE @@ -181,7 +165,6 @@ declare namespace distributedData { *

{@code ValueType} is obtained based on the value. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ValueType @@ -190,7 +173,6 @@ declare namespace distributedData { /** * Indicates that the value type is string. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ValueType#STRING @@ -200,7 +182,6 @@ declare namespace distributedData { /** * Indicates that the value type is int. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ValueType#INTEGER @@ -210,7 +191,6 @@ declare namespace distributedData { /** * Indicates that the value type is float. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ValueType#FLOAT @@ -220,7 +200,6 @@ declare namespace distributedData { /** * Indicates that the value type is byte array. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ValueTypeB#YTE_ARRAY @@ -230,7 +209,6 @@ declare namespace distributedData { /** * Indicates that the value type is boolean. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ValueType#BOOLEAN @@ -240,7 +218,6 @@ declare namespace distributedData { /** * Indicates that the value type is double. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ValueType#DOUBLE @@ -252,7 +229,6 @@ declare namespace distributedData { * Obtains {@code Value} objects stored in a {@link KVStore} database. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Value @@ -261,7 +237,6 @@ declare namespace distributedData { /** * Indicates value type * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @see ValueType * @type {number} * @memberof Value @@ -273,7 +248,6 @@ declare namespace distributedData { /** * Indicates value * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Value#value @@ -285,7 +259,6 @@ declare namespace distributedData { * Provides key-value pairs stored in the distributed database. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Entry @@ -294,7 +267,6 @@ declare namespace distributedData { /** * Indicates key * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Entry#key @@ -303,7 +275,6 @@ declare namespace distributedData { /** * Indicates value * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Entry#value @@ -318,7 +289,6 @@ declare namespace distributedData { * from the parameters in callback methods upon data insertion, update, or deletion. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ChangeNotification @@ -327,7 +297,6 @@ declare namespace distributedData { /** * Indicates data addition records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ChangeNotification#insertEntries @@ -336,7 +305,6 @@ declare namespace distributedData { /** * Indicates data update records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ChangeNotification#updateEntries @@ -345,7 +313,6 @@ declare namespace distributedData { /** * Indicates data deletion records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ChangeNotification#deleteEntries @@ -354,7 +321,6 @@ declare namespace distributedData { /** * Indicates from device id. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.ChangeNotification#deviceId @@ -366,7 +332,6 @@ declare namespace distributedData { * Indicates the database synchronization mode. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SyncMode @@ -375,7 +340,6 @@ declare namespace distributedData { /** * Indicates that data is only pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SyncMode#PULL_ONLY @@ -384,7 +348,6 @@ declare namespace distributedData { /** * Indicates that data is only pushed from the local end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_ONLY @@ -393,7 +356,6 @@ declare namespace distributedData { /** * Indicates that data is pushed from the local end, and then pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_PULL @@ -405,7 +367,6 @@ declare namespace distributedData { * Describes the subscription type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SubscribeType @@ -414,7 +375,6 @@ declare namespace distributedData { /** * Subscription to local data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_LOCAL @@ -424,7 +384,6 @@ declare namespace distributedData { /** * Subscription to remote data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_REMOTE @@ -434,7 +393,6 @@ declare namespace distributedData { /** * Subscription to both local and remote data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_ALL @@ -446,7 +404,6 @@ declare namespace distributedData { * Describes the {@code KVStore} type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.KVStoreType @@ -455,7 +412,6 @@ declare namespace distributedData { /** * Device-collaborated database, as specified by {@code DeviceKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.KVStoreType#DEVICE_COLLABORATION @@ -465,7 +421,6 @@ declare namespace distributedData { /** * Single-version database, as specified by {@code SingleKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.KVStoreType#SINGLE_VERSION @@ -475,7 +430,6 @@ declare namespace distributedData { /** * Multi-version database, as specified by {@code MultiKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 7 * @deprecated since 9 */ @@ -486,7 +440,6 @@ declare namespace distributedData { * Describes the {@code KVStore} type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SecurityLevel @@ -496,7 +449,6 @@ declare namespace distributedData { * NO_LEVEL: mains not set the security level. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 7 * @deprecated since 9 */ @@ -507,7 +459,6 @@ declare namespace distributedData { * There is no impact even if the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 */ @@ -518,7 +469,6 @@ declare namespace distributedData { * There are some low impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SecurityLevel#S1 @@ -530,7 +480,6 @@ declare namespace distributedData { * There are some major impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SecurityLevel#S2 @@ -542,7 +491,6 @@ declare namespace distributedData { * There are some severity impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SecurityLevel#S3 @@ -554,7 +502,6 @@ declare namespace distributedData { * There are some critical impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.SecurityLevel#S4 @@ -569,7 +516,6 @@ declare namespace distributedData { * whether to encrypt the database, and the database type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options @@ -578,7 +524,6 @@ declare namespace distributedData { /** * Indicates whether to createa database when the database file does not exist * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options#createIfMissing @@ -587,7 +532,6 @@ declare namespace distributedData { /** * Indicates setting whether database files are encrypted * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options#encrypt @@ -596,7 +540,6 @@ declare namespace distributedData { /** * Indicates setting whether to back up database files * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options#backup @@ -606,7 +549,6 @@ declare namespace distributedData { * Indicates setting whether database files are automatically synchronized * @permission ohos.permission.DISTRIBUTED_DATASYNC * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options#autoSync @@ -615,7 +557,6 @@ declare namespace distributedData { /** * Indicates setting the databse type * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options#kvStoreType @@ -624,7 +565,6 @@ declare namespace distributedData { /** * Indicates setting the database security level * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options#securityLevel @@ -633,7 +573,6 @@ declare namespace distributedData { /** * Indicates schema object * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 8 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Options#schema @@ -647,7 +586,6 @@ declare namespace distributedData { * You can create Schema objects and put them in Options when creating or opening the database. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 8 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.Schema @@ -710,7 +648,6 @@ declare namespace distributedData { *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 8 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.FieldNode @@ -775,7 +712,6 @@ declare namespace distributedData { * methods for moving the data read position in the result set. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 7 * @deprecated since 9 * @useinstead ohos.data.distributedKVStore.KVStoreResultSet @@ -935,7 +871,6 @@ declare namespace distributedData { * *

This class also provides methods for adding predicates to the {@code Query} instance. * - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -955,7 +890,6 @@ declare namespace distributedData { * Resets this {@code Query} object. * * @returns Returns the reset {@code Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -969,7 +903,6 @@ declare namespace distributedData { * @param value IIndicates the long value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -983,7 +916,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -998,7 +930,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1012,7 +943,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1027,7 +957,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1042,7 +971,6 @@ declare namespace distributedData { * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1055,7 +983,6 @@ declare namespace distributedData { * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1069,7 +996,6 @@ declare namespace distributedData { * @param valueList Indicates the int value list. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1083,7 +1009,6 @@ declare namespace distributedData { * @param valueList Indicates the string value list. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1097,7 +1022,6 @@ declare namespace distributedData { * @param valueList Indicates the int value list. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1111,7 +1035,6 @@ declare namespace distributedData { * @param valueList Indicates the string value list. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1125,7 +1048,6 @@ declare namespace distributedData { * @param value Indicates the string value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1139,7 +1061,6 @@ declare namespace distributedData { * @param value Indicates the string value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1152,7 +1073,6 @@ declare namespace distributedData { *

Multiple predicates should be connected using the and or or condition. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1165,7 +1085,6 @@ declare namespace distributedData { *

Multiple predicates should be connected using the and or or condition. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1178,7 +1097,6 @@ declare namespace distributedData { * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1191,7 +1109,6 @@ declare namespace distributedData { * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1204,7 +1121,6 @@ declare namespace distributedData { * @param total Indicates the number of results. * @param offset Indicates the start position. * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1217,7 +1133,6 @@ declare namespace distributedData { * @param field Indicates the specified field. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1231,7 +1146,6 @@ declare namespace distributedData { * whole to combine with other query conditions. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1245,7 +1159,6 @@ declare namespace distributedData { * whole to combine with other query conditions. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1258,7 +1171,6 @@ declare namespace distributedData { * @param prefix Indicates the specified key prefix. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1271,7 +1183,6 @@ declare namespace distributedData { * @param index Indicates the index to set. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1284,7 +1195,6 @@ declare namespace distributedData { * @param deviceId Specify device id to query from. * @return Returns the {@code Query} object with device ID prefix added. * @throw Throws this exception if input is invalid. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1298,7 +1208,6 @@ declare namespace distributedData { * The String length should be no longer than 500kb. * * @return String representing this {@code Query}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1316,7 +1225,6 @@ declare namespace distributedData { * including {@code SingleKVStore}. * * - * @import N/A * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 @@ -1507,7 +1415,6 @@ declare namespace distributedData { * The {@code SingleKVStore} database does not support * synchronous transactions, or data search using snapshots. * - * @import N/A * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 @@ -1521,7 +1428,6 @@ declare namespace distributedData { * @param key Indicates the key of the boolean value to be queried. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 * @deprecated since 9 @@ -1537,7 +1443,6 @@ declare namespace distributedData { * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1553,7 +1458,6 @@ declare namespace distributedData { * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1572,7 +1476,6 @@ declare namespace distributedData { * @param keyPrefix Indicates the key prefix to match. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1587,7 +1490,6 @@ declare namespace distributedData { * @param query Indicates the {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1602,7 +1504,6 @@ declare namespace distributedData { * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1618,7 +1519,6 @@ declare namespace distributedData { * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1630,7 +1530,6 @@ declare namespace distributedData { /** * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} * - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 * @deprecated since 9 @@ -1717,7 +1616,6 @@ declare namespace distributedData { * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. * - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 * @deprecated since 9 @@ -1960,7 +1858,6 @@ declare namespace distributedData { /** * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. * - * @import N/A * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 7 diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index a76094f411..30514b2525 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -21,7 +21,6 @@ import Context from './application/Context'; /** * Providers interfaces to create a {@link KVManager} istances. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 9 */ declare namespace distributedKVStore { @@ -29,14 +28,12 @@ declare namespace distributedKVStore { * Provides configuration information for {@link KVManager} instances, * including the caller's package name and distributed network type. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ interface KVManagerConfig { /** * Indicates the bundleName * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ bundleName: string; @@ -44,7 +41,6 @@ declare namespace distributedKVStore { /** * Indicates the ability or hap context * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @Note: if swap the area, you should close all the KV store and use the new Context to create the KVManager * @since 9 */ @@ -55,14 +51,12 @@ declare namespace distributedKVStore { * KVStore constants * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ namespace Constants { /** * max key length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ const MAX_KEY_LENGTH = 1024; @@ -70,7 +64,6 @@ declare namespace distributedKVStore { /** * max value length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ const MAX_VALUE_LENGTH = 4194303; @@ -78,7 +71,6 @@ declare namespace distributedKVStore { /** * max device coordinate key length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ const MAX_KEY_LENGTH_DEVICE = 896; @@ -86,7 +78,6 @@ declare namespace distributedKVStore { /** * max store id length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ const MAX_STORE_ID_LENGTH = 128; @@ -94,7 +85,6 @@ declare namespace distributedKVStore { /** * max query length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ const MAX_QUERY_LENGTH = 512000; @@ -102,7 +92,6 @@ declare namespace distributedKVStore { /** * max batch operation size. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ const MAX_BATCH_SIZE = 128; @@ -114,14 +103,12 @@ declare namespace distributedKVStore { *

{@code ValueType} is obtained based on the value. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ enum ValueType { /** * Indicates that the value type is string. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ STRING, @@ -129,7 +116,6 @@ declare namespace distributedKVStore { /** * Indicates that the value type is int. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ INTEGER, @@ -137,7 +123,6 @@ declare namespace distributedKVStore { /** * Indicates that the value type is float. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ FLOAT, @@ -145,7 +130,6 @@ declare namespace distributedKVStore { /** * Indicates that the value type is byte array. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 * */ BYTE_ARRAY, @@ -153,7 +137,6 @@ declare namespace distributedKVStore { /** * Indicates that the value type is boolean. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 * */ BOOLEAN, @@ -161,7 +144,6 @@ declare namespace distributedKVStore { /** * Indicates that the value type is double. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ DOUBLE, @@ -171,14 +153,12 @@ declare namespace distributedKVStore { * Obtains {@code Value} objects stored in a {@link SingleKVStore} or {@link DeviceKVStore} database. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ interface Value { /** * Indicates value type * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @see ValueType * @type {number} * @memberof Value @@ -188,7 +168,6 @@ declare namespace distributedKVStore { /** * Indicates value * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ value: Uint8Array | string | number | boolean; @@ -198,21 +177,18 @@ declare namespace distributedKVStore { * Provides key-value pairs stored in the distributed database. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ interface Entry { /** * Indicates key * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ key: string; /** * Indicates value * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ value: Value; @@ -226,35 +202,30 @@ declare namespace distributedKVStore { * upon data insertion, update, or deletion. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ interface ChangeNotification { /** * Indicates data addition records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ insertEntries: Entry[]; /** * Indicates data update records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ updateEntries: Entry[]; /** * Indicates data deletion records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ deleteEntries: Entry[]; /** * Indicates from device id. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ deviceId: string; @@ -264,28 +235,24 @@ declare namespace distributedKVStore { * Indicates the database synchronization mode. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ enum SyncMode { /** * Indicates that data is only pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ PULL_ONLY, /** * Indicates that data is only pushed from the local end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ PUSH_ONLY, /** * Indicates that data is pushed from the local end, and then pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ PUSH_PULL, @@ -295,14 +262,12 @@ declare namespace distributedKVStore { * Describes the subscription type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ enum SubscribeType { /** * Subscription to local data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ SUBSCRIBE_TYPE_LOCAL, @@ -310,7 +275,6 @@ declare namespace distributedKVStore { /** * Subscription to remote data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ SUBSCRIBE_TYPE_REMOTE, @@ -318,7 +282,6 @@ declare namespace distributedKVStore { /** * Subscription to both local and remote data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ SUBSCRIBE_TYPE_ALL, @@ -328,14 +291,12 @@ declare namespace distributedKVStore { * Describes the KVStore type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ enum KVStoreType { /** * Device-collaborated database, as specified by {@code DeviceKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 9 */ DEVICE_COLLABORATION, @@ -343,7 +304,6 @@ declare namespace distributedKVStore { /** * Single-version database, as specified by {@code SingleKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ SINGLE_VERSION, @@ -353,7 +313,6 @@ declare namespace distributedKVStore { * Describes the KVStore security level. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ enum SecurityLevel { @@ -362,7 +321,6 @@ declare namespace distributedKVStore { * There are some low impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ S1, @@ -372,7 +330,6 @@ declare namespace distributedKVStore { * There are some major impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ S2, @@ -382,7 +339,6 @@ declare namespace distributedKVStore { * There are some severity impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ S3, @@ -392,7 +348,6 @@ declare namespace distributedKVStore { * There are some critical impact, when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ S4, @@ -405,28 +360,24 @@ declare namespace distributedKVStore { * whether to encrypt the database, and the database type. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ interface Options { /** * Indicates whether to createa database when the database file does not exist * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ createIfMissing?: boolean; /** * Indicates setting whether database files are encrypted * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ encrypt?: boolean; /** * Indicates setting whether to back up database files * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ backup?: boolean; @@ -434,28 +385,24 @@ declare namespace distributedKVStore { * Indicates setting whether database files are automatically synchronized * @permission ohos.permission.DISTRIBUTED_DATASYNC * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ autoSync?: boolean; /** * Indicates setting the databse type * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ kvStoreType?: KVStoreType; /** * Indicates setting the database security level * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ securityLevel: SecurityLevel; /** * Indicates schema object * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 9 */ schema?: Schema; @@ -467,7 +414,6 @@ declare namespace distributedKVStore { * You can create Schema objects and put them in Options when creating or opening the database. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 9 */ class Schema { @@ -518,7 +464,6 @@ declare namespace distributedKVStore { *

The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A * @since 9 */ class FieldNode { @@ -572,7 +517,6 @@ declare namespace distributedKVStore { * position in the result set. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @since 9 */ interface KVStoreResultSet { @@ -706,7 +650,6 @@ declare namespace distributedKVStore { * *

This class also provides methods for adding predicates to the {@code Query} instance. * - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -722,7 +665,6 @@ declare namespace distributedKVStore { * Resets this {@code Query} object. * * @returns Returns the reset {@code Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -734,7 +676,6 @@ declare namespace distributedKVStore { * @param {number|string|boolean} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -746,7 +687,6 @@ declare namespace distributedKVStore { * @param {number|string|boolean} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -759,7 +699,6 @@ declare namespace distributedKVStore { * @param {number|string|boolean} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -771,7 +710,6 @@ declare namespace distributedKVStore { * @param {number|string} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -784,7 +722,6 @@ declare namespace distributedKVStore { * @param {number|string} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -797,7 +734,6 @@ declare namespace distributedKVStore { * @param {number|string} value - Indicates the value to be compared. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -808,7 +744,6 @@ declare namespace distributedKVStore { * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -820,7 +755,6 @@ declare namespace distributedKVStore { * @param {number[]} valueList - Indicates the int value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -832,7 +766,6 @@ declare namespace distributedKVStore { * @param {string[]} valueList - Indicates the string value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -844,7 +777,6 @@ declare namespace distributedKVStore { * @param {number[]} valueList - Indicates the int value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -856,7 +788,6 @@ declare namespace distributedKVStore { * @param {string[]} valueList - Indicates the string value list. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -868,7 +799,6 @@ declare namespace distributedKVStore { * @param {string} value - Indicates the string value. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -880,7 +810,6 @@ declare namespace distributedKVStore { * @param {string} value - Indicates the string value. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -891,7 +820,6 @@ declare namespace distributedKVStore { *

Multiple predicates should be connected using the and or or condition. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -902,7 +830,6 @@ declare namespace distributedKVStore { *

Multiple predicates should be connected using the and or or condition. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -913,7 +840,6 @@ declare namespace distributedKVStore { * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -924,7 +850,6 @@ declare namespace distributedKVStore { * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -936,7 +861,6 @@ declare namespace distributedKVStore { * @param {number} offset - Indicates the start position. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -947,7 +871,6 @@ declare namespace distributedKVStore { * @param {string} field - Indicates the specified field. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -959,7 +882,6 @@ declare namespace distributedKVStore { * whole to combine with other query conditions. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -971,7 +893,6 @@ declare namespace distributedKVStore { * whole to combine with other query conditions. * * @returns Returns the {@coed Query} object. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -982,7 +903,6 @@ declare namespace distributedKVStore { * @param {string} prefix - Indicates the specified key prefix. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -993,7 +913,6 @@ declare namespace distributedKVStore { * @param {string} index - Indicates the index to set. * @returns Returns the {@coed Query} object. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1004,7 +923,6 @@ declare namespace distributedKVStore { * @param {string} deviceId - Specify device id to query from. * @return Returns the {@code Query} object with device ID prefix added. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1016,7 +934,6 @@ declare namespace distributedKVStore { * The String length should be no longer than 500kb. * * @return String representing this {@code Query}. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1033,7 +950,6 @@ declare namespace distributedKVStore { * The {@code SingleKVStore} database does not support * synchronous transactions, or data search using snapshots. * - * @import N/A * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -1253,7 +1169,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1269,7 +1184,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100004 - if the data not exist when query data. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1284,7 +1198,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1299,7 +1212,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1315,7 +1227,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1331,7 +1242,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100005 - if not support the operation. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1350,7 +1260,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1369,7 +1278,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1384,7 +1292,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1399,7 +1306,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1441,7 +1347,6 @@ declare namespace distributedKVStore { * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. * @param {AsyncCallback} callback - the callback of closeResultSet. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1453,7 +1358,6 @@ declare namespace distributedKVStore { * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1468,7 +1372,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1483,7 +1386,6 @@ declare namespace distributedKVStore { * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100003 - if the database is corrupted. * @throws {BusinessError} 15100006 - if the database or result set has been closed. - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -1824,7 +1726,6 @@ declare namespace distributedKVStore { * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. * - * @import N/A * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -2093,7 +1994,6 @@ declare namespace distributedKVStore { /** * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}. * - * @import N/A * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 -- Gitee From 529709166e6bd6fff84eb7be1f184c09cf8da260 Mon Sep 17 00:00:00 2001 From: dboy190 Date: Wed, 19 Oct 2022 15:44:27 +0800 Subject: [PATCH 22/22] fix js doc language error Signed-off-by: dboy190 --- api/@ohos.data.distributedKVStore.d.ts | 175 ++++++++++++------------- 1 file changed, 84 insertions(+), 91 deletions(-) diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts index 30514b2525..cc55042a39 100644 --- a/api/@ohos.data.distributedKVStore.d.ts +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -19,14 +19,14 @@ import dataSharePredicates from './@ohos.data.dataSharePredicates'; import Context from './application/Context'; /** - * Providers interfaces to create a {@link KVManager} istances. + * Provider interfaces to create a {@link KVManager} istances. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ declare namespace distributedKVStore { /** - * Provides configuration information for {@link KVManager} instances, - * including the caller's package name and distributed network type. + * Provides configuration information to create a {@link KVManager} instance, + * which includes the caller's package name and ability or hap context. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -55,42 +55,42 @@ declare namespace distributedKVStore { */ namespace Constants { /** - * max key length. + * Max key length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ const MAX_KEY_LENGTH = 1024; /** - * max value length. + * Max value length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ const MAX_VALUE_LENGTH = 4194303; /** - * max device coordinate key length. + * Max device coordinate key length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ const MAX_KEY_LENGTH_DEVICE = 896; /** - * max store id length. + * Max store id length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ const MAX_STORE_ID_LENGTH = 128; /** - * max query length. + * Max query length. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ const MAX_QUERY_LENGTH = 512000; /** - * max batch operation size. + * Max batch operation size. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -157,16 +157,14 @@ declare namespace distributedKVStore { */ interface Value { /** - * Indicates value type + * Indicates the value type * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @see ValueType - * @type {number} - * @memberof Value * @since 9 */ type: ValueType; /** - * Indicates value + * Indicates the value * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -174,20 +172,20 @@ declare namespace distributedKVStore { } /** - * Provides key-value pairs stored in the distributed database. + * Provides key-value pairs stored in the distributedKVStore. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ interface Entry { /** - * Indicates key + * Indicates the key * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ key: string; /** - * Indicates value + * Indicates the value * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -195,18 +193,18 @@ declare namespace distributedKVStore { } /** - * Receives notifications of all data changes, including data insertion, update, and deletion. + * Receive notifications of all data changes, including data insertion, update, and deletion. * *

If you have subscribed to {@code SingleKVStore} or {@code DeviceKVStore}, you will receive * data change notifications and obtain the changed data from the parameters in callback methods - * upon data insertion, update, or deletion. + * upon data insertion, update or deletion. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ interface ChangeNotification { /** - * Indicates data addition records. + * Indicates data insertion records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -224,7 +222,7 @@ declare namespace distributedKVStore { */ deleteEntries: Entry[]; /** - * Indicates from device id. + * Indicates the device id which brings the data change. * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -317,8 +315,8 @@ declare namespace distributedKVStore { */ enum SecurityLevel { /** - * S1: mains the db is low level security - * There are some low impact, when the data is leaked. + * S1: means the db is in the low security level + * There are some low impact when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -326,8 +324,8 @@ declare namespace distributedKVStore { S1, /** - * S2: mains the db is middle level security - * There are some major impact, when the data is leaked. + * S2: means the db is in the middle security level + * There are some major impact when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -335,8 +333,8 @@ declare namespace distributedKVStore { S2, /** - * S3: mains the db is high level security - * There are some severity impact, when the data is leaked. + * S3: means the db is in the high security level + * There are some severity impact when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -344,8 +342,8 @@ declare namespace distributedKVStore { S3, /** - * S4: mains the db is critical level security - * There are some critical impact, when the data is leaked. + * S4: means the db is in the critical security level + * There are some critical impact when the data is leaked. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -354,54 +352,51 @@ declare namespace distributedKVStore { } /** - * Provides configuration options for creating a {@code SingleKVStore} or {@code DeviceKVStore}. - * - *

You can determine whether to create another database if a KVStore database is missing, - * whether to encrypt the database, and the database type. + * Provides configuration options to create a {@code SingleKVStore} or {@code DeviceKVStore}. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ interface Options { /** - * Indicates whether to createa database when the database file does not exist + * Indicates whether to create a database when the database file does not exist * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ createIfMissing?: boolean; /** - * Indicates setting whether database files are encrypted + * Indicates whether database files to be encrypted * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ encrypt?: boolean; /** - * Indicates setting whether to back up database files + * Indicates whether to back up database files * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ backup?: boolean; /** - * Indicates setting whether database files are automatically synchronized + * Indicates whether database files are automatically synchronized * @permission ohos.permission.DISTRIBUTED_DATASYNC * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ autoSync?: boolean; /** - * Indicates setting the databse type + * Indicates the database type * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ kvStoreType?: KVStoreType; /** - * Indicates setting the database security level + * Indicates the database security level * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ securityLevel: SecurityLevel; /** - * Indicates schema object + * Indicates the database schema * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ @@ -411,7 +406,7 @@ declare namespace distributedKVStore { /** * Represents the database schema. * - * You can create Schema objects and put them in Options when creating or opening the database. + * You can set the schema object in options when create or open the database. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 @@ -446,7 +441,7 @@ declare namespace distributedKVStore { */ mode: number; /** - * Indicates the skipsize of schema. + * Indicates the skip size of schema. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 @@ -457,7 +452,7 @@ declare namespace distributedKVStore { /** * Represents a node of a {@link Schema} instance. * - *

Through the {@link Schema} instance, you can define the fields contained in the values stored in a database. + *

With a {@link Schema} instance, you can define the value fields which stored in the database. * *

A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. * @@ -478,16 +473,16 @@ declare namespace distributedKVStore { /** * Adds a child node to this {@code FieldNode}. * - *

Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. + *

Add a child node to makes this node a non-leaf node and field value will be ignored if it has a child node. * * @param {FieldNode} child - The field node to append. - * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. + * @returns Returns true if the child node is successfully added to this {@code FieldNode} and false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 */ appendChild(child: FieldNode): boolean; /** - * Indicates the default value of fieldnode. + * Indicates the default value of field node. * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 9 @@ -510,10 +505,10 @@ declare namespace distributedKVStore { } /** - * Provide methods to obtain the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database. + * Provides methods to operate the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database. * *

The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or - * {@code DeviceKVStore} class. This interface also provides methods for moving the data read + * {@code DeviceKVStore} class. This interface also provides methods to move the data read * position in the result set. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -643,12 +638,12 @@ declare namespace distributedKVStore { } /** - * Represents a database query using a predicate. + * Represents a database query using predicates. * *

This class provides a constructor used to create a {@code Query} instance, which is used to query data * matching specified conditions in the database. * - *

This class also provides methods for adding predicates to the {@code Query} instance. + *

This class also provides methods to add predicates to the {@code Query} instance. * * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 @@ -950,7 +945,6 @@ declare namespace distributedKVStore { * The {@code SingleKVStore} database does not support * synchronous transactions, or data search using snapshots. * - * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -960,7 +954,7 @@ declare namespace distributedKVStore { * *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. * - * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param {Uint8Array|string|number|boolean} value - Indicates the value to be inserted. * @param {AsyncCallback} callback - the callback of put. @@ -977,7 +971,7 @@ declare namespace distributedKVStore { * *

If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. * - * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param {Uint8Array|string|number|boolean} value - Indicates the value to be inserted. * @returns {Promise} the promise returned by the function. @@ -1016,7 +1010,7 @@ declare namespace distributedKVStore { putBatch(entries: Entry[]): Promise; /** - * Writes a value of the ValuesBucket type into the {@code SingleKVStore} database. + * Writes values of ValuesBucket type into the {@code SingleKVStore} database. * * @param {Array} value - Indicates the ValuesBucket array to be inserted. * @param {AsyncCallback} callback - the callback of putBatch. @@ -1030,7 +1024,7 @@ declare namespace distributedKVStore { putBatch(value: Array, callback: AsyncCallback): void; /** - * Writes a value of the ValuesBucket type into the {@code SingleKVStore} database. + * Writes values of ValuesBucket type into the {@code SingleKVStore} database. * * @param {Array} value - Indicates the ValuesBucket array to be inserted. * @returns {Promise} the promise returned by the function. @@ -1046,7 +1040,7 @@ declare namespace distributedKVStore { /** * Deletes the key-value pair based on a specified key. * - * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param {AsyncCallback} callback - the callback of delete. * @throws {BusinessError} 401 - if parameter check failed. @@ -1061,7 +1055,7 @@ declare namespace distributedKVStore { /** * Deletes the key-value pair based on a specified key. * - * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. @@ -1132,11 +1126,11 @@ declare namespace distributedKVStore { deleteBatch(keys: string[]): Promise; /** - * Removes data of a specified device from the current database. This method is used to remove only the data + * Removes data of the specified device from current database. This method is used to remove only the data * synchronized from remote devices. This operation does not synchronize data to other databases or affect * subsequent data synchronization. * - * @param {string} deviceId - Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. * @param {AsyncCallback} callback - the callback of removeDeviceData. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1146,11 +1140,11 @@ declare namespace distributedKVStore { removeDeviceData(deviceId: string, callback: AsyncCallback): void; /** - * Removes data of a specified device from the current database. This method is used to remove only the data + * Removes data of the specified device from current database. This method is used to remove only the data * synchronized from remote devices. This operation does not synchronize data to other databases or affect * subsequent data synchronization. * - * @param {string} deviceId - Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100006 - if the database or result set has been closed. @@ -1248,7 +1242,7 @@ declare namespace distributedKVStore { getEntries(query: Query): Promise; /** - * Obtains the result sets with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet @@ -1266,7 +1260,7 @@ declare namespace distributedKVStore { getResultSet(keyPrefix: string, callback: AsyncCallback): void; /** - * Obtains the result sets with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet @@ -1312,7 +1306,7 @@ declare namespace distributedKVStore { getResultSet(query: Query): Promise; /** - * Obtains the KVStoreResultSet object matching the specified Predicate object. + * Obtains the KVStoreResultSet object matching the specified predicate object. * * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} @@ -1327,7 +1321,7 @@ declare namespace distributedKVStore { getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; /** - * Obtains the KVStoreResultSet object matching the specified Predicate object. + * Obtains the KVStoreResultSet object matching the specified predicate object. * * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} @@ -1342,7 +1336,7 @@ declare namespace distributedKVStore { getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; /** - * Closes a {@code KVStoreResultSet} object returned by getResultSet. + * Closes a {@code KVStoreResultSet} object returned by getResultSet method. * * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. * @param {AsyncCallback} callback - the callback of closeResultSet. @@ -1353,7 +1347,7 @@ declare namespace distributedKVStore { closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback): void; /** - * Closes a {@code KVStoreResultSet} object returned by getResultSet. + * Closes a {@code KVStoreResultSet} object returned by getResultSet method. * * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. * @returns {Promise} the promise returned by the function. @@ -1392,9 +1386,9 @@ declare namespace distributedKVStore { getResultSize(query: Query): Promise; /** - * Backs up a database in a specified name. + * Backs up a database in the specified filename. * - * @param {string} file - Indicates the name that saves the database backup. + * @param {string} file - Indicates the database backup filename. * @param {AsyncCallback} callback - the callback of backup. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. @@ -1405,9 +1399,9 @@ declare namespace distributedKVStore { backup(file:string, callback: AsyncCallback):void; /** - * Backs up a database in a specified name. + * Backs up a database in the specified filename. * - * @param {string} file - Indicates the name that saves the database backup. + * @param {string} file - Indicates the database backup filename. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. @@ -1420,7 +1414,7 @@ declare namespace distributedKVStore { /** * Restores a database from a specified database file. * - * @param {string} file - Indicates the name that saves the database file. + * @param {string} file - Indicates the database backup filename. * @param {AsyncCallback} callback - the callback of restore. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. @@ -1433,7 +1427,7 @@ declare namespace distributedKVStore { /** * Restores a database from a specified database file. * - * @param {string} file - Indicates the name that saves the database file. + * @param {string} file - Indicates the database backup filename. * @returns {Promise} the promise returned by the function. * @throws {BusinessError} 401 - if parameter check failed. * @throws {BusinessError} 15100005 - if not support the operation. @@ -1444,9 +1438,9 @@ declare namespace distributedKVStore { restore(file:string): Promise; /** - * Delete a backup files based on a specified name. + * Delete database backup files based on the specified filenames. * - * @param {Array} files - Indicates the backup files to be deleted. + * @param {Array} files - Indicates the backup filenames to be deleted. * @param {AsyncCallback>} callback - {Array<[string, number]>}: * the list of backup file and it's corresponding delete result which 0 means delete success * and otherwise failed. @@ -1457,9 +1451,9 @@ declare namespace distributedKVStore { deleteBackup(files:Array, callback: AsyncCallback>):void; /** - * Delete a backup files based on a specified name. + * Delete database backup files based on the specified filenames. * - * @param {Array} files - Indicates the backup files to be deleted. + * @param {Array} files - Indicates the backup filenames to be deleted. * @returns {Promise>} {Array<[string, number]>}: the list of backup * file and it's corresponding delete result which 0 means delete success and otherwise failed. * @throws {BusinessError} 401 - if parameter check failed. @@ -1644,8 +1638,8 @@ declare namespace distributedKVStore { sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; /** - * Registers a {@code KVStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KVStoreObserver} will be invoked. + * Register a callback to the database and when data in the distributed database has changed, + * the callback will be invoked. * * @param {SubscribeType} type - Indicates the subscription type, which is defined in {@code SubscribeType}. * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} @@ -1659,7 +1653,7 @@ declare namespace distributedKVStore { on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** - * Register Synchronizes SingleKVStore databases callback. + * Register a databases synchronization callback to the database. *

Sync result is returned through asynchronous callback. * * @param {Callback>} syncCallback - {Array<[string, number]>}: the @@ -1672,7 +1666,7 @@ declare namespace distributedKVStore { on(event: 'syncComplete', syncCallback: Callback>): void; /** - * Unsubscribes from the SingleKVStore database based on the specified subscribeType and {@code KVStoreObserver}. + * Unsubscribe from the SingleKVStore database based on the specified subscribeType and listener. * * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} * object indicates the data change events in the distributed database. @@ -1684,7 +1678,7 @@ declare namespace distributedKVStore { off(event:'dataChange', listener?: Callback): void; /** - * UnRegister Synchronizes SingleKVStore databases callback. + * Unregister the database synchronization callback. * * @param {Callback>} syncCallback - {Array<[string, number]>}: the * deviceId and it's corresponding synchronization result which 0 means synchronization success @@ -1719,7 +1713,7 @@ declare namespace distributedKVStore { } /** - * Manages distributed data by device in a distributed system. + * Provides methods related to device-collaboration distributed databases. * *

To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKVStore(Options, String)} * method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed @@ -1965,10 +1959,10 @@ declare namespace distributedKVStore { * Creates a {@link KVManager} instance based on the configuration information. * *

You must pass {@link KVManagerConfig} to provide configuration information - * for creating the {@link KVManager} instance. + * to create a {@link KVManager} instance. * * @param {KVManagerConfig} config - Indicates the KVStore configuration information, - * including the user information and package name. + * including the package name and context. * @param {AsyncCallback} callback - {KVManager}: the {@code KVManager} instance. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1980,10 +1974,10 @@ declare namespace distributedKVStore { * Creates a {@link KVManager} instance based on the configuration information. * *

You must pass {@link KVManagerConfig} to provide configuration information - * for creating the {@link KVManager} instance. + * to create a {@link KVManager} instance. * * @param {KVManagerConfig} config - Indicates the KVStore configuration information, - * including the user information and package name. + * including the package name and context. * @returns {Promise} {KVManager}: the {@code KVManager} instance. * @throws {BusinessError} 401 - if parameter check failed. * @syscap SystemCapability.DistributedDataManager.KVStore.Core @@ -1994,7 +1988,6 @@ declare namespace distributedKVStore { /** * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}. * - * @version 1 * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 9 */ @@ -2039,7 +2032,7 @@ declare namespace distributedKVStore { * *

The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise - * closing the database will fail. If you are attempting to close a database that is already closed, an error will be returned. + * closing the database will fail. * * @param {string} appId - Identifies the application that the database belong to. * @param {string} storeId - Identifies the KVStore database to close. @@ -2058,7 +2051,7 @@ declare namespace distributedKVStore { * *

The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise - * closing the database will fail. If you are attempting to close a database that is already closed, an error will be returned. + * closing the database will fail. * * @param {string} appId - Identifies the application that the database belong to. * @param {string} storeId - Identifies the KVStore database to close. @@ -2130,7 +2123,7 @@ declare namespace distributedKVStore { getAllKVStoreId(appId: string): Promise; /** - * register DeathCallback to get notification when service died. + * Register a death callback to get notification when service died. * * @param {Callback} deathCallback - the service died callback. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -2140,7 +2133,7 @@ declare namespace distributedKVStore { on(event: 'distributedDataServiceDie', deathCallback: Callback): void; /** - * unRegister DeathCallback and can not receive service died notification. + * Unregister the death callback and can not receive service died notification any more. * * @param {Callback} deathCallback - the service died callback which has been registered. * @throws {BusinessError} 401 - if parameter check failed. -- Gitee