• 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} and false otherwise.
590     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
591     * <br>2.Incorrect parameters types.
592     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
593     * @since 9
594     */
595    appendChild(child: FieldNode): boolean;
596
597    /**
598     * Indicates the default value of field node.
599     *
600     * @type { string }
601     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
602     * @since 9
603     */
604    default: string;
605
606    /**
607     * Indicates the nullable of database field.
608     *
609     * @type { boolean }
610     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
611     * @since 9
612     */
613    nullable: boolean;
614
615    /**
616     * Indicates the type of value.
617     *
618     * @type { number }
619     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
620     * @since 9
621     */
622    type: number;
623  }
624
625  /**
626   * Provides methods to operate the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database.
627   * <p>The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or
628   * {@code DeviceKVStore} class. This interface also provides methods to move the data read
629   * position in the result set.
630   *
631   * @interface KVStoreResultSet
632   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
633   * @since 9
634   */
635  interface KVStoreResultSet {
636    /**
637     * Obtains the number of lines in a result set.
638     *
639     * @returns { number } Returns the number of lines.
640     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
641     * @since 9
642     */
643    getCount(): number;
644
645    /**
646     * Obtains the current read position in a result set.
647     *
648     * @returns { number } Returns the current read position. The read position starts with 0.
649     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
650     * @since 9
651     */
652    getPosition(): number;
653
654    /**
655     * Moves the read position to the first line.
656     * <p>If the result set is empty, false is returned.
657     *
658     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
659     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
660     * @since 9
661     */
662    moveToFirst(): boolean;
663
664    /**
665     * Moves the read position to the last line.
666     * <p>If the result set is empty, false is returned.
667     *
668     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
669     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
670     * @since 9
671     */
672    moveToLast(): boolean;
673
674    /**
675     * Moves the read position to the next line.
676     * <p>If the result set is empty or the data in the last line is being read, false is returned.
677     *
678     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
679     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
680     * @since 9
681     */
682    moveToNext(): boolean;
683
684    /**
685     * Moves the read position to the previous line.
686     * <p>If the result set is empty or the data in the first line is being read, false is returned.
687     *
688     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
689     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
690     * @since 9
691     */
692    moveToPrevious(): boolean;
693
694    /**
695     * Moves the read position by a relative offset to the current position.
696     *
697     * @param { number } offset - Indicates the relative offset to the current position. A negative offset indicates moving
698     * backwards, and a positive offset indicates moving forwards. For example, if the current position is entry 1 and
699     * this offset is 2, the destination position will be entry 3; if the current position is entry 3 and this offset is -2,
700     * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the
701     * final position is invalid, false will be returned.
702     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
703     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
704     * <br>2.Incorrect parameters types.
705     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
706     * @since 9
707     */
708    move(offset: number): boolean;
709
710    /**
711     * Moves the read position from 0 to an absolute position.
712     *
713     * @param { number } position - Indicates the absolute position.
714     * @returns { boolean } Returns true if the operation succeeds; return false otherwise.
715     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
716     * <br>2.Incorrect parameters types.
717     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
718     * @since 9
719     */
720    moveToPosition(position: number): boolean;
721
722    /**
723     * Checks whether the read position is the first line.
724     *
725     * @returns { boolean } Returns true if the read position is the first line; returns false otherwise.
726     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
727     * @since 9
728     */
729    isFirst(): boolean;
730
731    /**
732     * Checks whether the read position is the last line.
733     *
734     * @returns { boolean } Returns true if the read position is the last line; returns false otherwise.
735     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
736     * @since 9
737     */
738    isLast(): boolean;
739
740    /**
741     * Checks whether the read position is before the last line.
742     *
743     * @returns { boolean } Returns true if the read position is before the first line; returns false otherwise.
744     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
745     * @since 9
746     */
747    isBeforeFirst(): boolean;
748
749    /**
750     * Checks whether the read position is after the last line.
751     *
752     * @returns { boolean } Returns true if the read position is after the last line; returns false otherwise.
753     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
754     * @since 9
755     */
756    isAfterLast(): boolean;
757
758    /**
759     * Obtains a key-value pair.
760     *
761     * @returns { Entry } Returns a key-value pair.
762     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
763     * @since 9
764     */
765    getEntry(): Entry;
766  }
767
768  /**
769   * Represents a database query using predicates.
770   * <p>This class provides a constructor used to create a {@code Query} instance, which is used to query data
771   * matching specified conditions in the database.
772   * <p>This class also provides methods to add predicates to the {@code Query} instance.
773   *
774   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
775   * @since 9
776   */
777  class Query {
778    /**
779     * A constructor used to create a Query instance.
780     *
781     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
782     * @since 9
783     */
784    constructor();
785
786    /**
787     * Resets this {@code Query} object.
788     *
789     * @returns { Query } Returns the reset {@code Query} object.
790     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
791     * @since 9
792     */
793    reset(): Query;
794
795    /**
796     * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value.
797     *
798     * @param { string } field - Indicates the field, which cannot contain ^.
799     * @param { number | string | boolean } value - Indicates the value to be compared.
800     * @returns { Query } Returns the {@coed Query} object.
801     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
802     * <br>2.Incorrect parameters types;
803     * <br>3.Parameter verification failed.
804     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
805     * @since 9
806     */
807    equalTo(field: string, value: number | string | boolean): Query;
808
809    /**
810     * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value.
811     *
812     * @param { string } field - Indicates the field, which cannot contain ^.
813     * @param { number | string | boolean } value - Indicates the value to be compared.
814     * @returns { Query } Returns the {@coed Query} object.
815     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
816     * <br>2.Incorrect parameters types;
817     * <br>3.Parameter verification failed.
818     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
819     * @since 9
820     */
821    notEqualTo(field: string, value: number | string | boolean): Query;
822
823    /**
824     * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the
825     * specified int value.
826     *
827     * @param { string } field - Indicates the field, which cannot contain ^.
828     * @param { number | string | boolean } value - Indicates the value to be compared.
829     * @returns { Query } Returns the {@coed Query} object.
830     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
831     * <br>2.Incorrect parameters types;
832     * <br>3.Parameter verification failed.
833     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
834     * @since 9
835     */
836    greaterThan(field: string, value: number | string | boolean): Query;
837
838    /**
839     * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value.
840     *
841     * @param { string } field - Indicates the field, which cannot contain ^.
842     * @param { number | string } value - Indicates the value to be compared.
843     * @returns { Query } Returns the {@coed Query} object.
844     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
845     * <br>2.Incorrect parameters types;
846     * <br>3.Parameter verification failed.
847     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
848     * @since 9
849     */
850    lessThan(field: string, value: number | string): Query;
851
852    /**
853     * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or
854     * equal to the specified int value.
855     *
856     * @param { string } field - Indicates the field, which cannot contain ^.
857     * @param { number | string } value - Indicates the value to be compared.
858     * @returns { Query } Returns the {@coed Query} object.
859     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
860     * <br>2.Incorrect parameters types;
861     * <br>3.Parameter verification failed.
862     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
863     * @since 9
864     */
865    greaterThanOrEqualTo(field: string, value: number | string): Query;
866
867    /**
868     * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the
869     * specified int value.
870     *
871     * @param { string } field - Indicates the field, which cannot contain ^.
872     * @param { number | string } value - Indicates the value to be compared.
873     * @returns { Query } Returns the {@coed Query} object.
874     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
875     * <br>2.Incorrect parameters types;
876     * <br>3.Parameter verification failed.
877     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
878     * @since 9
879     */
880    lessThanOrEqualTo(field: string, value: number | string): Query;
881
882    /**
883     * Constructs a {@code Query} object to query entries with the specified field whose value is null.
884     *
885     * @param { string } field - Indicates the field, which cannot contain ^.
886     * @returns { Query } Returns the {@coed Query} object.
887     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
888     * <br>2.Incorrect parameters types;
889     * <br>3.Parameter verification failed.
890     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
891     * @since 9
892     */
893    isNull(field: string): Query;
894
895    /**
896     * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list.
897     *
898     * @param { string } field - Indicates the field, which cannot contain ^.
899     * @param { number[] } valueList - Indicates the int value list.
900     * @returns { Query } Returns the {@coed Query} object.
901     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
902     * <br>2.Incorrect parameters types;
903     * <br>3.Parameter verification failed.
904     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
905     * @since 9
906     */
907    inNumber(field: string, valueList: number[]): Query;
908
909    /**
910     * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list.
911     *
912     * @param { string } field - Indicates the field, which cannot contain ^.
913     * @param { string[] } valueList - Indicates the string value list.
914     * @returns { Query } Returns the {@coed Query} object.
915     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
916     * <br>2.Incorrect parameters types;
917     * <br>3.Parameter verification failed.
918     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
919     * @since 9
920     */
921    inString(field: string, valueList: string[]): Query;
922
923    /**
924     * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list.
925     *
926     * @param { string } field - Indicates the field, which cannot contain ^.
927     * @param { number[] } valueList - Indicates the int value list.
928     * @returns { Query } Returns the {@coed Query} object.
929     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
930     * <br>2.Incorrect parameters types;
931     * <br>3.Parameter verification failed.
932     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
933     * @since 9
934     */
935    notInNumber(field: string, valueList: number[]): Query;
936
937    /**
938     * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list.
939     *
940     * @param { string } field - Indicates the field, which cannot contain ^.
941     * @param { string[] } valueList - Indicates the string value list.
942     * @returns { Query } Returns the {@coed Query} object.
943     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
944     * <br>2.Incorrect parameters types;
945     * <br>3.Parameter verification failed.
946     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
947     * @since 9
948     */
949    notInString(field: string, valueList: string[]): Query;
950
951    /**
952     * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value.
953     *
954     * @param { string } field - Indicates the field, which cannot contain ^.
955     * @param { string } value - Indicates the string value.
956     * @returns { Query } Returns the {@coed Query} object.
957     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
958     * <br>2.Incorrect parameters types;
959     * <br>3.Parameter verification failed.
960     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
961     * @since 9
962     */
963    like(field: string, value: string): Query;
964
965    /**
966     * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value.
967     *
968     * @param { string } field - Indicates the field, which cannot contain ^.
969     * @param { string } value - Indicates the string value.
970     * @returns { Query } Returns the {@coed Query} object.
971     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
972     * <br>2.Incorrect parameters types;
973     * <br>3.Parameter verification failed.
974     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
975     * @since 9
976     */
977    unlike(field: string, value: string): Query;
978
979    /**
980     * Constructs a {@code Query} object with the and condition.
981     * <p>Multiple predicates should be connected using the and or or condition.
982     *
983     * @returns { Query } Returns the {@coed Query} object.
984     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
985     * @since 9
986     */
987    and(): Query;
988
989    /**
990     * Constructs a {@code Query} object with the or 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    or(): Query;
998
999    /**
1000     * Constructs a {@code Query} object to sort the query results in ascending order.
1001     *
1002     * @param { string } field - Indicates the field, which cannot contain ^.
1003     * @returns { Query } Returns the {@coed Query} object.
1004     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1005     * <br>2.Incorrect parameters types;
1006     * <br>3.Parameter verification failed.
1007     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1008     * @since 9
1009     */
1010    orderByAsc(field: string): Query;
1011
1012    /**
1013     * Constructs a {@code Query} object to sort the query results in descending order.
1014     *
1015     * @param { string } field - Indicates the field, which cannot contain ^.
1016     * @returns { Query } Returns the {@coed Query} object.
1017     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1018     * <br>2.Incorrect parameters types;
1019     * <br>3.Parameter verification failed.
1020     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1021     * @since 9
1022     */
1023    orderByDesc(field: string): Query;
1024
1025    /**
1026     * Constructs a {@code Query} object to specify the number of results and the start position.
1027     *
1028     * @param { number } total - Indicates the number of results.
1029     * @param { number } offset - Indicates the start position.
1030     * @returns { Query } Returns the {@coed Query} object.
1031     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1032     * <br>2.Incorrect parameters types.
1033     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1034     * @since 9
1035     */
1036    limit(total: number, offset: number): Query;
1037
1038    /**
1039     * Creates a {@code Query} condition with a specified field that is not null.
1040     *
1041     * @param { string } field - Indicates the specified field.
1042     * @returns { Query } Returns the {@coed Query} object.
1043     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1044     * <br>2.Incorrect parameters types.
1045     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1046     * @since 9
1047     */
1048    isNotNull(field: string): Query;
1049
1050    /**
1051     * Creates a query condition group with a left bracket.
1052     * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a
1053     * whole to combine with other query conditions.
1054     *
1055     * @returns { Query } Returns the {@coed Query} object.
1056     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1057     * @since 9
1058     */
1059    beginGroup(): Query;
1060
1061    /**
1062     * Creates a query condition group with a right bracket.
1063     * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a
1064     * whole to combine with other query conditions.
1065     *
1066     * @returns { Query } Returns the {@coed Query} object.
1067     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1068     * @since 9
1069     */
1070    endGroup(): Query;
1071
1072    /**
1073     * Creates a query condition with a specified key prefix.
1074     *
1075     * @param { string } prefix - Indicates the specified key prefix.
1076     * @returns { Query } Returns the {@coed Query} object.
1077     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1078     * <br>2.Incorrect parameters types.
1079     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1080     * @since 9
1081     */
1082    prefixKey(prefix: string): Query;
1083
1084    /**
1085     * Sets a specified index that will be preferentially used for query.
1086     *
1087     * @param { string } index - Indicates the index to set.
1088     * @returns { Query } Returns the {@coed Query} object.
1089     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1090     * <br>2.Incorrect parameters types.
1091     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1092     * @since 9
1093     */
1094    setSuggestIndex(index: string): Query;
1095
1096    /**
1097     * Add device ID key prefix.Used by {@code DeviceKVStore}.
1098     *
1099     * @param { string } deviceId - Specify device id to query from, It can not be empty.
1100     * @returns { Query } Returns the {@code Query} object with device ID prefix added.
1101     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1102     * <br>2.Incorrect parameters types;
1103     * <br>3.Parameter verification failed.
1104     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1105     * @since 9
1106     */
1107    deviceId(deviceId: string): Query;
1108
1109    /**
1110     * Get a String that represents this {@code Query}.
1111     * <p>The String would be parsed to DB query format.
1112     * The String length should be no longer than 500kb.
1113     *
1114     * @returns { string } String representing this {@code Query}.
1115     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1116     * @since 9
1117     */
1118    getSqlLike(): string;
1119  }
1120
1121  /**
1122   * Provides methods related to single-version distributed databases.
1123   * <p>To create a {@code SingleKVStore} database,
1124   * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method
1125   * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}.
1126   * This database synchronizes data to other databases in time sequence.
1127   * The {@code SingleKVStore} database does not support
1128   * synchronous transactions, or data search using snapshots.
1129   *
1130   * @interface SingleKVStore
1131   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1132   * @since 9
1133   */
1134  interface SingleKVStore {
1135    /**
1136     * Writes a key-value pair of the string type into the {@code SingleKVStore} database.
1137     * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database.
1138     *
1139     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1140     * Spaces before and after the key will be cleared.
1141     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1142     * @param { AsyncCallback<void> } callback - the callback of put.
1143     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1144     * <br>2.Incorrect parameters types;
1145     * <br>3.Parameter verification failed.
1146     * @throws { BusinessError } 15100003 - Database corrupted.
1147     * @throws { BusinessError } 15100005 - Database or result set already closed.
1148     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1149     * @since 9
1150     */
1151    /**
1152     * Writes a key-value pair of the string type into the {@code SingleKVStore} database.
1153     * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database.
1154     *
1155     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1156     * Spaces before and after the key will be cleared.
1157     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1158     * @param { AsyncCallback<void> } callback - the callback of put.
1159     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1160     * <br>2.Incorrect parameters types;
1161     * <br>3.Parameter verification failed.
1162     * @throws { BusinessError } 15100003 - Database corrupted.
1163     * @throws { BusinessError } 15100005 - Database or result set already closed.
1164     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1165     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1166     * @since 10
1167     */
1168    put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback<void>): void;
1169
1170    /**
1171     * Writes a key-value pair of the string type into the {@code SingleKVStore} database.
1172     * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database.
1173     *
1174     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1175     * Spaces before and after the key will be cleared.
1176     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1177     * @returns { Promise<void> } the promise returned by the function.
1178     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1179     * <br>2.Incorrect parameters types;
1180     * <br>3.Parameter verification failed.
1181     * @throws { BusinessError } 15100003 - Database corrupted.
1182     * @throws { BusinessError } 15100005 - Database or result set already closed.
1183     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1184     * @since 9
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 database.
1189     *
1190     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1191     * Spaces before and after the key will be cleared.
1192     * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
1193     * @returns { Promise<void> } the promise returned by the function.
1194     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1195     * <br>2.Incorrect parameters types;
1196     * <br>3.Parameter verification failed.
1197     * @throws { BusinessError } 15100003 - Database corrupted.
1198     * @throws { BusinessError } 15100005 - Database or result set already closed.
1199     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1200     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1201     * @since 10
1202     */
1203    put(key: string, value: Uint8Array | string | number | boolean): Promise<void>;
1204
1205    /**
1206     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1207     *
1208     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1209     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1210     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1211     * <br>2.Incorrect parameters types.
1212     * @throws { BusinessError } 15100003 - Database corrupted.
1213     * @throws { BusinessError } 15100005 - Database or result set already closed.
1214     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1215     * @since 9
1216     */
1217    /**
1218     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1219     *
1220     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1221     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1222     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1223     * <br>2.Incorrect parameters types.
1224     * @throws { BusinessError } 15100003 - Database corrupted.
1225     * @throws { BusinessError } 15100005 - Database or result set already closed.
1226     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1227     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1228     * @since 10
1229     */
1230    putBatch(entries: Entry[], callback: AsyncCallback<void>): void;
1231
1232    /**
1233     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1234     *
1235     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1236     * @returns { Promise<void> } the promise returned by the function.
1237     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1238     * <br>2.Incorrect parameters types.
1239     * @throws { BusinessError } 15100003 - Database corrupted.
1240     * @throws { BusinessError } 15100005 - Database or result set already closed.
1241     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1242     * @since 9
1243     */
1244    /**
1245     * Inserts key-value pairs into the {@code SingleKVStore} database in batches.
1246     *
1247     * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
1248     * @returns { Promise<void> } the promise returned by the function.
1249     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1250     * <br>2.Incorrect parameters types.
1251     * @throws { BusinessError } 15100003 - Database corrupted.
1252     * @throws { BusinessError } 15100005 - Database or result set already closed.
1253     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1254     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1255     * @since 10
1256     */
1257    putBatch(entries: Entry[]): Promise<void>;
1258
1259    /**
1260     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1261     *
1262     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1263     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1264     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1265     * <br>2.Incorrect parameters types.
1266     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1267     * @throws { BusinessError } 15100003 - Database corrupted.
1268     * @throws { BusinessError } 15100005 - Database or result set already closed.
1269     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1270     * @systemapi
1271     * @StageModelOnly
1272     * @since 9
1273     */
1274    /**
1275     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1276     *
1277     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1278     * @param { AsyncCallback<void> } callback - the callback of putBatch.
1279     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1280     * <br>2.Incorrect parameters types.
1281     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1282     * @throws { BusinessError } 15100003 - Database corrupted.
1283     * @throws { BusinessError } 15100005 - Database or result set already closed.
1284     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1285     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1286     * @systemapi
1287     * @StageModelOnly
1288     * @since 10
1289     */
1290    putBatch(value: Array<ValuesBucket>, callback: AsyncCallback<void>): void;
1291
1292    /**
1293     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1294     *
1295     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1296     * @returns { Promise<void> } the promise returned by the function.
1297     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1298     * <br>2.Incorrect parameters types.
1299     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1300     * @throws { BusinessError } 15100003 - Database corrupted.
1301     * @throws { BusinessError } 15100005 - Database or result set already closed.
1302     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1303     * @systemapi
1304     * @StageModelOnly
1305     * @since 9
1306     */
1307    /**
1308     * Writes values of ValuesBucket type into the {@code SingleKVStore} database.
1309     *
1310     * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
1311     * @returns { Promise<void> } the promise returned by the function.
1312     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1313     * <br>2.Incorrect parameters types.
1314     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1315     * @throws { BusinessError } 15100003 - Database corrupted.
1316     * @throws { BusinessError } 15100005 - Database or result set already closed.
1317     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1318     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1319     * @systemapi
1320     * @StageModelOnly
1321     * @since 10
1322     */
1323    putBatch(value: Array<ValuesBucket>): Promise<void>;
1324
1325    /**
1326     * Deletes the key-value pair based on a specified key.
1327     *
1328     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1329     * Spaces before and after the key will be cleared.
1330     * @param { AsyncCallback<void> } callback - the callback of delete.
1331     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1332     * <br>2.Incorrect parameters types;
1333     * <br>3.Parameter verification failed.
1334     * @throws { BusinessError } 15100003 - Database corrupted.
1335     * @throws { BusinessError } 15100005 - Database or result set already closed.
1336     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1337     * @since 9
1338     */
1339    /**
1340     * Deletes the key-value pair based on a specified key.
1341     *
1342     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1343     * Spaces before and after the key will be cleared.
1344     * @param { AsyncCallback<void> } callback - the callback of delete.
1345     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1346     * <br>2.Incorrect parameters types;
1347     * <br>3.Parameter verification failed.
1348     * @throws { BusinessError } 15100003 - Database corrupted.
1349     * @throws { BusinessError } 15100005 - Database or result set already closed.
1350     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1351     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1352     * @since 10
1353     */
1354    delete(key: string, callback: AsyncCallback<void>): void;
1355
1356    /**
1357     * Deletes the key-value pair based on a specified key.
1358     *
1359     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1360     * Spaces before and after the key will be cleared.
1361     * @returns { Promise<void> } the promise returned by the function.
1362     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1363     * <br>2.Incorrect parameters types;
1364     * <br>3.Parameter verification failed.
1365     * @throws { BusinessError } 15100003 - Database corrupted.
1366     * @throws { BusinessError } 15100005 - Database or result set already closed.
1367     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1368     * @since 9
1369     */
1370    /**
1371     * Deletes the key-value pair based on a specified key.
1372     *
1373     * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
1374     * Spaces before and after the key will be cleared.
1375     * @returns { Promise<void> } the promise returned by the function.
1376     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1377     * <br>2.Incorrect parameters types;
1378     * <br>3.Parameter verification failed.
1379     * @throws { BusinessError } 15100003 - Database corrupted.
1380     * @throws { BusinessError } 15100005 - Database or result set already closed.
1381     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1382     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1383     * @since 10
1384     */
1385    delete(key: string): Promise<void>;
1386
1387    /**
1388     * Deletes the key-value pairs based on the dataSharePredicates.
1389     *
1390     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1391     * @param { AsyncCallback<void> } callback - the callback of delete.
1392     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1393     * <br>2.Incorrect parameters types.
1394     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1395     * @throws { BusinessError } 15100003 - Database corrupted.
1396     * @throws { BusinessError } 15100005 - Database or result set already closed.
1397     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1398     * @systemapi
1399     * @StageModelOnly
1400     * @since 9
1401     */
1402    /**
1403     * Deletes the key-value pairs based on the dataSharePredicates.
1404     *
1405     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1406     * @param { AsyncCallback<void> } callback - the callback of delete.
1407     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1408     * <br>2.Incorrect parameters types.
1409     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1410     * @throws { BusinessError } 15100003 - Database corrupted.
1411     * @throws { BusinessError } 15100005 - Database or result set already closed.
1412     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1413     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1414     * @systemapi
1415     * @StageModelOnly
1416     * @since 10
1417     */
1418    delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>);
1419
1420    /**
1421     * Deletes the key-value pairs based on the dataSharePredicates.
1422     *
1423     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1424     * @returns { Promise<void> } the promise returned by the function.
1425     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1426     * <br>2.Incorrect parameters types.
1427     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1428     * @throws { BusinessError } 15100003 - Database corrupted.
1429     * @throws { BusinessError } 15100005 - Database or result set already closed.
1430     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1431     * @systemapi
1432     * @StageModelOnly
1433     * @since 9
1434     */
1435    /**
1436     * Deletes the key-value pairs based on the dataSharePredicates.
1437     *
1438     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
1439     * @returns { Promise<void> } the promise returned by the function.
1440     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1441     * <br>2.Incorrect parameters types.
1442     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1443     * @throws { BusinessError } 15100003 - Database corrupted.
1444     * @throws { BusinessError } 15100005 - Database or result set already closed.
1445     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1446     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1447     * @systemapi
1448     * @StageModelOnly
1449     * @since 10
1450     */
1451    delete(predicates: dataSharePredicates.DataSharePredicates): Promise<void>;
1452
1453    /**
1454     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1455     *
1456     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1457     * @param { AsyncCallback<void> } callback - the callback of deleteBatch.
1458     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1459     * <br>2.Incorrect parameters types;
1460     * <br>3.Parameter verification failed.
1461     * @throws { BusinessError } 15100003 - Database corrupted.
1462     * @throws { BusinessError } 15100005 - Database or result set already closed.
1463     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1464     * @since 9
1465     */
1466    /**
1467     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1468     *
1469     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1470     * @param { AsyncCallback<void> } callback - the callback of deleteBatch.
1471     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1472     * <br>2.Incorrect parameters types;
1473     * <br>3.Parameter verification failed.
1474     * @throws { BusinessError } 15100003 - Database corrupted.
1475     * @throws { BusinessError } 15100005 - Database or result set already closed.
1476     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1477     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1478     * @since 10
1479     */
1480    deleteBatch(keys: string[], callback: AsyncCallback<void>): void;
1481
1482    /**
1483     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1484     *
1485     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1486     * @returns { Promise<void> } the promise returned by the function.
1487     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1488     * <br>2.Incorrect parameters types;
1489     * <br>3.Parameter verification failed.
1490     * @throws { BusinessError } 15100003 - Database corrupted.
1491     * @throws { BusinessError } 15100005 - Database or result set already closed.
1492     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1493     * @since 9
1494     */
1495    /**
1496     * Deletes key-value pairs in batches from the {@code SingleKVStore} database.
1497     *
1498     * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
1499     * @returns { Promise<void> } the promise returned by the function.
1500     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1501     * <br>2.Incorrect parameters types;
1502     * <br>3.Parameter verification failed.
1503     * @throws { BusinessError } 15100003 - Database corrupted.
1504     * @throws { BusinessError } 15100005 - Database or result set already closed.
1505     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1506     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1507     * @since 10
1508     */
1509    deleteBatch(keys: string[]): Promise<void>;
1510
1511    /**
1512     * Removes data of the specified device from current database. This method is used to remove only the data
1513     * synchronized from remote devices. This operation does not synchronize data to other databases or affect
1514     * subsequent data synchronization.
1515     *
1516     * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID.
1517     * @param { AsyncCallback<void> } callback - the callback of removeDeviceData.
1518     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1519     * <br>2.Parameter verification failed.
1520     * @throws { BusinessError } 15100005 - Database or result set already closed.
1521     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
1522     * @since 9
1523     */
1524    removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void;
1525
1526    /**
1527     * Removes data of the specified device from current database. This method is used to remove only the data
1528     * synchronized from remote devices. This operation does not synchronize data to other databases or affect
1529     * subsequent data synchronization.
1530     *
1531     * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID.
1532     * @returns { Promise<void> } the promise returned by the function.
1533     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1534     * <br>2.Parameter verification failed.
1535     * @throws { BusinessError } 15100005 - Database or result set already closed.
1536     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
1537     * @since 9
1538     */
1539    removeDeviceData(deviceId: string): Promise<void>;
1540
1541    /**
1542     * Obtains the value of a specified key.
1543     *
1544     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
1545     * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
1546     * {Uint8Array|string|boolean|number}: the returned value specified by the key.
1547     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1548     * <br>2.Incorrect parameters types;
1549     * <br>3.Parameter verification failed.
1550     * @throws { BusinessError } 15100003 - Database corrupted.
1551     * @throws { BusinessError } 15100004 - Not found.
1552     * @throws { BusinessError } 15100005 - Database or result set already closed.
1553     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1554     * @since 9
1555     */
1556    get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
1557
1558    /**
1559     * Obtains the value of a specified key.
1560     *
1561     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
1562     * @returns { Promise<boolean | string | number | Uint8Array> }
1563     * {Uint8Array|string|boolean|number}: the returned value specified by the key.
1564     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1565     * <br>2.Incorrect parameters types;
1566     * <br>3.Parameter verification failed.
1567     * @throws { BusinessError } 15100003 - Database corrupted.
1568     * @throws { BusinessError } 15100004 - Not found.
1569     * @throws { BusinessError } 15100005 - Database or result set already closed.
1570     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1571     * @since 9
1572     */
1573    get(key: string): Promise<boolean | string | number | Uint8Array>;
1574
1575    /**
1576     * Obtains all key-value pairs that match a specified key prefix.
1577     *
1578     * @param { string } keyPrefix - Indicates the key prefix to match.
1579     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
1580     * that match the specified key prefix.
1581     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1582     * <br>2.Incorrect parameters types.
1583     * @throws { BusinessError } 15100003 - Database corrupted.
1584     * @throws { BusinessError } 15100005 - Database or result set already closed.
1585     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1586     * @since 9
1587     */
1588    getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
1589
1590    /**
1591     * Obtains all key-value pairs that match a specified key prefix.
1592     *
1593     * @param { string } keyPrefix - Indicates the key prefix to match.
1594     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
1595     * specified key prefix.
1596     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1597     * <br>2.Incorrect parameters types.
1598     * @throws { BusinessError } 15100003 - Database corrupted.
1599     * @throws { BusinessError } 15100005 - Database or result set already closed.
1600     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1601     * @since 9
1602     */
1603    getEntries(keyPrefix: string): Promise<Entry[]>;
1604
1605    /**
1606     * Obtains the list of key-value pairs matching the specified {@code Query} object.
1607     *
1608     * @param { Query } query - Indicates the {@code Query} object.
1609     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
1610     * matching the specified {@code Query} object.
1611     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1612     * <br>2.Incorrect parameters types.
1613     * @throws { BusinessError } 15100003 - Database corrupted.
1614     * @throws { BusinessError } 15100005 - Database or result set already closed.
1615     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1616     * @since 9
1617     */
1618    getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
1619
1620    /**
1621     * Obtains the list of key-value pairs matching the specified {@code Query} object.
1622     *
1623     * @param { Query } query - Indicates the {@code Query} object.
1624     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the
1625     * specified {@code Query} object.
1626     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1627     * <br>2.Incorrect parameters types.
1628     * @throws { BusinessError } 15100003 - Database corrupted.
1629     * @throws { BusinessError } 15100005 - Database or result set already closed.
1630     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1631     * @since 9
1632     */
1633    getEntries(query: Query): Promise<Entry[]>;
1634
1635    /**
1636     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
1637     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1638     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1639     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1640     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1641     *
1642     * @param { string } keyPrefix - Indicates the key prefix to match.
1643     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1644     * object matching the specified keyPrefix.
1645     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1646     * <br>2.Incorrect parameters types.
1647     * @throws { BusinessError } 15100003 - Database corrupted.
1648     * @throws { BusinessError } 15100005 - Database or result set already closed.
1649     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1650     * @since 9
1651     */
1652    /**
1653     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
1654     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1655     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1656     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1657     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1658     *
1659     * @param { string } keyPrefix - Indicates the key prefix to match.
1660     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1661     * object matching the specified keyPrefix.
1662     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1663     * <br>2.Incorrect parameters types.
1664     * @throws { BusinessError } 15100001 - Over max limits.
1665     * @throws { BusinessError } 15100003 - Database corrupted.
1666     * @throws { BusinessError } 15100005 - Database or result set already closed.
1667     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1668     * @since 10
1669     */
1670    getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
1671
1672    /**
1673     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
1674     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1675     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1676     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1677     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1678     *
1679     * @param { string } keyPrefix - Indicates the key prefix to match.
1680     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1681     * object matching the specified keyPrefix.
1682     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1683     * <br>2.Incorrect parameters types.
1684     * @throws { BusinessError } 15100003 - Database corrupted.
1685     * @throws { BusinessError } 15100005 - Database or result set already closed.
1686     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1687     * @since 9
1688     */
1689    /**
1690     * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
1691     * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
1692     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
1693     * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
1694     * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
1695     *
1696     * @param { string } keyPrefix - Indicates the key prefix to match.
1697     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1698     * object matching the specified keyPrefix.
1699     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1700     * <br>2.Incorrect parameters types.
1701     * @throws { BusinessError } 15100001 - Over max limits.
1702     * @throws { BusinessError } 15100003 - Database corrupted.
1703     * @throws { BusinessError } 15100005 - Database or result set already closed.
1704     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1705     * @since 10
1706     */
1707    getResultSet(keyPrefix: string): Promise<KVStoreResultSet>;
1708
1709    /**
1710     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1711     *
1712     * @param { Query } query - Indicates the {@code Query} object.
1713     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1714     * object matching the specified {@code Query} object.
1715     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1716     * <br>2.Incorrect parameters types.
1717     * @throws { BusinessError } 15100003 - Database corrupted.
1718     * @throws { BusinessError } 15100005 - Database or result set already closed.
1719     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1720     * @since 9
1721     */
1722    /**
1723     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1724     *
1725     * @param { Query } query - Indicates the {@code Query} object.
1726     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1727     * object matching the specified {@code Query} object.
1728     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1729     * <br>2.Incorrect parameters types.
1730     * @throws { BusinessError } 15100001 - Over max limits.
1731     * @throws { BusinessError } 15100003 - Database corrupted.
1732     * @throws { BusinessError } 15100005 - Database or result set already closed.
1733     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1734     * @since 10
1735     */
1736    getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
1737
1738    /**
1739     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1740     *
1741     * @param { Query } query - Indicates the {@code Query} object.
1742     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1743     * object matching the specified {@code Query} object.
1744     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1745     * <br>2.Incorrect parameters types.
1746     * @throws { BusinessError } 15100003 - Database corrupted.
1747     * @throws { BusinessError } 15100005 - Database or result set already closed.
1748     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1749     * @since 9
1750     */
1751    /**
1752     * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
1753     *
1754     * @param { Query } query - Indicates the {@code Query} object.
1755     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1756     * object matching the specified {@code Query} object.
1757     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1758     * <br>2.Incorrect parameters types.
1759     * @throws { BusinessError } 15100001 - Over max limits.
1760     * @throws { BusinessError } 15100003 - Database corrupted.
1761     * @throws { BusinessError } 15100005 - Database or result set already closed.
1762     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1763     * @since 10
1764     */
1765    getResultSet(query: Query): Promise<KVStoreResultSet>;
1766
1767    /**
1768     * Obtains the KVStoreResultSet object matching the specified predicate object.
1769     *
1770     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1771     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1772     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1773     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1774     * <br>2.Incorrect parameters types.
1775     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1776     * @throws { BusinessError } 15100003 - Database corrupted.
1777     * @throws { BusinessError } 15100005 - Database or result set already closed.
1778     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1779     * @systemapi
1780     * @StageModelOnly
1781     * @since 9
1782     */
1783    /**
1784     * Obtains the KVStoreResultSet object matching the specified predicate object.
1785     *
1786     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1787     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
1788     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1789     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1790     * <br>2.Incorrect parameters types.
1791     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1792     * @throws { BusinessError } 15100001 - Over max limits.
1793     * @throws { BusinessError } 15100003 - Database corrupted.
1794     * @throws { BusinessError } 15100005 - Database or result set already closed.
1795     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1796     * @systemapi
1797     * @StageModelOnly
1798     * @since 10
1799     */
1800    getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void;
1801
1802    /**
1803     * Obtains the KVStoreResultSet object matching the specified predicate object.
1804     *
1805     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1806     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1807     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1808     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1809     * <br>2.Incorrect parameters types.
1810     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1811     * @throws { BusinessError } 15100003 - Database corrupted.
1812     * @throws { BusinessError } 15100005 - Database or result set already closed.
1813     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1814     * @systemapi
1815     * @StageModelOnly
1816     * @since 9
1817     */
1818    /**
1819     * Obtains the KVStoreResultSet object matching the specified predicate object.
1820     *
1821     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
1822     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
1823     * object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
1824     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1825     * <br>2.Incorrect parameters types.
1826     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
1827     * @throws { BusinessError } 15100001 - Over max limits.
1828     * @throws { BusinessError } 15100003 - Database corrupted.
1829     * @throws { BusinessError } 15100005 - Database or result set already closed.
1830     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
1831     * @systemapi
1832     * @StageModelOnly
1833     * @since 10
1834     */
1835    getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
1836
1837    /**
1838     * Closes a {@code KVStoreResultSet} object returned by getResultSet method.
1839     *
1840     * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close.
1841     * @param { AsyncCallback<void> } callback - the callback of closeResultSet.
1842     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1843     * <br>2.Incorrect parameters types.
1844     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1845     * @since 9
1846     */
1847    closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback<void>): void;
1848
1849    /**
1850     * Closes a {@code KVStoreResultSet} object returned by getResultSet method.
1851     *
1852     * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close.
1853     * @returns { Promise<void> } the promise returned by the function.
1854     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1855     * <br>2.Incorrect parameters types.
1856     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1857     * @since 9
1858     */
1859    closeResultSet(resultSet: KVStoreResultSet): Promise<void>;
1860
1861    /**
1862     * Obtains the number of results matching the specified {@code Query} object.
1863     *
1864     * @param { Query } query - Indicates the {@code Query} object.
1865     * @param { AsyncCallback<number> } callback - {number}: the number of results matching the
1866     * specified {@code Query} object.
1867     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1868     * <br>2.Incorrect parameters types.
1869     * @throws { BusinessError } 15100003 - Database corrupted.
1870     * @throws { BusinessError } 15100005 - Database or result set already closed.
1871     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1872     * @since 9
1873     */
1874    getResultSize(query: Query, callback: AsyncCallback<number>): void;
1875
1876    /**
1877     * Obtains the number of results matching the specified {@code Query} object.
1878     *
1879     * @param { Query } query - Indicates the {@code Query} object.
1880     * @returns { Promise<number> } {number}: the number of results matching the specified
1881     * {@code Query} object.
1882     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1883     * <br>2.Incorrect parameters types.
1884     * @throws { BusinessError } 15100003 - Database corrupted.
1885     * @throws { BusinessError } 15100005 - Database or result set already closed.
1886     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1887     * @since 9
1888     */
1889    getResultSize(query: Query): Promise<number>;
1890
1891    /**
1892     * Backs up a database in the specified filename.
1893     *
1894     * @param { string } file - Indicates the database backup filename, It can not be empty and
1895     * The length must be less than {@code MAX_KEY_LENGTH}.
1896     * @param { AsyncCallback<void> } callback - the callback of backup.
1897     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1898     * <br>2.Parameter verification failed.
1899     * @throws { BusinessError } 15100005 - Database or result set already closed.
1900     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1901     * @since 9
1902     */
1903    backup(file: string, callback: AsyncCallback<void>): void;
1904
1905    /**
1906     * Backs up a database in the specified filename.
1907     *
1908     * @param { string } file - Indicates the database backup filename, It can not be empty and
1909     * The length must be less than {@code MAX_KEY_LENGTH}.
1910     * @returns { Promise<void> } the promise returned by the function.
1911     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1912     * <br>2.Parameter verification failed.
1913     * @throws { BusinessError } 15100005 - Database or result set already closed.
1914     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1915     * @since 9
1916     */
1917    backup(file: string): Promise<void>;
1918
1919    /**
1920     * Restores a database from a specified database file.
1921     *
1922     * @param { string } file - Indicates the database backup filename, It can not be empty and
1923     * The length must be less than {@code MAX_KEY_LENGTH}.
1924     * @param { AsyncCallback<void> } callback - the callback of restore.
1925     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1926     * <br>2.Parameter verification failed.
1927     * @throws { BusinessError } 15100005 - Database or result set already closed.
1928     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1929     * @since 9
1930     */
1931    restore(file: string, callback: AsyncCallback<void>): void;
1932
1933    /**
1934     * Restores a database from a specified database file.
1935     *
1936     * @param { string } file - Indicates the database backup filename, It can not be empty and
1937     * The length must be less than {@code MAX_KEY_LENGTH}.
1938     * @returns { Promise<void> } the promise returned by the function.
1939     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1940     * <br>2.Parameter verification failed.
1941     * @throws { BusinessError } 15100005 - Database or result set already closed.
1942     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1943     * @since 9
1944     */
1945    restore(file: string): Promise<void>;
1946
1947    /**
1948     * Delete database backup files based on the specified filenames.
1949     *
1950     * @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and
1951     * The length must be less than {@code MAX_KEY_LENGTH}.
1952     * @param { AsyncCallback<Array<[string, number]>> } callback - {Array<[string, number]>}:
1953     * the list of backup file and it's corresponding delete result which 0 means delete success
1954     * and otherwise failed.
1955     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1956     * <br>2.Parameter verification failed.
1957     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1958     * @since 9
1959     */
1960    deleteBackup(files: Array<string>, callback: AsyncCallback<Array<[string, number]>>): void;
1961
1962    /**
1963     * Delete database backup files based on the specified filenames.
1964     *
1965     * @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and
1966     * The length must be less than {@code MAX_KEY_LENGTH}.
1967     * @returns { Promise<Array<[string, number]>> } {Array<[string, number]>}: the list of backup
1968     * file and it's corresponding delete result which 0 means delete success and otherwise failed.
1969     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
1970     * <br>2.Parameter verification failed.
1971     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1972     * @since 9
1973     */
1974    deleteBackup(files: Array<string>): Promise<Array<[string, number]>>;
1975
1976    /**
1977     * Starts a transaction operation in the {@code SingleKVStore} database.
1978     * <p>After the database transaction is started, you can submit or roll back the operation.
1979     *
1980     * @param { AsyncCallback<void> } callback - the callback of startTransaction.
1981     * @throws { BusinessError } 15100005 - Database or result set already closed.
1982     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1983     * @since 9
1984     */
1985    /**
1986     * Starts a transaction operation in the {@code SingleKVStore} database.
1987     * <p>After the database transaction is started, you can submit or roll back the operation.
1988     *
1989     * @param { AsyncCallback<void> } callback - the callback of startTransaction.
1990     * @throws { BusinessError } 15100005 - Database or result set already closed.
1991     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
1992     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
1993     * @since 10
1994     */
1995    startTransaction(callback: AsyncCallback<void>): void;
1996
1997    /**
1998     * Starts a transaction operation in the {@code SingleKVStore} database.
1999     * <p>After the database transaction is started, you can submit or roll back the operation.
2000     *
2001     * @returns { Promise<void> } the promise returned by the function.
2002     * @throws { BusinessError } 15100005 - Database or result set already closed.
2003     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2004     * @since 9
2005     */
2006    /**
2007     * Starts a transaction operation in the {@code SingleKVStore} database.
2008     * <p>After the database transaction is started, you can submit or roll back the operation.
2009     *
2010     * @returns { Promise<void> } the promise returned by the function.
2011     * @throws { BusinessError } 15100005 - Database or result set already closed.
2012     * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
2013     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2014     * @since 10
2015     */
2016    startTransaction(): Promise<void>;
2017
2018    /**
2019     * Submits a transaction operation in the {@code SingleKVStore} database.
2020     *
2021     * @param { AsyncCallback<void> } callback - the callback of commit.
2022     * @throws { BusinessError } 15100005 - Database or result set already closed.
2023     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2024     * @since 9
2025     */
2026    commit(callback: AsyncCallback<void>): void;
2027
2028    /**
2029     * Submits a transaction operation in the {@code SingleKVStore} database.
2030     *
2031     * @returns { Promise<void> } the promise returned by the function.
2032     * @throws { BusinessError } 15100005 - Database or result set already closed.
2033     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2034     * @since 9
2035     */
2036    commit(): Promise<void>;
2037
2038    /**
2039     * Rolls back a transaction operation in the {@code SingleKVStore} database.
2040     *
2041     * @param { AsyncCallback<void> } callback - the callback of rollback.
2042     * @throws { BusinessError } 15100005 - Database or result set already closed.
2043     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2044     * @since 9
2045     */
2046    rollback(callback: AsyncCallback<void>): void;
2047
2048    /**
2049     * Rolls back a transaction operation in the {@code SingleKVStore} database.
2050     *
2051     * @returns { Promise<void> } the promise returned by the function.
2052     * @throws { BusinessError } 15100005 - Database or result set already closed.
2053     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2054     * @since 9
2055     */
2056    rollback(): Promise<void>;
2057
2058    /**
2059     * Sets whether to enable synchronization.
2060     *
2061     * @param { boolean } enabled - Specifies whether to enable synchronization. The value true
2062     * means to enable synchronization, and false means the opposite.
2063     * @param { AsyncCallback<void> } callback - the callback of enableSync.
2064     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2065     * <br>2.Incorrect parameters types.
2066     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2067     * @since 9
2068     */
2069    enableSync(enabled: boolean, callback: AsyncCallback<void>): void;
2070
2071    /**
2072     * Sets whether to enable synchronization.
2073     *
2074     * @param { boolean } enabled - Specifies whether to enable synchronization. The value true
2075     * means to enable synchronization, and false means the opposite.
2076     * @returns { Promise<void> } the promise returned by the function.
2077     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2078     * <br>2.Incorrect parameters types.
2079     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2080     * @since 9
2081     */
2082    enableSync(enabled: boolean): Promise<void>;
2083
2084    /**
2085     * Sets synchronization range labels.
2086     * <p>The labels determine the devices with which data will be synchronized.
2087     *
2088     * @param { string[] } localLabels - Indicates the synchronization labels of the local device.
2089     * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which
2090     * data will be synchronized.
2091     * @param { AsyncCallback<void> } callback - the callback of setSyncRange.
2092     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2093     * <br>2.Incorrect parameters types.
2094     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2095     * @since 9
2096     */
2097    setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback<void>): void;
2098
2099    /**
2100     * Sets synchronization range labels.
2101     * <p>The labels determine the devices with which data will be synchronized.
2102     *
2103     * @param { string[] } localLabels - Indicates the synchronization labels of the local device.
2104     * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which
2105     * data will be synchronized.
2106     * @returns { Promise<void> } the promise returned by the function.
2107     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2108     * <br>2.Incorrect parameters types.
2109     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2110     * @since 9
2111     */
2112    setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>;
2113
2114    /**
2115     * Sets the default delay allowed for database synchronization
2116     *
2117     * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the
2118     * database synchronization, in milliseconds.
2119     * @param { AsyncCallback<void> } callback - the callback of setSyncParam.
2120     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2121     * <br>2.Incorrect parameters types.
2122     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2123     * @since 9
2124     */
2125    setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void;
2126
2127    /**
2128     * Sets the default delay allowed for database synchronization
2129     *
2130     * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the
2131     * database synchronization, in milliseconds.
2132     * @returns { Promise<void> } the promise returned by the function.
2133     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2134     * <br>2.Incorrect parameters types.
2135     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2136     * @since 9
2137     */
2138    setSyncParam(defaultAllowedDelayMs: number): Promise<void>;
2139
2140    /**
2141     * Synchronize the database to the specified devices with the specified delay allowed.
2142     *
2143     * @permission ohos.permission.DISTRIBUTED_DATASYNC
2144     * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database.
2145     * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH},
2146     * {@code PULL}, or {@code PUSH_PULL}.
2147     * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds.
2148     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2149     * <br>2.Incorrect parameters types.
2150     * @throws { BusinessError } 15100003 - Database corrupted.
2151     * @throws { BusinessError } 15100004 - Not found.
2152     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2153     * @since 9
2154     */
2155    sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void;
2156
2157    /**
2158     * Synchronize the database to the specified devices with the specified delay allowed.
2159     *
2160     * @permission ohos.permission.DISTRIBUTED_DATASYNC
2161     * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database.
2162     * @param { Query } query - Indicates the {@code Query} object.
2163     * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH},
2164     * {@code PULL}, or {@code PUSH_PULL}.
2165     * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds.
2166     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2167     * <br>2.Incorrect parameters types.
2168     * @throws { BusinessError } 15100003 - Database corrupted.
2169     * @throws { BusinessError } 15100004 - Not found.
2170     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2171     * @since 9
2172     */
2173    sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void;
2174
2175    /**
2176     * Register a callback to the database and when data in the distributed database has changed,
2177     * the callback will be invoked.
2178     *
2179     * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event.
2180     * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}.
2181     * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
2182     * object indicates the data change events in the distributed database.
2183     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2184     * <br>2.Incorrect parameters types.
2185     * @throws { BusinessError } 15100001 - Over max limits.
2186     * @throws { BusinessError } 15100005 - Database or result set already closed.
2187     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2188     * @since 9
2189     */
2190    /**
2191     * Register a callback to the database and when data in the distributed database has changed,
2192     * the callback will be invoked.
2193     *
2194     * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event.
2195     * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}.
2196     * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
2197     * object indicates the data change events in the distributed database.
2198     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2199     * <br>2.Incorrect parameters types.
2200     * @throws { BusinessError } 15100001 - Over max limits.
2201     * @throws { BusinessError } 15100005 - Database or result set already closed.
2202     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2203     * @since 10
2204     */
2205    on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void;
2206
2207    /**
2208     * Register a databases synchronization callback to the database.
2209     * <p> Sync result is returned through asynchronous callback.
2210     *
2211     * @param { 'syncComplete' } event - Subscribed event name, fixed as 'syncComplete', indicates the synchronization completion event.
2212     * @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the
2213     * deviceId and it's corresponding synchronization result which 0 means synchronization success
2214     * and otherwise failed.
2215     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2216     * <br>2.Incorrect parameters types.
2217     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2218     * @since 9
2219     */
2220    on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void;
2221
2222    /**
2223     * Unsubscribe from the SingleKVStore database based on the specified subscribeType and listener.
2224     *
2225     * @param { 'dataChange' } event - The unsubscribe event name, fixed as 'dataChange', indicates the data change event.
2226     * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
2227     * object indicates the data change events in the distributed database.
2228     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2229     * <br>2.Incorrect parameters types.
2230     * @throws { BusinessError } 15100005 - Database or result set already closed.
2231     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2232     * @since 9
2233     */
2234    off(event: 'dataChange', listener?: Callback<ChangeNotification>): void;
2235
2236    /**
2237     * Unregister the database synchronization callback.
2238     *
2239     * @param { 'syncComplete' } event - The unsubscribe event name, fixed as 'syncComplete', indicates the synchronization completion event.
2240     * @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the
2241     * deviceId and it's corresponding synchronization result which 0 means synchronization success
2242     * and otherwise failed.
2243     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2244     * <br>2.Incorrect parameters types.
2245     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2246     * @since 9
2247     */
2248    off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>>): void;
2249
2250    /**
2251     * Get the security level of the database.
2252     *
2253     * @param { AsyncCallback<SecurityLevel> } callback - {SecurityLevel}: the {@code SecurityLevel}
2254     * object indicates the security level of the database.
2255     * @throws { BusinessError } 15100005 - Database or result set already closed.
2256     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2257     * @since 9
2258     */
2259    getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void;
2260
2261    /**
2262     * Get the security level of the database.
2263     *
2264     * @returns { Promise<SecurityLevel> } {SecurityLevel}: the {@code SecurityLevel} object indicates
2265     * the security level of the database.
2266     * @throws { BusinessError } 15100005 - Database or result set already closed.
2267     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2268     * @since 9
2269     */
2270    getSecurityLevel(): Promise<SecurityLevel>;
2271  }
2272
2273  /**
2274   * Provides methods related to device-collaboration distributed databases.
2275   * <p>To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKVStore(Options, String)}
2276   * method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed
2277   * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry
2278   * into the database, the system automatically adds the ID of the device running the application to the key.
2279   *
2280   * @extends SingleKVStore
2281   * @typedef DeviceKVStore
2282   * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2283   * @since 9
2284   */
2285  interface DeviceKVStore extends SingleKVStore {
2286    /**
2287     * Obtains the value matching the local device ID and specified key.
2288     *
2289     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
2290     * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
2291     * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key.
2292     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2293     * <br>2.Incorrect parameters types;
2294     * <br>3.Parameter verification failed.
2295     * @throws { BusinessError } 15100003 - Database corrupted.
2296     * @throws { BusinessError } 15100004 - Not found.
2297     * @throws { BusinessError } 15100005 - Database or result set already closed.
2298     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2299     * @since 9
2300     */
2301    get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
2302
2303    /**
2304     * Obtains the value matching the local device ID and specified key.
2305     *
2306     * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
2307     * @returns { Promise<boolean | string | number | Uint8Array> }
2308     * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key.
2309     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2310     * <br>2.Incorrect parameters types;
2311     * <br>3.Parameter verification failed.
2312     * @throws { BusinessError } 15100003 - Database corrupted.
2313     * @throws { BusinessError } 15100004 - Not found.
2314     * @throws { BusinessError } 15100005 - Database or result set already closed.
2315     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2316     * @since 9
2317     */
2318    get(key: string): Promise<boolean | string | number | Uint8Array>;
2319
2320    /**
2321     * Obtains the value matching a specified device ID and key.
2322     *
2323     * @param { string } deviceId - Indicates the device to be queried.
2324     * @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}.
2325     * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
2326     * {boolean | string | number | Uint8Array}: the returned value specified by the deviceId and key.
2327     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2328     * <br>2.Incorrect parameters types;
2329     * <br>3.Parameter verification failed.
2330     * @throws { BusinessError } 15100003 - Database corrupted.
2331     * @throws { BusinessError } 15100004 - Not found.
2332     * @throws { BusinessError } 15100005 - Database or result set already closed.
2333     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2334     * @since 9
2335     */
2336    get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
2337
2338    /**
2339     * Obtains the value matching a specified device ID and key.
2340     *
2341     * @param { string } deviceId - Indicates the device to be queried.
2342     * @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}.
2343     * @returns { Promise<boolean | string | number | Uint8Array> }
2344     * {Uint8Array|string|boolean|number}: the returned value specified by the deviceId and key.
2345     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2346     * <br>2.Incorrect parameters types;
2347     * <br>3.Parameter verification failed.
2348     * @throws { BusinessError } 15100003 - Database corrupted.
2349     * @throws { BusinessError } 15100004 - Not found.
2350     * @throws { BusinessError } 15100005 - Database or result set already closed.
2351     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2352     * @since 9
2353     */
2354    get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array>;
2355
2356    /**
2357     * Obtains all key-value pairs that match the local device ID and specified key prefix.
2358     *
2359     * @param { string } keyPrefix - Indicates the key prefix to match.
2360     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2361     * that match the local device ID and specified key prefix.
2362     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2363     * <br>2.Incorrect parameters types.
2364     * @throws { BusinessError } 15100003 - Database corrupted.
2365     * @throws { BusinessError } 15100005 - Database or result set already closed.
2366     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2367     * @since 9
2368     */
2369    getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
2370
2371    /**
2372     * Obtains all key-value pairs that match the local device ID and specified key prefix.
2373     *
2374     * @param { string } keyPrefix - Indicates the key prefix to match.
2375     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
2376     * local device ID and specified key prefix.
2377     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2378     * <br>2.Incorrect parameters types.
2379     * @throws { BusinessError } 15100003 - Database corrupted.
2380     * @throws { BusinessError } 15100005 - Database or result set already closed.
2381     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2382     * @since 9
2383     */
2384    getEntries(keyPrefix: string): Promise<Entry[]>;
2385
2386    /**
2387     * Obtains all key-value pairs matching a specified device ID and key prefix.
2388     *
2389     * @param { string } deviceId - Identifies the device whose data is to be queried.
2390     * @param { string } keyPrefix - Indicates the key prefix to match.
2391     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2392     * that match the specified deviceId and key prefix.
2393     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2394     * <br>2.Incorrect parameters types.
2395     * @throws { BusinessError } 15100003 - Database corrupted.
2396     * @throws { BusinessError } 15100005 - Database or result set already closed.
2397     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2398     * @since 9
2399     */
2400    getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
2401
2402    /**
2403     * Obtains all key-value pairs matching a specified device ID and key prefix.
2404     *
2405     * @param { string } deviceId - Identifies the device whose data is to be queried.
2406     * @param { string } keyPrefix - Indicates the key prefix to match.
2407     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
2408     * specified deviceId and key prefix.
2409     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2410     * <br>2.Incorrect parameters types.
2411     * @throws { BusinessError } 15100003 - Database corrupted.
2412     * @throws { BusinessError } 15100005 - Database or result set already closed.
2413     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2414     * @since 9
2415     */
2416    getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>;
2417
2418    /**
2419     * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object.
2420     *
2421     * @param { Query } query - Indicates the {@code Query} object.
2422     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2423     * matching the local device ID and specified {@code Query} object.
2424     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2425     * <br>2.Incorrect parameters types.
2426     * @throws { BusinessError } 15100003 - Database corrupted.
2427     * @throws { BusinessError } 15100005 - Database or result set already closed.
2428     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2429     * @since 9
2430     */
2431    getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
2432
2433    /**
2434     * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object.
2435     *
2436     * @param { Query } query - Indicates the {@code Query} object.
2437     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the local device ID and
2438     * specified {@code Query} object.
2439     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2440     * <br>2.Incorrect parameters types.
2441     * @throws { BusinessError } 15100003 - Database corrupted.
2442     * @throws { BusinessError } 15100005 - Database or result set already closed.
2443     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2444     * @since 9
2445     */
2446    getEntries(query: Query): Promise<Entry[]>;
2447
2448    /**
2449     * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object.
2450     *
2451     * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong.
2452     * @param { Query } query - Indicates the {@code Query} object.
2453     * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
2454     * matching the specified deviceId and {@code Query} object.
2455     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2456     * <br>2.Incorrect parameters types.
2457     * @throws { BusinessError } 15100003 - Database corrupted.
2458     * @throws { BusinessError } 15100005 - Database or result set already closed.
2459     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2460     * @since 9
2461     */
2462    getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void;
2463
2464    /**
2465     * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object.
2466     *
2467     * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong.
2468     * @param { Query } query - Indicates the {@code Query} object.
2469     * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the
2470     * specified deviceId and {@code Query} object.
2471     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2472     * <br>2.Incorrect parameters types.
2473     * @throws { BusinessError } 15100003 - Database corrupted.
2474     * @throws { BusinessError } 15100005 - Database or result set already closed.
2475     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2476     * @since 9
2477     */
2478    getEntries(deviceId: string, query: Query): Promise<Entry[]>;
2479
2480    /**
2481     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2482     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2483     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
2484     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2485     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2486     *
2487     * @param { string } keyPrefix - Indicates the key prefix to match.
2488     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2489     * object matching the local device ID and specified keyPrefix.
2490     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2491     * <br>2.Incorrect parameters types.
2492     * @throws { BusinessError } 15100003 - Database corrupted.
2493     * @throws { BusinessError } 15100005 - Database or result set already closed.
2494     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2495     * @since 9
2496     */
2497    /**
2498     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2499     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2500     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
2501     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2502     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2503     *
2504     * @param { string } keyPrefix - Indicates the key prefix to match.
2505     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2506     * object matching the local device ID and specified keyPrefix.
2507     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2508     * <br>2.Incorrect parameters types.
2509     * @throws { BusinessError } 15100001 - Over max limits.
2510     * @throws { BusinessError } 15100003 - Database corrupted.
2511     * @throws { BusinessError } 15100005 - Database or result set already closed.
2512     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2513     * @since 10
2514     */
2515    getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
2516
2517    /**
2518     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2519     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2520     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
2521     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2522     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2523     *
2524     * @param { string } keyPrefix - Indicates the key prefix to match.
2525     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2526     * object matching the local device ID and specified keyPrefix.
2527     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2528     * <br>2.Incorrect parameters types.
2529     * @throws { BusinessError } 15100003 - Database corrupted.
2530     * @throws { BusinessError } 15100005 - Database or result set already closed.
2531     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2532     * @since 9
2533     */
2534    /**
2535     * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
2536     * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
2537     * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
2538     * If you have created four objects, calling this method will return a failure. Therefore, you are advised to
2539     * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
2540     *
2541     * @param { string } keyPrefix - Indicates the key prefix to match.
2542     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2543     * object matching the local device ID and specified keyPrefix.
2544     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2545     * <br>2.Incorrect parameters types.
2546     * @throws { BusinessError } 15100001 - Over max limits.
2547     * @throws { BusinessError } 15100003 - Database corrupted.
2548     * @throws { BusinessError } 15100005 - Database or result set already closed.
2549     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2550     * @since 10
2551     */
2552    getResultSet(keyPrefix: string): Promise<KVStoreResultSet>;
2553
2554    /**
2555     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2556     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
2557     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
2558     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
2559     * {@code KVStoreResultSet} objects in a timely manner.
2560     *
2561     * @param { string } deviceId - Identifies the device whose data is to be queried.
2562     * @param { string } keyPrefix - Indicates the key prefix to match.
2563     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2564     * object matching the specified deviceId and keyPrefix.
2565     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2566     * <br>2.Incorrect parameters types.
2567     * @throws { BusinessError } 15100003 - Database corrupted.
2568     * @throws { BusinessError } 15100005 - Database or result set already closed.
2569     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2570     * @since 9
2571     */
2572    /**
2573     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2574     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
2575     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
2576     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
2577     * {@code KVStoreResultSet} objects in a timely manner.
2578     *
2579     * @param { string } deviceId - Identifies the device whose data is to be queried.
2580     * @param { string } keyPrefix - Indicates the key prefix to match.
2581     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2582     * object matching the specified deviceId and keyPrefix.
2583     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2584     * <br>2.Incorrect parameters types.
2585     * @throws { BusinessError } 15100001 - Over max limits.
2586     * @throws { BusinessError } 15100003 - Database corrupted.
2587     * @throws { BusinessError } 15100005 - Database or result set already closed.
2588     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2589     * @since 10
2590     */
2591    getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
2592
2593    /**
2594     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2595     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
2596     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
2597     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
2598     * {@code KVStoreResultSet} objects in a timely manner.
2599     *
2600     * @param { string } deviceId - Identifies the device whose data is to be queried.
2601     * @param { string } keyPrefix - Indicates the key prefix to match.
2602     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2603     * object matching the specified deviceId and keyPrefix.
2604     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2605     * <br>2.Incorrect parameters types.
2606     * @throws { BusinessError } 15100003 - Database corrupted.
2607     * @throws { BusinessError } 15100005 - Database or result set already closed.
2608     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2609     * @since 9
2610     */
2611    /**
2612     * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
2613     * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
2614     * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
2615     * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
2616     * {@code KVStoreResultSet} objects in a timely manner.
2617     *
2618     * @param { string } deviceId - Identifies the device whose data is to be queried.
2619     * @param { string } keyPrefix - Indicates the key prefix to match.
2620     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2621     * object matching the specified deviceId and keyPrefix.
2622     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2623     * <br>2.Incorrect parameters types.
2624     * @throws { BusinessError } 15100001 - Over max limits.
2625     * @throws { BusinessError } 15100003 - Database corrupted.
2626     * @throws { BusinessError } 15100005 - Database or result set already closed.
2627     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2628     * @since 10
2629     */
2630    getResultSet(deviceId: string, keyPrefix: string): Promise<KVStoreResultSet>;
2631
2632    /**
2633     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2634     *
2635     * @param { Query } query - Indicates the {@code Query} object.
2636     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2637     * object matching the local device ID and specified {@code Query} object.
2638     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2639     * <br>2.Incorrect parameters types.
2640     * @throws { BusinessError } 15100003 - Database corrupted.
2641     * @throws { BusinessError } 15100005 - Database or result set already closed.
2642     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2643     * @since 9
2644     */
2645    /**
2646     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2647     *
2648     * @param { Query } query - Indicates the {@code Query} object.
2649     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2650     * object matching the local device ID and specified {@code Query} object.
2651     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2652     * <br>2.Incorrect parameters types.
2653     * @throws { BusinessError } 15100001 - Over max limits.
2654     * @throws { BusinessError } 15100003 - Database corrupted.
2655     * @throws { BusinessError } 15100005 - Database or result set already closed.
2656     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2657     * @since 10
2658     */
2659    getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
2660
2661    /**
2662     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2663     *
2664     * @param { Query } query - Indicates the {@code Query} object.
2665     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2666     * object matching the local device ID and specified {@code Query} object.
2667     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2668     * <br>2.Incorrect parameters types.
2669     * @throws { BusinessError } 15100003 - Database corrupted.
2670     * @throws { BusinessError } 15100005 - Database or result set already closed.
2671     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2672     * @since 9
2673     */
2674    /**
2675     * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
2676     *
2677     * @param { Query } query - Indicates the {@code Query} object.
2678     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2679     * object matching the local device ID and specified {@code Query} object.
2680     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2681     * <br>2.Incorrect parameters types.
2682     * @throws { BusinessError } 15100001 - Over max limits.
2683     * @throws { BusinessError } 15100003 - Database corrupted.
2684     * @throws { BusinessError } 15100005 - Database or result set already closed.
2685     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2686     * @since 10
2687     */
2688    getResultSet(query: Query): Promise<KVStoreResultSet>;
2689
2690    /**
2691     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2692     *
2693     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
2694     * @param { Query } query - Indicates the {@code Query} object.
2695     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2696     * object matching the specified deviceId and {@code Query} object.
2697     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2698     * <br>2.Incorrect parameters types.
2699     * @throws { BusinessError } 15100003 - Database corrupted.
2700     * @throws { BusinessError } 15100005 - Database or result set already closed.
2701     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2702     * @since 9
2703     */
2704    /**
2705     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2706     *
2707     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
2708     * @param { Query } query - Indicates the {@code Query} object.
2709     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2710     * object matching the specified deviceId and {@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.DistributedKVStore
2717     * @since 10
2718     */
2719    getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
2720
2721    /**
2722     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2723     *
2724     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
2725     * @param { Query } query - Indicates the {@code Query} object.
2726     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2727     * object matching the specified deviceId and {@code Query} object.
2728     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2729     * <br>2.Incorrect parameters types.
2730     * @throws { BusinessError } 15100003 - Database corrupted.
2731     * @throws { BusinessError } 15100005 - Database or result set already closed.
2732     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2733     * @since 9
2734     */
2735    /**
2736     * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
2737     *
2738     * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
2739     * @param { Query } query - Indicates the {@code Query} object.
2740     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2741     * object matching the specified deviceId and {@code Query} object.
2742     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2743     * <br>2.Incorrect parameters types.
2744     * @throws { BusinessError } 15100001 - Over max limits.
2745     * @throws { BusinessError } 15100003 - Database corrupted.
2746     * @throws { BusinessError } 15100005 - Database or result set already closed.
2747     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2748     * @since 10
2749     */
2750    getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet>;
2751
2752    /**
2753     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2754     *
2755     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2756     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2757     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2758     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2759     * <br>2.Incorrect parameters types.
2760     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2761     * @throws { BusinessError } 15100003 - Database corrupted.
2762     * @throws { BusinessError } 15100005 - Database or result set already closed.
2763     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2764     * @systemapi
2765     * @StageModelOnly
2766     * @since 9
2767     */
2768    /**
2769     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2770     *
2771     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2772     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2773     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2774     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2775     * <br>2.Incorrect parameters types.
2776     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2777     * @throws { BusinessError } 15100001 - Over max limits.
2778     * @throws { BusinessError } 15100003 - Database corrupted.
2779     * @throws { BusinessError } 15100005 - Database or result set already closed.
2780     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2781     * @systemapi
2782     * @StageModelOnly
2783     * @since 10
2784     */
2785    getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void;
2786
2787    /**
2788     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2789     *
2790     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2791     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2792     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2793     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2794     * <br>2.Incorrect parameters types.
2795     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2796     * @throws { BusinessError } 15100003 - Database corrupted.
2797     * @throws { BusinessError } 15100005 - Database or result set already closed.
2798     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2799     * @systemapi
2800     * @StageModelOnly
2801     * @since 9
2802     */
2803    /**
2804     * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
2805     *
2806     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
2807     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2808     * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
2809     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2810     * <br>2.Incorrect parameters types.
2811     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2812     * @throws { BusinessError } 15100001 - Over max limits.
2813     * @throws { BusinessError } 15100003 - Database corrupted.
2814     * @throws { BusinessError } 15100005 - Database or result set already closed.
2815     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2816     * @systemapi
2817     * @StageModelOnly
2818     * @since 10
2819     */
2820    getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
2821
2822    /**
2823     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2824     *
2825     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2826     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2827     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2828     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2829     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2830     * <br>2.Incorrect parameters types.
2831     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2832     * @throws { BusinessError } 15100003 - Database corrupted.
2833     * @throws { BusinessError } 15100005 - Database or result set already closed.
2834     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2835     * @systemapi
2836     * @StageModelOnly
2837     * @since 9
2838     */
2839    /**
2840     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2841     *
2842     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2843     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2844     * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
2845     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2846     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2847     * <br>2.Incorrect parameters types.
2848     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2849     * @throws { BusinessError } 15100001 - Over max limits.
2850     * @throws { BusinessError } 15100003 - Database corrupted.
2851     * @throws { BusinessError } 15100005 - Database or result set already closed.
2852     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2853     * @systemapi
2854     * @StageModelOnly
2855     * @since 10
2856     */
2857    getResultSet(
2858      deviceId: string,
2859      predicates: dataSharePredicates.DataSharePredicates,
2860      callback: AsyncCallback<KVStoreResultSet>
2861    ): void;
2862
2863    /**
2864     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2865     *
2866     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2867     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2868     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2869     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2870     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2871     * <br>2.Incorrect parameters types.
2872     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2873     * @throws { BusinessError } 15100003 - Database corrupted.
2874     * @throws { BusinessError } 15100005 - Database or result set already closed.
2875     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2876     * @systemapi
2877     * @StageModelOnly
2878     * @since 9
2879     */
2880    /**
2881     * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
2882     *
2883     * @param { string } deviceId Indicates the ID of the device to which the results belong.
2884     * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
2885     * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
2886     * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
2887     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2888     * <br>2.Incorrect parameters types.
2889     * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
2890     * @throws { BusinessError } 15100001 - Over max limits.
2891     * @throws { BusinessError } 15100003 - Database corrupted.
2892     * @throws { BusinessError } 15100005 - Database or result set already closed.
2893     * @syscap SystemCapability.DistributedDataManager.DataShare.Provider
2894     * @systemapi
2895     * @StageModelOnly
2896     * @since 10
2897     */
2898    getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
2899
2900    /**
2901     * Obtains the number of results matching the local device ID and specified {@code Query} object.
2902     *
2903     * @param { Query } query - Indicates the {@code Query} object.
2904     * @param { AsyncCallback<number> } callback - {number}: the number of results matching the
2905     * local device ID and specified {@code Query} object.
2906     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2907     * <br>2.Incorrect parameters types.
2908     * @throws { BusinessError } 15100003 - Database corrupted.
2909     * @throws { BusinessError } 15100005 - Database or result set already closed.
2910     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2911     * @since 9
2912     */
2913    getResultSize(query: Query, callback: AsyncCallback<number>): void;
2914
2915    /**
2916     * Obtains the number of results matching the local device ID and specified {@code Query} object.
2917     *
2918     * @param { Query } query - Indicates the {@code Query} object.
2919     * @returns { Promise<number> } {number}: the number of results matching the local device ID and specified
2920     * {@code Query} object.
2921     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2922     * <br>2.Incorrect parameters types.
2923     * @throws { BusinessError } 15100003 - Database corrupted.
2924     * @throws { BusinessError } 15100005 - Database or result set already closed.
2925     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2926     * @since 9
2927     */
2928    getResultSize(query: Query): Promise<number>;
2929
2930    /**
2931     * Obtains the number of results matching a specified device ID and {@code Query} object.
2932     *
2933     * @param { string } deviceId - Indicates the ID of the device to which the results belong.
2934     * @param { Query } query - Indicates the {@code Query} object.
2935     * @param { AsyncCallback<number> } callback - {number}: the number of results matching the
2936     * specified deviceId and {@code Query} object.
2937     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2938     * <br>2.Incorrect parameters types.
2939     * @throws { BusinessError } 15100003 - Database corrupted.
2940     * @throws { BusinessError } 15100005 - Database or result set already closed.
2941     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2942     * @since 9
2943     */
2944    getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void;
2945
2946    /**
2947     * Obtains the number of results matching a specified device ID and {@code Query} object.
2948     *
2949     * @param { string } deviceId - Indicates the ID of the device to which the results belong.
2950     * @param { Query } query - Indicates the {@code Query} object.
2951     * @returns { Promise<number> } {number}: the number of results matching the specified
2952     * deviceId and {@code Query} object.
2953     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2954     * <br>2.Incorrect parameters types.
2955     * @throws { BusinessError } 15100003 - Database corrupted.
2956     * @throws { BusinessError } 15100005 - Database or result set already closed.
2957     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
2958     * @since 9
2959     */
2960    getResultSize(deviceId: string, query: Query): Promise<number>;
2961  }
2962
2963  /**
2964   * Creates a {@link KVManager} instance based on the configuration information.
2965   * <p>You must pass {@link KVManagerConfig} to provide configuration information
2966   * to create a {@link KVManager} instance.
2967   *
2968   * @param { KVManagerConfig } config - Indicates the KVStore configuration information,
2969   * including the package name and context, and package name can not be empty.
2970   * @returns { KVManager } : the {@code KVManager} instance.
2971   * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2972   * <br>2.Incorrect parameters types;
2973   * <br>3.Parameter verification failed.
2974   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2975   * @since 9
2976   */
2977  function createKVManager(config: KVManagerConfig): KVManager;
2978
2979  /**
2980   * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}.
2981   *
2982   * @interface KVManager
2983   * @syscap SystemCapability.DistributedDataManager.KVStore.Core
2984   * @since 9
2985   */
2986  interface KVManager {
2987    /**
2988     * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}.
2989     *
2990     * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique
2991     * for the same application, and different applications can share the same value. The storeId can consist
2992     * of only letters, digits, and underscores (_), and cannot exceed 128 characters.
2993     * @param { Options } options - Indicates the {@code Options} object used for creating and
2994     * obtaining the KVStore database.
2995     * @param { AsyncCallback<T> } callback - {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance.
2996     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
2997     * <br>2.Incorrect parameters types;
2998     * <br>3.Parameter verification failed.
2999     * @throws { BusinessError } 15100002 - Open existed database with changed options.
3000     * @throws { BusinessError } 15100003 - Database corrupted.
3001     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3002     * @since 9
3003     */
3004    getKVStore<T>(storeId: string, options: Options, callback: AsyncCallback<T>): void;
3005
3006    /**
3007     * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}.
3008     *
3009     * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique
3010     * for the same application, and different applications can share the same value. The storeId can consist
3011     * of only letters, digits, and underscores (_), and cannot exceed 128 characters.
3012     * @param { Options } options - Indicates the {@code Options} object used for creating and
3013     * obtaining the KVStore database.
3014     * @returns { Promise<T> } {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance.
3015     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3016     * <br>2.Incorrect parameters types;
3017     * <br>3.Parameter verification failed.
3018     * @throws { BusinessError } 15100002 - Open existed database with changed options.
3019     * @throws { BusinessError } 15100003 - Database corrupted.
3020     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3021     * @since 9
3022     */
3023    getKVStore<T>(storeId: string, options: Options): Promise<T>;
3024
3025    /**
3026     * Closes the KVStore database.
3027     * <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your
3028     * thread may crash.
3029     * <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this
3030     * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise
3031     * closing the database will fail.
3032     *
3033     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
3034     * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits,
3035     * and underscores (_), and cannot exceed 128 characters.
3036     * @param { AsyncCallback<void> } callback - the callback of closeKVStore.
3037     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3038     * <br>2.Parameter verification failed.
3039     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3040     * @since 9
3041     */
3042    closeKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void;
3043
3044    /**
3045     * Closes the KVStore database.
3046     * <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your
3047     * thread may crash.
3048     * <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this
3049     * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise
3050     * closing the database will fail.
3051     *
3052     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
3053     * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits,
3054     * and underscores (_), and cannot exceed 128 characters.
3055     * @returns { Promise<void> } the promise returned by the function.
3056     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3057     * <br>2.Parameter verification failed.
3058     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3059     * @since 9
3060     */
3061    closeKVStore(appId: string, storeId: string): Promise<void>;
3062
3063    /**
3064     * Deletes the KVStore database identified by storeId.
3065     * <p>Before using this method, close all KVStore instances in use that are identified by the same storeId.
3066     * <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be
3067     * lost.
3068     *
3069     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
3070     * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits,
3071     * and underscores (_), and cannot exceed 128 characters.
3072     * @param { AsyncCallback<void> } callback - the callback of deleteKVStore.
3073     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3074     * <br>2.Parameter verification failed.
3075     * @throws { BusinessError } 15100004 - Not found.
3076     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3077     * @since 9
3078     */
3079    deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void;
3080
3081    /**
3082     * Deletes the KVStore database identified by storeId.
3083     * <p>Before using this method, close all KVStore instances in use that are identified by the same storeId.
3084     * <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be
3085     * lost.
3086     *
3087     * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
3088     * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits,
3089     * and underscores (_), and cannot exceed 128 characters.
3090     * @returns { Promise<void> } the promise returned by the function.
3091     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3092     * <br>2.Parameter verification failed.
3093     * @throws { BusinessError } 15100004 - Not found.
3094     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3095     * @since 9
3096     */
3097    deleteKVStore(appId: string, storeId: string): Promise<void>;
3098
3099    /**
3100     * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by
3101     * calling the {@code deleteKVStore} method.
3102     *
3103     * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters.
3104     * @param { AsyncCallback<string[]> } callback - {string[]}: the storeId of all created KVStore databases.
3105     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3106     * <br>2.Parameter verification failed.
3107     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3108     * @since 9
3109     */
3110    getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void;
3111
3112    /**
3113     * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by
3114     * calling the {@code deleteKVStore} method.
3115     *
3116     * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters.
3117     * @returns { Promise<string[]> } {string[]}: the storeId of all created KVStore databases.
3118     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3119     * <br>2.Parameter verification failed.
3120     * @syscap SystemCapability.DistributedDataManager.KVStore.Core
3121     * @since 9
3122     */
3123    getAllKVStoreId(appId: string): Promise<string[]>;
3124
3125    /**
3126     * Register a death callback to get notification when the data manager service is terminated.
3127     * <p>If the data manager service is terminated,you need to re-subscribe to data change notifications and synchronization
3128     * completion notifications, and calling the sync method will return a failure.
3129     *
3130     * @param { 'distributedDataServiceDie' } event - Subscribed event name, fixed as 'distributedDataServiceDie', as a service status change events.
3131     * @param { Callback<void> } deathCallback - callback to be invoked when the data manager service is terminated.
3132     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3133     * <br>2.Incorrect parameters types;
3134     * <br>3.Parameter verification failed.
3135     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
3136     * @since 9
3137     */
3138    on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void;
3139
3140    /**
3141     * Unregister the death callback. Not notification will be received when the data manager service is terminated.
3142     * <p>The unregistered death callback must be a registered death callback of the database. If no death callback parameter
3143     * is passed, all database death callbacks will be unregistered.
3144     *
3145     * @param { 'distributedDataServiceDie' } event - Unsubscribe event name, fixed as 'distributedDataServiceDie', as a service status change events.
3146     * @param { Callback<void> } deathCallback - the data manager service is terminated callback which has been registered.
3147     * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
3148     * <br>2.Incorrect parameters types;
3149     * <br>3.Parameter verification failed.
3150     * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
3151     * @since 9
3152     */
3153    off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void;
3154  }
3155}
3156
3157export default distributedKVStore;