• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkData
19 */
20
21import { AsyncCallback, Callback } from './@ohos.base';
22import { ValuesBucket } from './@ohos.data.ValuesBucket';
23import dataSharePredicates from './@ohos.data.dataSharePredicates';
24import BaseContext from './application/BaseContext';
25
26/**
27 * Provider interfaces to create a {@link KVManager} instance.
28 *
29 * @namespace distributedKVStore
30 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
31 * @since 9
32 */
33declare namespace distributedKVStore {
34  /**
35   * Provides configuration information to create a {@link KVManager} instance,
36   * which includes the caller's package name and ability or hap context.
37   *
38   * @interface KVManagerConfig
39   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
40   * @since 9
41   */
42  interface KVManagerConfig {
43    /**
44     * Indicates the bundleName
45     *
46     * @type { string }
47     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
48     * @since 9
49     */
50    bundleName: string;
51
52    /**
53     * Indicates the ability or hap context
54     *
55     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
56     * if swap the area, you should close all the KV store and use the new Context to create the KVManager
57     * @since 9
58     */
59    /**
60     * Indicates the ability or hap context
61     *
62     * @type { BaseContext }
63     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
64     * if swap the area, you should close all the KV store and use the new BaseContext to create the KVManager
65     * @since 10
66     */
67    context: BaseContext;
68  }
69
70  /**
71   * KVStore constants
72   *
73   * @interface Constants
74   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
75   * @since 9
76   */
77  interface Constants {
78    /**
79     * Max key length is 1024.
80     *
81     * @type { number }
82     * @readonly
83     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
84     * @since 9
85     */
86    readonly MAX_KEY_LENGTH: number;
87
88    /**
89     * Max value length is 4194303.
90     *
91     * @type { number }
92     * @readonly
93     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
94     * @since 9
95     */
96    readonly MAX_VALUE_LENGTH: number;
97
98    /**
99     * Max device coordinate key length is 896.
100     *
101     * @type { number }
102     * @readonly
103     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
104     * @since 9
105     */
106    readonly MAX_KEY_LENGTH_DEVICE: number;
107
108    /**
109     * Max store id length is 128.
110     *
111     * @type { number }
112     * @readonly
113     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
114     * @since 9
115     */
116    readonly MAX_STORE_ID_LENGTH: number;
117
118    /**
119     * Max query length is 512000.
120     *
121     * @type { number }
122     * @readonly
123     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
124     * @since 9
125     */
126    readonly MAX_QUERY_LENGTH: number;
127
128    /**
129     * Max batch operation size is 128.
130     *
131     * @type { number }
132     * @readonly
133     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
134     * @since 9
135     */
136    readonly MAX_BATCH_SIZE: number;
137  }
138
139  /**
140   * Indicates the {@code ValueType}.
141   * <p>{@code ValueType} is obtained based on the value.
142   *
143   * @enum { number }
144   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
145   * @since 9
146   */
147  enum ValueType {
148    /**
149     * Indicates that the value type is string.
150     *
151     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
152     * @since 9
153     */
154    STRING,
155
156    /**
157     * Indicates that the value type is int.
158     *
159     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
160     * @since 9
161     */
162    INTEGER,
163
164    /**
165     * Indicates that the value type is float.
166     *
167     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
168     * @since 9
169     */
170    FLOAT,
171
172    /**
173     * Indicates that the value type is byte array.
174     *
175     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
176     * @since 9
177     */
178    BYTE_ARRAY,
179
180    /**
181     * Indicates that the value type is boolean.
182     *
183     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
184     * @since 9
185     */
186    BOOLEAN,
187
188    /**
189     * Indicates that the value type is double.
190     *
191     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
192     * @since 9
193     */
194    DOUBLE
195  }
196
197  /**
198   * Obtains {@code Value} objects stored in a {@link SingleKVStore} or {@link DeviceKVStore} database.
199   *
200   * @interface Value
201   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
202   * @since 9
203   */
204  interface Value {
205    /**
206     * Indicates the value type
207     *
208     * @type { ValueType }
209     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
210     * @since 9
211     * @see ValueType
212     */
213    type: ValueType;
214
215    /**
216     * Indicates the value
217     *
218     * @type { Uint8Array | string | number | boolean }
219     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
220     * @since 9
221     */
222    value: Uint8Array | string | number | boolean;
223  }
224
225  /**
226   * Provides key-value pairs stored in the distributedKVStore.
227   *
228   * @interface Entry
229   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
230   * @since 9
231   */
232  interface Entry {
233    /**
234     * Indicates the key
235     *
236     * @type { string }
237     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
238     * @since 9
239     */
240    key: string;
241
242    /**
243     * Indicates the value
244     *
245     * @type { Value }
246     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
247     * @since 9
248     */
249    value: Value;
250  }
251
252  /**
253   * Receive notifications of all data changes, including data insertion, update, and deletion.
254   * <p>If you have subscribed to {@code SingleKVStore} or {@code DeviceKVStore}, you will receive
255   * data change notifications and obtain the changed data from the parameters in callback methods
256   * upon data insertion, update or deletion.
257   *
258   * @interface ChangeNotification
259   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
260   * @since 9
261   */
262  interface ChangeNotification {
263    /**
264     * Indicates data insertion records.
265     *
266     * @type { Entry[] }
267     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
268     * @since 9
269     */
270    insertEntries: Entry[];
271
272    /**
273     * Indicates data update records.
274     *
275     * @type { Entry[] }
276     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
277     * @since 9
278     */
279    updateEntries: Entry[];
280
281    /**
282     * Indicates data deletion records.
283     *
284     * @type { Entry[] }
285     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
286     * @since 9
287     */
288    deleteEntries: Entry[];
289
290    /**
291     * Indicates the device id which brings the data change.
292     *
293     * @type { string }
294     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
295     * @since 9
296     */
297    deviceId: string;
298  }
299
300  /**
301   * Indicates the database synchronization mode.
302   *
303   * @enum { number }
304   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
305   * @since 9
306   */
307  enum SyncMode {
308    /**
309     * Indicates that data is only pulled from the remote end.
310     *
311     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
312     * @since 9
313     */
314    PULL_ONLY,
315
316    /**
317     * Indicates that data is only pushed from the local end.
318     *
319     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
320     * @since 9
321     */
322    PUSH_ONLY,
323
324    /**
325     * Indicates that data is pushed from the local end, and then pulled from the remote end.
326     *
327     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
328     * @since 9
329     */
330    PUSH_PULL
331  }
332
333  /**
334   * Describes the subscription type.
335   *
336   * @enum { number }
337   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
338   * @since 9
339   */
340  enum SubscribeType {
341    /**
342     * Subscription to local data changes
343     *
344     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
345     * @since 9
346     */
347    SUBSCRIBE_TYPE_LOCAL,
348
349    /**
350     * Subscription to remote data changes
351     *
352     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
353     * @since 9
354     */
355    SUBSCRIBE_TYPE_REMOTE,
356
357    /**
358     * Subscription to both local and remote data changes
359     *
360     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
361     * @since 9
362     */
363    SUBSCRIBE_TYPE_ALL
364  }
365
366  /**
367   * Describes the KVStore type.
368   *
369   * @enum { number }
370   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
371   * @since 9
372   */
373  enum KVStoreType {
374    /**
375     * Device-collaboration database, as specified by {@code DeviceKVStore}
376     *
377     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
378     * @since 9
379     */
380    DEVICE_COLLABORATION,
381
382    /**
383     * Single-version database, as specified by {@code SingleKVStore}
384     *
385     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
386     * @since 9
387     */
388    SINGLE_VERSION
389  }
390
391  /**
392   * Describes the KVStore security level.
393   *
394   * @enum { number }
395   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
396   * @since 9
397   */
398  enum SecurityLevel {
399    /**
400     * S1: means the db is in the low security level
401     * There are some low impact when the data is leaked.
402     *
403     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
404     * @since 9
405     */
406    S1,
407
408    /**
409     * S2: means the db is in the middle security level
410     * There are some major impact when the data is leaked.
411     *
412     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
413     * @since 9
414     */
415    S2,
416
417    /**
418     * S3: means the db is in the high security level
419     * There are some severity impact when the data is leaked.
420     *
421     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
422     * @since 9
423     */
424    S3,
425
426    /**
427     * S4: means the db is in the critical security level
428     * There are some critical impact when the data is leaked.
429     *
430     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
431     * @since 9
432     */
433    S4
434  }
435
436  /**
437   * Provides configuration options to create a {@code SingleKVStore} or {@code DeviceKVStore}.
438   *
439   * @interface Options
440   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
441   * @since 9
442   */
443  interface Options {
444    /**
445     * Indicates whether to create a database when the database file does not exist
446     *
447     * @type { ?boolean }
448     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
449     * @since 9
450     */
451    createIfMissing?: boolean;
452
453    /**
454     * Indicates whether database files to be encrypted
455     *
456     * @type { ?boolean }
457     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
458     * @since 9
459     */
460    encrypt?: boolean;
461
462    /**
463     * Indicates whether to back up database files
464     *
465     * @type { ?boolean }
466     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
467     * @since 9
468     */
469    backup?: boolean;
470
471    /**
472     * Indicates whether database files are automatically synchronized
473     *
474     * @permission ohos.permission.DISTRIBUTED_DATASYNC
475     * @type { ?boolean }
476     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
477     * @since 9
478     */
479    autoSync?: boolean;
480
481    /**
482     * Indicates the database type
483     *
484     * @type { ?KVStoreType }
485     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
486     * @since 9
487     */
488    kvStoreType?: KVStoreType;
489
490    /**
491     * Indicates the database security level
492     *
493     * @type { SecurityLevel }
494     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
495     * @since 9
496     */
497    securityLevel: SecurityLevel;
498
499    /**
500     * Indicates the database schema
501     *
502     * @type { ?Schema }
503     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
504     * @since 9
505     */
506    schema?: Schema;
507  }
508
509  /**
510   * Represents the database schema.
511   * You can set the schema object in options when create or open the database.
512   *
513   * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
514   * @since 9
515   */
516  class Schema {
517    /**
518     * A constructor used to create a Schema instance.
519     *
520     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
521     * @since 9
522     */
523    constructor();
524
525    /**
526     * Indicates the root json object.
527     *
528     * @type { FieldNode }
529     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
530     * @since 9
531     */
532    root: FieldNode;
533
534    /**
535     * Indicates the string array of json.
536     *
537     * @type { Array<string> }
538     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
539     * @since 9
540     */
541    indexes: Array<string>;
542
543    /**
544     * Indicates the mode of schema.
545     *
546     * @type { number }
547     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
548     * @since 9
549     */
550    mode: number;
551
552    /**
553     * Indicates the skip size of schema.
554     *
555     * @type { number }
556     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
557     * @since 9
558     */
559    skip: number;
560  }
561
562  /**
563   * Represents a node of a {@link Schema} instance.
564   * <p>With a {@link Schema} instance, you can define the value fields which stored in the database.
565   * <p>A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node.
566   * <p>The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}.
567   *
568   * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
569   * @since 9
570   */
571  class FieldNode {
572    /**
573     * A constructor used to create a FieldNode instance with the specified field.
574     * name Indicates the field node name.
575     *
576     * @param { string } name - It can not be empty.
577     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
578     * <br>2.Parameter verification failed.
579     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
580     * @since 9
581     */
582    constructor(name: string);
583
584    /**
585     * Adds a child node to this {@code FieldNode}.
586     * <p>Add a child node to makes this node a non-leaf node and field value will be ignored if it has a child node.
587     *
588     * @param { FieldNode } child - The field node to append.
589     * @returns { boolean } Returns true if the child node is successfully added to this {@code FieldNode}
590     * and false otherwise.
591     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
592     * <br>2.Incorrect parameters types.
593     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
594     * @since 9
595     */
596    appendChild(child: FieldNode): boolean;
597
598    /**
599     * Indicates the default value of field node.
600     *
601     * @type { string }
602     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
603     * @since 9
604     */
605    default: string;
606
607    /**
608     * Indicates the nullable of database field.
609     *
610     * @type { boolean }
611     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
612     * @since 9
613     */
614    nullable: boolean;
615
616    /**
617     * Indicates the type of value.
618     *
619     * @type { number }
620     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
621     * @since 9
622     */
623    type: number;
624  }
625
626  /**
627   * Provides methods to operate the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database.
628   * <p>The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or
629   * {@code DeviceKVStore} class. This interface also provides methods to move the data read
630   * position in the result set.
631   *
632   * @interface KVStoreResultSet
633   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
634   * @since 9
635   */
636  interface KVStoreResultSet {
637    /**
638     * Obtains the number of lines in a result set.
639     *
640     * @returns { number } Returns the number of lines.
641     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
642     * @since 9
643     */
644    getCount(): number;
645
646    /**
647     * Obtains the current read position in a result set.
648     *
649     * @returns { number } Returns the current read position. The read position starts with 0.
650     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
651     * @since 9
652     */
653    getPosition(): number;
654
655    /**
656     * Moves the read position to the first line.
657     * <p>If the result set is empty, false is returned.
658     *
659     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
660     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
661     * @since 9
662     */
663    moveToFirst(): boolean;
664
665    /**
666     * Moves the read position to the last line.
667     * <p>If the result set is empty, false is returned.
668     *
669     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
670     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
671     * @since 9
672     */
673    moveToLast(): boolean;
674
675    /**
676     * Moves the read position to the next line.
677     * <p>If the result set is empty or the data in the last line is being read, false is returned.
678     *
679     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
680     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
681     * @since 9
682     */
683    moveToNext(): boolean;
684
685    /**
686     * Moves the read position to the previous line.
687     * <p>If the result set is empty or the data in the first line is being read, false is returned.
688     *
689     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
690     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
691     * @since 9
692     */
693    moveToPrevious(): boolean;
694
695    /**
696     * Moves the read position by a relative offset to the current position.
697     *
698     * @param { number } offset - Indicates the relative offset to the current position. A negative offset indicates
699     * moving backwards, and a positive offset indicates moving forwards. For example, if the current position is entry
700     * 1 and this offset is 2, the destination position will be entry 3; if the current position is entry 3 and this
701     * offset is -2, the destination position will be entry 1. The valid final position after moving forwards starts
702     * with 0. If the final position is invalid, false will be returned.
703     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
704     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
705     * <br>2.Incorrect parameters types.
706     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
707     * @since 9
708     */
709    move(offset: number): boolean;
710
711    /**
712     * Moves the read position from 0 to an absolute position.
713     *
714     * @param { number } position - Indicates the absolute position.
715     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
716     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
717     * <br>2.Incorrect parameters types.
718     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
719     * @since 9
720     */
721    moveToPosition(position: number): boolean;
722
723    /**
724     * Checks whether the read position is the first line.
725     *
726     * @returns { boolean } Returns true if the read position is the first line; returns false otherwise.
727     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
728     * @since 9
729     */
730    isFirst(): boolean;
731
732    /**
733     * Checks whether the read position is the last line.
734     *
735     * @returns { boolean } Returns true if the read position is the last line; returns false otherwise.
736     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
737     * @since 9
738     */
739    isLast(): boolean;
740
741    /**
742     * Checks whether the read position is before the last line.
743     *
744     * @returns { boolean } Returns true if the read position is before the first line; returns false otherwise.
745     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
746     * @since 9
747     */
748    isBeforeFirst(): boolean;
749
750    /**
751     * Checks whether the read position is after the last line.
752     *
753     * @returns { boolean } Returns true if the read position is after the last line; returns false otherwise.
754     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
755     * @since 9
756     */
757    isAfterLast(): boolean;
758
759    /**
760     * Obtains a key-value pair.
761     *
762     * @returns { Entry } Returns a key-value pair.
763     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
764     * @since 9
765     */
766    getEntry(): Entry;
767  }
768
769  /**
770   * Represents a database query using predicates.
771   * <p>This class provides a constructor used to create a {@code Query} instance, which is used to query data
772   * matching specified conditions in the database.
773   * <p>This class also provides methods to add predicates to the {@code Query} instance.
774   *
775   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
776   * @since 9
777   */
778  class Query {
779    /**
780     * A constructor used to create a Query instance.
781     *
782     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
783     * @since 9
784     */
785    constructor();
786
787    /**
788     * Resets this {@code Query} object.
789     *
790     * @returns { Query } Returns the reset {@code Query} object.
791     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
792     * @since 9
793     */
794    reset(): Query;
795
796    /**
797     * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the
798     * specified long value.
799     *
800     * @param { string } field - Indicates the field, which cannot contain ^.
801     * @param { number | string | boolean } value - Indicates the value to be compared.
802     * @returns { Query } Returns the {@coed Query} object.
803     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
804     * <br>2.Incorrect parameters types;
805     * <br>3.Parameter verification failed.
806     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
807     * @since 9
808     */
809    equalTo(field: string, value: number | string | boolean): Query;
810
811    /**
812     * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the
813     * specified int value.
814     *
815     * @param { string } field - Indicates the field, which cannot contain ^.
816     * @param { number | string | boolean } value - Indicates the value to be compared.
817     * @returns { Query } Returns the {@coed Query} object.
818     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
819     * <br>2.Incorrect parameters types;
820     * <br>3.Parameter verification failed.
821     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
822     * @since 9
823     */
824    notEqualTo(field: string, value: number | string | boolean): Query;
825
826    /**
827     * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or
828     * equal to the specified int value.
829     *
830     * @param { string } field - Indicates the field, which cannot contain ^.
831     * @param { number | string | boolean } value - Indicates the value to be compared.
832     * @returns { Query } Returns the {@coed Query} object.
833     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
834     * <br>2.Incorrect parameters types;
835     * <br>3.Parameter verification failed.
836     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
837     * @since 9
838     */
839    greaterThan(field: string, value: number | string | boolean): Query;
840
841    /**
842     * Constructs a {@code Query} object to query entries with the specified field whose value is less than the
843     * specified int value.
844     *
845     * @param { string } field - Indicates the field, which cannot contain ^.
846     * @param { number | string } value - Indicates the value to be compared.
847     * @returns { Query } Returns the {@coed Query} object.
848     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
849     * <br>2.Incorrect parameters types;
850     * <br>3.Parameter verification failed.
851     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
852     * @since 9
853     */
854    lessThan(field: string, value: number | string): Query;
855
856    /**
857     * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or
858     * equal to the specified int value.
859     *
860     * @param { string } field - Indicates the field, which cannot contain ^.
861     * @param { number | string } value - Indicates the value to be compared.
862     * @returns { Query } Returns the {@coed Query} object.
863     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
864     * <br>2.Incorrect parameters types;
865     * <br>3.Parameter verification failed.
866     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
867     * @since 9
868     */
869    greaterThanOrEqualTo(field: string, value: number | string): Query;
870
871    /**
872     * Constructs a {@code Query} object to query entries with the specified field whose value is less than or
873     * equal to the specified int value.
874     *
875     * @param { string } field - Indicates the field, which cannot contain ^.
876     * @param { number | string } value - Indicates the value to be compared.
877     * @returns { Query } Returns the {@coed Query} object.
878     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
879     * <br>2.Incorrect parameters types;
880     * <br>3.Parameter verification failed.
881     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
882     * @since 9
883     */
884    lessThanOrEqualTo(field: string, value: number | string): Query;
885
886    /**
887     * Constructs a {@code Query} object to query entries with the specified field whose value is null.
888     *
889     * @param { string } field - Indicates the field, which cannot contain ^.
890     * @returns { Query } Returns the {@coed Query} object.
891     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
892     * <br>2.Incorrect parameters types;
893     * <br>3.Parameter verification failed.
894     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
895     * @since 9
896     */
897    isNull(field: string): Query;
898
899    /**
900     * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified
901     * int value list.
902     *
903     * @param { string } field - Indicates the field, which cannot contain ^.
904     * @param { number[] } valueList - Indicates the int value list.
905     * @returns { Query } Returns the {@coed Query} object.
906     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
907     * <br>2.Incorrect parameters types;
908     * <br>3.Parameter verification failed.
909     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
910     * @since 9
911     */
912    inNumber(field: string, valueList: number[]): Query;
913
914    /**
915     * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified
916     * string value list.
917     *
918     * @param { string } field - Indicates the field, which cannot contain ^.
919     * @param { string[] } valueList - Indicates the string value list.
920     * @returns { Query } Returns the {@coed Query} object.
921     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
922     * <br>2.Incorrect parameters types;
923     * <br>3.Parameter verification failed.
924     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
925     * @since 9
926     */
927    inString(field: string, valueList: string[]): Query;
928
929    /**
930     * Constructs a {@code Query} object to query entries with the specified field whose value is not within the
931     * specified int value list.
932     *
933     * @param { string } field - Indicates the field, which cannot contain ^.
934     * @param { number[] } valueList - Indicates the int value list.
935     * @returns { Query } Returns the {@coed Query} object.
936     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
937     * <br>2.Incorrect parameters types;
938     * <br>3.Parameter verification failed.
939     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
940     * @since 9
941     */
942    notInNumber(field: string, valueList: number[]): Query;
943
944    /**
945     * Constructs a {@code Query} object to query entries with the specified field whose value is not within the
946     * specified string value list.
947     *
948     * @param { string } field - Indicates the field, which cannot contain ^.
949     * @param { string[] } valueList - Indicates the string value list.
950     * @returns { Query } Returns the {@coed Query} object.
951     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
952     * <br>2.Incorrect parameters types;
953     * <br>3.Parameter verification failed.
954     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
955     * @since 9
956     */
957    notInString(field: string, valueList: string[]): Query;
958
959    /**
960     * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the
961     * specified string value.
962     *
963     * @param { string } field - Indicates the field, which cannot contain ^.
964     * @param { string } value - Indicates the string value.
965     * @returns { Query } Returns the {@coed Query} object.
966     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
967     * <br>2.Incorrect parameters types;
968     * <br>3.Parameter verification failed.
969     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
970     * @since 9
971     */
972    like(field: string, value: string): Query;
973
974    /**
975     * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the
976     * specified string value.
977     *
978     * @param { string } field - Indicates the field, which cannot contain ^.
979     * @param { string } value - Indicates the string value.
980     * @returns { Query } Returns the {@coed Query} object.
981     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
982     * <br>2.Incorrect parameters types;
983     * <br>3.Parameter verification failed.
984     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
985     * @since 9
986     */
987    unlike(field: string, value: string): Query;
988
989    /**
990     * Constructs a {@code Query} object with the and condition.
991     * <p>Multiple predicates should be connected using the and or or condition.
992     *
993     * @returns { Query } Returns the {@coed Query} object.
994     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
995     * @since 9
996     */
997    and(): Query;
998
999    /**
1000     * Constructs a {@code Query} object with the or condition.
1001     * <p>Multiple predicates should be connected using the and or or condition.
1002     *
1003     * @returns { Query } Returns the {@coed Query} object.
1004     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1005     * @since 9
1006     */
1007    or(): Query;
1008
1009    /**
1010     * Constructs a {@code Query} object to sort the query results in ascending order.
1011     *
1012     * @param { string } field - Indicates the field, which cannot contain ^.
1013     * @returns { Query } Returns the {@coed Query} object.
1014     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1015     * <br>2.Incorrect parameters types;
1016     * <br>3.Parameter verification failed.
1017     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1018     * @since 9
1019     */
1020    orderByAsc(field: string): Query;
1021
1022    /**
1023     * Constructs a {@code Query} object to sort the query results in descending order.
1024     *
1025     * @param { string } field - Indicates the field, which cannot contain ^.
1026     * @returns { Query } Returns the {@coed Query} object.
1027     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1028     * <br>2.Incorrect parameters types;
1029     * <br>3.Parameter verification failed.
1030     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1031     * @since 9
1032     */
1033    orderByDesc(field: string): Query;
1034
1035    /**
1036     * Constructs a {@code Query} object to specify the number of results and the start position.
1037     *
1038     * @param { number } total - Maximum number of results to query. The value must be a non-negative integer.
1039     * If the input value is less than 0, the number of results is not limited.
1040     * @param { number } offset - Start position of the query result. By default,
1041     * the start position is the beginning of the result set. If **offset** is a negative number,
1042     * the start position is the beginning of the result set. If **offset** exceeds the end of the result set,
1043     * the query result is empty.
1044     * @returns { Query } Returns the {@coed Query} object.
1045     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1046     * <br>2.Incorrect parameters types.
1047     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1048     * @since 9
1049     */
1050    limit(total: number, offset: number): Query;
1051
1052    /**
1053     * Creates a {@code Query} condition with a specified field that is not null.
1054     *
1055     * @param { string } field - Indicates the specified field.
1056     * @returns { Query } Returns the {@coed Query} object.
1057     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1058     * <br>2.Incorrect parameters types.
1059     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1060     * @since 9
1061     */
1062    isNotNull(field: string): Query;
1063
1064    /**
1065     * Creates a query condition group with a left bracket.
1066     * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can
1067     * beused as a whole to combine with other query conditions.
1068     *
1069     * @returns { Query } Returns the {@coed Query} object.
1070     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1071     * @since 9
1072     */
1073    beginGroup(): Query;
1074
1075    /**
1076     * Creates a query condition group with a right bracket.
1077     * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can
1078     * be used as a whole to combine with other query conditions.
1079     *
1080     * @returns { Query } Returns the {@coed Query} object.
1081     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1082     * @since 9
1083     */
1084    endGroup(): Query;
1085
1086    /**
1087     * Creates a query condition with a specified key prefix.
1088     *
1089     * @param { string } prefix - Indicates the specified key prefix.
1090     * @returns { Query } Returns the {@coed Query} object.
1091     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1092     * <br>2.Incorrect parameters types.
1093     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1094     * @since 9
1095     */
1096    prefixKey(prefix: string): Query;
1097
1098    /**
1099     * Sets a specified index that will be preferentially used for query.
1100     *
1101     * @param { string } index - Indicates the index to set.
1102     * @returns { Query } Returns the {@coed Query} object.
1103     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1104     * <br>2.Incorrect parameters types.
1105     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1106     * @since 9
1107     */
1108    setSuggestIndex(index: string): Query;
1109
1110    /**
1111     * Add device ID key prefix.Used by {@code DeviceKVStore}.
1112     *
1113     * @param { string } deviceId - Specify device id to query from, It can not be empty.
1114     * @returns { Query } Returns the {@code Query} object with device ID prefix added.
1115     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1116     * <br>2.Incorrect parameters types;
1117     * <br>3.Parameter verification failed.
1118     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1119     * @since 9
1120     */
1121    deviceId(deviceId: string): Query;
1122
1123    /**
1124     * Get a String that represents this {@code Query}.
1125     * <p>The String would be parsed to DB query format.
1126     * The String length should be no longer than 500kb.
1127     *
1128     * @returns { string } String representing this {@code Query}.
1129     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1130     * @since 9
1131     */
1132    getSqlLike(): string;
1133  }
1134
1135  /**
1136   * Provides methods related to single-version distributed databases.
1137   * <p>To create a {@code SingleKVStore} database,
1138   * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method
1139   * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}.
1140   * This database synchronizes data to other databases in time sequence.
1141   * The {@code SingleKVStore} database does not support
1142   * synchronous transactions, or data search using snapshots.
1143   *
1144   * @interface SingleKVStore
1145   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1146   * @since 9
1147   */
1148  interface SingleKVStore {
1149    /**
1150     * Writes a key-value pair of the string type into the {@code SingleKVStore} database.
1151     * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local
1152     * database.
1153     *
1154     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1155     * Spaces before and after the key will be cleared.
1156     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1157     * @param { AsyncCallback<void> } callback - the callback of put.
1158     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1159     * <br>2.Incorrect parameters types;
1160     * <br>3.Parameter verification failed.
1161     * @throws { BusinessError } 15100003 - Database corrupted.
1162     * @throws { BusinessError } 15100005 - Database or result set already closed.
1163     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1164     * @since 9
1165     */
1166    /**
1167     * Writes a key-value pair of the string type into the {@code SingleKVStore} database.
1168     * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local
1169     * database.
1170     *
1171     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1172     * Spaces before and after the key will be cleared.
1173     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1174     * @param { AsyncCallback<void> } callback - the callback of put.
1175     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1176     * <br>2.Incorrect parameters types;
1177     * <br>3.Parameter verification failed.
1178     * @throws { BusinessError } 15100003 - Database corrupted.
1179     * @throws { BusinessError } 15100005 - Database or result set already closed.
1180     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1181     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1182     * @since 10
1183     */
1184    put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback<void>): void;
1185
1186    /**
1187     * Writes a key-value pair of the string type into the {@code SingleKVStore} database.
1188     * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local
1189     * database.
1190     *
1191     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1192     * Spaces before and after the key will be cleared.
1193     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1194     * @returns { Promise<void> } the promise returned by the function.
1195     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1196     * <br>2.Incorrect parameters types;
1197     * <br>3.Parameter verification failed.
1198     * @throws { BusinessError } 15100003 - Database corrupted.
1199     * @throws { BusinessError } 15100005 - Database or result set already closed.
1200     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1201     * @since 9
1202     */
1203    /**
1204     * Writes a key-value pair of the string type into the {@code SingleKVStore} database.
1205     * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local
1206     * database.
1207     *
1208     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1209     * Spaces before and after the key will be cleared.
1210     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1211     * @returns { Promise<void> } the promise returned by the function.
1212     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1213     * <br>2.Incorrect parameters types;
1214     * <br>3.Parameter verification failed.
1215     * @throws { BusinessError } 15100003 - Database corrupted.
1216     * @throws { BusinessError } 15100005 - Database or result set already closed.
1217     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1218     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1219     * @since 10
1220     */
1221    put(key: string, value: Uint8Array | string | number | boolean): Promise<void>;
1222
1223    /**
1224     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1225     *
1226     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1227     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1228     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1229     * <br>2.Incorrect parameters types.
1230     * @throws { BusinessError } 15100003 - Database corrupted.
1231     * @throws { BusinessError } 15100005 - Database or result set already closed.
1232     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1233     * @since 9
1234     */
1235    /**
1236     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1237     *
1238     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1239     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1240     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1241     * <br>2.Incorrect parameters types.
1242     * @throws { BusinessError } 15100003 - Database corrupted.
1243     * @throws { BusinessError } 15100005 - Database or result set already closed.
1244     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1245     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1246     * @since 10
1247     */
1248    putBatch(entries: Entry[], callback: AsyncCallback<void>): void;
1249
1250    /**
1251     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1252     *
1253     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1254     * @returns { Promise<void> } the promise returned by the function.
1255     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1256     * <br>2.Incorrect parameters types.
1257     * @throws { BusinessError } 15100003 - Database corrupted.
1258     * @throws { BusinessError } 15100005 - Database or result set already closed.
1259     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1260     * @since 9
1261     */
1262    /**
1263     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1264     *
1265     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1266     * @returns { Promise<void> } the promise returned by the function.
1267     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1268     * <br>2.Incorrect parameters types.
1269     * @throws { BusinessError } 15100003 - Database corrupted.
1270     * @throws { BusinessError } 15100005 - Database or result set already closed.
1271     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1272     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1273     * @since 10
1274     */
1275    putBatch(entries: Entry[]): Promise<void>;
1276
1277    /**
1278     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1279     *
1280     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1281     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1282     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1283     * <br>2.Incorrect parameters types.
1284     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1285     * uses system API.
1286     * @throws { BusinessError } 15100003 - Database corrupted.
1287     * @throws { BusinessError } 15100005 - Database or result set already closed.
1288     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1289     * @systemapi
1290     * @StageModelOnly
1291     * @since 9
1292     */
1293    /**
1294     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1295     *
1296     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1297     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1298     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1299     * <br>2.Incorrect parameters types.
1300     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1301     * uses system API.
1302     * @throws { BusinessError } 15100003 - Database corrupted.
1303     * @throws { BusinessError } 15100005 - Database or result set already closed.
1304     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1305     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1306     * @systemapi
1307     * @StageModelOnly
1308     * @since 10
1309     */
1310    putBatch(value: Array<ValuesBucket>, callback: AsyncCallback<void>): void;
1311
1312    /**
1313     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1314     *
1315     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1316     * @returns { Promise<void> } the promise returned by the function.
1317     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1318     * <br>2.Incorrect parameters types.
1319     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1320     * uses system API.
1321     * @throws { BusinessError } 15100003 - Database corrupted.
1322     * @throws { BusinessError } 15100005 - Database or result set already closed.
1323     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1324     * @systemapi
1325     * @StageModelOnly
1326     * @since 9
1327     */
1328    /**
1329     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1330     *
1331     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1332     * @returns { Promise<void> } the promise returned by the function.
1333     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1334     * <br>2.Incorrect parameters types.
1335     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1336     * uses system API.
1337     * @throws { BusinessError } 15100003 - Database corrupted.
1338     * @throws { BusinessError } 15100005 - Database or result set already closed.
1339     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1340     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1341     * @systemapi
1342     * @StageModelOnly
1343     * @since 10
1344     */
1345    putBatch(value: Array<ValuesBucket>): Promise<void>;
1346
1347    /**
1348     * Deletes the key-value pair based on a specified key.
1349     *
1350     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1351     * Spaces before and after the key will be cleared.
1352     * @param { AsyncCallback<void> } callback - the callback of delete.
1353     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1354     * <br>2.Incorrect parameters types;
1355     * <br>3.Parameter verification failed.
1356     * @throws { BusinessError } 15100003 - Database corrupted.
1357     * @throws { BusinessError } 15100005 - Database or result set already closed.
1358     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1359     * @since 9
1360     */
1361    /**
1362     * Deletes the key-value pair based on a specified key.
1363     *
1364     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1365     * Spaces before and after the key will be cleared.
1366     * @param { AsyncCallback<void> } callback - the callback of delete.
1367     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1368     * <br>2.Incorrect parameters types;
1369     * <br>3.Parameter verification failed.
1370     * @throws { BusinessError } 15100003 - Database corrupted.
1371     * @throws { BusinessError } 15100005 - Database or result set already closed.
1372     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1373     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1374     * @since 10
1375     */
1376    delete(key: string, callback: AsyncCallback<void>): void;
1377
1378    /**
1379     * Deletes the key-value pair based on a specified key.
1380     *
1381     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1382     * Spaces before and after the key will be cleared.
1383     * @returns { Promise<void> } the promise returned by the function.
1384     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1385     * <br>2.Incorrect parameters types;
1386     * <br>3.Parameter verification failed.
1387     * @throws { BusinessError } 15100003 - Database corrupted.
1388     * @throws { BusinessError } 15100005 - Database or result set already closed.
1389     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1390     * @since 9
1391     */
1392    /**
1393     * Deletes the key-value pair based on a specified key.
1394     *
1395     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1396     * Spaces before and after the key will be cleared.
1397     * @returns { Promise<void> } the promise returned by the function.
1398     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1399     * <br>2.Incorrect parameters types;
1400     * <br>3.Parameter verification failed.
1401     * @throws { BusinessError } 15100003 - Database corrupted.
1402     * @throws { BusinessError } 15100005 - Database or result set already closed.
1403     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1404     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1405     * @since 10
1406     */
1407    delete(key: string): Promise<void>;
1408
1409    /**
1410     * Deletes the key-value pairs based on the dataSharePredicates.
1411     *
1412     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1413     * @param { AsyncCallback<void> } callback - the callback of delete.
1414     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1415     * <br>2.Incorrect parameters types.
1416     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1417     * uses system API.
1418     * @throws { BusinessError } 15100003 - Database corrupted.
1419     * @throws { BusinessError } 15100005 - Database or result set already closed.
1420     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1421     * @systemapi
1422     * @StageModelOnly
1423     * @since 9
1424     */
1425    /**
1426     * Deletes the key-value pairs based on the dataSharePredicates.
1427     *
1428     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1429     * @param { AsyncCallback<void> } callback - the callback of delete.
1430     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1431     * <br>2.Incorrect parameters types.
1432     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1433     * uses system API.
1434     * @throws { BusinessError } 15100003 - Database corrupted.
1435     * @throws { BusinessError } 15100005 - Database or result set already closed.
1436     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1437     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1438     * @systemapi
1439     * @StageModelOnly
1440     * @since 10
1441     */
1442    delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>): void;
1443
1444    /**
1445     * Deletes the key-value pairs based on the dataSharePredicates.
1446     *
1447     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1448     * @returns { Promise<void> } the promise returned by the function.
1449     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1450     * <br>2.Incorrect parameters types.
1451     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1452     * uses system API.
1453     * @throws { BusinessError } 15100003 - Database corrupted.
1454     * @throws { BusinessError } 15100005 - Database or result set already closed.
1455     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1456     * @systemapi
1457     * @StageModelOnly
1458     * @since 9
1459     */
1460    /**
1461     * Deletes the key-value pairs based on the dataSharePredicates.
1462     *
1463     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1464     * @returns { Promise<void> } the promise returned by the function.
1465     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1466     * <br>2.Incorrect parameters types.
1467     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1468     * uses system API.
1469     * @throws { BusinessError } 15100003 - Database corrupted.
1470     * @throws { BusinessError } 15100005 - Database or result set already closed.
1471     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1472     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1473     * @systemapi
1474     * @StageModelOnly
1475     * @since 10
1476     */
1477    delete(predicates: dataSharePredicates.DataSharePredicates): Promise<void>;
1478
1479    /**
1480     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1481     *
1482     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1483     * @param { AsyncCallback<void> } callback - the callback of deleteBatch.
1484     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1485     * <br>2.Incorrect parameters types;
1486     * <br>3.Parameter verification failed.
1487     * @throws { BusinessError } 15100003 - Database corrupted.
1488     * @throws { BusinessError } 15100005 - Database or result set already closed.
1489     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1490     * @since 9
1491     */
1492    /**
1493     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1494     *
1495     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1496     * @param { AsyncCallback<void> } callback - the callback of deleteBatch.
1497     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1498     * <br>2.Incorrect parameters types;
1499     * <br>3.Parameter verification failed.
1500     * @throws { BusinessError } 15100003 - Database corrupted.
1501     * @throws { BusinessError } 15100005 - Database or result set already closed.
1502     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1503     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1504     * @since 10
1505     */
1506    deleteBatch(keys: string[], callback: AsyncCallback<void>): void;
1507
1508    /**
1509     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1510     *
1511     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1512     * @returns { Promise<void> } the promise returned by the function.
1513     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1514     * <br>2.Incorrect parameters types;
1515     * <br>3.Parameter verification failed.
1516     * @throws { BusinessError } 15100003 - Database corrupted.
1517     * @throws { BusinessError } 15100005 - Database or result set already closed.
1518     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1519     * @since 9
1520     */
1521    /**
1522     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1523     *
1524     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1525     * @returns { Promise<void> } the promise returned by the function.
1526     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1527     * <br>2.Incorrect parameters types;
1528     * <br>3.Parameter verification failed.
1529     * @throws { BusinessError } 15100003 - Database corrupted.
1530     * @throws { BusinessError } 15100005 - Database or result set already closed.
1531     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1532     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1533     * @since 10
1534     */
1535    deleteBatch(keys: string[]): Promise<void>;
1536
1537    /**
1538     * Removes data of the specified device from current database. This method is used to remove only the data
1539     * synchronized from remote devices. This operation does not synchronize data to other databases or affect
1540     * subsequent data synchronization.
1541     *
1542     * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the
1543     * current device ID.
1544     * @param { AsyncCallback<void> } callback - the callback of removeDeviceData.
1545     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1546     * <br>2.Parameter verification failed.
1547     * @throws { BusinessError } 15100005 - Database or result set already closed.
1548     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
1549     * @since 9
1550     */
1551    removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void;
1552
1553    /**
1554     * Removes data of the specified device from current database. This method is used to remove only the data
1555     * synchronized from remote devices. This operation does not synchronize data to other databases or affect
1556     * subsequent data synchronization.
1557     *
1558     * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the
1559     * current device ID.
1560     * @returns { Promise<void> } the promise returned by the function.
1561     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1562     * <br>2.Parameter verification failed.
1563     * @throws { BusinessError } 15100005 - Database or result set already closed.
1564     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
1565     * @since 9
1566     */
1567    removeDeviceData(deviceId: string): Promise<void>;
1568
1569    /**
1570     * Obtains the value of a specified key.
1571     *
1572     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
1573     * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
1574     * {Uint8Array|string|boolean|number}: the returned value specified by the key.
1575     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1576     * <br>2.Incorrect parameters types;
1577     * <br>3.Parameter verification failed.
1578     * @throws { BusinessError } 15100003 - Database corrupted.
1579     * @throws { BusinessError } 15100004 - Not found.
1580     * @throws { BusinessError } 15100005 - Database or result set already closed.
1581     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1582     * @since 9
1583     */
1584    get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
1585
1586    /**
1587     * Obtains the value of a specified key.
1588     *
1589     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
1590     * @returns { Promise<boolean | string | number | Uint8Array> }
1591     * {Uint8Array|string|boolean|number}: the returned value specified by the key.
1592     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1593     * <br>2.Incorrect parameters types;
1594     * <br>3.Parameter verification failed.
1595     * @throws { BusinessError } 15100003 - Database corrupted.
1596     * @throws { BusinessError } 15100004 - Not found.
1597     * @throws { BusinessError } 15100005 - Database or result set already closed.
1598     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1599     * @since 9
1600     */
1601    get(key: string): Promise<boolean | string | number | Uint8Array>;
1602
1603    /**
1604     * Obtains all key-value pairs that match a specified key prefix.
1605     *
1606     * @param { string } keyPrefix - Indicates the key prefix to match.
1607     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
1608     * that match the specified key prefix.
1609     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1610     * <br>2.Incorrect parameters types.
1611     * @throws { BusinessError } 15100003 - Database corrupted.
1612     * @throws { BusinessError } 15100005 - Database or result set already closed.
1613     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1614     * @since 9
1615     */
1616    getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
1617
1618    /**
1619     * Obtains all key-value pairs that match a specified key prefix.
1620     *
1621     * @param { string } keyPrefix - Indicates the key prefix to match.
1622     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
1623     * specified key prefix.
1624     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1625     * <br>2.Incorrect parameters types.
1626     * @throws { BusinessError } 15100003 - Database corrupted.
1627     * @throws { BusinessError } 15100005 - Database or result set already closed.
1628     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1629     * @since 9
1630     */
1631    getEntries(keyPrefix: string): Promise<Entry[]>;
1632
1633    /**
1634     * Obtains the list of key-value pairs matching the specified {@code Query} object.
1635     *
1636     * @param { Query } query - Indicates the {@code Query} object.
1637     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
1638     * matching the specified {@code Query} object.
1639     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1640     * <br>2.Incorrect parameters types.
1641     * @throws { BusinessError } 15100003 - Database corrupted.
1642     * @throws { BusinessError } 15100005 - Database or result set already closed.
1643     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1644     * @since 9
1645     */
1646    getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
1647
1648    /**
1649     * Obtains the list of key-value pairs matching the specified {@code Query} object.
1650     *
1651     * @param { Query } query - Indicates the {@code Query} object.
1652     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the
1653     * specified {@code Query} object.
1654     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1655     * <br>2.Incorrect parameters types.
1656     * @throws { BusinessError } 15100003 - Database corrupted.
1657     * @throws { BusinessError } 15100005 - Database or result set already closed.
1658     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1659     * @since 9
1660     */
1661    getEntries(query: Query): Promise<Entry[]>;
1662
1663    /**
1664     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database.
1665     * The {@code KVStoreResultSet}
1666     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1667     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1668     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1669     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1670     *
1671     * @param { string } keyPrefix - Indicates the key prefix to match.
1672     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1673     * object matching the specified keyPrefix.
1674     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1675     * <br>2.Incorrect parameters types.
1676     * @throws { BusinessError } 15100003 - Database corrupted.
1677     * @throws { BusinessError } 15100005 - Database or result set already closed.
1678     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1679     * @since 9
1680     */
1681    /**
1682     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database.
1683     * The {@code KVStoreResultSet}
1684     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1685     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1686     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1687     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1688     *
1689     * @param { string } keyPrefix - Indicates the key prefix to match.
1690     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1691     * object matching the specified keyPrefix.
1692     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1693     * <br>2.Incorrect parameters types.
1694     * @throws { BusinessError } 15100001 - Over max limits.
1695     * @throws { BusinessError } 15100003 - Database corrupted.
1696     * @throws { BusinessError } 15100005 - Database or result set already closed.
1697     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1698     * @since 10
1699     */
1700    getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
1701
1702    /**
1703     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database.
1704     * The {@code KVStoreResultSet}
1705     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1706     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1707     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1708     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1709     *
1710     * @param { string } keyPrefix - Indicates the key prefix to match.
1711     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1712     * object matching the specified keyPrefix.
1713     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1714     * <br>2.Incorrect parameters types.
1715     * @throws { BusinessError } 15100003 - Database corrupted.
1716     * @throws { BusinessError } 15100005 - Database or result set already closed.
1717     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1718     * @since 9
1719     */
1720    /**
1721     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database.
1722     * The {@code KVStoreResultSet}
1723     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1724     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1725     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1726     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1727     *
1728     * @param { string } keyPrefix - Indicates the key prefix to match.
1729     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1730     * object matching the specified keyPrefix.
1731     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1732     * <br>2.Incorrect parameters types.
1733     * @throws { BusinessError } 15100001 - Over max limits.
1734     * @throws { BusinessError } 15100003 - Database corrupted.
1735     * @throws { BusinessError } 15100005 - Database or result set already closed.
1736     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1737     * @since 10
1738     */
1739    getResultSet(keyPrefix: string): Promise<KVStoreResultSet>;
1740
1741    /**
1742     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1743     *
1744     * @param { Query } query - Indicates the {@code Query} object.
1745     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1746     * object matching the specified {@code Query} object.
1747     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1748     * <br>2.Incorrect parameters types.
1749     * @throws { BusinessError } 15100003 - Database corrupted.
1750     * @throws { BusinessError } 15100005 - Database or result set already closed.
1751     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1752     * @since 9
1753     */
1754    /**
1755     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1756     *
1757     * @param { Query } query - Indicates the {@code Query} object.
1758     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1759     * object matching the specified {@code Query} object.
1760     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1761     * <br>2.Incorrect parameters types.
1762     * @throws { BusinessError } 15100001 - Over max limits.
1763     * @throws { BusinessError } 15100003 - Database corrupted.
1764     * @throws { BusinessError } 15100005 - Database or result set already closed.
1765     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1766     * @since 10
1767     */
1768    getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
1769
1770    /**
1771     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1772     *
1773     * @param { Query } query - Indicates the {@code Query} object.
1774     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1775     * object matching the specified {@code Query} object.
1776     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1777     * <br>2.Incorrect parameters types.
1778     * @throws { BusinessError } 15100003 - Database corrupted.
1779     * @throws { BusinessError } 15100005 - Database or result set already closed.
1780     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1781     * @since 9
1782     */
1783    /**
1784     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1785     *
1786     * @param { Query } query - Indicates the {@code Query} object.
1787     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1788     * object matching the specified {@code Query} object.
1789     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1790     * <br>2.Incorrect parameters types.
1791     * @throws { BusinessError } 15100001 - Over max limits.
1792     * @throws { BusinessError } 15100003 - Database corrupted.
1793     * @throws { BusinessError } 15100005 - Database or result set already closed.
1794     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1795     * @since 10
1796     */
1797    getResultSet(query: Query): Promise<KVStoreResultSet>;
1798
1799    /**
1800     * Obtains the KVStoreResultSet object matching the specified predicate object.
1801     *
1802     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1803     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1804     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1805     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1806     * <br>2.Incorrect parameters types.
1807     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1808     * uses system API.
1809     * @throws { BusinessError } 15100003 - Database corrupted.
1810     * @throws { BusinessError } 15100005 - Database or result set already closed.
1811     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1812     * @systemapi
1813     * @StageModelOnly
1814     * @since 9
1815     */
1816    /**
1817     * Obtains the KVStoreResultSet object matching the specified predicate object.
1818     *
1819     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1820     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1821     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1822     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1823     * <br>2.Incorrect parameters types.
1824     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1825     * uses system API.
1826     * @throws { BusinessError } 15100001 - Over max limits.
1827     * @throws { BusinessError } 15100003 - Database corrupted.
1828     * @throws { BusinessError } 15100005 - Database or result set already closed.
1829     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1830     * @systemapi
1831     * @StageModelOnly
1832     * @since 10
1833     */
1834    getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void;
1835
1836    /**
1837     * Obtains the KVStoreResultSet object matching the specified predicate object.
1838     *
1839     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1840     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1841     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1842     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1843     * <br>2.Incorrect parameters types.
1844     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1845     * uses system API.
1846     * @throws { BusinessError } 15100003 - Database corrupted.
1847     * @throws { BusinessError } 15100005 - Database or result set already closed.
1848     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1849     * @systemapi
1850     * @StageModelOnly
1851     * @since 9
1852     */
1853    /**
1854     * Obtains the KVStoreResultSet object matching the specified predicate object.
1855     *
1856     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1857     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1858     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1859     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1860     * <br>2.Incorrect parameters types.
1861     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
1862     * uses system API.
1863     * @throws { BusinessError } 15100001 - Over max limits.
1864     * @throws { BusinessError } 15100003 - Database corrupted.
1865     * @throws { BusinessError } 15100005 - Database or result set already closed.
1866     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1867     * @systemapi
1868     * @StageModelOnly
1869     * @since 10
1870     */
1871    getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
1872
1873    /**
1874     * Closes a {@code KVStoreResultSet} object returned by getResultSet method.
1875     *
1876     * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close.
1877     * @param { AsyncCallback<void> } callback - the callback of closeResultSet.
1878     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1879     * <br>2.Incorrect parameters types.
1880     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1881     * @since 9
1882     */
1883    closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback<void>): void;
1884
1885    /**
1886     * Closes a {@code KVStoreResultSet} object returned by getResultSet method.
1887     *
1888     * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close.
1889     * @returns { Promise<void> } the promise returned by the function.
1890     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1891     * <br>2.Incorrect parameters types.
1892     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1893     * @since 9
1894     */
1895    closeResultSet(resultSet: KVStoreResultSet): Promise<void>;
1896
1897    /**
1898     * Obtains the number of results matching the specified {@code Query} object.
1899     *
1900     * @param { Query } query - Indicates the {@code Query} object.
1901     * @param { AsyncCallback<number> } callback - {number}: the number of results matching the
1902     * specified {@code Query} object.
1903     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1904     * <br>2.Incorrect parameters types.
1905     * @throws { BusinessError } 15100003 - Database corrupted.
1906     * @throws { BusinessError } 15100005 - Database or result set already closed.
1907     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1908     * @since 9
1909     */
1910    getResultSize(query: Query, callback: AsyncCallback<number>): void;
1911
1912    /**
1913     * Obtains the number of results matching the specified {@code Query} object.
1914     *
1915     * @param { Query } query - Indicates the {@code Query} object.
1916     * @returns { Promise<number> } {number}: the number of results matching the specified
1917     * {@code Query} object.
1918     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1919     * <br>2.Incorrect parameters types.
1920     * @throws { BusinessError } 15100003 - Database corrupted.
1921     * @throws { BusinessError } 15100005 - Database or result set already closed.
1922     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1923     * @since 9
1924     */
1925    getResultSize(query: Query): Promise<number>;
1926
1927    /**
1928     * Backs up a database in the specified filename.
1929     *
1930     * @param { string } file - Indicates the database backup filename, It can not be empty and
1931     * The length must be less than {@code MAX_KEY_LENGTH}.
1932     * @param { AsyncCallback<void> } callback - the callback of backup.
1933     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1934     * <br>2.Parameter verification failed.
1935     * @throws { BusinessError } 15100005 - Database or result set already closed.
1936     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1937     * @since 9
1938     */
1939    backup(file: string, callback: AsyncCallback<void>): void;
1940
1941    /**
1942     * Backs up a database in the specified filename.
1943     *
1944     * @param { string } file - Indicates the database backup filename, It can not be empty and
1945     * The length must be less than {@code MAX_KEY_LENGTH}.
1946     * @returns { Promise<void> } the promise returned by the function.
1947     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1948     * <br>2.Parameter verification failed.
1949     * @throws { BusinessError } 15100005 - Database or result set already closed.
1950     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1951     * @since 9
1952     */
1953    backup(file: string): Promise<void>;
1954
1955    /**
1956     * Restores a database from a specified database file.
1957     *
1958     * @param { string } file - Indicates the database backup filename, It can not be empty and
1959     * The length must be less than {@code MAX_KEY_LENGTH}.
1960     * @param { AsyncCallback<void> } callback - the callback of restore.
1961     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1962     * <br>2.Parameter verification failed.
1963     * @throws { BusinessError } 15100005 - Database or result set already closed.
1964     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1965     * @since 9
1966     */
1967    restore(file: string, callback: AsyncCallback<void>): void;
1968
1969    /**
1970     * Restores a database from a specified database file.
1971     *
1972     * @param { string } file - Indicates the database backup filename, It can not be empty and
1973     * The length must be less than {@code MAX_KEY_LENGTH}.
1974     * @returns { Promise<void> } the promise returned by the function.
1975     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1976     * <br>2.Parameter verification failed.
1977     * @throws { BusinessError } 15100005 - Database or result set already closed.
1978     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1979     * @since 9
1980     */
1981    restore(file: string): Promise<void>;
1982
1983    /**
1984     * Delete database backup files based on the specified filenames.
1985     *
1986     * @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and
1987     * The length must be less than {@code MAX_KEY_LENGTH}.
1988     * @param { AsyncCallback<Array<[string, number]>> } callback - {Array<[string, number]>}:
1989     * the list of backup file and it's corresponding delete result which 0 means delete success
1990     * and otherwise failed.
1991     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1992     * <br>2.Parameter verification failed.
1993     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1994     * @since 9
1995     */
1996    deleteBackup(files: Array<string>, callback: AsyncCallback<Array<[string, number]>>): void;
1997
1998    /**
1999     * Delete database backup files based on the specified filenames.
2000     *
2001     * @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and
2002     * The length must be less than {@code MAX_KEY_LENGTH}.
2003     * @returns { Promise<Array<[string, number]>> } {Array<[string, number]>}: the list of backup
2004     * file and it's corresponding delete result which 0 means delete success and otherwise failed.
2005     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2006     * <br>2.Parameter verification failed.
2007     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2008     * @since 9
2009     */
2010    deleteBackup(files: Array<string>): Promise<Array<[string, number]>>;
2011
2012    /**
2013     * Starts a transaction operation in the {@code SingleKVStore} database.
2014     * <p>After the database transaction is started, you can submit or roll back the operation.
2015     *
2016     * @param { AsyncCallback<void> } callback - the callback of startTransaction.
2017     * @throws { BusinessError } 15100005 - Database or result set already closed.
2018     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2019     * @since 9
2020     */
2021    /**
2022     * Starts a transaction operation in the {@code SingleKVStore} database.
2023     * <p>After the database transaction is started, you can submit or roll back the operation.
2024     *
2025     * @param { AsyncCallback<void> } callback - the callback of startTransaction.
2026     * @throws { BusinessError } 15100005 - Database or result set already closed.
2027     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
2028     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2029     * @since 10
2030     */
2031    startTransaction(callback: AsyncCallback<void>): void;
2032
2033    /**
2034     * Starts a transaction operation in the {@code SingleKVStore} database.
2035     * <p>After the database transaction is started, you can submit or roll back the operation.
2036     *
2037     * @returns { Promise<void> } the promise returned by the function.
2038     * @throws { BusinessError } 15100005 - Database or result set already closed.
2039     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2040     * @since 9
2041     */
2042    /**
2043     * Starts a transaction operation in the {@code SingleKVStore} database.
2044     * <p>After the database transaction is started, you can submit or roll back the operation.
2045     *
2046     * @returns { Promise<void> } the promise returned by the function.
2047     * @throws { BusinessError } 15100005 - Database or result set already closed.
2048     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
2049     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2050     * @since 10
2051     */
2052    startTransaction(): Promise<void>;
2053
2054    /**
2055     * Submits a transaction operation in the {@code SingleKVStore} database.
2056     *
2057     * @param { AsyncCallback<void> } callback - the callback of commit.
2058     * @throws { BusinessError } 15100005 - Database or result set already closed.
2059     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2060     * @since 9
2061     */
2062    commit(callback: AsyncCallback<void>): void;
2063
2064    /**
2065     * Submits a transaction operation in the {@code SingleKVStore} database.
2066     *
2067     * @returns { Promise<void> } the promise returned by the function.
2068     * @throws { BusinessError } 15100005 - Database or result set already closed.
2069     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2070     * @since 9
2071     */
2072    commit(): Promise<void>;
2073
2074    /**
2075     * Rolls back a transaction operation in the {@code SingleKVStore} database.
2076     *
2077     * @param { AsyncCallback<void> } callback - the callback of rollback.
2078     * @throws { BusinessError } 15100005 - Database or result set already closed.
2079     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2080     * @since 9
2081     */
2082    rollback(callback: AsyncCallback<void>): void;
2083
2084    /**
2085     * Rolls back a transaction operation in the {@code SingleKVStore} database.
2086     *
2087     * @returns { Promise<void> } the promise returned by the function.
2088     * @throws { BusinessError } 15100005 - Database or result set already closed.
2089     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2090     * @since 9
2091     */
2092    rollback(): Promise<void>;
2093
2094    /**
2095     * Sets whether to enable synchronization.
2096     *
2097     * @param { boolean } enabled - Specifies whether to enable synchronization. The value true
2098     * means to enable synchronization, and false means the opposite.
2099     * @param { AsyncCallback<void> } callback - the callback of enableSync.
2100     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2101     * <br>2.Incorrect parameters types.
2102     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2103     * @since 9
2104     */
2105    enableSync(enabled: boolean, callback: AsyncCallback<void>): void;
2106
2107    /**
2108     * Sets whether to enable synchronization.
2109     *
2110     * @param { boolean } enabled - Specifies whether to enable synchronization. The value true
2111     * means to enable synchronization, and false means the opposite.
2112     * @returns { Promise<void> } the promise returned by the function.
2113     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2114     * <br>2.Incorrect parameters types.
2115     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2116     * @since 9
2117     */
2118    enableSync(enabled: boolean): Promise<void>;
2119
2120    /**
2121     * Sets synchronization range labels.
2122     * <p>The labels determine the devices with which data will be synchronized.
2123     *
2124     * @param { string[] } localLabels - Indicates the synchronization labels of the local device.
2125     * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which
2126     * data will be synchronized.
2127     * @param { AsyncCallback<void> } callback - the callback of setSyncRange.
2128     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2129     * <br>2.Incorrect parameters types.
2130     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2131     * @since 9
2132     */
2133    setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback<void>): void;
2134
2135    /**
2136     * Sets synchronization range labels.
2137     * <p>The labels determine the devices with which data will be synchronized.
2138     *
2139     * @param { string[] } localLabels - Indicates the synchronization labels of the local device.
2140     * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which
2141     * data will be synchronized.
2142     * @returns { Promise<void> } the promise returned by the function.
2143     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2144     * <br>2.Incorrect parameters types.
2145     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2146     * @since 9
2147     */
2148    setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>;
2149
2150    /**
2151     * Sets the default delay allowed for database synchronization
2152     *
2153     * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the
2154     * database synchronization, in milliseconds.
2155     * @param { AsyncCallback<void> } callback - the callback of setSyncParam.
2156     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2157     * <br>2.Incorrect parameters types.
2158     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2159     * @since 9
2160     */
2161    setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void;
2162
2163    /**
2164     * Sets the default delay allowed for database synchronization
2165     *
2166     * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the
2167     * database synchronization, in milliseconds.
2168     * @returns { Promise<void> } the promise returned by the function.
2169     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2170     * <br>2.Incorrect parameters types.
2171     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2172     * @since 9
2173     */
2174    setSyncParam(defaultAllowedDelayMs: number): Promise<void>;
2175
2176    /**
2177     * Synchronize the database to the specified devices with the specified delay allowed.
2178     *
2179     * @permission ohos.permission.DISTRIBUTED_DATASYNC
2180     * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database.
2181     * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH},
2182     * {@code PULL}, or {@code PUSH_PULL}.
2183     * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds.
2184     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2185     * <br>2.Incorrect parameters types.
2186     * @throws { BusinessError } 15100003 - Database corrupted.
2187     * @throws { BusinessError } 15100004 - Not found.
2188     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2189     * @since 9
2190     */
2191    sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void;
2192
2193    /**
2194     * Synchronize the database to the specified devices with the specified delay allowed.
2195     *
2196     * @permission ohos.permission.DISTRIBUTED_DATASYNC
2197     * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database.
2198     * @param { Query } query - Indicates the {@code Query} object.
2199     * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH},
2200     * {@code PULL}, or {@code PUSH_PULL}.
2201     * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds.
2202     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2203     * <br>2.Incorrect parameters types.
2204     * @throws { BusinessError } 15100003 - Database corrupted.
2205     * @throws { BusinessError } 15100004 - Not found.
2206     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2207     * @since 9
2208     */
2209    sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void;
2210
2211    /**
2212     * Register a callback to the database and when data in the distributed database has changed,
2213     * the callback will be invoked.
2214     *
2215     * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event.
2216     * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}.
2217     * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
2218     * object indicates the data change events in the distributed database.
2219     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2220     * <br>2.Incorrect parameters types.
2221     * @throws { BusinessError } 15100001 - Over max limits.
2222     * @throws { BusinessError } 15100005 - Database or result set already closed.
2223     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2224     * @since 9
2225     */
2226    /**
2227     * Register a callback to the database and when data in the distributed database has changed,
2228     * the callback will be invoked.
2229     *
2230     * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event.
2231     * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}.
2232     * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
2233     * object indicates the data change events in the distributed database.
2234     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2235     * <br>2.Incorrect parameters types.
2236     * @throws { BusinessError } 15100001 - Over max limits.
2237     * @throws { BusinessError } 15100005 - Database or result set already closed.
2238     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2239     * @since 10
2240     */
2241    on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void;
2242
2243    /**
2244     * Register a databases synchronization callback to the database.
2245     * <p> Sync result is returned through asynchronous callback.
2246     *
2247     * @param { 'syncComplete' } event - Subscribed event name, fixed as 'syncComplete', indicates the synchronization
2248     * completion event.
2249     * @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the
2250     * deviceId and it's corresponding synchronization result which 0 means synchronization success
2251     * and otherwise failed.
2252     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2253     * <br>2.Incorrect parameters types.
2254     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2255     * @since 9
2256     */
2257    on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void;
2258
2259    /**
2260     * Unsubscribe from the SingleKVStore database based on the specified subscribeType and listener.
2261     *
2262     * @param { 'dataChange' } event - The unsubscribe event name, fixed as 'dataChange', indicates the data change
2263     * event.
2264     * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
2265     * object indicates the data change events in the distributed database.
2266     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2267     * <br>2.Incorrect parameters types.
2268     * @throws { BusinessError } 15100005 - Database or result set already closed.
2269     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2270     * @since 9
2271     */
2272    off(event: 'dataChange', listener?: Callback<ChangeNotification>): void;
2273
2274    /**
2275     * Unregister the database synchronization callback.
2276     *
2277     * @param { 'syncComplete' } event - The unsubscribe event name, fixed as 'syncComplete', indicates the
2278     * synchronization completion event.
2279     * @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the
2280     * deviceId and it's corresponding synchronization result which 0 means synchronization success
2281     * and otherwise failed.
2282     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2283     * <br>2.Incorrect parameters types.
2284     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2285     * @since 9
2286     */
2287    off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>>): void;
2288
2289    /**
2290     * Get the security level of the database.
2291     *
2292     * @param { AsyncCallback<SecurityLevel> } callback - {SecurityLevel}: the {@code SecurityLevel}
2293     * object indicates the security level of the database.
2294     * @throws { BusinessError } 15100005 - Database or result set already closed.
2295     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2296     * @since 9
2297     */
2298    getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void;
2299
2300    /**
2301     * Get the security level of the database.
2302     *
2303     * @returns { Promise<SecurityLevel> } {SecurityLevel}: the {@code SecurityLevel} object indicates
2304     * the security level of the database.
2305     * @throws { BusinessError } 15100005 - Database or result set already closed.
2306     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2307     * @since 9
2308     */
2309    getSecurityLevel(): Promise<SecurityLevel>;
2310  }
2311
2312  /**
2313   * Provides methods related to device-collaboration distributed databases.
2314   * <p>To create a {@code DeviceKVStore} database, you can use the
2315   * {@link data.distributed.common.KVManager.getKVStore(Options, String)}
2316   * method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options.
2317   * This database manages distributed
2318   * data by device, and cannot modify data synchronized from remote devices. When an application writes a
2319   * key-value pair entry
2320   * into the database, the system automatically adds the ID of the device running the application to the key.
2321   *
2322   * @extends SingleKVStore
2323   * @typedef DeviceKVStore
2324   * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2325   * @since 9
2326   */
2327  interface DeviceKVStore extends SingleKVStore {
2328    /**
2329     * Obtains the value matching the local device ID and specified key.
2330     *
2331     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
2332     * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
2333     * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key.
2334     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2335     * <br>2.Incorrect parameters types;
2336     * <br>3.Parameter verification failed.
2337     * @throws { BusinessError } 15100003 - Database corrupted.
2338     * @throws { BusinessError } 15100004 - Not found.
2339     * @throws { BusinessError } 15100005 - Database or result set already closed.
2340     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2341     * @since 9
2342     */
2343    get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
2344
2345    /**
2346     * Obtains the value matching the local device ID and specified key.
2347     *
2348     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
2349     * @returns { Promise<boolean | string | number | Uint8Array> }
2350     * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key.
2351     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2352     * <br>2.Incorrect parameters types;
2353     * <br>3.Parameter verification failed.
2354     * @throws { BusinessError } 15100003 - Database corrupted.
2355     * @throws { BusinessError } 15100004 - Not found.
2356     * @throws { BusinessError } 15100005 - Database or result set already closed.
2357     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2358     * @since 9
2359     */
2360    get(key: string): Promise<boolean | string | number | Uint8Array>;
2361
2362    /**
2363     * Obtains the value matching a specified device ID and key.
2364     *
2365     * @param { string } deviceId - Indicates the device to be queried.
2366     * @param { string } key - Indicates the key of the value to be queried. The length must be less than
2367     * {@code MAX_KEY_LENGTH}.
2368     * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
2369     * {boolean | string | number | Uint8Array}: the returned value specified by the deviceId and key.
2370     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2371     * <br>2.Incorrect parameters types;
2372     * <br>3.Parameter verification failed.
2373     * @throws { BusinessError } 15100003 - Database corrupted.
2374     * @throws { BusinessError } 15100004 - Not found.
2375     * @throws { BusinessError } 15100005 - Database or result set already closed.
2376     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2377     * @since 9
2378     */
2379    get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
2380
2381    /**
2382     * Obtains the value matching a specified device ID and key.
2383     *
2384     * @param { string } deviceId - Indicates the device to be queried.
2385     * @param { string } key - Indicates the key of the value to be queried. The length must be less than
2386     * {@code MAX_KEY_LENGTH}.
2387     * @returns { Promise<boolean | string | number | Uint8Array> }
2388     * {Uint8Array|string|boolean|number}: the returned value specified by the deviceId and key.
2389     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2390     * <br>2.Incorrect parameters types;
2391     * <br>3.Parameter verification failed.
2392     * @throws { BusinessError } 15100003 - Database corrupted.
2393     * @throws { BusinessError } 15100004 - Not found.
2394     * @throws { BusinessError } 15100005 - Database or result set already closed.
2395     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2396     * @since 9
2397     */
2398    get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array>;
2399
2400    /**
2401     * Obtains all key-value pairs that match the local device ID and specified key prefix.
2402     *
2403     * @param { string } keyPrefix - Indicates the key prefix to match.
2404     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2405     * that match the local device ID and specified key prefix.
2406     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2407     * <br>2.Incorrect parameters types.
2408     * @throws { BusinessError } 15100003 - Database corrupted.
2409     * @throws { BusinessError } 15100005 - Database or result set already closed.
2410     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2411     * @since 9
2412     */
2413    getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
2414
2415    /**
2416     * Obtains all key-value pairs that match the local device ID and specified key prefix.
2417     *
2418     * @param { string } keyPrefix - Indicates the key prefix to match.
2419     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
2420     * local device ID and specified key prefix.
2421     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2422     * <br>2.Incorrect parameters types.
2423     * @throws { BusinessError } 15100003 - Database corrupted.
2424     * @throws { BusinessError } 15100005 - Database or result set already closed.
2425     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2426     * @since 9
2427     */
2428    getEntries(keyPrefix: string): Promise<Entry[]>;
2429
2430    /**
2431     * Obtains all key-value pairs matching a specified device ID and key prefix.
2432     *
2433     * @param { string } deviceId - Identifies the device whose data is to be queried.
2434     * @param { string } keyPrefix - Indicates the key prefix to match.
2435     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2436     * that match the specified deviceId and key prefix.
2437     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2438     * <br>2.Incorrect parameters types.
2439     * @throws { BusinessError } 15100003 - Database corrupted.
2440     * @throws { BusinessError } 15100005 - Database or result set already closed.
2441     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2442     * @since 9
2443     */
2444    getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
2445
2446    /**
2447     * Obtains all key-value pairs matching a specified device ID and key prefix.
2448     *
2449     * @param { string } deviceId - Identifies the device whose data is to be queried.
2450     * @param { string } keyPrefix - Indicates the key prefix to match.
2451     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
2452     * specified deviceId and key prefix.
2453     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2454     * <br>2.Incorrect parameters types.
2455     * @throws { BusinessError } 15100003 - Database corrupted.
2456     * @throws { BusinessError } 15100005 - Database or result set already closed.
2457     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2458     * @since 9
2459     */
2460    getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>;
2461
2462    /**
2463     * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object.
2464     *
2465     * @param { Query } query - Indicates the {@code Query} object.
2466     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2467     * matching the local device ID and specified {@code Query} object.
2468     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2469     * <br>2.Incorrect parameters types.
2470     * @throws { BusinessError } 15100003 - Database corrupted.
2471     * @throws { BusinessError } 15100005 - Database or result set already closed.
2472     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2473     * @since 9
2474     */
2475    getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
2476
2477    /**
2478     * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object.
2479     *
2480     * @param { Query } query - Indicates the {@code Query} object.
2481     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the local device ID and
2482     * specified {@code Query} object.
2483     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2484     * <br>2.Incorrect parameters types.
2485     * @throws { BusinessError } 15100003 - Database corrupted.
2486     * @throws { BusinessError } 15100005 - Database or result set already closed.
2487     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2488     * @since 9
2489     */
2490    getEntries(query: Query): Promise<Entry[]>;
2491
2492    /**
2493     * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object.
2494     *
2495     * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong.
2496     * @param { Query } query - Indicates the {@code Query} object.
2497     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2498     * matching the specified deviceId and {@code Query} object.
2499     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2500     * <br>2.Incorrect parameters types.
2501     * @throws { BusinessError } 15100003 - Database corrupted.
2502     * @throws { BusinessError } 15100005 - Database or result set already closed.
2503     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2504     * @since 9
2505     */
2506    getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void;
2507
2508    /**
2509     * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object.
2510     *
2511     * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong.
2512     * @param { Query } query - Indicates the {@code Query} object.
2513     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the
2514     * specified deviceId and {@code Query} object.
2515     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2516     * <br>2.Incorrect parameters types.
2517     * @throws { BusinessError } 15100003 - Database corrupted.
2518     * @throws { BusinessError } 15100005 - Database or result set already closed.
2519     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2520     * @since 9
2521     */
2522    getEntries(deviceId: string, query: Query): Promise<Entry[]>;
2523
2524    /**
2525     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2526     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2527     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the
2528     * same time.
2529     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2530     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2531     *
2532     * @param { string } keyPrefix - Indicates the key prefix to match.
2533     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2534     * object matching the local device ID and specified keyPrefix.
2535     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2536     * <br>2.Incorrect parameters types.
2537     * @throws { BusinessError } 15100003 - Database corrupted.
2538     * @throws { BusinessError } 15100005 - Database or result set already closed.
2539     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2540     * @since 9
2541     */
2542    /**
2543     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2544     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2545     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the
2546     * same time.
2547     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2548     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2549     *
2550     * @param { string } keyPrefix - Indicates the key prefix to match.
2551     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2552     * object matching the local device ID and specified keyPrefix.
2553     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2554     * <br>2.Incorrect parameters types.
2555     * @throws { BusinessError } 15100001 - Over max limits.
2556     * @throws { BusinessError } 15100003 - Database corrupted.
2557     * @throws { BusinessError } 15100005 - Database or result set already closed.
2558     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2559     * @since 10
2560     */
2561    getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
2562
2563    /**
2564     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2565     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2566     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the
2567     * same time.
2568     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2569     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2570     *
2571     * @param { string } keyPrefix - Indicates the key prefix to match.
2572     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2573     * object matching the local device ID and specified keyPrefix.
2574     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2575     * <br>2.Incorrect parameters types.
2576     * @throws { BusinessError } 15100003 - Database corrupted.
2577     * @throws { BusinessError } 15100005 - Database or result set already closed.
2578     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2579     * @since 9
2580     */
2581    /**
2582     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2583     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2584     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the
2585     * same time.
2586     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2587     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2588     *
2589     * @param { string } keyPrefix - Indicates the key prefix to match.
2590     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2591     * object matching the local device ID and specified keyPrefix.
2592     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2593     * <br>2.Incorrect parameters types.
2594     * @throws { BusinessError } 15100001 - Over max limits.
2595     * @throws { BusinessError } 15100003 - Database corrupted.
2596     * @throws { BusinessError } 15100005 - Database or result set already closed.
2597     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2598     * @since 10
2599     */
2600    getResultSet(keyPrefix: string): Promise<KVStoreResultSet>;
2601
2602    /**
2603     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2604     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2605     * Each {@code DeviceKVStore}
2606     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four
2607     * objects,
2608     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close
2609     * unnecessary
2610     * {@code KVStoreResultSet} objects in a timely manner.
2611     *
2612     * @param { string } deviceId - Identifies the device whose data is to be queried.
2613     * @param { string } keyPrefix - Indicates the key prefix to match.
2614     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2615     * object matching the specified deviceId and keyPrefix.
2616     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2617     * <br>2.Incorrect parameters types.
2618     * @throws { BusinessError } 15100003 - Database corrupted.
2619     * @throws { BusinessError } 15100005 - Database or result set already closed.
2620     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2621     * @since 9
2622     */
2623    /**
2624     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2625     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2626     * Each {@code DeviceKVStore}
2627     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four
2628     * objects,
2629     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close
2630     * unnecessary
2631     * {@code KVStoreResultSet} objects in a timely manner.
2632     *
2633     * @param { string } deviceId - Identifies the device whose data is to be queried.
2634     * @param { string } keyPrefix - Indicates the key prefix to match.
2635     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2636     * object matching the specified deviceId and keyPrefix.
2637     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2638     * <br>2.Incorrect parameters types.
2639     * @throws { BusinessError } 15100001 - Over max limits.
2640     * @throws { BusinessError } 15100003 - Database corrupted.
2641     * @throws { BusinessError } 15100005 - Database or result set already closed.
2642     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2643     * @since 10
2644     */
2645    getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
2646
2647    /**
2648     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2649     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2650     * Each {@code DeviceKVStore}
2651     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four
2652     * objects,
2653     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close
2654     * unnecessary
2655     * {@code KVStoreResultSet} objects in a timely manner.
2656     *
2657     * @param { string } deviceId - Identifies the device whose data is to be queried.
2658     * @param { string } keyPrefix - Indicates the key prefix to match.
2659     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2660     * object matching the specified deviceId and keyPrefix.
2661     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2662     * <br>2.Incorrect parameters types.
2663     * @throws { BusinessError } 15100003 - Database corrupted.
2664     * @throws { BusinessError } 15100005 - Database or result set already closed.
2665     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2666     * @since 9
2667     */
2668    /**
2669     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2670     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2671     * Each {@code DeviceKVStore}
2672     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four
2673     * objects,
2674     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close
2675     * unnecessary
2676     * {@code KVStoreResultSet} objects in a timely manner.
2677     *
2678     * @param { string } deviceId - Identifies the device whose data is to be queried.
2679     * @param { string } keyPrefix - Indicates the key prefix to match.
2680     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2681     * object matching the specified deviceId and keyPrefix.
2682     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2683     * <br>2.Incorrect parameters types.
2684     * @throws { BusinessError } 15100001 - Over max limits.
2685     * @throws { BusinessError } 15100003 - Database corrupted.
2686     * @throws { BusinessError } 15100005 - Database or result set already closed.
2687     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2688     * @since 10
2689     */
2690    getResultSet(deviceId: string, keyPrefix: string): Promise<KVStoreResultSet>;
2691
2692    /**
2693     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2694     *
2695     * @param { Query } query - Indicates the {@code Query} object.
2696     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2697     * object matching the local device ID and specified {@code Query} object.
2698     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2699     * <br>2.Incorrect parameters types.
2700     * @throws { BusinessError } 15100003 - Database corrupted.
2701     * @throws { BusinessError } 15100005 - Database or result set already closed.
2702     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2703     * @since 9
2704     */
2705    /**
2706     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2707     *
2708     * @param { Query } query - Indicates the {@code Query} object.
2709     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2710     * object matching the local device ID and specified {@code Query} object.
2711     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2712     * <br>2.Incorrect parameters types.
2713     * @throws { BusinessError } 15100001 - Over max limits.
2714     * @throws { BusinessError } 15100003 - Database corrupted.
2715     * @throws { BusinessError } 15100005 - Database or result set already closed.
2716     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2717     * @since 10
2718     */
2719    getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
2720
2721    /**
2722     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2723     *
2724     * @param { Query } query - Indicates the {@code Query} object.
2725     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2726     * object matching the local device ID and specified {@code Query} object.
2727     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2728     * <br>2.Incorrect parameters types.
2729     * @throws { BusinessError } 15100003 - Database corrupted.
2730     * @throws { BusinessError } 15100005 - Database or result set already closed.
2731     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2732     * @since 9
2733     */
2734    /**
2735     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2736     *
2737     * @param { Query } query - Indicates the {@code Query} object.
2738     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2739     * object matching the local device ID and specified {@code Query} object.
2740     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2741     * <br>2.Incorrect parameters types.
2742     * @throws { BusinessError } 15100001 - Over max limits.
2743     * @throws { BusinessError } 15100003 - Database corrupted.
2744     * @throws { BusinessError } 15100005 - Database or result set already closed.
2745     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2746     * @since 10
2747     */
2748    getResultSet(query: Query): Promise<KVStoreResultSet>;
2749
2750    /**
2751     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2752     *
2753     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object
2754     * belongs.
2755     * @param { Query } query - Indicates the {@code Query} object.
2756     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2757     * object matching the specified deviceId and {@code Query} object.
2758     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2759     * <br>2.Incorrect parameters types.
2760     * @throws { BusinessError } 15100003 - Database corrupted.
2761     * @throws { BusinessError } 15100005 - Database or result set already closed.
2762     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2763     * @since 9
2764     */
2765    /**
2766     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2767     *
2768     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object
2769     * belongs.
2770     * @param { Query } query - Indicates the {@code Query} object.
2771     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2772     * object matching the specified deviceId and {@code Query} object.
2773     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2774     * <br>2.Incorrect parameters types.
2775     * @throws { BusinessError } 15100001 - Over max limits.
2776     * @throws { BusinessError } 15100003 - Database corrupted.
2777     * @throws { BusinessError } 15100005 - Database or result set already closed.
2778     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2779     * @since 10
2780     */
2781    getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
2782
2783    /**
2784     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2785     *
2786     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object
2787     * belongs.
2788     * @param { Query } query - Indicates the {@code Query} object.
2789     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2790     * object matching the specified deviceId and {@code Query} object.
2791     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2792     * <br>2.Incorrect parameters types.
2793     * @throws { BusinessError } 15100003 - Database corrupted.
2794     * @throws { BusinessError } 15100005 - Database or result set already closed.
2795     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2796     * @since 9
2797     */
2798    /**
2799     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2800     *
2801     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object
2802     * belongs.
2803     * @param { Query } query - Indicates the {@code Query} object.
2804     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2805     * object matching the specified deviceId and {@code Query} object.
2806     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2807     * <br>2.Incorrect parameters types.
2808     * @throws { BusinessError } 15100001 - Over max limits.
2809     * @throws { BusinessError } 15100003 - Database corrupted.
2810     * @throws { BusinessError } 15100005 - Database or result set already closed.
2811     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2812     * @since 10
2813     */
2814    getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet>;
2815
2816    /**
2817     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2818     *
2819     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2820     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2821     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2822     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2823     * <br>2.Incorrect parameters types.
2824     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2825     * uses system API.
2826     * @throws { BusinessError } 15100003 - Database corrupted.
2827     * @throws { BusinessError } 15100005 - Database or result set already closed.
2828     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2829     * @systemapi
2830     * @StageModelOnly
2831     * @since 9
2832     */
2833    /**
2834     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2835     *
2836     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2837     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2838     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2839     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2840     * <br>2.Incorrect parameters types.
2841     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2842     * uses system API.
2843     * @throws { BusinessError } 15100001 - Over max limits.
2844     * @throws { BusinessError } 15100003 - Database corrupted.
2845     * @throws { BusinessError } 15100005 - Database or result set already closed.
2846     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2847     * @systemapi
2848     * @StageModelOnly
2849     * @since 10
2850     */
2851    getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void;
2852
2853    /**
2854     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2855     *
2856     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2857     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2858     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2859     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2860     * <br>2.Incorrect parameters types.
2861     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2862     * uses system API.
2863     * @throws { BusinessError } 15100003 - Database corrupted.
2864     * @throws { BusinessError } 15100005 - Database or result set already closed.
2865     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2866     * @systemapi
2867     * @StageModelOnly
2868     * @since 9
2869     */
2870    /**
2871     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2872     *
2873     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2874     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2875     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2876     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2877     * <br>2.Incorrect parameters types.
2878     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2879     * uses system API.
2880     * @throws { BusinessError } 15100001 - Over max limits.
2881     * @throws { BusinessError } 15100003 - Database corrupted.
2882     * @throws { BusinessError } 15100005 - Database or result set already closed.
2883     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2884     * @systemapi
2885     * @StageModelOnly
2886     * @since 10
2887     */
2888    getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
2889
2890    /**
2891     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2892     *
2893     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2894     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2895     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2896     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2897     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2898     * <br>2.Incorrect parameters types.
2899     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2900     * uses system API.
2901     * @throws { BusinessError } 15100003 - Database corrupted.
2902     * @throws { BusinessError } 15100005 - Database or result set already closed.
2903     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2904     * @systemapi
2905     * @StageModelOnly
2906     * @since 9
2907     */
2908    /**
2909     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2910     *
2911     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2912     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2913     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2914     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2915     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2916     * <br>2.Incorrect parameters types.
2917     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2918     * uses system API.
2919     * @throws { BusinessError } 15100001 - Over max limits.
2920     * @throws { BusinessError } 15100003 - Database corrupted.
2921     * @throws { BusinessError } 15100005 - Database or result set already closed.
2922     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2923     * @systemapi
2924     * @StageModelOnly
2925     * @since 10
2926     */
2927    getResultSet(
2928      deviceId: string,
2929      predicates: dataSharePredicates.DataSharePredicates,
2930      callback: AsyncCallback<KVStoreResultSet>
2931    ): void;
2932
2933    /**
2934     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2935     *
2936     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2937     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2938     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2939     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2940     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2941     * <br>2.Incorrect parameters types.
2942     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2943     * uses system API.
2944     * @throws { BusinessError } 15100003 - Database corrupted.
2945     * @throws { BusinessError } 15100005 - Database or result set already closed.
2946     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2947     * @systemapi
2948     * @StageModelOnly
2949     * @since 9
2950     */
2951    /**
2952     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2953     *
2954     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2955     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2956     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2957     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2958     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2959     * <br>2.Incorrect parameters types.
2960     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application
2961     * uses system API.
2962     * @throws { BusinessError } 15100001 - Over max limits.
2963     * @throws { BusinessError } 15100003 - Database corrupted.
2964     * @throws { BusinessError } 15100005 - Database or result set already closed.
2965     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2966     * @systemapi
2967     * @StageModelOnly
2968     * @since 10
2969     */
2970    getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
2971
2972    /**
2973     * Obtains the number of results matching the local device ID and specified {@code Query} object.
2974     *
2975     * @param { Query } query - Indicates the {@code Query} object.
2976     * @param { AsyncCallback<number> } callback - {number}: the number of results matching the
2977     * local device ID and specified {@code Query} object.
2978     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2979     * <br>2.Incorrect parameters types.
2980     * @throws { BusinessError } 15100003 - Database corrupted.
2981     * @throws { BusinessError } 15100005 - Database or result set already closed.
2982     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2983     * @since 9
2984     */
2985    getResultSize(query: Query, callback: AsyncCallback<number>): void;
2986
2987    /**
2988     * Obtains the number of results matching the local device ID and specified {@code Query} object.
2989     *
2990     * @param { Query } query - Indicates the {@code Query} object.
2991     * @returns { Promise<number> } {number}: the number of results matching the local device ID and specified
2992     * {@code Query} object.
2993     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2994     * <br>2.Incorrect parameters types.
2995     * @throws { BusinessError } 15100003 - Database corrupted.
2996     * @throws { BusinessError } 15100005 - Database or result set already closed.
2997     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2998     * @since 9
2999     */
3000    getResultSize(query: Query): Promise<number>;
3001
3002    /**
3003     * Obtains the number of results matching a specified device ID and {@code Query} object.
3004     *
3005     * @param { string } deviceId - Indicates the ID of the device to which the results belong.
3006     * @param { Query } query - Indicates the {@code Query} object.
3007     * @param { AsyncCallback<number> } callback - {number}: the number of results matching the
3008     * specified deviceId and {@code Query} object.
3009     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3010     * <br>2.Incorrect parameters types.
3011     * @throws { BusinessError } 15100003 - Database corrupted.
3012     * @throws { BusinessError } 15100004 - Not found.
3013     * @throws { BusinessError } 15100005 - Database or result set already closed.
3014     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
3015     * @since 9
3016     */
3017    getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void;
3018
3019    /**
3020     * Obtains the number of results matching a specified device ID and {@code Query} object.
3021     *
3022     * @param { string } deviceId - Indicates the ID of the device to which the results belong.
3023     * @param { Query } query - Indicates the {@code Query} object.
3024     * @returns { Promise<number> } {number}: the number of results matching the specified
3025     * deviceId and {@code Query} object.
3026     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3027     * <br>2.Incorrect parameters types.
3028     * @throws { BusinessError } 15100003 - Database corrupted.
3029     * @throws { BusinessError } 15100004 - Not found.
3030     * @throws { BusinessError } 15100005 - Database or result set already closed.
3031     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
3032     * @since 9
3033     */
3034    getResultSize(deviceId: string, query: Query): Promise<number>;
3035  }
3036
3037  /**
3038   * Creates a {@link KVManager} instance based on the configuration information.
3039   * <p>You must pass {@link KVManagerConfig} to provide configuration information
3040   * to create a {@link KVManager} instance.
3041   *
3042   * @param { KVManagerConfig } config - Indicates the KVStore configuration information,
3043   * including the package name and context, and package name can not be empty.
3044   * @returns { KVManager } : the {@code KVManager} instance.
3045   * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3046   * <br>2.Incorrect parameters types;
3047   * <br>3.Parameter verification failed.
3048   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3049   * @since 9
3050   */
3051  function createKVManager(config: KVManagerConfig): KVManager;
3052
3053  /**
3054   * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the
3055   * {@code SingleKVStore}.
3056   *
3057   * @interface KVManager
3058   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3059   * @since 9
3060   */
3061  interface KVManager {
3062    /**
3063     * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}.
3064     *
3065     * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique
3066     * for the same application, and different applications can share the same value. The storeId can consist
3067     * of only letters, digits, and underscores (_), and cannot exceed 128 characters.
3068     * @param { Options } options - Indicates the {@code Options} object used for creating and
3069     * obtaining the KVStore database.
3070     * @param { AsyncCallback<T> } callback - {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance.
3071     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3072     * <br>2.Incorrect parameters types;
3073     * <br>3.Parameter verification failed.
3074     * @throws { BusinessError } 15100002 - Open existed database with changed options.
3075     * @throws { BusinessError } 15100003 - Database corrupted.
3076     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3077     * @since 9
3078     */
3079    getKVStore<T>(storeId: string, options: Options, callback: AsyncCallback<T>): void;
3080
3081    /**
3082     * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}.
3083     *
3084     * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique
3085     * for the same application, and different applications can share the same value. The storeId can consist
3086     * of only letters, digits, and underscores (_), and cannot exceed 128 characters.
3087     * @param { Options } options - Indicates the {@code Options} object used for creating and
3088     * obtaining the KVStore database.
3089     * @returns { Promise<T> } {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance.
3090     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3091     * <br>2.Incorrect parameters types;
3092     * <br>3.Parameter verification failed.
3093     * @throws { BusinessError } 15100002 - Open existed database with changed options.
3094     * @throws { BusinessError } 15100003 - Database corrupted.
3095     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3096     * @since 9
3097     */
3098    getKVStore<T>(storeId: string, options: Options): Promise<T>;
3099
3100    /**
3101     * Closes the KVStore database.
3102     * <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running,
3103     * your thread may crash.
3104     * <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using
3105     * this method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore,
3106     * otherwise closing the database will fail.
3107     *
3108     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256
3109     * characters.
3110     * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters,
3111     * digits, and underscores (_), and cannot exceed 128 characters.
3112     * @param { AsyncCallback<void> } callback - the callback of closeKVStore.
3113     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3114     * <br>2.Parameter verification failed.
3115     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3116     * @since 9
3117     */
3118    closeKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void;
3119
3120    /**
3121     * Closes the KVStore database.
3122     * <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running,
3123     * your thread may crash.
3124     * <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using
3125     * this method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore,
3126     * otherwise closing the database will fail.
3127     *
3128     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256
3129     * characters.
3130     * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters,
3131     * digits, and underscores (_), and cannot exceed 128 characters.
3132     * @returns { Promise<void> } the promise returned by the function.
3133     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3134     * <br>2.Parameter verification failed.
3135     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3136     * @since 9
3137     */
3138    closeKVStore(appId: string, storeId: string): Promise<void>;
3139
3140    /**
3141     * Deletes the KVStore database identified by storeId.
3142     * <p>Before using this method, close all KVStore instances in use that are identified by the same storeId.
3143     * <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data
3144     * will be lost.
3145     *
3146     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256
3147     * characters.
3148     * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters,
3149     * digits, and underscores (_), and cannot exceed 128 characters.
3150     * @param { AsyncCallback<void> } callback - the callback of deleteKVStore.
3151     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3152     * <br>2.Parameter verification failed.
3153     * @throws { BusinessError } 15100004 - Not found.
3154     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3155     * @since 9
3156     */
3157    deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void;
3158
3159    /**
3160     * Deletes the KVStore database identified by storeId.
3161     * <p>Before using this method, close all KVStore instances in use that are identified by the same storeId.
3162     * <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data
3163     * will be lost.
3164     *
3165     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256
3166     * characters.
3167     * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters,
3168     * digits, and underscores (_), and cannot exceed 128 characters.
3169     * @returns { Promise<void> } the promise returned by the function.
3170     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3171     * <br>2.Parameter verification failed.
3172     * @throws { BusinessError } 15100004 - Not found.
3173     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3174     * @since 9
3175     */
3176    deleteKVStore(appId: string, storeId: string): Promise<void>;
3177
3178    /**
3179     * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not
3180     * deleted by calling the {@code deleteKVStore} method.
3181     *
3182     * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256
3183     * characters.
3184     * @param { AsyncCallback<string[]> } callback - {string[]}: the storeId of all created KVStore databases.
3185     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3186     * <br>2.Parameter verification failed.
3187     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3188     * @since 9
3189     */
3190    getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void;
3191
3192    /**
3193     * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not
3194     * deleted by calling the {@code deleteKVStore} method.
3195     *
3196     * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256
3197     * characters.
3198     * @returns { Promise<string[]> } {string[]}: the storeId of all created KVStore databases.
3199     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3200     * <br>2.Parameter verification failed.
3201     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3202     * @since 9
3203     */
3204    getAllKVStoreId(appId: string): Promise<string[]>;
3205
3206    /**
3207     * Register a death callback to get notification when the data manager service is terminated.
3208     * <p>If the data manager service is terminated,you need to re-subscribe to data change notifications and
3209     * synchronization completion notifications, and calling the sync method will return a failure.
3210     *
3211     * @param { 'distributedDataServiceDie' } event - Subscribed event name, fixed as 'distributedDataServiceDie',
3212     * as a service status change events.
3213     * @param { Callback<void> } deathCallback - callback to be invoked when the data manager service is terminated.
3214     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3215     * <br>2.Incorrect parameters types;
3216     * <br>3.Parameter verification failed.
3217     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
3218     * @since 9
3219     */
3220    on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void;
3221
3222    /**
3223     * Unregister the death callback. Not notification will be received when the data manager service is terminated.
3224     * <p>The unregistered death callback must be a registered death callback of the database. If no death callback
3225     * parameter is passed, all database death callbacks will be unregistered.
3226     *
3227     * @param { 'distributedDataServiceDie' } event - Unsubscribe event name, fixed as 'distributedDataServiceDie',
3228     * as a service status change events.
3229     * @param { Callback<void> } deathCallback - the data manager service is terminated callback which has been
3230     * registered.
3231     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3232     * <br>2.Incorrect parameters types;
3233     * <br>3.Parameter verification failed.
3234     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
3235     * @since 9
3236     */
3237    off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void;
3238  }
3239}
3240
3241export default distributedKVStore;