161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkData 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback, Callback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport { ValuesBucket } from './@ohos.data.ValuesBucket'; 2361847f8eSopenharmony_ciimport dataSharePredicates from './@ohos.data.dataSharePredicates'; 2461847f8eSopenharmony_ciimport BaseContext from './application/BaseContext'; 2561847f8eSopenharmony_ci 2661847f8eSopenharmony_ci/** 2761847f8eSopenharmony_ci * Provider interfaces to create a {@link KVManager} instance. 2861847f8eSopenharmony_ci * 2961847f8eSopenharmony_ci * @namespace distributedKVStore 3061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 3161847f8eSopenharmony_ci * @since 9 3261847f8eSopenharmony_ci */ 3361847f8eSopenharmony_cideclare namespace distributedKVStore { 3461847f8eSopenharmony_ci /** 3561847f8eSopenharmony_ci * Provides configuration information to create a {@link KVManager} instance, 3661847f8eSopenharmony_ci * which includes the caller's package name and ability or hap context. 3761847f8eSopenharmony_ci * 3861847f8eSopenharmony_ci * @interface KVManagerConfig 3961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 4061847f8eSopenharmony_ci * @since 9 4161847f8eSopenharmony_ci */ 4261847f8eSopenharmony_ci interface KVManagerConfig { 4361847f8eSopenharmony_ci /** 4461847f8eSopenharmony_ci * Indicates the bundleName 4561847f8eSopenharmony_ci * 4661847f8eSopenharmony_ci * @type { string } 4761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 4861847f8eSopenharmony_ci * @since 9 4961847f8eSopenharmony_ci */ 5061847f8eSopenharmony_ci bundleName: string; 5161847f8eSopenharmony_ci 5261847f8eSopenharmony_ci /** 5361847f8eSopenharmony_ci * Indicates the ability or hap context 5461847f8eSopenharmony_ci * 5561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 5661847f8eSopenharmony_ci * if swap the area, you should close all the KV store and use the new Context to create the KVManager 5761847f8eSopenharmony_ci * @since 9 5861847f8eSopenharmony_ci */ 5961847f8eSopenharmony_ci /** 6061847f8eSopenharmony_ci * Indicates the ability or hap context 6161847f8eSopenharmony_ci * 6261847f8eSopenharmony_ci * @type { BaseContext } 6361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 6461847f8eSopenharmony_ci * if swap the area, you should close all the KV store and use the new BaseContext to create the KVManager 6561847f8eSopenharmony_ci * @since 10 6661847f8eSopenharmony_ci */ 6761847f8eSopenharmony_ci context: BaseContext; 6861847f8eSopenharmony_ci } 6961847f8eSopenharmony_ci 7061847f8eSopenharmony_ci /** 7161847f8eSopenharmony_ci * KVStore constants 7261847f8eSopenharmony_ci * 7361847f8eSopenharmony_ci * @interface Constants 7461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 7561847f8eSopenharmony_ci * @since 9 7661847f8eSopenharmony_ci */ 7761847f8eSopenharmony_ci interface Constants { 7861847f8eSopenharmony_ci /** 7961847f8eSopenharmony_ci * Max key length is 1024. 8061847f8eSopenharmony_ci * 8161847f8eSopenharmony_ci * @type { number } 8261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 8361847f8eSopenharmony_ci * @since 9 8461847f8eSopenharmony_ci */ 8561847f8eSopenharmony_ci readonly MAX_KEY_LENGTH: number; 8661847f8eSopenharmony_ci 8761847f8eSopenharmony_ci /** 8861847f8eSopenharmony_ci * Max value length is 4194303. 8961847f8eSopenharmony_ci * 9061847f8eSopenharmony_ci * @type { number } 9161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 9261847f8eSopenharmony_ci * @since 9 9361847f8eSopenharmony_ci */ 9461847f8eSopenharmony_ci readonly MAX_VALUE_LENGTH: number; 9561847f8eSopenharmony_ci 9661847f8eSopenharmony_ci /** 9761847f8eSopenharmony_ci * Max device coordinate key length is 896. 9861847f8eSopenharmony_ci * 9961847f8eSopenharmony_ci * @type { number } 10061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 10161847f8eSopenharmony_ci * @since 9 10261847f8eSopenharmony_ci */ 10361847f8eSopenharmony_ci readonly MAX_KEY_LENGTH_DEVICE: number; 10461847f8eSopenharmony_ci 10561847f8eSopenharmony_ci /** 10661847f8eSopenharmony_ci * Max store id length is 128. 10761847f8eSopenharmony_ci * 10861847f8eSopenharmony_ci * @type { number } 10961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 11061847f8eSopenharmony_ci * @since 9 11161847f8eSopenharmony_ci */ 11261847f8eSopenharmony_ci readonly MAX_STORE_ID_LENGTH: number; 11361847f8eSopenharmony_ci 11461847f8eSopenharmony_ci /** 11561847f8eSopenharmony_ci * Max query length is 512000. 11661847f8eSopenharmony_ci * 11761847f8eSopenharmony_ci * @type { number } 11861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 11961847f8eSopenharmony_ci * @since 9 12061847f8eSopenharmony_ci */ 12161847f8eSopenharmony_ci readonly MAX_QUERY_LENGTH: number; 12261847f8eSopenharmony_ci 12361847f8eSopenharmony_ci /** 12461847f8eSopenharmony_ci * Max batch operation size is 128. 12561847f8eSopenharmony_ci * 12661847f8eSopenharmony_ci * @type { number } 12761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 12861847f8eSopenharmony_ci * @since 9 12961847f8eSopenharmony_ci */ 13061847f8eSopenharmony_ci readonly MAX_BATCH_SIZE: number; 13161847f8eSopenharmony_ci } 13261847f8eSopenharmony_ci 13361847f8eSopenharmony_ci /** 13461847f8eSopenharmony_ci * Indicates the {@code ValueType}. 13561847f8eSopenharmony_ci * <p>{@code ValueType} is obtained based on the value. 13661847f8eSopenharmony_ci * 13761847f8eSopenharmony_ci * @enum { number } 13861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 13961847f8eSopenharmony_ci * @since 9 14061847f8eSopenharmony_ci */ 14161847f8eSopenharmony_ci enum ValueType { 14261847f8eSopenharmony_ci /** 14361847f8eSopenharmony_ci * Indicates that the value type is string. 14461847f8eSopenharmony_ci * 14561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 14661847f8eSopenharmony_ci * @since 9 14761847f8eSopenharmony_ci */ 14861847f8eSopenharmony_ci STRING, 14961847f8eSopenharmony_ci 15061847f8eSopenharmony_ci /** 15161847f8eSopenharmony_ci * Indicates that the value type is int. 15261847f8eSopenharmony_ci * 15361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 15461847f8eSopenharmony_ci * @since 9 15561847f8eSopenharmony_ci */ 15661847f8eSopenharmony_ci INTEGER, 15761847f8eSopenharmony_ci 15861847f8eSopenharmony_ci /** 15961847f8eSopenharmony_ci * Indicates that the value type is float. 16061847f8eSopenharmony_ci * 16161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 16261847f8eSopenharmony_ci * @since 9 16361847f8eSopenharmony_ci */ 16461847f8eSopenharmony_ci FLOAT, 16561847f8eSopenharmony_ci 16661847f8eSopenharmony_ci /** 16761847f8eSopenharmony_ci * Indicates that the value type is byte array. 16861847f8eSopenharmony_ci * 16961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 17061847f8eSopenharmony_ci * @since 9 17161847f8eSopenharmony_ci */ 17261847f8eSopenharmony_ci BYTE_ARRAY, 17361847f8eSopenharmony_ci 17461847f8eSopenharmony_ci /** 17561847f8eSopenharmony_ci * Indicates that the value type is boolean. 17661847f8eSopenharmony_ci * 17761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 17861847f8eSopenharmony_ci * @since 9 17961847f8eSopenharmony_ci */ 18061847f8eSopenharmony_ci BOOLEAN, 18161847f8eSopenharmony_ci 18261847f8eSopenharmony_ci /** 18361847f8eSopenharmony_ci * Indicates that the value type is double. 18461847f8eSopenharmony_ci * 18561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 18661847f8eSopenharmony_ci * @since 9 18761847f8eSopenharmony_ci */ 18861847f8eSopenharmony_ci DOUBLE 18961847f8eSopenharmony_ci } 19061847f8eSopenharmony_ci 19161847f8eSopenharmony_ci /** 19261847f8eSopenharmony_ci * Obtains {@code Value} objects stored in a {@link SingleKVStore} or {@link DeviceKVStore} database. 19361847f8eSopenharmony_ci * 19461847f8eSopenharmony_ci * @interface Value 19561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 19661847f8eSopenharmony_ci * @since 9 19761847f8eSopenharmony_ci */ 19861847f8eSopenharmony_ci interface Value { 19961847f8eSopenharmony_ci /** 20061847f8eSopenharmony_ci * Indicates the value type 20161847f8eSopenharmony_ci * 20261847f8eSopenharmony_ci * @type { ValueType } 20361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 20461847f8eSopenharmony_ci * @since 9 20561847f8eSopenharmony_ci * @see ValueType 20661847f8eSopenharmony_ci */ 20761847f8eSopenharmony_ci type: ValueType; 20861847f8eSopenharmony_ci 20961847f8eSopenharmony_ci /** 21061847f8eSopenharmony_ci * Indicates the value 21161847f8eSopenharmony_ci * 21261847f8eSopenharmony_ci * @type { Uint8Array | string | number | boolean } 21361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 21461847f8eSopenharmony_ci * @since 9 21561847f8eSopenharmony_ci */ 21661847f8eSopenharmony_ci value: Uint8Array | string | number | boolean; 21761847f8eSopenharmony_ci } 21861847f8eSopenharmony_ci 21961847f8eSopenharmony_ci /** 22061847f8eSopenharmony_ci * Provides key-value pairs stored in the distributedKVStore. 22161847f8eSopenharmony_ci * 22261847f8eSopenharmony_ci * @interface Entry 22361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 22461847f8eSopenharmony_ci * @since 9 22561847f8eSopenharmony_ci */ 22661847f8eSopenharmony_ci interface Entry { 22761847f8eSopenharmony_ci /** 22861847f8eSopenharmony_ci * Indicates the key 22961847f8eSopenharmony_ci * 23061847f8eSopenharmony_ci * @type { string } 23161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 23261847f8eSopenharmony_ci * @since 9 23361847f8eSopenharmony_ci */ 23461847f8eSopenharmony_ci key: string; 23561847f8eSopenharmony_ci 23661847f8eSopenharmony_ci /** 23761847f8eSopenharmony_ci * Indicates the value 23861847f8eSopenharmony_ci * 23961847f8eSopenharmony_ci * @type { Value } 24061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 24161847f8eSopenharmony_ci * @since 9 24261847f8eSopenharmony_ci */ 24361847f8eSopenharmony_ci value: Value; 24461847f8eSopenharmony_ci } 24561847f8eSopenharmony_ci 24661847f8eSopenharmony_ci /** 24761847f8eSopenharmony_ci * Receive notifications of all data changes, including data insertion, update, and deletion. 24861847f8eSopenharmony_ci * <p>If you have subscribed to {@code SingleKVStore} or {@code DeviceKVStore}, you will receive 24961847f8eSopenharmony_ci * data change notifications and obtain the changed data from the parameters in callback methods 25061847f8eSopenharmony_ci * upon data insertion, update or deletion. 25161847f8eSopenharmony_ci * 25261847f8eSopenharmony_ci * @interface ChangeNotification 25361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 25461847f8eSopenharmony_ci * @since 9 25561847f8eSopenharmony_ci */ 25661847f8eSopenharmony_ci interface ChangeNotification { 25761847f8eSopenharmony_ci /** 25861847f8eSopenharmony_ci * Indicates data insertion records. 25961847f8eSopenharmony_ci * 26061847f8eSopenharmony_ci * @type { Entry[] } 26161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 26261847f8eSopenharmony_ci * @since 9 26361847f8eSopenharmony_ci */ 26461847f8eSopenharmony_ci insertEntries: Entry[]; 26561847f8eSopenharmony_ci 26661847f8eSopenharmony_ci /** 26761847f8eSopenharmony_ci * Indicates data update records. 26861847f8eSopenharmony_ci * 26961847f8eSopenharmony_ci * @type { Entry[] } 27061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 27161847f8eSopenharmony_ci * @since 9 27261847f8eSopenharmony_ci */ 27361847f8eSopenharmony_ci updateEntries: Entry[]; 27461847f8eSopenharmony_ci 27561847f8eSopenharmony_ci /** 27661847f8eSopenharmony_ci * Indicates data deletion records. 27761847f8eSopenharmony_ci * 27861847f8eSopenharmony_ci * @type { Entry[] } 27961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 28061847f8eSopenharmony_ci * @since 9 28161847f8eSopenharmony_ci */ 28261847f8eSopenharmony_ci deleteEntries: Entry[]; 28361847f8eSopenharmony_ci 28461847f8eSopenharmony_ci /** 28561847f8eSopenharmony_ci * Indicates the device id which brings the data change. 28661847f8eSopenharmony_ci * 28761847f8eSopenharmony_ci * @type { string } 28861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 28961847f8eSopenharmony_ci * @since 9 29061847f8eSopenharmony_ci */ 29161847f8eSopenharmony_ci deviceId: string; 29261847f8eSopenharmony_ci } 29361847f8eSopenharmony_ci 29461847f8eSopenharmony_ci /** 29561847f8eSopenharmony_ci * Indicates the database synchronization mode. 29661847f8eSopenharmony_ci * 29761847f8eSopenharmony_ci * @enum { number } 29861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 29961847f8eSopenharmony_ci * @since 9 30061847f8eSopenharmony_ci */ 30161847f8eSopenharmony_ci enum SyncMode { 30261847f8eSopenharmony_ci /** 30361847f8eSopenharmony_ci * Indicates that data is only pulled from the remote end. 30461847f8eSopenharmony_ci * 30561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 30661847f8eSopenharmony_ci * @since 9 30761847f8eSopenharmony_ci */ 30861847f8eSopenharmony_ci PULL_ONLY, 30961847f8eSopenharmony_ci 31061847f8eSopenharmony_ci /** 31161847f8eSopenharmony_ci * Indicates that data is only pushed from the local end. 31261847f8eSopenharmony_ci * 31361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 31461847f8eSopenharmony_ci * @since 9 31561847f8eSopenharmony_ci */ 31661847f8eSopenharmony_ci PUSH_ONLY, 31761847f8eSopenharmony_ci 31861847f8eSopenharmony_ci /** 31961847f8eSopenharmony_ci * Indicates that data is pushed from the local end, and then pulled from the remote end. 32061847f8eSopenharmony_ci * 32161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 32261847f8eSopenharmony_ci * @since 9 32361847f8eSopenharmony_ci */ 32461847f8eSopenharmony_ci PUSH_PULL 32561847f8eSopenharmony_ci } 32661847f8eSopenharmony_ci 32761847f8eSopenharmony_ci /** 32861847f8eSopenharmony_ci * Describes the subscription type. 32961847f8eSopenharmony_ci * 33061847f8eSopenharmony_ci * @enum { number } 33161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 33261847f8eSopenharmony_ci * @since 9 33361847f8eSopenharmony_ci */ 33461847f8eSopenharmony_ci enum SubscribeType { 33561847f8eSopenharmony_ci /** 33661847f8eSopenharmony_ci * Subscription to local data changes 33761847f8eSopenharmony_ci * 33861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 33961847f8eSopenharmony_ci * @since 9 34061847f8eSopenharmony_ci */ 34161847f8eSopenharmony_ci SUBSCRIBE_TYPE_LOCAL, 34261847f8eSopenharmony_ci 34361847f8eSopenharmony_ci /** 34461847f8eSopenharmony_ci * Subscription to remote data changes 34561847f8eSopenharmony_ci * 34661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 34761847f8eSopenharmony_ci * @since 9 34861847f8eSopenharmony_ci */ 34961847f8eSopenharmony_ci SUBSCRIBE_TYPE_REMOTE, 35061847f8eSopenharmony_ci 35161847f8eSopenharmony_ci /** 35261847f8eSopenharmony_ci * Subscription to both local and remote data changes 35361847f8eSopenharmony_ci * 35461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 35561847f8eSopenharmony_ci * @since 9 35661847f8eSopenharmony_ci */ 35761847f8eSopenharmony_ci SUBSCRIBE_TYPE_ALL 35861847f8eSopenharmony_ci } 35961847f8eSopenharmony_ci 36061847f8eSopenharmony_ci /** 36161847f8eSopenharmony_ci * Describes the KVStore type. 36261847f8eSopenharmony_ci * 36361847f8eSopenharmony_ci * @enum { number } 36461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 36561847f8eSopenharmony_ci * @since 9 36661847f8eSopenharmony_ci */ 36761847f8eSopenharmony_ci enum KVStoreType { 36861847f8eSopenharmony_ci /** 36961847f8eSopenharmony_ci * Device-collaboration database, as specified by {@code DeviceKVStore} 37061847f8eSopenharmony_ci * 37161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 37261847f8eSopenharmony_ci * @since 9 37361847f8eSopenharmony_ci */ 37461847f8eSopenharmony_ci DEVICE_COLLABORATION, 37561847f8eSopenharmony_ci 37661847f8eSopenharmony_ci /** 37761847f8eSopenharmony_ci * Single-version database, as specified by {@code SingleKVStore} 37861847f8eSopenharmony_ci * 37961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 38061847f8eSopenharmony_ci * @since 9 38161847f8eSopenharmony_ci */ 38261847f8eSopenharmony_ci SINGLE_VERSION 38361847f8eSopenharmony_ci } 38461847f8eSopenharmony_ci 38561847f8eSopenharmony_ci /** 38661847f8eSopenharmony_ci * Describes the KVStore security level. 38761847f8eSopenharmony_ci * 38861847f8eSopenharmony_ci * @enum { number } 38961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 39061847f8eSopenharmony_ci * @since 9 39161847f8eSopenharmony_ci */ 39261847f8eSopenharmony_ci enum SecurityLevel { 39361847f8eSopenharmony_ci /** 39461847f8eSopenharmony_ci * S1: means the db is in the low security level 39561847f8eSopenharmony_ci * There are some low impact when the data is leaked. 39661847f8eSopenharmony_ci * 39761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 39861847f8eSopenharmony_ci * @since 9 39961847f8eSopenharmony_ci */ 40061847f8eSopenharmony_ci S1, 40161847f8eSopenharmony_ci 40261847f8eSopenharmony_ci /** 40361847f8eSopenharmony_ci * S2: means the db is in the middle security level 40461847f8eSopenharmony_ci * There are some major impact when the data is leaked. 40561847f8eSopenharmony_ci * 40661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 40761847f8eSopenharmony_ci * @since 9 40861847f8eSopenharmony_ci */ 40961847f8eSopenharmony_ci S2, 41061847f8eSopenharmony_ci 41161847f8eSopenharmony_ci /** 41261847f8eSopenharmony_ci * S3: means the db is in the high security level 41361847f8eSopenharmony_ci * There are some severity impact when the data is leaked. 41461847f8eSopenharmony_ci * 41561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 41661847f8eSopenharmony_ci * @since 9 41761847f8eSopenharmony_ci */ 41861847f8eSopenharmony_ci S3, 41961847f8eSopenharmony_ci 42061847f8eSopenharmony_ci /** 42161847f8eSopenharmony_ci * S4: means the db is in the critical security level 42261847f8eSopenharmony_ci * There are some critical impact when the data is leaked. 42361847f8eSopenharmony_ci * 42461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 42561847f8eSopenharmony_ci * @since 9 42661847f8eSopenharmony_ci */ 42761847f8eSopenharmony_ci S4 42861847f8eSopenharmony_ci } 42961847f8eSopenharmony_ci 43061847f8eSopenharmony_ci /** 43161847f8eSopenharmony_ci * Provides configuration options to create a {@code SingleKVStore} or {@code DeviceKVStore}. 43261847f8eSopenharmony_ci * 43361847f8eSopenharmony_ci * @interface Options 43461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 43561847f8eSopenharmony_ci * @since 9 43661847f8eSopenharmony_ci */ 43761847f8eSopenharmony_ci interface Options { 43861847f8eSopenharmony_ci /** 43961847f8eSopenharmony_ci * Indicates whether to create a database when the database file does not exist 44061847f8eSopenharmony_ci * 44161847f8eSopenharmony_ci * @type { ?boolean } 44261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 44361847f8eSopenharmony_ci * @since 9 44461847f8eSopenharmony_ci */ 44561847f8eSopenharmony_ci createIfMissing?: boolean; 44661847f8eSopenharmony_ci 44761847f8eSopenharmony_ci /** 44861847f8eSopenharmony_ci * Indicates whether database files to be encrypted 44961847f8eSopenharmony_ci * 45061847f8eSopenharmony_ci * @type { ?boolean } 45161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 45261847f8eSopenharmony_ci * @since 9 45361847f8eSopenharmony_ci */ 45461847f8eSopenharmony_ci encrypt?: boolean; 45561847f8eSopenharmony_ci 45661847f8eSopenharmony_ci /** 45761847f8eSopenharmony_ci * Indicates whether to back up database files 45861847f8eSopenharmony_ci * 45961847f8eSopenharmony_ci * @type { ?boolean } 46061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 46161847f8eSopenharmony_ci * @since 9 46261847f8eSopenharmony_ci */ 46361847f8eSopenharmony_ci backup?: boolean; 46461847f8eSopenharmony_ci 46561847f8eSopenharmony_ci /** 46661847f8eSopenharmony_ci * Indicates whether database files are automatically synchronized 46761847f8eSopenharmony_ci * 46861847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 46961847f8eSopenharmony_ci * @type { ?boolean } 47061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 47161847f8eSopenharmony_ci * @since 9 47261847f8eSopenharmony_ci */ 47361847f8eSopenharmony_ci autoSync?: boolean; 47461847f8eSopenharmony_ci 47561847f8eSopenharmony_ci /** 47661847f8eSopenharmony_ci * Indicates the database type 47761847f8eSopenharmony_ci * 47861847f8eSopenharmony_ci * @type { ?KVStoreType } 47961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 48061847f8eSopenharmony_ci * @since 9 48161847f8eSopenharmony_ci */ 48261847f8eSopenharmony_ci kvStoreType?: KVStoreType; 48361847f8eSopenharmony_ci 48461847f8eSopenharmony_ci /** 48561847f8eSopenharmony_ci * Indicates the database security level 48661847f8eSopenharmony_ci * 48761847f8eSopenharmony_ci * @type { SecurityLevel } 48861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 48961847f8eSopenharmony_ci * @since 9 49061847f8eSopenharmony_ci */ 49161847f8eSopenharmony_ci securityLevel: SecurityLevel; 49261847f8eSopenharmony_ci 49361847f8eSopenharmony_ci /** 49461847f8eSopenharmony_ci * Indicates the database schema 49561847f8eSopenharmony_ci * 49661847f8eSopenharmony_ci * @type { ?Schema } 49761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 49861847f8eSopenharmony_ci * @since 9 49961847f8eSopenharmony_ci */ 50061847f8eSopenharmony_ci schema?: Schema; 50161847f8eSopenharmony_ci } 50261847f8eSopenharmony_ci 50361847f8eSopenharmony_ci /** 50461847f8eSopenharmony_ci * Represents the database schema. 50561847f8eSopenharmony_ci * You can set the schema object in options when create or open the database. 50661847f8eSopenharmony_ci * 50761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 50861847f8eSopenharmony_ci * @since 9 50961847f8eSopenharmony_ci */ 51061847f8eSopenharmony_ci class Schema { 51161847f8eSopenharmony_ci /** 51261847f8eSopenharmony_ci * A constructor used to create a Schema instance. 51361847f8eSopenharmony_ci * 51461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 51561847f8eSopenharmony_ci * @since 9 51661847f8eSopenharmony_ci */ 51761847f8eSopenharmony_ci constructor(); 51861847f8eSopenharmony_ci 51961847f8eSopenharmony_ci /** 52061847f8eSopenharmony_ci * Indicates the root json object. 52161847f8eSopenharmony_ci * 52261847f8eSopenharmony_ci * @type { FieldNode } 52361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 52461847f8eSopenharmony_ci * @since 9 52561847f8eSopenharmony_ci */ 52661847f8eSopenharmony_ci root: FieldNode; 52761847f8eSopenharmony_ci 52861847f8eSopenharmony_ci /** 52961847f8eSopenharmony_ci * Indicates the string array of json. 53061847f8eSopenharmony_ci * 53161847f8eSopenharmony_ci * @type { Array<string> } 53261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 53361847f8eSopenharmony_ci * @since 9 53461847f8eSopenharmony_ci */ 53561847f8eSopenharmony_ci indexes: Array<string>; 53661847f8eSopenharmony_ci 53761847f8eSopenharmony_ci /** 53861847f8eSopenharmony_ci * Indicates the mode of schema. 53961847f8eSopenharmony_ci * 54061847f8eSopenharmony_ci * @type { number } 54161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 54261847f8eSopenharmony_ci * @since 9 54361847f8eSopenharmony_ci */ 54461847f8eSopenharmony_ci mode: number; 54561847f8eSopenharmony_ci 54661847f8eSopenharmony_ci /** 54761847f8eSopenharmony_ci * Indicates the skip size of schema. 54861847f8eSopenharmony_ci * 54961847f8eSopenharmony_ci * @type { number } 55061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 55161847f8eSopenharmony_ci * @since 9 55261847f8eSopenharmony_ci */ 55361847f8eSopenharmony_ci skip: number; 55461847f8eSopenharmony_ci } 55561847f8eSopenharmony_ci 55661847f8eSopenharmony_ci /** 55761847f8eSopenharmony_ci * Represents a node of a {@link Schema} instance. 55861847f8eSopenharmony_ci * <p>With a {@link Schema} instance, you can define the value fields which stored in the database. 55961847f8eSopenharmony_ci * <p>A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. 56061847f8eSopenharmony_ci * <p>The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. 56161847f8eSopenharmony_ci * 56261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 56361847f8eSopenharmony_ci * @since 9 56461847f8eSopenharmony_ci */ 56561847f8eSopenharmony_ci class FieldNode { 56661847f8eSopenharmony_ci /** 56761847f8eSopenharmony_ci * A constructor used to create a FieldNode instance with the specified field. 56861847f8eSopenharmony_ci * name Indicates the field node name. 56961847f8eSopenharmony_ci * 57061847f8eSopenharmony_ci * @param { string } name - It can not be empty. 57161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 57261847f8eSopenharmony_ci * <br>2.Parameter verification failed. 57361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 57461847f8eSopenharmony_ci * @since 9 57561847f8eSopenharmony_ci */ 57661847f8eSopenharmony_ci constructor(name: string); 57761847f8eSopenharmony_ci 57861847f8eSopenharmony_ci /** 57961847f8eSopenharmony_ci * Adds a child node to this {@code FieldNode}. 58061847f8eSopenharmony_ci * <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. 58161847f8eSopenharmony_ci * 58261847f8eSopenharmony_ci * @param { FieldNode } child - The field node to append. 58361847f8eSopenharmony_ci * @returns { boolean } Returns true if the child node is successfully added to this {@code FieldNode} and false otherwise. 58461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 58561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 58661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 58761847f8eSopenharmony_ci * @since 9 58861847f8eSopenharmony_ci */ 58961847f8eSopenharmony_ci appendChild(child: FieldNode): boolean; 59061847f8eSopenharmony_ci 59161847f8eSopenharmony_ci /** 59261847f8eSopenharmony_ci * Indicates the default value of field node. 59361847f8eSopenharmony_ci * 59461847f8eSopenharmony_ci * @type { string } 59561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 59661847f8eSopenharmony_ci * @since 9 59761847f8eSopenharmony_ci */ 59861847f8eSopenharmony_ci default: string; 59961847f8eSopenharmony_ci 60061847f8eSopenharmony_ci /** 60161847f8eSopenharmony_ci * Indicates the nullable of database field. 60261847f8eSopenharmony_ci * 60361847f8eSopenharmony_ci * @type { boolean } 60461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 60561847f8eSopenharmony_ci * @since 9 60661847f8eSopenharmony_ci */ 60761847f8eSopenharmony_ci nullable: boolean; 60861847f8eSopenharmony_ci 60961847f8eSopenharmony_ci /** 61061847f8eSopenharmony_ci * Indicates the type of value. 61161847f8eSopenharmony_ci * 61261847f8eSopenharmony_ci * @type { number } 61361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 61461847f8eSopenharmony_ci * @since 9 61561847f8eSopenharmony_ci */ 61661847f8eSopenharmony_ci type: number; 61761847f8eSopenharmony_ci } 61861847f8eSopenharmony_ci 61961847f8eSopenharmony_ci /** 62061847f8eSopenharmony_ci * Provides methods to operate the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database. 62161847f8eSopenharmony_ci * <p>The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or 62261847f8eSopenharmony_ci * {@code DeviceKVStore} class. This interface also provides methods to move the data read 62361847f8eSopenharmony_ci * position in the result set. 62461847f8eSopenharmony_ci * 62561847f8eSopenharmony_ci * @interface KVStoreResultSet 62661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 62761847f8eSopenharmony_ci * @since 9 62861847f8eSopenharmony_ci */ 62961847f8eSopenharmony_ci interface KVStoreResultSet { 63061847f8eSopenharmony_ci /** 63161847f8eSopenharmony_ci * Obtains the number of lines in a result set. 63261847f8eSopenharmony_ci * 63361847f8eSopenharmony_ci * @returns { number } Returns the number of lines. 63461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 63561847f8eSopenharmony_ci * @since 9 63661847f8eSopenharmony_ci */ 63761847f8eSopenharmony_ci getCount(): number; 63861847f8eSopenharmony_ci 63961847f8eSopenharmony_ci /** 64061847f8eSopenharmony_ci * Obtains the current read position in a result set. 64161847f8eSopenharmony_ci * 64261847f8eSopenharmony_ci * @returns { number } Returns the current read position. The read position starts with 0. 64361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 64461847f8eSopenharmony_ci * @since 9 64561847f8eSopenharmony_ci */ 64661847f8eSopenharmony_ci getPosition(): number; 64761847f8eSopenharmony_ci 64861847f8eSopenharmony_ci /** 64961847f8eSopenharmony_ci * Moves the read position to the first line. 65061847f8eSopenharmony_ci * <p>If the result set is empty, false is returned. 65161847f8eSopenharmony_ci * 65261847f8eSopenharmony_ci * @returns { boolean } Returns true if the operation succeeds; return false otherwise. 65361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 65461847f8eSopenharmony_ci * @since 9 65561847f8eSopenharmony_ci */ 65661847f8eSopenharmony_ci moveToFirst(): boolean; 65761847f8eSopenharmony_ci 65861847f8eSopenharmony_ci /** 65961847f8eSopenharmony_ci * Moves the read position to the last line. 66061847f8eSopenharmony_ci * <p>If the result set is empty, false is returned. 66161847f8eSopenharmony_ci * 66261847f8eSopenharmony_ci * @returns { boolean } Returns true if the operation succeeds; return false otherwise. 66361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 66461847f8eSopenharmony_ci * @since 9 66561847f8eSopenharmony_ci */ 66661847f8eSopenharmony_ci moveToLast(): boolean; 66761847f8eSopenharmony_ci 66861847f8eSopenharmony_ci /** 66961847f8eSopenharmony_ci * Moves the read position to the next line. 67061847f8eSopenharmony_ci * <p>If the result set is empty or the data in the last line is being read, false is returned. 67161847f8eSopenharmony_ci * 67261847f8eSopenharmony_ci * @returns { boolean } Returns true if the operation succeeds; return false otherwise. 67361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 67461847f8eSopenharmony_ci * @since 9 67561847f8eSopenharmony_ci */ 67661847f8eSopenharmony_ci moveToNext(): boolean; 67761847f8eSopenharmony_ci 67861847f8eSopenharmony_ci /** 67961847f8eSopenharmony_ci * Moves the read position to the previous line. 68061847f8eSopenharmony_ci * <p>If the result set is empty or the data in the first line is being read, false is returned. 68161847f8eSopenharmony_ci * 68261847f8eSopenharmony_ci * @returns { boolean } Returns true if the operation succeeds; return false otherwise. 68361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 68461847f8eSopenharmony_ci * @since 9 68561847f8eSopenharmony_ci */ 68661847f8eSopenharmony_ci moveToPrevious(): boolean; 68761847f8eSopenharmony_ci 68861847f8eSopenharmony_ci /** 68961847f8eSopenharmony_ci * Moves the read position by a relative offset to the current position. 69061847f8eSopenharmony_ci * 69161847f8eSopenharmony_ci * @param { number } offset - Indicates the relative offset to the current position. A negative offset indicates moving 69261847f8eSopenharmony_ci * backwards, and a positive offset indicates moving forwards. For example, if the current position is entry 1 and 69361847f8eSopenharmony_ci * this offset is 2, the destination position will be entry 3; if the current position is entry 3 and this offset is -2, 69461847f8eSopenharmony_ci * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the 69561847f8eSopenharmony_ci * final position is invalid, false will be returned. 69661847f8eSopenharmony_ci * @returns { boolean } Returns true if the operation succeeds; return false otherwise. 69761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 69861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 69961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 70061847f8eSopenharmony_ci * @since 9 70161847f8eSopenharmony_ci */ 70261847f8eSopenharmony_ci move(offset: number): boolean; 70361847f8eSopenharmony_ci 70461847f8eSopenharmony_ci /** 70561847f8eSopenharmony_ci * Moves the read position from 0 to an absolute position. 70661847f8eSopenharmony_ci * 70761847f8eSopenharmony_ci * @param { number } position - Indicates the absolute position. 70861847f8eSopenharmony_ci * @returns { boolean } Returns true if the operation succeeds; return false otherwise. 70961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 71061847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 71161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 71261847f8eSopenharmony_ci * @since 9 71361847f8eSopenharmony_ci */ 71461847f8eSopenharmony_ci moveToPosition(position: number): boolean; 71561847f8eSopenharmony_ci 71661847f8eSopenharmony_ci /** 71761847f8eSopenharmony_ci * Checks whether the read position is the first line. 71861847f8eSopenharmony_ci * 71961847f8eSopenharmony_ci * @returns { boolean } Returns true if the read position is the first line; returns false otherwise. 72061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 72161847f8eSopenharmony_ci * @since 9 72261847f8eSopenharmony_ci */ 72361847f8eSopenharmony_ci isFirst(): boolean; 72461847f8eSopenharmony_ci 72561847f8eSopenharmony_ci /** 72661847f8eSopenharmony_ci * Checks whether the read position is the last line. 72761847f8eSopenharmony_ci * 72861847f8eSopenharmony_ci * @returns { boolean } Returns true if the read position is the last line; returns false otherwise. 72961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 73061847f8eSopenharmony_ci * @since 9 73161847f8eSopenharmony_ci */ 73261847f8eSopenharmony_ci isLast(): boolean; 73361847f8eSopenharmony_ci 73461847f8eSopenharmony_ci /** 73561847f8eSopenharmony_ci * Checks whether the read position is before the last line. 73661847f8eSopenharmony_ci * 73761847f8eSopenharmony_ci * @returns { boolean } Returns true if the read position is before the first line; returns false otherwise. 73861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 73961847f8eSopenharmony_ci * @since 9 74061847f8eSopenharmony_ci */ 74161847f8eSopenharmony_ci isBeforeFirst(): boolean; 74261847f8eSopenharmony_ci 74361847f8eSopenharmony_ci /** 74461847f8eSopenharmony_ci * Checks whether the read position is after the last line. 74561847f8eSopenharmony_ci * 74661847f8eSopenharmony_ci * @returns { boolean } Returns true if the read position is after the last line; returns false otherwise. 74761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 74861847f8eSopenharmony_ci * @since 9 74961847f8eSopenharmony_ci */ 75061847f8eSopenharmony_ci isAfterLast(): boolean; 75161847f8eSopenharmony_ci 75261847f8eSopenharmony_ci /** 75361847f8eSopenharmony_ci * Obtains a key-value pair. 75461847f8eSopenharmony_ci * 75561847f8eSopenharmony_ci * @returns { Entry } Returns a key-value pair. 75661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 75761847f8eSopenharmony_ci * @since 9 75861847f8eSopenharmony_ci */ 75961847f8eSopenharmony_ci getEntry(): Entry; 76061847f8eSopenharmony_ci } 76161847f8eSopenharmony_ci 76261847f8eSopenharmony_ci /** 76361847f8eSopenharmony_ci * Represents a database query using predicates. 76461847f8eSopenharmony_ci * <p>This class provides a constructor used to create a {@code Query} instance, which is used to query data 76561847f8eSopenharmony_ci * matching specified conditions in the database. 76661847f8eSopenharmony_ci * <p>This class also provides methods to add predicates to the {@code Query} instance. 76761847f8eSopenharmony_ci * 76861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 76961847f8eSopenharmony_ci * @since 9 77061847f8eSopenharmony_ci */ 77161847f8eSopenharmony_ci class Query { 77261847f8eSopenharmony_ci /** 77361847f8eSopenharmony_ci * A constructor used to create a Query instance. 77461847f8eSopenharmony_ci * 77561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 77661847f8eSopenharmony_ci * @since 9 77761847f8eSopenharmony_ci */ 77861847f8eSopenharmony_ci constructor(); 77961847f8eSopenharmony_ci 78061847f8eSopenharmony_ci /** 78161847f8eSopenharmony_ci * Resets this {@code Query} object. 78261847f8eSopenharmony_ci * 78361847f8eSopenharmony_ci * @returns { Query } Returns the reset {@code Query} object. 78461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 78561847f8eSopenharmony_ci * @since 9 78661847f8eSopenharmony_ci */ 78761847f8eSopenharmony_ci reset(): Query; 78861847f8eSopenharmony_ci 78961847f8eSopenharmony_ci /** 79061847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. 79161847f8eSopenharmony_ci * 79261847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 79361847f8eSopenharmony_ci * @param { number | string | boolean } value - Indicates the value to be compared. 79461847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 79561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 79661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 79761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 79861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 79961847f8eSopenharmony_ci * @since 9 80061847f8eSopenharmony_ci */ 80161847f8eSopenharmony_ci equalTo(field: string, value: number | string | boolean): Query; 80261847f8eSopenharmony_ci 80361847f8eSopenharmony_ci /** 80461847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. 80561847f8eSopenharmony_ci * 80661847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 80761847f8eSopenharmony_ci * @param { number | string | boolean } value - Indicates the value to be compared. 80861847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 80961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 81061847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 81161847f8eSopenharmony_ci * <br>3.Parameter verification failed. 81261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 81361847f8eSopenharmony_ci * @since 9 81461847f8eSopenharmony_ci */ 81561847f8eSopenharmony_ci notEqualTo(field: string, value: number | string | boolean): Query; 81661847f8eSopenharmony_ci 81761847f8eSopenharmony_ci /** 81861847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the 81961847f8eSopenharmony_ci * specified int value. 82061847f8eSopenharmony_ci * 82161847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 82261847f8eSopenharmony_ci * @param { number | string | boolean } value - Indicates the value to be compared. 82361847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 82461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 82561847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 82661847f8eSopenharmony_ci * <br>3.Parameter verification failed. 82761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 82861847f8eSopenharmony_ci * @since 9 82961847f8eSopenharmony_ci */ 83061847f8eSopenharmony_ci greaterThan(field: string, value: number | string | boolean): Query; 83161847f8eSopenharmony_ci 83261847f8eSopenharmony_ci /** 83361847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. 83461847f8eSopenharmony_ci * 83561847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 83661847f8eSopenharmony_ci * @param { number | string } value - Indicates the value to be compared. 83761847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 83861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 83961847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 84061847f8eSopenharmony_ci * <br>3.Parameter verification failed. 84161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 84261847f8eSopenharmony_ci * @since 9 84361847f8eSopenharmony_ci */ 84461847f8eSopenharmony_ci lessThan(field: string, value: number | string): Query; 84561847f8eSopenharmony_ci 84661847f8eSopenharmony_ci /** 84761847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or 84861847f8eSopenharmony_ci * equal to the specified int value. 84961847f8eSopenharmony_ci * 85061847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 85161847f8eSopenharmony_ci * @param { number | string } value - Indicates the value to be compared. 85261847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 85361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 85461847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 85561847f8eSopenharmony_ci * <br>3.Parameter verification failed. 85661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 85761847f8eSopenharmony_ci * @since 9 85861847f8eSopenharmony_ci */ 85961847f8eSopenharmony_ci greaterThanOrEqualTo(field: string, value: number | string): Query; 86061847f8eSopenharmony_ci 86161847f8eSopenharmony_ci /** 86261847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the 86361847f8eSopenharmony_ci * specified int value. 86461847f8eSopenharmony_ci * 86561847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 86661847f8eSopenharmony_ci * @param { number | string } value - Indicates the value to be compared. 86761847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 86861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 86961847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 87061847f8eSopenharmony_ci * <br>3.Parameter verification failed. 87161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 87261847f8eSopenharmony_ci * @since 9 87361847f8eSopenharmony_ci */ 87461847f8eSopenharmony_ci lessThanOrEqualTo(field: string, value: number | string): Query; 87561847f8eSopenharmony_ci 87661847f8eSopenharmony_ci /** 87761847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is null. 87861847f8eSopenharmony_ci * 87961847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 88061847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 88161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 88261847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 88361847f8eSopenharmony_ci * <br>3.Parameter verification failed. 88461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 88561847f8eSopenharmony_ci * @since 9 88661847f8eSopenharmony_ci */ 88761847f8eSopenharmony_ci isNull(field: string): Query; 88861847f8eSopenharmony_ci 88961847f8eSopenharmony_ci /** 89061847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. 89161847f8eSopenharmony_ci * 89261847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 89361847f8eSopenharmony_ci * @param { number[] } valueList - Indicates the int value list. 89461847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 89561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 89661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 89761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 89861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 89961847f8eSopenharmony_ci * @since 9 90061847f8eSopenharmony_ci */ 90161847f8eSopenharmony_ci inNumber(field: string, valueList: number[]): Query; 90261847f8eSopenharmony_ci 90361847f8eSopenharmony_ci /** 90461847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. 90561847f8eSopenharmony_ci * 90661847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 90761847f8eSopenharmony_ci * @param { string[] } valueList - Indicates the string value list. 90861847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 90961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 91061847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 91161847f8eSopenharmony_ci * <br>3.Parameter verification failed. 91261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 91361847f8eSopenharmony_ci * @since 9 91461847f8eSopenharmony_ci */ 91561847f8eSopenharmony_ci inString(field: string, valueList: string[]): Query; 91661847f8eSopenharmony_ci 91761847f8eSopenharmony_ci /** 91861847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. 91961847f8eSopenharmony_ci * 92061847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 92161847f8eSopenharmony_ci * @param { number[] } valueList - Indicates the int value list. 92261847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 92361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 92461847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 92561847f8eSopenharmony_ci * <br>3.Parameter verification failed. 92661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 92761847f8eSopenharmony_ci * @since 9 92861847f8eSopenharmony_ci */ 92961847f8eSopenharmony_ci notInNumber(field: string, valueList: number[]): Query; 93061847f8eSopenharmony_ci 93161847f8eSopenharmony_ci /** 93261847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. 93361847f8eSopenharmony_ci * 93461847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 93561847f8eSopenharmony_ci * @param { string[] } valueList - Indicates the string value list. 93661847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 93761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 93861847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 93961847f8eSopenharmony_ci * <br>3.Parameter verification failed. 94061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 94161847f8eSopenharmony_ci * @since 9 94261847f8eSopenharmony_ci */ 94361847f8eSopenharmony_ci notInString(field: string, valueList: string[]): Query; 94461847f8eSopenharmony_ci 94561847f8eSopenharmony_ci /** 94661847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. 94761847f8eSopenharmony_ci * 94861847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 94961847f8eSopenharmony_ci * @param { string } value - Indicates the string value. 95061847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 95161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 95261847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 95361847f8eSopenharmony_ci * <br>3.Parameter verification failed. 95461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 95561847f8eSopenharmony_ci * @since 9 95661847f8eSopenharmony_ci */ 95761847f8eSopenharmony_ci like(field: string, value: string): Query; 95861847f8eSopenharmony_ci 95961847f8eSopenharmony_ci /** 96061847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. 96161847f8eSopenharmony_ci * 96261847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 96361847f8eSopenharmony_ci * @param { string } value - Indicates the string value. 96461847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 96561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 96661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 96761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 96861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 96961847f8eSopenharmony_ci * @since 9 97061847f8eSopenharmony_ci */ 97161847f8eSopenharmony_ci unlike(field: string, value: string): Query; 97261847f8eSopenharmony_ci 97361847f8eSopenharmony_ci /** 97461847f8eSopenharmony_ci * Constructs a {@code Query} object with the and condition. 97561847f8eSopenharmony_ci * <p>Multiple predicates should be connected using the and or or condition. 97661847f8eSopenharmony_ci * 97761847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 97861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 97961847f8eSopenharmony_ci * @since 9 98061847f8eSopenharmony_ci */ 98161847f8eSopenharmony_ci and(): Query; 98261847f8eSopenharmony_ci 98361847f8eSopenharmony_ci /** 98461847f8eSopenharmony_ci * Constructs a {@code Query} object with the or condition. 98561847f8eSopenharmony_ci * <p>Multiple predicates should be connected using the and or or condition. 98661847f8eSopenharmony_ci * 98761847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 98861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 98961847f8eSopenharmony_ci * @since 9 99061847f8eSopenharmony_ci */ 99161847f8eSopenharmony_ci or(): Query; 99261847f8eSopenharmony_ci 99361847f8eSopenharmony_ci /** 99461847f8eSopenharmony_ci * Constructs a {@code Query} object to sort the query results in ascending order. 99561847f8eSopenharmony_ci * 99661847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 99761847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 99861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 99961847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 100061847f8eSopenharmony_ci * <br>3.Parameter verification failed. 100161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 100261847f8eSopenharmony_ci * @since 9 100361847f8eSopenharmony_ci */ 100461847f8eSopenharmony_ci orderByAsc(field: string): Query; 100561847f8eSopenharmony_ci 100661847f8eSopenharmony_ci /** 100761847f8eSopenharmony_ci * Constructs a {@code Query} object to sort the query results in descending order. 100861847f8eSopenharmony_ci * 100961847f8eSopenharmony_ci * @param { string } field - Indicates the field, which cannot contain ^. 101061847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 101161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 101261847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 101361847f8eSopenharmony_ci * <br>3.Parameter verification failed. 101461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 101561847f8eSopenharmony_ci * @since 9 101661847f8eSopenharmony_ci */ 101761847f8eSopenharmony_ci orderByDesc(field: string): Query; 101861847f8eSopenharmony_ci 101961847f8eSopenharmony_ci /** 102061847f8eSopenharmony_ci * Constructs a {@code Query} object to specify the number of results and the start position. 102161847f8eSopenharmony_ci * 102261847f8eSopenharmony_ci * @param { number } total - Indicates the number of results. 102361847f8eSopenharmony_ci * @param { number } offset - Indicates the start position. 102461847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 102561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 102661847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 102761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 102861847f8eSopenharmony_ci * @since 9 102961847f8eSopenharmony_ci */ 103061847f8eSopenharmony_ci limit(total: number, offset: number): Query; 103161847f8eSopenharmony_ci 103261847f8eSopenharmony_ci /** 103361847f8eSopenharmony_ci * Creates a {@code Query} condition with a specified field that is not null. 103461847f8eSopenharmony_ci * 103561847f8eSopenharmony_ci * @param { string } field - Indicates the specified field. 103661847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 103761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 103861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 103961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 104061847f8eSopenharmony_ci * @since 9 104161847f8eSopenharmony_ci */ 104261847f8eSopenharmony_ci isNotNull(field: string): Query; 104361847f8eSopenharmony_ci 104461847f8eSopenharmony_ci /** 104561847f8eSopenharmony_ci * Creates a query condition group with a left bracket. 104661847f8eSopenharmony_ci * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a 104761847f8eSopenharmony_ci * whole to combine with other query conditions. 104861847f8eSopenharmony_ci * 104961847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 105061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 105161847f8eSopenharmony_ci * @since 9 105261847f8eSopenharmony_ci */ 105361847f8eSopenharmony_ci beginGroup(): Query; 105461847f8eSopenharmony_ci 105561847f8eSopenharmony_ci /** 105661847f8eSopenharmony_ci * Creates a query condition group with a right bracket. 105761847f8eSopenharmony_ci * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a 105861847f8eSopenharmony_ci * whole to combine with other query conditions. 105961847f8eSopenharmony_ci * 106061847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 106161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 106261847f8eSopenharmony_ci * @since 9 106361847f8eSopenharmony_ci */ 106461847f8eSopenharmony_ci endGroup(): Query; 106561847f8eSopenharmony_ci 106661847f8eSopenharmony_ci /** 106761847f8eSopenharmony_ci * Creates a query condition with a specified key prefix. 106861847f8eSopenharmony_ci * 106961847f8eSopenharmony_ci * @param { string } prefix - Indicates the specified key prefix. 107061847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 107161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 107261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 107361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 107461847f8eSopenharmony_ci * @since 9 107561847f8eSopenharmony_ci */ 107661847f8eSopenharmony_ci prefixKey(prefix: string): Query; 107761847f8eSopenharmony_ci 107861847f8eSopenharmony_ci /** 107961847f8eSopenharmony_ci * Sets a specified index that will be preferentially used for query. 108061847f8eSopenharmony_ci * 108161847f8eSopenharmony_ci * @param { string } index - Indicates the index to set. 108261847f8eSopenharmony_ci * @returns { Query } Returns the {@coed Query} object. 108361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 108461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 108561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 108661847f8eSopenharmony_ci * @since 9 108761847f8eSopenharmony_ci */ 108861847f8eSopenharmony_ci setSuggestIndex(index: string): Query; 108961847f8eSopenharmony_ci 109061847f8eSopenharmony_ci /** 109161847f8eSopenharmony_ci * Add device ID key prefix.Used by {@code DeviceKVStore}. 109261847f8eSopenharmony_ci * 109361847f8eSopenharmony_ci * @param { string } deviceId - Specify device id to query from, It can not be empty. 109461847f8eSopenharmony_ci * @returns { Query } Returns the {@code Query} object with device ID prefix added. 109561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 109661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 109761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 109861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 109961847f8eSopenharmony_ci * @since 9 110061847f8eSopenharmony_ci */ 110161847f8eSopenharmony_ci deviceId(deviceId: string): Query; 110261847f8eSopenharmony_ci 110361847f8eSopenharmony_ci /** 110461847f8eSopenharmony_ci * Get a String that represents this {@code Query}. 110561847f8eSopenharmony_ci * <p>The String would be parsed to DB query format. 110661847f8eSopenharmony_ci * The String length should be no longer than 500kb. 110761847f8eSopenharmony_ci * 110861847f8eSopenharmony_ci * @returns { string } String representing this {@code Query}. 110961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 111061847f8eSopenharmony_ci * @since 9 111161847f8eSopenharmony_ci */ 111261847f8eSopenharmony_ci getSqlLike(): string; 111361847f8eSopenharmony_ci } 111461847f8eSopenharmony_ci 111561847f8eSopenharmony_ci /** 111661847f8eSopenharmony_ci * Provides methods related to single-version distributed databases. 111761847f8eSopenharmony_ci * <p>To create a {@code SingleKVStore} database, 111861847f8eSopenharmony_ci * you can use the {@link data.distributed.common.KVManager#getKVStore(Options, String)} method 111961847f8eSopenharmony_ci * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. 112061847f8eSopenharmony_ci * This database synchronizes data to other databases in time sequence. 112161847f8eSopenharmony_ci * The {@code SingleKVStore} database does not support 112261847f8eSopenharmony_ci * synchronous transactions, or data search using snapshots. 112361847f8eSopenharmony_ci * 112461847f8eSopenharmony_ci * @interface SingleKVStore 112561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 112661847f8eSopenharmony_ci * @since 9 112761847f8eSopenharmony_ci */ 112861847f8eSopenharmony_ci interface SingleKVStore { 112961847f8eSopenharmony_ci /** 113061847f8eSopenharmony_ci * Writes a key-value pair of the string type into the {@code SingleKVStore} database. 113161847f8eSopenharmony_ci * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. 113261847f8eSopenharmony_ci * 113361847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 113461847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 113561847f8eSopenharmony_ci * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. 113661847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of put. 113761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 113861847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 113961847f8eSopenharmony_ci * <br>3.Parameter verification failed. 114061847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 114161847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 114261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 114361847f8eSopenharmony_ci * @since 9 114461847f8eSopenharmony_ci */ 114561847f8eSopenharmony_ci /** 114661847f8eSopenharmony_ci * Writes a key-value pair of the string type into the {@code SingleKVStore} database. 114761847f8eSopenharmony_ci * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. 114861847f8eSopenharmony_ci * 114961847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 115061847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 115161847f8eSopenharmony_ci * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. 115261847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of put. 115361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 115461847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 115561847f8eSopenharmony_ci * <br>3.Parameter verification failed. 115661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 115761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 115861847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 115961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 116061847f8eSopenharmony_ci * @since 10 116161847f8eSopenharmony_ci */ 116261847f8eSopenharmony_ci put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback<void>): void; 116361847f8eSopenharmony_ci 116461847f8eSopenharmony_ci /** 116561847f8eSopenharmony_ci * Writes a key-value pair of the string type into the {@code SingleKVStore} database. 116661847f8eSopenharmony_ci * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. 116761847f8eSopenharmony_ci * 116861847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 116961847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 117061847f8eSopenharmony_ci * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. 117161847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 117261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 117361847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 117461847f8eSopenharmony_ci * <br>3.Parameter verification failed. 117561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 117661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 117761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 117861847f8eSopenharmony_ci * @since 9 117961847f8eSopenharmony_ci */ 118061847f8eSopenharmony_ci /** 118161847f8eSopenharmony_ci * Writes a key-value pair of the string type into the {@code SingleKVStore} database. 118261847f8eSopenharmony_ci * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. 118361847f8eSopenharmony_ci * 118461847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 118561847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 118661847f8eSopenharmony_ci * @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted. 118761847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 118861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 118961847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 119061847f8eSopenharmony_ci * <br>3.Parameter verification failed. 119161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 119261847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 119361847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 119461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 119561847f8eSopenharmony_ci * @since 10 119661847f8eSopenharmony_ci */ 119761847f8eSopenharmony_ci put(key: string, value: Uint8Array | string | number | boolean): Promise<void>; 119861847f8eSopenharmony_ci 119961847f8eSopenharmony_ci /** 120061847f8eSopenharmony_ci * Inserts key-value pairs into the {@code SingleKVStore} database in batches. 120161847f8eSopenharmony_ci * 120261847f8eSopenharmony_ci * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. 120361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of putBatch. 120461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 120561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 120661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 120761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 120861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 120961847f8eSopenharmony_ci * @since 9 121061847f8eSopenharmony_ci */ 121161847f8eSopenharmony_ci /** 121261847f8eSopenharmony_ci * Inserts key-value pairs into the {@code SingleKVStore} database in batches. 121361847f8eSopenharmony_ci * 121461847f8eSopenharmony_ci * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. 121561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of putBatch. 121661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 121761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 121861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 121961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 122061847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 122161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 122261847f8eSopenharmony_ci * @since 10 122361847f8eSopenharmony_ci */ 122461847f8eSopenharmony_ci putBatch(entries: Entry[], callback: AsyncCallback<void>): void; 122561847f8eSopenharmony_ci 122661847f8eSopenharmony_ci /** 122761847f8eSopenharmony_ci * Inserts key-value pairs into the {@code SingleKVStore} database in batches. 122861847f8eSopenharmony_ci * 122961847f8eSopenharmony_ci * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. 123061847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 123161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 123261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 123361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 123461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 123561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 123661847f8eSopenharmony_ci * @since 9 123761847f8eSopenharmony_ci */ 123861847f8eSopenharmony_ci /** 123961847f8eSopenharmony_ci * Inserts key-value pairs into the {@code SingleKVStore} database in batches. 124061847f8eSopenharmony_ci * 124161847f8eSopenharmony_ci * @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches. 124261847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 124361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 124461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 124561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 124661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 124761847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 124861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 124961847f8eSopenharmony_ci * @since 10 125061847f8eSopenharmony_ci */ 125161847f8eSopenharmony_ci putBatch(entries: Entry[]): Promise<void>; 125261847f8eSopenharmony_ci 125361847f8eSopenharmony_ci /** 125461847f8eSopenharmony_ci * Writes values of ValuesBucket type into the {@code SingleKVStore} database. 125561847f8eSopenharmony_ci * 125661847f8eSopenharmony_ci * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted. 125761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of putBatch. 125861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 125961847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 126061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 126161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 126261847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 126361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 126461847f8eSopenharmony_ci * @systemapi 126561847f8eSopenharmony_ci * @StageModelOnly 126661847f8eSopenharmony_ci * @since 9 126761847f8eSopenharmony_ci */ 126861847f8eSopenharmony_ci /** 126961847f8eSopenharmony_ci * Writes values of ValuesBucket type into the {@code SingleKVStore} database. 127061847f8eSopenharmony_ci * 127161847f8eSopenharmony_ci * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted. 127261847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of putBatch. 127361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 127461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 127561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 127661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 127761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 127861847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 127961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 128061847f8eSopenharmony_ci * @systemapi 128161847f8eSopenharmony_ci * @StageModelOnly 128261847f8eSopenharmony_ci * @since 10 128361847f8eSopenharmony_ci */ 128461847f8eSopenharmony_ci putBatch(value: Array<ValuesBucket>, callback: AsyncCallback<void>): void; 128561847f8eSopenharmony_ci 128661847f8eSopenharmony_ci /** 128761847f8eSopenharmony_ci * Writes values of ValuesBucket type into the {@code SingleKVStore} database. 128861847f8eSopenharmony_ci * 128961847f8eSopenharmony_ci * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted. 129061847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 129161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 129261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 129361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 129461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 129561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 129661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 129761847f8eSopenharmony_ci * @systemapi 129861847f8eSopenharmony_ci * @StageModelOnly 129961847f8eSopenharmony_ci * @since 9 130061847f8eSopenharmony_ci */ 130161847f8eSopenharmony_ci /** 130261847f8eSopenharmony_ci * Writes values of ValuesBucket type into the {@code SingleKVStore} database. 130361847f8eSopenharmony_ci * 130461847f8eSopenharmony_ci * @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted. 130561847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 130661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 130761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 130861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 130961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 131061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 131161847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 131261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 131361847f8eSopenharmony_ci * @systemapi 131461847f8eSopenharmony_ci * @StageModelOnly 131561847f8eSopenharmony_ci * @since 10 131661847f8eSopenharmony_ci */ 131761847f8eSopenharmony_ci putBatch(value: Array<ValuesBucket>): Promise<void>; 131861847f8eSopenharmony_ci 131961847f8eSopenharmony_ci /** 132061847f8eSopenharmony_ci * Deletes the key-value pair based on a specified key. 132161847f8eSopenharmony_ci * 132261847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 132361847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 132461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of delete. 132561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 132661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 132761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 132861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 132961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 133061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 133161847f8eSopenharmony_ci * @since 9 133261847f8eSopenharmony_ci */ 133361847f8eSopenharmony_ci /** 133461847f8eSopenharmony_ci * Deletes the key-value pair based on a specified key. 133561847f8eSopenharmony_ci * 133661847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 133761847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 133861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of delete. 133961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 134061847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 134161847f8eSopenharmony_ci * <br>3.Parameter verification failed. 134261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 134361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 134461847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 134561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 134661847f8eSopenharmony_ci * @since 10 134761847f8eSopenharmony_ci */ 134861847f8eSopenharmony_ci delete(key: string, callback: AsyncCallback<void>): void; 134961847f8eSopenharmony_ci 135061847f8eSopenharmony_ci /** 135161847f8eSopenharmony_ci * Deletes the key-value pair based on a specified key. 135261847f8eSopenharmony_ci * 135361847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 135461847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 135561847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 135661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 135761847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 135861847f8eSopenharmony_ci * <br>3.Parameter verification failed. 135961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 136061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 136161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 136261847f8eSopenharmony_ci * @since 9 136361847f8eSopenharmony_ci */ 136461847f8eSopenharmony_ci /** 136561847f8eSopenharmony_ci * Deletes the key-value pair based on a specified key. 136661847f8eSopenharmony_ci * 136761847f8eSopenharmony_ci * @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. 136861847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 136961847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 137061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 137161847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 137261847f8eSopenharmony_ci * <br>3.Parameter verification failed. 137361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 137461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 137561847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 137661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 137761847f8eSopenharmony_ci * @since 10 137861847f8eSopenharmony_ci */ 137961847f8eSopenharmony_ci delete(key: string): Promise<void>; 138061847f8eSopenharmony_ci 138161847f8eSopenharmony_ci /** 138261847f8eSopenharmony_ci * Deletes the key-value pairs based on the dataSharePredicates. 138361847f8eSopenharmony_ci * 138461847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 138561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of delete. 138661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 138761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 138861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 138961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 139061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 139161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 139261847f8eSopenharmony_ci * @systemapi 139361847f8eSopenharmony_ci * @StageModelOnly 139461847f8eSopenharmony_ci * @since 9 139561847f8eSopenharmony_ci */ 139661847f8eSopenharmony_ci /** 139761847f8eSopenharmony_ci * Deletes the key-value pairs based on the dataSharePredicates. 139861847f8eSopenharmony_ci * 139961847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 140061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of delete. 140161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 140261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 140361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 140461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 140561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 140661847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 140761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 140861847f8eSopenharmony_ci * @systemapi 140961847f8eSopenharmony_ci * @StageModelOnly 141061847f8eSopenharmony_ci * @since 10 141161847f8eSopenharmony_ci */ 141261847f8eSopenharmony_ci delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>); 141361847f8eSopenharmony_ci 141461847f8eSopenharmony_ci /** 141561847f8eSopenharmony_ci * Deletes the key-value pairs based on the dataSharePredicates. 141661847f8eSopenharmony_ci * 141761847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 141861847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 141961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 142061847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 142161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 142261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 142361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 142461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 142561847f8eSopenharmony_ci * @systemapi 142661847f8eSopenharmony_ci * @StageModelOnly 142761847f8eSopenharmony_ci * @since 9 142861847f8eSopenharmony_ci */ 142961847f8eSopenharmony_ci /** 143061847f8eSopenharmony_ci * Deletes the key-value pairs based on the dataSharePredicates. 143161847f8eSopenharmony_ci * 143261847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 143361847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 143461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 143561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 143661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 143761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 143861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 143961847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 144061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 144161847f8eSopenharmony_ci * @systemapi 144261847f8eSopenharmony_ci * @StageModelOnly 144361847f8eSopenharmony_ci * @since 10 144461847f8eSopenharmony_ci */ 144561847f8eSopenharmony_ci delete(predicates: dataSharePredicates.DataSharePredicates): Promise<void>; 144661847f8eSopenharmony_ci 144761847f8eSopenharmony_ci /** 144861847f8eSopenharmony_ci * Deletes key-value pairs in batches from the {@code SingleKVStore} database. 144961847f8eSopenharmony_ci * 145061847f8eSopenharmony_ci * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. 145161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of deleteBatch. 145261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 145361847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 145461847f8eSopenharmony_ci * <br>3.Parameter verification failed. 145561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 145661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 145761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 145861847f8eSopenharmony_ci * @since 9 145961847f8eSopenharmony_ci */ 146061847f8eSopenharmony_ci /** 146161847f8eSopenharmony_ci * Deletes key-value pairs in batches from the {@code SingleKVStore} database. 146261847f8eSopenharmony_ci * 146361847f8eSopenharmony_ci * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. 146461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of deleteBatch. 146561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 146661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 146761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 146861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 146961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 147061847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 147161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 147261847f8eSopenharmony_ci * @since 10 147361847f8eSopenharmony_ci */ 147461847f8eSopenharmony_ci deleteBatch(keys: string[], callback: AsyncCallback<void>): void; 147561847f8eSopenharmony_ci 147661847f8eSopenharmony_ci /** 147761847f8eSopenharmony_ci * Deletes key-value pairs in batches from the {@code SingleKVStore} database. 147861847f8eSopenharmony_ci * 147961847f8eSopenharmony_ci * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. 148061847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 148161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 148261847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 148361847f8eSopenharmony_ci * <br>3.Parameter verification failed. 148461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 148561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 148661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 148761847f8eSopenharmony_ci * @since 9 148861847f8eSopenharmony_ci */ 148961847f8eSopenharmony_ci /** 149061847f8eSopenharmony_ci * Deletes key-value pairs in batches from the {@code SingleKVStore} database. 149161847f8eSopenharmony_ci * 149261847f8eSopenharmony_ci * @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty. 149361847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 149461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 149561847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 149661847f8eSopenharmony_ci * <br>3.Parameter verification failed. 149761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 149861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 149961847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 150061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 150161847f8eSopenharmony_ci * @since 10 150261847f8eSopenharmony_ci */ 150361847f8eSopenharmony_ci deleteBatch(keys: string[]): Promise<void>; 150461847f8eSopenharmony_ci 150561847f8eSopenharmony_ci /** 150661847f8eSopenharmony_ci * Removes data of the specified device from current database. This method is used to remove only the data 150761847f8eSopenharmony_ci * synchronized from remote devices. This operation does not synchronize data to other databases or affect 150861847f8eSopenharmony_ci * subsequent data synchronization. 150961847f8eSopenharmony_ci * 151061847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. 151161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of removeDeviceData. 151261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 151361847f8eSopenharmony_ci * <br>2.Parameter verification failed. 151461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 151561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 151661847f8eSopenharmony_ci * @since 9 151761847f8eSopenharmony_ci */ 151861847f8eSopenharmony_ci removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void; 151961847f8eSopenharmony_ci 152061847f8eSopenharmony_ci /** 152161847f8eSopenharmony_ci * Removes data of the specified device from current database. This method is used to remove only the data 152261847f8eSopenharmony_ci * synchronized from remote devices. This operation does not synchronize data to other databases or affect 152361847f8eSopenharmony_ci * subsequent data synchronization. 152461847f8eSopenharmony_ci * 152561847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. 152661847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 152761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 152861847f8eSopenharmony_ci * <br>2.Parameter verification failed. 152961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 153061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 153161847f8eSopenharmony_ci * @since 9 153261847f8eSopenharmony_ci */ 153361847f8eSopenharmony_ci removeDeviceData(deviceId: string): Promise<void>; 153461847f8eSopenharmony_ci 153561847f8eSopenharmony_ci /** 153661847f8eSopenharmony_ci * Obtains the value of a specified key. 153761847f8eSopenharmony_ci * 153861847f8eSopenharmony_ci * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 153961847f8eSopenharmony_ci * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback - 154061847f8eSopenharmony_ci * {Uint8Array|string|boolean|number}: the returned value specified by the key. 154161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 154261847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 154361847f8eSopenharmony_ci * <br>3.Parameter verification failed. 154461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 154561847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 154661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 154761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 154861847f8eSopenharmony_ci * @since 9 154961847f8eSopenharmony_ci */ 155061847f8eSopenharmony_ci get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void; 155161847f8eSopenharmony_ci 155261847f8eSopenharmony_ci /** 155361847f8eSopenharmony_ci * Obtains the value of a specified key. 155461847f8eSopenharmony_ci * 155561847f8eSopenharmony_ci * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 155661847f8eSopenharmony_ci * @returns { Promise<boolean | string | number | Uint8Array> } 155761847f8eSopenharmony_ci * {Uint8Array|string|boolean|number}: the returned value specified by the key. 155861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 155961847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 156061847f8eSopenharmony_ci * <br>3.Parameter verification failed. 156161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 156261847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 156361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 156461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 156561847f8eSopenharmony_ci * @since 9 156661847f8eSopenharmony_ci */ 156761847f8eSopenharmony_ci get(key: string): Promise<boolean | string | number | Uint8Array>; 156861847f8eSopenharmony_ci 156961847f8eSopenharmony_ci /** 157061847f8eSopenharmony_ci * Obtains all key-value pairs that match a specified key prefix. 157161847f8eSopenharmony_ci * 157261847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 157361847f8eSopenharmony_ci * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs 157461847f8eSopenharmony_ci * that match the specified key prefix. 157561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 157661847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 157761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 157861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 157961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 158061847f8eSopenharmony_ci * @since 9 158161847f8eSopenharmony_ci */ 158261847f8eSopenharmony_ci getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void; 158361847f8eSopenharmony_ci 158461847f8eSopenharmony_ci /** 158561847f8eSopenharmony_ci * Obtains all key-value pairs that match a specified key prefix. 158661847f8eSopenharmony_ci * 158761847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 158861847f8eSopenharmony_ci * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the 158961847f8eSopenharmony_ci * specified key prefix. 159061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 159161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 159261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 159361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 159461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 159561847f8eSopenharmony_ci * @since 9 159661847f8eSopenharmony_ci */ 159761847f8eSopenharmony_ci getEntries(keyPrefix: string): Promise<Entry[]>; 159861847f8eSopenharmony_ci 159961847f8eSopenharmony_ci /** 160061847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the specified {@code Query} object. 160161847f8eSopenharmony_ci * 160261847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 160361847f8eSopenharmony_ci * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs 160461847f8eSopenharmony_ci * matching the specified {@code Query} object. 160561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 160661847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 160761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 160861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 160961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 161061847f8eSopenharmony_ci * @since 9 161161847f8eSopenharmony_ci */ 161261847f8eSopenharmony_ci getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; 161361847f8eSopenharmony_ci 161461847f8eSopenharmony_ci /** 161561847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the specified {@code Query} object. 161661847f8eSopenharmony_ci * 161761847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 161861847f8eSopenharmony_ci * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the 161961847f8eSopenharmony_ci * specified {@code Query} object. 162061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 162161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 162261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 162361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 162461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 162561847f8eSopenharmony_ci * @since 9 162661847f8eSopenharmony_ci */ 162761847f8eSopenharmony_ci getEntries(query: Query): Promise<Entry[]>; 162861847f8eSopenharmony_ci 162961847f8eSopenharmony_ci /** 163061847f8eSopenharmony_ci * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} 163161847f8eSopenharmony_ci * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} 163261847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created 163361847f8eSopenharmony_ci * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet 163461847f8eSopenharmony_ci * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 163561847f8eSopenharmony_ci * 163661847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 163761847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 163861847f8eSopenharmony_ci * object matching the specified keyPrefix. 163961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 164061847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 164161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 164261847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 164361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 164461847f8eSopenharmony_ci * @since 9 164561847f8eSopenharmony_ci */ 164661847f8eSopenharmony_ci /** 164761847f8eSopenharmony_ci * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} 164861847f8eSopenharmony_ci * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} 164961847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created 165061847f8eSopenharmony_ci * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet 165161847f8eSopenharmony_ci * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 165261847f8eSopenharmony_ci * 165361847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 165461847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 165561847f8eSopenharmony_ci * object matching the specified keyPrefix. 165661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 165761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 165861847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 165961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 166061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 166161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 166261847f8eSopenharmony_ci * @since 10 166361847f8eSopenharmony_ci */ 166461847f8eSopenharmony_ci getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void; 166561847f8eSopenharmony_ci 166661847f8eSopenharmony_ci /** 166761847f8eSopenharmony_ci * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} 166861847f8eSopenharmony_ci * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} 166961847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created 167061847f8eSopenharmony_ci * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet 167161847f8eSopenharmony_ci * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 167261847f8eSopenharmony_ci * 167361847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 167461847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 167561847f8eSopenharmony_ci * object matching the specified keyPrefix. 167661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 167761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 167861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 167961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 168061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 168161847f8eSopenharmony_ci * @since 9 168261847f8eSopenharmony_ci */ 168361847f8eSopenharmony_ci /** 168461847f8eSopenharmony_ci * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} 168561847f8eSopenharmony_ci * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} 168661847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created 168761847f8eSopenharmony_ci * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet 168861847f8eSopenharmony_ci * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 168961847f8eSopenharmony_ci * 169061847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 169161847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 169261847f8eSopenharmony_ci * object matching the specified keyPrefix. 169361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 169461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 169561847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 169661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 169761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 169861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 169961847f8eSopenharmony_ci * @since 10 170061847f8eSopenharmony_ci */ 170161847f8eSopenharmony_ci getResultSet(keyPrefix: string): Promise<KVStoreResultSet>; 170261847f8eSopenharmony_ci 170361847f8eSopenharmony_ci /** 170461847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. 170561847f8eSopenharmony_ci * 170661847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 170761847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 170861847f8eSopenharmony_ci * object matching the specified {@code Query} object. 170961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 171061847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 171161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 171261847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 171361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 171461847f8eSopenharmony_ci * @since 9 171561847f8eSopenharmony_ci */ 171661847f8eSopenharmony_ci /** 171761847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. 171861847f8eSopenharmony_ci * 171961847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 172061847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 172161847f8eSopenharmony_ci * object matching the specified {@code Query} object. 172261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 172361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 172461847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 172561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 172661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 172761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 172861847f8eSopenharmony_ci * @since 10 172961847f8eSopenharmony_ci */ 173061847f8eSopenharmony_ci getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void; 173161847f8eSopenharmony_ci 173261847f8eSopenharmony_ci /** 173361847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. 173461847f8eSopenharmony_ci * 173561847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 173661847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 173761847f8eSopenharmony_ci * object matching the specified {@code Query} object. 173861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 173961847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 174061847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 174161847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 174261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 174361847f8eSopenharmony_ci * @since 9 174461847f8eSopenharmony_ci */ 174561847f8eSopenharmony_ci /** 174661847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. 174761847f8eSopenharmony_ci * 174861847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 174961847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 175061847f8eSopenharmony_ci * object matching the specified {@code Query} object. 175161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 175261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 175361847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 175461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 175561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 175661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 175761847f8eSopenharmony_ci * @since 10 175861847f8eSopenharmony_ci */ 175961847f8eSopenharmony_ci getResultSet(query: Query): Promise<KVStoreResultSet>; 176061847f8eSopenharmony_ci 176161847f8eSopenharmony_ci /** 176261847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the specified predicate object. 176361847f8eSopenharmony_ci * 176461847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 176561847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 176661847f8eSopenharmony_ci * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. 176761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 176861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 176961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 177061847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 177161847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 177261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 177361847f8eSopenharmony_ci * @systemapi 177461847f8eSopenharmony_ci * @StageModelOnly 177561847f8eSopenharmony_ci * @since 9 177661847f8eSopenharmony_ci */ 177761847f8eSopenharmony_ci /** 177861847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the specified predicate object. 177961847f8eSopenharmony_ci * 178061847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 178161847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 178261847f8eSopenharmony_ci * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. 178361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 178461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 178561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 178661847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 178761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 178861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 178961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 179061847f8eSopenharmony_ci * @systemapi 179161847f8eSopenharmony_ci * @StageModelOnly 179261847f8eSopenharmony_ci * @since 10 179361847f8eSopenharmony_ci */ 179461847f8eSopenharmony_ci getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void; 179561847f8eSopenharmony_ci 179661847f8eSopenharmony_ci /** 179761847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the specified predicate object. 179861847f8eSopenharmony_ci * 179961847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 180061847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 180161847f8eSopenharmony_ci * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. 180261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 180361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 180461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 180561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 180661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 180761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 180861847f8eSopenharmony_ci * @systemapi 180961847f8eSopenharmony_ci * @StageModelOnly 181061847f8eSopenharmony_ci * @since 9 181161847f8eSopenharmony_ci */ 181261847f8eSopenharmony_ci /** 181361847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the specified predicate object. 181461847f8eSopenharmony_ci * 181561847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 181661847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 181761847f8eSopenharmony_ci * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. 181861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 181961847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 182061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 182161847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 182261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 182361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 182461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 182561847f8eSopenharmony_ci * @systemapi 182661847f8eSopenharmony_ci * @StageModelOnly 182761847f8eSopenharmony_ci * @since 10 182861847f8eSopenharmony_ci */ 182961847f8eSopenharmony_ci getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>; 183061847f8eSopenharmony_ci 183161847f8eSopenharmony_ci /** 183261847f8eSopenharmony_ci * Closes a {@code KVStoreResultSet} object returned by getResultSet method. 183361847f8eSopenharmony_ci * 183461847f8eSopenharmony_ci * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close. 183561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of closeResultSet. 183661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 183761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 183861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 183961847f8eSopenharmony_ci * @since 9 184061847f8eSopenharmony_ci */ 184161847f8eSopenharmony_ci closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback<void>): void; 184261847f8eSopenharmony_ci 184361847f8eSopenharmony_ci /** 184461847f8eSopenharmony_ci * Closes a {@code KVStoreResultSet} object returned by getResultSet method. 184561847f8eSopenharmony_ci * 184661847f8eSopenharmony_ci * @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close. 184761847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 184861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 184961847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 185061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 185161847f8eSopenharmony_ci * @since 9 185261847f8eSopenharmony_ci */ 185361847f8eSopenharmony_ci closeResultSet(resultSet: KVStoreResultSet): Promise<void>; 185461847f8eSopenharmony_ci 185561847f8eSopenharmony_ci /** 185661847f8eSopenharmony_ci * Obtains the number of results matching the specified {@code Query} object. 185761847f8eSopenharmony_ci * 185861847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 185961847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of results matching the 186061847f8eSopenharmony_ci * specified {@code Query} object. 186161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 186261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 186361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 186461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 186561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 186661847f8eSopenharmony_ci * @since 9 186761847f8eSopenharmony_ci */ 186861847f8eSopenharmony_ci getResultSize(query: Query, callback: AsyncCallback<number>): void; 186961847f8eSopenharmony_ci 187061847f8eSopenharmony_ci /** 187161847f8eSopenharmony_ci * Obtains the number of results matching the specified {@code Query} object. 187261847f8eSopenharmony_ci * 187361847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 187461847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of results matching the specified 187561847f8eSopenharmony_ci * {@code Query} object. 187661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 187761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 187861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 187961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 188061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 188161847f8eSopenharmony_ci * @since 9 188261847f8eSopenharmony_ci */ 188361847f8eSopenharmony_ci getResultSize(query: Query): Promise<number>; 188461847f8eSopenharmony_ci 188561847f8eSopenharmony_ci /** 188661847f8eSopenharmony_ci * Backs up a database in the specified filename. 188761847f8eSopenharmony_ci * 188861847f8eSopenharmony_ci * @param { string } file - Indicates the database backup filename, It can not be empty and 188961847f8eSopenharmony_ci * The length must be less than {@code MAX_KEY_LENGTH}. 189061847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of backup. 189161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 189261847f8eSopenharmony_ci * <br>2.Parameter verification failed. 189361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 189461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 189561847f8eSopenharmony_ci * @since 9 189661847f8eSopenharmony_ci */ 189761847f8eSopenharmony_ci backup(file: string, callback: AsyncCallback<void>): void; 189861847f8eSopenharmony_ci 189961847f8eSopenharmony_ci /** 190061847f8eSopenharmony_ci * Backs up a database in the specified filename. 190161847f8eSopenharmony_ci * 190261847f8eSopenharmony_ci * @param { string } file - Indicates the database backup filename, It can not be empty and 190361847f8eSopenharmony_ci * The length must be less than {@code MAX_KEY_LENGTH}. 190461847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 190561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 190661847f8eSopenharmony_ci * <br>2.Parameter verification failed. 190761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 190861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 190961847f8eSopenharmony_ci * @since 9 191061847f8eSopenharmony_ci */ 191161847f8eSopenharmony_ci backup(file: string): Promise<void>; 191261847f8eSopenharmony_ci 191361847f8eSopenharmony_ci /** 191461847f8eSopenharmony_ci * Restores a database from a specified database file. 191561847f8eSopenharmony_ci * 191661847f8eSopenharmony_ci * @param { string } file - Indicates the database backup filename, It can not be empty and 191761847f8eSopenharmony_ci * The length must be less than {@code MAX_KEY_LENGTH}. 191861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of restore. 191961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 192061847f8eSopenharmony_ci * <br>2.Parameter verification failed. 192161847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 192261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 192361847f8eSopenharmony_ci * @since 9 192461847f8eSopenharmony_ci */ 192561847f8eSopenharmony_ci restore(file: string, callback: AsyncCallback<void>): void; 192661847f8eSopenharmony_ci 192761847f8eSopenharmony_ci /** 192861847f8eSopenharmony_ci * Restores a database from a specified database file. 192961847f8eSopenharmony_ci * 193061847f8eSopenharmony_ci * @param { string } file - Indicates the database backup filename, It can not be empty and 193161847f8eSopenharmony_ci * The length must be less than {@code MAX_KEY_LENGTH}. 193261847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 193361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 193461847f8eSopenharmony_ci * <br>2.Parameter verification failed. 193561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 193661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 193761847f8eSopenharmony_ci * @since 9 193861847f8eSopenharmony_ci */ 193961847f8eSopenharmony_ci restore(file: string): Promise<void>; 194061847f8eSopenharmony_ci 194161847f8eSopenharmony_ci /** 194261847f8eSopenharmony_ci * Delete database backup files based on the specified filenames. 194361847f8eSopenharmony_ci * 194461847f8eSopenharmony_ci * @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and 194561847f8eSopenharmony_ci * The length must be less than {@code MAX_KEY_LENGTH}. 194661847f8eSopenharmony_ci * @param { AsyncCallback<Array<[string, number]>> } callback - {Array<[string, number]>}: 194761847f8eSopenharmony_ci * the list of backup file and it's corresponding delete result which 0 means delete success 194861847f8eSopenharmony_ci * and otherwise failed. 194961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 195061847f8eSopenharmony_ci * <br>2.Parameter verification failed. 195161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 195261847f8eSopenharmony_ci * @since 9 195361847f8eSopenharmony_ci */ 195461847f8eSopenharmony_ci deleteBackup(files: Array<string>, callback: AsyncCallback<Array<[string, number]>>): void; 195561847f8eSopenharmony_ci 195661847f8eSopenharmony_ci /** 195761847f8eSopenharmony_ci * Delete database backup files based on the specified filenames. 195861847f8eSopenharmony_ci * 195961847f8eSopenharmony_ci * @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and 196061847f8eSopenharmony_ci * The length must be less than {@code MAX_KEY_LENGTH}. 196161847f8eSopenharmony_ci * @returns { Promise<Array<[string, number]>> } {Array<[string, number]>}: the list of backup 196261847f8eSopenharmony_ci * file and it's corresponding delete result which 0 means delete success and otherwise failed. 196361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 196461847f8eSopenharmony_ci * <br>2.Parameter verification failed. 196561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 196661847f8eSopenharmony_ci * @since 9 196761847f8eSopenharmony_ci */ 196861847f8eSopenharmony_ci deleteBackup(files: Array<string>): Promise<Array<[string, number]>>; 196961847f8eSopenharmony_ci 197061847f8eSopenharmony_ci /** 197161847f8eSopenharmony_ci * Starts a transaction operation in the {@code SingleKVStore} database. 197261847f8eSopenharmony_ci * <p>After the database transaction is started, you can submit or roll back the operation. 197361847f8eSopenharmony_ci * 197461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of startTransaction. 197561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 197661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 197761847f8eSopenharmony_ci * @since 9 197861847f8eSopenharmony_ci */ 197961847f8eSopenharmony_ci /** 198061847f8eSopenharmony_ci * Starts a transaction operation in the {@code SingleKVStore} database. 198161847f8eSopenharmony_ci * <p>After the database transaction is started, you can submit or roll back the operation. 198261847f8eSopenharmony_ci * 198361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of startTransaction. 198461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 198561847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 198661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 198761847f8eSopenharmony_ci * @since 10 198861847f8eSopenharmony_ci */ 198961847f8eSopenharmony_ci startTransaction(callback: AsyncCallback<void>): void; 199061847f8eSopenharmony_ci 199161847f8eSopenharmony_ci /** 199261847f8eSopenharmony_ci * Starts a transaction operation in the {@code SingleKVStore} database. 199361847f8eSopenharmony_ci * <p>After the database transaction is started, you can submit or roll back the operation. 199461847f8eSopenharmony_ci * 199561847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 199661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 199761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 199861847f8eSopenharmony_ci * @since 9 199961847f8eSopenharmony_ci */ 200061847f8eSopenharmony_ci /** 200161847f8eSopenharmony_ci * Starts a transaction operation in the {@code SingleKVStore} database. 200261847f8eSopenharmony_ci * <p>After the database transaction is started, you can submit or roll back the operation. 200361847f8eSopenharmony_ci * 200461847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 200561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 200661847f8eSopenharmony_ci * @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit. 200761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 200861847f8eSopenharmony_ci * @since 10 200961847f8eSopenharmony_ci */ 201061847f8eSopenharmony_ci startTransaction(): Promise<void>; 201161847f8eSopenharmony_ci 201261847f8eSopenharmony_ci /** 201361847f8eSopenharmony_ci * Submits a transaction operation in the {@code SingleKVStore} database. 201461847f8eSopenharmony_ci * 201561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of commit. 201661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 201761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 201861847f8eSopenharmony_ci * @since 9 201961847f8eSopenharmony_ci */ 202061847f8eSopenharmony_ci commit(callback: AsyncCallback<void>): void; 202161847f8eSopenharmony_ci 202261847f8eSopenharmony_ci /** 202361847f8eSopenharmony_ci * Submits a transaction operation in the {@code SingleKVStore} database. 202461847f8eSopenharmony_ci * 202561847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 202661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 202761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 202861847f8eSopenharmony_ci * @since 9 202961847f8eSopenharmony_ci */ 203061847f8eSopenharmony_ci commit(): Promise<void>; 203161847f8eSopenharmony_ci 203261847f8eSopenharmony_ci /** 203361847f8eSopenharmony_ci * Rolls back a transaction operation in the {@code SingleKVStore} database. 203461847f8eSopenharmony_ci * 203561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of rollback. 203661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 203761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 203861847f8eSopenharmony_ci * @since 9 203961847f8eSopenharmony_ci */ 204061847f8eSopenharmony_ci rollback(callback: AsyncCallback<void>): void; 204161847f8eSopenharmony_ci 204261847f8eSopenharmony_ci /** 204361847f8eSopenharmony_ci * Rolls back a transaction operation in the {@code SingleKVStore} database. 204461847f8eSopenharmony_ci * 204561847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 204661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 204761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 204861847f8eSopenharmony_ci * @since 9 204961847f8eSopenharmony_ci */ 205061847f8eSopenharmony_ci rollback(): Promise<void>; 205161847f8eSopenharmony_ci 205261847f8eSopenharmony_ci /** 205361847f8eSopenharmony_ci * Sets whether to enable synchronization. 205461847f8eSopenharmony_ci * 205561847f8eSopenharmony_ci * @param { boolean } enabled - Specifies whether to enable synchronization. The value true 205661847f8eSopenharmony_ci * means to enable synchronization, and false means the opposite. 205761847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of enableSync. 205861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 205961847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 206061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 206161847f8eSopenharmony_ci * @since 9 206261847f8eSopenharmony_ci */ 206361847f8eSopenharmony_ci enableSync(enabled: boolean, callback: AsyncCallback<void>): void; 206461847f8eSopenharmony_ci 206561847f8eSopenharmony_ci /** 206661847f8eSopenharmony_ci * Sets whether to enable synchronization. 206761847f8eSopenharmony_ci * 206861847f8eSopenharmony_ci * @param { boolean } enabled - Specifies whether to enable synchronization. The value true 206961847f8eSopenharmony_ci * means to enable synchronization, and false means the opposite. 207061847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 207161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 207261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 207361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 207461847f8eSopenharmony_ci * @since 9 207561847f8eSopenharmony_ci */ 207661847f8eSopenharmony_ci enableSync(enabled: boolean): Promise<void>; 207761847f8eSopenharmony_ci 207861847f8eSopenharmony_ci /** 207961847f8eSopenharmony_ci * Sets synchronization range labels. 208061847f8eSopenharmony_ci * <p>The labels determine the devices with which data will be synchronized. 208161847f8eSopenharmony_ci * 208261847f8eSopenharmony_ci * @param { string[] } localLabels - Indicates the synchronization labels of the local device. 208361847f8eSopenharmony_ci * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which 208461847f8eSopenharmony_ci * data will be synchronized. 208561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setSyncRange. 208661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 208761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 208861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 208961847f8eSopenharmony_ci * @since 9 209061847f8eSopenharmony_ci */ 209161847f8eSopenharmony_ci setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback<void>): void; 209261847f8eSopenharmony_ci 209361847f8eSopenharmony_ci /** 209461847f8eSopenharmony_ci * Sets synchronization range labels. 209561847f8eSopenharmony_ci * <p>The labels determine the devices with which data will be synchronized. 209661847f8eSopenharmony_ci * 209761847f8eSopenharmony_ci * @param { string[] } localLabels - Indicates the synchronization labels of the local device. 209861847f8eSopenharmony_ci * @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which 209961847f8eSopenharmony_ci * data will be synchronized. 210061847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 210161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 210261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 210361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 210461847f8eSopenharmony_ci * @since 9 210561847f8eSopenharmony_ci */ 210661847f8eSopenharmony_ci setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>; 210761847f8eSopenharmony_ci 210861847f8eSopenharmony_ci /** 210961847f8eSopenharmony_ci * Sets the default delay allowed for database synchronization 211061847f8eSopenharmony_ci * 211161847f8eSopenharmony_ci * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the 211261847f8eSopenharmony_ci * database synchronization, in milliseconds. 211361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setSyncParam. 211461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 211561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 211661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 211761847f8eSopenharmony_ci * @since 9 211861847f8eSopenharmony_ci */ 211961847f8eSopenharmony_ci setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void; 212061847f8eSopenharmony_ci 212161847f8eSopenharmony_ci /** 212261847f8eSopenharmony_ci * Sets the default delay allowed for database synchronization 212361847f8eSopenharmony_ci * 212461847f8eSopenharmony_ci * @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the 212561847f8eSopenharmony_ci * database synchronization, in milliseconds. 212661847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 212761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 212861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 212961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 213061847f8eSopenharmony_ci * @since 9 213161847f8eSopenharmony_ci */ 213261847f8eSopenharmony_ci setSyncParam(defaultAllowedDelayMs: number): Promise<void>; 213361847f8eSopenharmony_ci 213461847f8eSopenharmony_ci /** 213561847f8eSopenharmony_ci * Synchronize the database to the specified devices with the specified delay allowed. 213661847f8eSopenharmony_ci * 213761847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 213861847f8eSopenharmony_ci * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database. 213961847f8eSopenharmony_ci * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH}, 214061847f8eSopenharmony_ci * {@code PULL}, or {@code PUSH_PULL}. 214161847f8eSopenharmony_ci * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds. 214261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 214361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 214461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 214561847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 214661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 214761847f8eSopenharmony_ci * @since 9 214861847f8eSopenharmony_ci */ 214961847f8eSopenharmony_ci sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; 215061847f8eSopenharmony_ci 215161847f8eSopenharmony_ci /** 215261847f8eSopenharmony_ci * Synchronize the database to the specified devices with the specified delay allowed. 215361847f8eSopenharmony_ci * 215461847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 215561847f8eSopenharmony_ci * @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database. 215661847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 215761847f8eSopenharmony_ci * @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH}, 215861847f8eSopenharmony_ci * {@code PULL}, or {@code PUSH_PULL}. 215961847f8eSopenharmony_ci * @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds. 216061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 216161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 216261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 216361847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 216461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 216561847f8eSopenharmony_ci * @since 9 216661847f8eSopenharmony_ci */ 216761847f8eSopenharmony_ci sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; 216861847f8eSopenharmony_ci 216961847f8eSopenharmony_ci /** 217061847f8eSopenharmony_ci * Register a callback to the database and when data in the distributed database has changed, 217161847f8eSopenharmony_ci * the callback will be invoked. 217261847f8eSopenharmony_ci * 217361847f8eSopenharmony_ci * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event. 217461847f8eSopenharmony_ci * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}. 217561847f8eSopenharmony_ci * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification} 217661847f8eSopenharmony_ci * object indicates the data change events in the distributed database. 217761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 217861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 217961847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 218061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 218161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 218261847f8eSopenharmony_ci * @since 9 218361847f8eSopenharmony_ci */ 218461847f8eSopenharmony_ci /** 218561847f8eSopenharmony_ci * Register a callback to the database and when data in the distributed database has changed, 218661847f8eSopenharmony_ci * the callback will be invoked. 218761847f8eSopenharmony_ci * 218861847f8eSopenharmony_ci * @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event. 218961847f8eSopenharmony_ci * @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}. 219061847f8eSopenharmony_ci * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification} 219161847f8eSopenharmony_ci * object indicates the data change events in the distributed database. 219261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 219361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 219461847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 219561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 219661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 219761847f8eSopenharmony_ci * @since 10 219861847f8eSopenharmony_ci */ 219961847f8eSopenharmony_ci on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void; 220061847f8eSopenharmony_ci 220161847f8eSopenharmony_ci /** 220261847f8eSopenharmony_ci * Register a databases synchronization callback to the database. 220361847f8eSopenharmony_ci * <p> Sync result is returned through asynchronous callback. 220461847f8eSopenharmony_ci * 220561847f8eSopenharmony_ci * @param { 'syncComplete' } event - Subscribed event name, fixed as 'syncComplete', indicates the synchronization completion event. 220661847f8eSopenharmony_ci * @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the 220761847f8eSopenharmony_ci * deviceId and it's corresponding synchronization result which 0 means synchronization success 220861847f8eSopenharmony_ci * and otherwise failed. 220961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 221061847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 221161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 221261847f8eSopenharmony_ci * @since 9 221361847f8eSopenharmony_ci */ 221461847f8eSopenharmony_ci on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void; 221561847f8eSopenharmony_ci 221661847f8eSopenharmony_ci /** 221761847f8eSopenharmony_ci * Unsubscribe from the SingleKVStore database based on the specified subscribeType and listener. 221861847f8eSopenharmony_ci * 221961847f8eSopenharmony_ci * @param { 'dataChange' } event - The unsubscribe event name, fixed as 'dataChange', indicates the data change event. 222061847f8eSopenharmony_ci * @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification} 222161847f8eSopenharmony_ci * object indicates the data change events in the distributed database. 222261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 222361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 222461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 222561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 222661847f8eSopenharmony_ci * @since 9 222761847f8eSopenharmony_ci */ 222861847f8eSopenharmony_ci off(event: 'dataChange', listener?: Callback<ChangeNotification>): void; 222961847f8eSopenharmony_ci 223061847f8eSopenharmony_ci /** 223161847f8eSopenharmony_ci * Unregister the database synchronization callback. 223261847f8eSopenharmony_ci * 223361847f8eSopenharmony_ci * @param { 'syncComplete' } event - The unsubscribe event name, fixed as 'syncComplete', indicates the synchronization completion event. 223461847f8eSopenharmony_ci * @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the 223561847f8eSopenharmony_ci * deviceId and it's corresponding synchronization result which 0 means synchronization success 223661847f8eSopenharmony_ci * and otherwise failed. 223761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 223861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 223961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 224061847f8eSopenharmony_ci * @since 9 224161847f8eSopenharmony_ci */ 224261847f8eSopenharmony_ci off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>>): void; 224361847f8eSopenharmony_ci 224461847f8eSopenharmony_ci /** 224561847f8eSopenharmony_ci * Get the security level of the database. 224661847f8eSopenharmony_ci * 224761847f8eSopenharmony_ci * @param { AsyncCallback<SecurityLevel> } callback - {SecurityLevel}: the {@code SecurityLevel} 224861847f8eSopenharmony_ci * object indicates the security level of the database. 224961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 225061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 225161847f8eSopenharmony_ci * @since 9 225261847f8eSopenharmony_ci */ 225361847f8eSopenharmony_ci getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void; 225461847f8eSopenharmony_ci 225561847f8eSopenharmony_ci /** 225661847f8eSopenharmony_ci * Get the security level of the database. 225761847f8eSopenharmony_ci * 225861847f8eSopenharmony_ci * @returns { Promise<SecurityLevel> } {SecurityLevel}: the {@code SecurityLevel} object indicates 225961847f8eSopenharmony_ci * the security level of the database. 226061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 226161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 226261847f8eSopenharmony_ci * @since 9 226361847f8eSopenharmony_ci */ 226461847f8eSopenharmony_ci getSecurityLevel(): Promise<SecurityLevel>; 226561847f8eSopenharmony_ci } 226661847f8eSopenharmony_ci 226761847f8eSopenharmony_ci /** 226861847f8eSopenharmony_ci * Provides methods related to device-collaboration distributed databases. 226961847f8eSopenharmony_ci * <p>To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKVStore(Options, String)} 227061847f8eSopenharmony_ci * method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed 227161847f8eSopenharmony_ci * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry 227261847f8eSopenharmony_ci * into the database, the system automatically adds the ID of the device running the application to the key. 227361847f8eSopenharmony_ci * 227461847f8eSopenharmony_ci * @interface DeviceKVStore 227561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 227661847f8eSopenharmony_ci * @since 9 227761847f8eSopenharmony_ci */ 227861847f8eSopenharmony_ci interface DeviceKVStore extends SingleKVStore { 227961847f8eSopenharmony_ci /** 228061847f8eSopenharmony_ci * Obtains the value matching the local device ID and specified key. 228161847f8eSopenharmony_ci * 228261847f8eSopenharmony_ci * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 228361847f8eSopenharmony_ci * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback - 228461847f8eSopenharmony_ci * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. 228561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 228661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 228761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 228861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 228961847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 229061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 229161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 229261847f8eSopenharmony_ci * @since 9 229361847f8eSopenharmony_ci */ 229461847f8eSopenharmony_ci get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void; 229561847f8eSopenharmony_ci 229661847f8eSopenharmony_ci /** 229761847f8eSopenharmony_ci * Obtains the value matching the local device ID and specified key. 229861847f8eSopenharmony_ci * 229961847f8eSopenharmony_ci * @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 230061847f8eSopenharmony_ci * @returns { Promise<boolean | string | number | Uint8Array> } 230161847f8eSopenharmony_ci * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. 230261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 230361847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 230461847f8eSopenharmony_ci * <br>3.Parameter verification failed. 230561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 230661847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 230761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 230861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 230961847f8eSopenharmony_ci * @since 9 231061847f8eSopenharmony_ci */ 231161847f8eSopenharmony_ci get(key: string): Promise<boolean | string | number | Uint8Array>; 231261847f8eSopenharmony_ci 231361847f8eSopenharmony_ci /** 231461847f8eSopenharmony_ci * Obtains the value matching a specified device ID and key. 231561847f8eSopenharmony_ci * 231661847f8eSopenharmony_ci * @param { string } deviceId - Indicates the device to be queried. 231761847f8eSopenharmony_ci * @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}. 231861847f8eSopenharmony_ci * @param { AsyncCallback<boolean | string | number | Uint8Array> } callback - 231961847f8eSopenharmony_ci * {boolean | string | number | Uint8Array}: the returned value specified by the deviceId and key. 232061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 232161847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 232261847f8eSopenharmony_ci * <br>3.Parameter verification failed. 232361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 232461847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 232561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 232661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 232761847f8eSopenharmony_ci * @since 9 232861847f8eSopenharmony_ci */ 232961847f8eSopenharmony_ci get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void; 233061847f8eSopenharmony_ci 233161847f8eSopenharmony_ci /** 233261847f8eSopenharmony_ci * Obtains the value matching a specified device ID and key. 233361847f8eSopenharmony_ci * 233461847f8eSopenharmony_ci * @param { string } deviceId - Indicates the device to be queried. 233561847f8eSopenharmony_ci * @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}. 233661847f8eSopenharmony_ci * @returns { Promise<boolean | string | number | Uint8Array> } 233761847f8eSopenharmony_ci * {Uint8Array|string|boolean|number}: the returned value specified by the deviceId and key. 233861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 233961847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 234061847f8eSopenharmony_ci * <br>3.Parameter verification failed. 234161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 234261847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 234361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 234461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 234561847f8eSopenharmony_ci * @since 9 234661847f8eSopenharmony_ci */ 234761847f8eSopenharmony_ci get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array>; 234861847f8eSopenharmony_ci 234961847f8eSopenharmony_ci /** 235061847f8eSopenharmony_ci * Obtains all key-value pairs that match the local device ID and specified key prefix. 235161847f8eSopenharmony_ci * 235261847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 235361847f8eSopenharmony_ci * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs 235461847f8eSopenharmony_ci * that match the local device ID and specified key prefix. 235561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 235661847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 235761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 235861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 235961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 236061847f8eSopenharmony_ci * @since 9 236161847f8eSopenharmony_ci */ 236261847f8eSopenharmony_ci getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void; 236361847f8eSopenharmony_ci 236461847f8eSopenharmony_ci /** 236561847f8eSopenharmony_ci * Obtains all key-value pairs that match the local device ID and specified key prefix. 236661847f8eSopenharmony_ci * 236761847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 236861847f8eSopenharmony_ci * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the 236961847f8eSopenharmony_ci * local device ID and specified key prefix. 237061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 237161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 237261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 237361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 237461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 237561847f8eSopenharmony_ci * @since 9 237661847f8eSopenharmony_ci */ 237761847f8eSopenharmony_ci getEntries(keyPrefix: string): Promise<Entry[]>; 237861847f8eSopenharmony_ci 237961847f8eSopenharmony_ci /** 238061847f8eSopenharmony_ci * Obtains all key-value pairs matching a specified device ID and key prefix. 238161847f8eSopenharmony_ci * 238261847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be queried. 238361847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 238461847f8eSopenharmony_ci * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs 238561847f8eSopenharmony_ci * that match the specified deviceId and key prefix. 238661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 238761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 238861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 238961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 239061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 239161847f8eSopenharmony_ci * @since 9 239261847f8eSopenharmony_ci */ 239361847f8eSopenharmony_ci getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void; 239461847f8eSopenharmony_ci 239561847f8eSopenharmony_ci /** 239661847f8eSopenharmony_ci * Obtains all key-value pairs matching a specified device ID and key prefix. 239761847f8eSopenharmony_ci * 239861847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be queried. 239961847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 240061847f8eSopenharmony_ci * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the 240161847f8eSopenharmony_ci * specified deviceId and key prefix. 240261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 240361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 240461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 240561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 240661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 240761847f8eSopenharmony_ci * @since 9 240861847f8eSopenharmony_ci */ 240961847f8eSopenharmony_ci getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>; 241061847f8eSopenharmony_ci 241161847f8eSopenharmony_ci /** 241261847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. 241361847f8eSopenharmony_ci * 241461847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 241561847f8eSopenharmony_ci * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs 241661847f8eSopenharmony_ci * matching the local device ID and specified {@code Query} object. 241761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 241861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 241961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 242061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 242161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 242261847f8eSopenharmony_ci * @since 9 242361847f8eSopenharmony_ci */ 242461847f8eSopenharmony_ci getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; 242561847f8eSopenharmony_ci 242661847f8eSopenharmony_ci /** 242761847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. 242861847f8eSopenharmony_ci * 242961847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 243061847f8eSopenharmony_ci * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the local device ID and 243161847f8eSopenharmony_ci * specified {@code Query} object. 243261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 243361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 243461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 243561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 243661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 243761847f8eSopenharmony_ci * @since 9 243861847f8eSopenharmony_ci */ 243961847f8eSopenharmony_ci getEntries(query: Query): Promise<Entry[]>; 244061847f8eSopenharmony_ci 244161847f8eSopenharmony_ci /** 244261847f8eSopenharmony_ci * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. 244361847f8eSopenharmony_ci * 244461847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong. 244561847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 244661847f8eSopenharmony_ci * @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs 244761847f8eSopenharmony_ci * matching the specified deviceId and {@code Query} object. 244861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 244961847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 245061847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 245161847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 245261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 245361847f8eSopenharmony_ci * @since 9 245461847f8eSopenharmony_ci */ 245561847f8eSopenharmony_ci getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void; 245661847f8eSopenharmony_ci 245761847f8eSopenharmony_ci /** 245861847f8eSopenharmony_ci * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. 245961847f8eSopenharmony_ci * 246061847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong. 246161847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 246261847f8eSopenharmony_ci * @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the 246361847f8eSopenharmony_ci * specified deviceId and {@code Query} object. 246461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 246561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 246661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 246761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 246861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 246961847f8eSopenharmony_ci * @since 9 247061847f8eSopenharmony_ci */ 247161847f8eSopenharmony_ci getEntries(deviceId: string, query: Query): Promise<Entry[]>; 247261847f8eSopenharmony_ci 247361847f8eSopenharmony_ci /** 247461847f8eSopenharmony_ci * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. 247561847f8eSopenharmony_ci * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. 247661847f8eSopenharmony_ci * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. 247761847f8eSopenharmony_ci * If you have created four objects, calling this method will return a failure. Therefore, you are advised to 247861847f8eSopenharmony_ci * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 247961847f8eSopenharmony_ci * 248061847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 248161847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 248261847f8eSopenharmony_ci * object matching the local device ID and specified keyPrefix. 248361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 248461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 248561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 248661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 248761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 248861847f8eSopenharmony_ci * @since 9 248961847f8eSopenharmony_ci */ 249061847f8eSopenharmony_ci /** 249161847f8eSopenharmony_ci * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. 249261847f8eSopenharmony_ci * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. 249361847f8eSopenharmony_ci * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. 249461847f8eSopenharmony_ci * If you have created four objects, calling this method will return a failure. Therefore, you are advised to 249561847f8eSopenharmony_ci * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 249661847f8eSopenharmony_ci * 249761847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 249861847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 249961847f8eSopenharmony_ci * object matching the local device ID and specified keyPrefix. 250061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 250161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 250261847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 250361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 250461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 250561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 250661847f8eSopenharmony_ci * @since 10 250761847f8eSopenharmony_ci */ 250861847f8eSopenharmony_ci getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void; 250961847f8eSopenharmony_ci 251061847f8eSopenharmony_ci /** 251161847f8eSopenharmony_ci * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. 251261847f8eSopenharmony_ci * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. 251361847f8eSopenharmony_ci * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. 251461847f8eSopenharmony_ci * If you have created four objects, calling this method will return a failure. Therefore, you are advised to 251561847f8eSopenharmony_ci * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 251661847f8eSopenharmony_ci * 251761847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 251861847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 251961847f8eSopenharmony_ci * object matching the local device ID and specified keyPrefix. 252061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 252161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 252261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 252361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 252461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 252561847f8eSopenharmony_ci * @since 9 252661847f8eSopenharmony_ci */ 252761847f8eSopenharmony_ci /** 252861847f8eSopenharmony_ci * Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database. 252961847f8eSopenharmony_ci * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. 253061847f8eSopenharmony_ci * Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. 253161847f8eSopenharmony_ci * If you have created four objects, calling this method will return a failure. Therefore, you are advised to 253261847f8eSopenharmony_ci * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. 253361847f8eSopenharmony_ci * 253461847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 253561847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 253661847f8eSopenharmony_ci * object matching the local device ID and specified keyPrefix. 253761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 253861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 253961847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 254061847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 254161847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 254261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 254361847f8eSopenharmony_ci * @since 10 254461847f8eSopenharmony_ci */ 254561847f8eSopenharmony_ci getResultSet(keyPrefix: string): Promise<KVStoreResultSet>; 254661847f8eSopenharmony_ci 254761847f8eSopenharmony_ci /** 254861847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. 254961847f8eSopenharmony_ci * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} 255061847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, 255161847f8eSopenharmony_ci * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary 255261847f8eSopenharmony_ci * {@code KVStoreResultSet} objects in a timely manner. 255361847f8eSopenharmony_ci * 255461847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be queried. 255561847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 255661847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 255761847f8eSopenharmony_ci * object matching the specified deviceId and keyPrefix. 255861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 255961847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 256061847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 256161847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 256261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 256361847f8eSopenharmony_ci * @since 9 256461847f8eSopenharmony_ci */ 256561847f8eSopenharmony_ci /** 256661847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. 256761847f8eSopenharmony_ci * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} 256861847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, 256961847f8eSopenharmony_ci * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary 257061847f8eSopenharmony_ci * {@code KVStoreResultSet} objects in a timely manner. 257161847f8eSopenharmony_ci * 257261847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be queried. 257361847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 257461847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 257561847f8eSopenharmony_ci * object matching the specified deviceId and keyPrefix. 257661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 257761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 257861847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 257961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 258061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 258161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 258261847f8eSopenharmony_ci * @since 10 258361847f8eSopenharmony_ci */ 258461847f8eSopenharmony_ci getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void; 258561847f8eSopenharmony_ci 258661847f8eSopenharmony_ci /** 258761847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. 258861847f8eSopenharmony_ci * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} 258961847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, 259061847f8eSopenharmony_ci * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary 259161847f8eSopenharmony_ci * {@code KVStoreResultSet} objects in a timely manner. 259261847f8eSopenharmony_ci * 259361847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be queried. 259461847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 259561847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 259661847f8eSopenharmony_ci * object matching the specified deviceId and keyPrefix. 259761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 259861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 259961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 260061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 260161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 260261847f8eSopenharmony_ci * @since 9 260361847f8eSopenharmony_ci */ 260461847f8eSopenharmony_ci /** 260561847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. 260661847f8eSopenharmony_ci * <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore} 260761847f8eSopenharmony_ci * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, 260861847f8eSopenharmony_ci * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary 260961847f8eSopenharmony_ci * {@code KVStoreResultSet} objects in a timely manner. 261061847f8eSopenharmony_ci * 261161847f8eSopenharmony_ci * @param { string } deviceId - Identifies the device whose data is to be queried. 261261847f8eSopenharmony_ci * @param { string } keyPrefix - Indicates the key prefix to match. 261361847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 261461847f8eSopenharmony_ci * object matching the specified deviceId and keyPrefix. 261561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 261661847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 261761847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 261861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 261961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 262061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 262161847f8eSopenharmony_ci * @since 10 262261847f8eSopenharmony_ci */ 262361847f8eSopenharmony_ci getResultSet(deviceId: string, keyPrefix: string): Promise<KVStoreResultSet>; 262461847f8eSopenharmony_ci 262561847f8eSopenharmony_ci /** 262661847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. 262761847f8eSopenharmony_ci * 262861847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 262961847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 263061847f8eSopenharmony_ci * object matching the local device ID and specified {@code Query} object. 263161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 263261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 263361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 263461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 263561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 263661847f8eSopenharmony_ci * @since 9 263761847f8eSopenharmony_ci */ 263861847f8eSopenharmony_ci /** 263961847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. 264061847f8eSopenharmony_ci * 264161847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 264261847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 264361847f8eSopenharmony_ci * object matching the local device ID and specified {@code Query} object. 264461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 264561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 264661847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 264761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 264861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 264961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 265061847f8eSopenharmony_ci * @since 10 265161847f8eSopenharmony_ci */ 265261847f8eSopenharmony_ci getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void; 265361847f8eSopenharmony_ci 265461847f8eSopenharmony_ci /** 265561847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. 265661847f8eSopenharmony_ci * 265761847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 265861847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 265961847f8eSopenharmony_ci * object matching the local device ID and specified {@code Query} object. 266061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 266161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 266261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 266361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 266461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 266561847f8eSopenharmony_ci * @since 9 266661847f8eSopenharmony_ci */ 266761847f8eSopenharmony_ci /** 266861847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. 266961847f8eSopenharmony_ci * 267061847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 267161847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 267261847f8eSopenharmony_ci * object matching the local device ID and specified {@code Query} object. 267361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 267461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 267561847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 267661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 267761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 267861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 267961847f8eSopenharmony_ci * @since 10 268061847f8eSopenharmony_ci */ 268161847f8eSopenharmony_ci getResultSet(query: Query): Promise<KVStoreResultSet>; 268261847f8eSopenharmony_ci 268361847f8eSopenharmony_ci /** 268461847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. 268561847f8eSopenharmony_ci * 268661847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. 268761847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 268861847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 268961847f8eSopenharmony_ci * object matching the specified deviceId and {@code Query} object. 269061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 269161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 269261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 269361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 269461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 269561847f8eSopenharmony_ci * @since 9 269661847f8eSopenharmony_ci */ 269761847f8eSopenharmony_ci /** 269861847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. 269961847f8eSopenharmony_ci * 270061847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. 270161847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 270261847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 270361847f8eSopenharmony_ci * object matching the specified deviceId and {@code Query} object. 270461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 270561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 270661847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 270761847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 270861847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 270961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 271061847f8eSopenharmony_ci * @since 10 271161847f8eSopenharmony_ci */ 271261847f8eSopenharmony_ci getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreResultSet>): void; 271361847f8eSopenharmony_ci 271461847f8eSopenharmony_ci /** 271561847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. 271661847f8eSopenharmony_ci * 271761847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. 271861847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 271961847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 272061847f8eSopenharmony_ci * object matching the specified deviceId and {@code Query} object. 272161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 272261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 272361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 272461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 272561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 272661847f8eSopenharmony_ci * @since 9 272761847f8eSopenharmony_ci */ 272861847f8eSopenharmony_ci /** 272961847f8eSopenharmony_ci * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. 273061847f8eSopenharmony_ci * 273161847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. 273261847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 273361847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 273461847f8eSopenharmony_ci * object matching the specified deviceId and {@code Query} object. 273561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 273661847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 273761847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 273861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 273961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 274061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 274161847f8eSopenharmony_ci * @since 10 274261847f8eSopenharmony_ci */ 274361847f8eSopenharmony_ci getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet>; 274461847f8eSopenharmony_ci 274561847f8eSopenharmony_ci /** 274661847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. 274761847f8eSopenharmony_ci * 274861847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 274961847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 275061847f8eSopenharmony_ci * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. 275161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 275261847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 275361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 275461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 275561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 275661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 275761847f8eSopenharmony_ci * @systemapi 275861847f8eSopenharmony_ci * @StageModelOnly 275961847f8eSopenharmony_ci * @since 9 276061847f8eSopenharmony_ci */ 276161847f8eSopenharmony_ci /** 276261847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. 276361847f8eSopenharmony_ci * 276461847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 276561847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 276661847f8eSopenharmony_ci * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. 276761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 276861847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 276961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 277061847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 277161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 277261847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 277361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 277461847f8eSopenharmony_ci * @systemapi 277561847f8eSopenharmony_ci * @StageModelOnly 277661847f8eSopenharmony_ci * @since 10 277761847f8eSopenharmony_ci */ 277861847f8eSopenharmony_ci getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void; 277961847f8eSopenharmony_ci 278061847f8eSopenharmony_ci /** 278161847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. 278261847f8eSopenharmony_ci * 278361847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 278461847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 278561847f8eSopenharmony_ci * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. 278661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 278761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 278861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 278961847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 279061847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 279161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 279261847f8eSopenharmony_ci * @systemapi 279361847f8eSopenharmony_ci * @StageModelOnly 279461847f8eSopenharmony_ci * @since 9 279561847f8eSopenharmony_ci */ 279661847f8eSopenharmony_ci /** 279761847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. 279861847f8eSopenharmony_ci * 279961847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates. 280061847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 280161847f8eSopenharmony_ci * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. 280261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 280361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 280461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 280561847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 280661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 280761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 280861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 280961847f8eSopenharmony_ci * @systemapi 281061847f8eSopenharmony_ci * @StageModelOnly 281161847f8eSopenharmony_ci * @since 10 281261847f8eSopenharmony_ci */ 281361847f8eSopenharmony_ci getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>; 281461847f8eSopenharmony_ci 281561847f8eSopenharmony_ci /** 281661847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. 281761847f8eSopenharmony_ci * 281861847f8eSopenharmony_ci * @param { string } deviceId Indicates the ID of the device to which the results belong. 281961847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 282061847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 282161847f8eSopenharmony_ci * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. 282261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 282361847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 282461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 282561847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 282661847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 282761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 282861847f8eSopenharmony_ci * @systemapi 282961847f8eSopenharmony_ci * @StageModelOnly 283061847f8eSopenharmony_ci * @since 9 283161847f8eSopenharmony_ci */ 283261847f8eSopenharmony_ci /** 283361847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. 283461847f8eSopenharmony_ci * 283561847f8eSopenharmony_ci * @param { string } deviceId Indicates the ID of the device to which the results belong. 283661847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 283761847f8eSopenharmony_ci * @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet} 283861847f8eSopenharmony_ci * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. 283961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 284061847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 284161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 284261847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 284361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 284461847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 284561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 284661847f8eSopenharmony_ci * @systemapi 284761847f8eSopenharmony_ci * @StageModelOnly 284861847f8eSopenharmony_ci * @since 10 284961847f8eSopenharmony_ci */ 285061847f8eSopenharmony_ci getResultSet( 285161847f8eSopenharmony_ci deviceId: string, 285261847f8eSopenharmony_ci predicates: dataSharePredicates.DataSharePredicates, 285361847f8eSopenharmony_ci callback: AsyncCallback<KVStoreResultSet> 285461847f8eSopenharmony_ci ): void; 285561847f8eSopenharmony_ci 285661847f8eSopenharmony_ci /** 285761847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. 285861847f8eSopenharmony_ci * 285961847f8eSopenharmony_ci * @param { string } deviceId Indicates the ID of the device to which the results belong. 286061847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 286161847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 286261847f8eSopenharmony_ci * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. 286361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 286461847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 286561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 286661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 286761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 286861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 286961847f8eSopenharmony_ci * @systemapi 287061847f8eSopenharmony_ci * @StageModelOnly 287161847f8eSopenharmony_ci * @since 9 287261847f8eSopenharmony_ci */ 287361847f8eSopenharmony_ci /** 287461847f8eSopenharmony_ci * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. 287561847f8eSopenharmony_ci * 287661847f8eSopenharmony_ci * @param { string } deviceId Indicates the ID of the device to which the results belong. 287761847f8eSopenharmony_ci * @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates. 287861847f8eSopenharmony_ci * @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet} 287961847f8eSopenharmony_ci * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. 288061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 288161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 288261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API. 288361847f8eSopenharmony_ci * @throws { BusinessError } 15100001 - Over max limits. 288461847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 288561847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 288661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 288761847f8eSopenharmony_ci * @systemapi 288861847f8eSopenharmony_ci * @StageModelOnly 288961847f8eSopenharmony_ci * @since 10 289061847f8eSopenharmony_ci */ 289161847f8eSopenharmony_ci getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>; 289261847f8eSopenharmony_ci 289361847f8eSopenharmony_ci /** 289461847f8eSopenharmony_ci * Obtains the number of results matching the local device ID and specified {@code Query} object. 289561847f8eSopenharmony_ci * 289661847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 289761847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of results matching the 289861847f8eSopenharmony_ci * local device ID and specified {@code Query} object. 289961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 290061847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 290161847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 290261847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 290361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 290461847f8eSopenharmony_ci * @since 9 290561847f8eSopenharmony_ci */ 290661847f8eSopenharmony_ci getResultSize(query: Query, callback: AsyncCallback<number>): void; 290761847f8eSopenharmony_ci 290861847f8eSopenharmony_ci /** 290961847f8eSopenharmony_ci * Obtains the number of results matching the local device ID and specified {@code Query} object. 291061847f8eSopenharmony_ci * 291161847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 291261847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of results matching the local device ID and specified 291361847f8eSopenharmony_ci * {@code Query} object. 291461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 291561847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 291661847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 291761847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 291861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 291961847f8eSopenharmony_ci * @since 9 292061847f8eSopenharmony_ci */ 292161847f8eSopenharmony_ci getResultSize(query: Query): Promise<number>; 292261847f8eSopenharmony_ci 292361847f8eSopenharmony_ci /** 292461847f8eSopenharmony_ci * Obtains the number of results matching a specified device ID and {@code Query} object. 292561847f8eSopenharmony_ci * 292661847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the results belong. 292761847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 292861847f8eSopenharmony_ci * @param { AsyncCallback<number> } callback - {number}: the number of results matching the 292961847f8eSopenharmony_ci * specified deviceId and {@code Query} object. 293061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 293161847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 293261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 293361847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 293461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 293561847f8eSopenharmony_ci * @since 9 293661847f8eSopenharmony_ci */ 293761847f8eSopenharmony_ci getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void; 293861847f8eSopenharmony_ci 293961847f8eSopenharmony_ci /** 294061847f8eSopenharmony_ci * Obtains the number of results matching a specified device ID and {@code Query} object. 294161847f8eSopenharmony_ci * 294261847f8eSopenharmony_ci * @param { string } deviceId - Indicates the ID of the device to which the results belong. 294361847f8eSopenharmony_ci * @param { Query } query - Indicates the {@code Query} object. 294461847f8eSopenharmony_ci * @returns { Promise<number> } {number}: the number of results matching the specified 294561847f8eSopenharmony_ci * deviceId and {@code Query} object. 294661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 294761847f8eSopenharmony_ci * <br>2.Incorrect parameters types. 294861847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 294961847f8eSopenharmony_ci * @throws { BusinessError } 15100005 - Database or result set already closed. 295061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 295161847f8eSopenharmony_ci * @since 9 295261847f8eSopenharmony_ci */ 295361847f8eSopenharmony_ci getResultSize(deviceId: string, query: Query): Promise<number>; 295461847f8eSopenharmony_ci } 295561847f8eSopenharmony_ci 295661847f8eSopenharmony_ci /** 295761847f8eSopenharmony_ci * Creates a {@link KVManager} instance based on the configuration information. 295861847f8eSopenharmony_ci * <p>You must pass {@link KVManagerConfig} to provide configuration information 295961847f8eSopenharmony_ci * to create a {@link KVManager} instance. 296061847f8eSopenharmony_ci * 296161847f8eSopenharmony_ci * @param { KVManagerConfig } config - Indicates the KVStore configuration information, 296261847f8eSopenharmony_ci * including the package name and context, and package name can not be empty. 296361847f8eSopenharmony_ci * @returns { KVManager } : the {@code KVManager} instance. 296461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 296561847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 296661847f8eSopenharmony_ci * <br>3.Parameter verification failed. 296761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 296861847f8eSopenharmony_ci * @since 9 296961847f8eSopenharmony_ci */ 297061847f8eSopenharmony_ci function createKVManager(config: KVManagerConfig): KVManager; 297161847f8eSopenharmony_ci 297261847f8eSopenharmony_ci /** 297361847f8eSopenharmony_ci * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}. 297461847f8eSopenharmony_ci * 297561847f8eSopenharmony_ci * @interface KVManager 297661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 297761847f8eSopenharmony_ci * @since 9 297861847f8eSopenharmony_ci */ 297961847f8eSopenharmony_ci interface KVManager { 298061847f8eSopenharmony_ci /** 298161847f8eSopenharmony_ci * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. 298261847f8eSopenharmony_ci * 298361847f8eSopenharmony_ci * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique 298461847f8eSopenharmony_ci * for the same application, and different applications can share the same value. The storeId can consist 298561847f8eSopenharmony_ci * of only letters, digits, and underscores (_), and cannot exceed 128 characters. 298661847f8eSopenharmony_ci * @param { Options } options - Indicates the {@code Options} object used for creating and 298761847f8eSopenharmony_ci * obtaining the KVStore database. 298861847f8eSopenharmony_ci * @param { AsyncCallback<T> } callback - {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. 298961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 299061847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 299161847f8eSopenharmony_ci * <br>3.Parameter verification failed. 299261847f8eSopenharmony_ci * @throws { BusinessError } 15100002 - Open existed database with changed options. 299361847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 299461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 299561847f8eSopenharmony_ci * @since 9 299661847f8eSopenharmony_ci */ 299761847f8eSopenharmony_ci getKVStore<T>(storeId: string, options: Options, callback: AsyncCallback<T>): void; 299861847f8eSopenharmony_ci 299961847f8eSopenharmony_ci /** 300061847f8eSopenharmony_ci * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. 300161847f8eSopenharmony_ci * 300261847f8eSopenharmony_ci * @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique 300361847f8eSopenharmony_ci * for the same application, and different applications can share the same value. The storeId can consist 300461847f8eSopenharmony_ci * of only letters, digits, and underscores (_), and cannot exceed 128 characters. 300561847f8eSopenharmony_ci * @param { Options } options - Indicates the {@code Options} object used for creating and 300661847f8eSopenharmony_ci * obtaining the KVStore database. 300761847f8eSopenharmony_ci * @returns { Promise<T> } {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. 300861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 300961847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 301061847f8eSopenharmony_ci * <br>3.Parameter verification failed. 301161847f8eSopenharmony_ci * @throws { BusinessError } 15100002 - Open existed database with changed options. 301261847f8eSopenharmony_ci * @throws { BusinessError } 15100003 - Database corrupted. 301361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 301461847f8eSopenharmony_ci * @since 9 301561847f8eSopenharmony_ci */ 301661847f8eSopenharmony_ci getKVStore<T>(storeId: string, options: Options): Promise<T>; 301761847f8eSopenharmony_ci 301861847f8eSopenharmony_ci /** 301961847f8eSopenharmony_ci * Closes the KVStore database. 302061847f8eSopenharmony_ci * <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your 302161847f8eSopenharmony_ci * thread may crash. 302261847f8eSopenharmony_ci * <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this 302361847f8eSopenharmony_ci * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise 302461847f8eSopenharmony_ci * closing the database will fail. 302561847f8eSopenharmony_ci * 302661847f8eSopenharmony_ci * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. 302761847f8eSopenharmony_ci * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits, 302861847f8eSopenharmony_ci * and underscores (_), and cannot exceed 128 characters. 302961847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of closeKVStore. 303061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 303161847f8eSopenharmony_ci * <br>2.Parameter verification failed. 303261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 303361847f8eSopenharmony_ci * @since 9 303461847f8eSopenharmony_ci */ 303561847f8eSopenharmony_ci closeKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void; 303661847f8eSopenharmony_ci 303761847f8eSopenharmony_ci /** 303861847f8eSopenharmony_ci * Closes the KVStore database. 303961847f8eSopenharmony_ci * <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your 304061847f8eSopenharmony_ci * thread may crash. 304161847f8eSopenharmony_ci * <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this 304261847f8eSopenharmony_ci * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise 304361847f8eSopenharmony_ci * closing the database will fail. 304461847f8eSopenharmony_ci * 304561847f8eSopenharmony_ci * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. 304661847f8eSopenharmony_ci * @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits, 304761847f8eSopenharmony_ci * and underscores (_), and cannot exceed 128 characters. 304861847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 304961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 305061847f8eSopenharmony_ci * <br>2.Parameter verification failed. 305161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 305261847f8eSopenharmony_ci * @since 9 305361847f8eSopenharmony_ci */ 305461847f8eSopenharmony_ci closeKVStore(appId: string, storeId: string): Promise<void>; 305561847f8eSopenharmony_ci 305661847f8eSopenharmony_ci /** 305761847f8eSopenharmony_ci * Deletes the KVStore database identified by storeId. 305861847f8eSopenharmony_ci * <p>Before using this method, close all KVStore instances in use that are identified by the same storeId. 305961847f8eSopenharmony_ci * <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be 306061847f8eSopenharmony_ci * lost. 306161847f8eSopenharmony_ci * 306261847f8eSopenharmony_ci * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. 306361847f8eSopenharmony_ci * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits, 306461847f8eSopenharmony_ci * and underscores (_), and cannot exceed 128 characters. 306561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of deleteKVStore. 306661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 306761847f8eSopenharmony_ci * <br>2.Parameter verification failed. 306861847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 306961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 307061847f8eSopenharmony_ci * @since 9 307161847f8eSopenharmony_ci */ 307261847f8eSopenharmony_ci deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void; 307361847f8eSopenharmony_ci 307461847f8eSopenharmony_ci /** 307561847f8eSopenharmony_ci * Deletes the KVStore database identified by storeId. 307661847f8eSopenharmony_ci * <p>Before using this method, close all KVStore instances in use that are identified by the same storeId. 307761847f8eSopenharmony_ci * <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be 307861847f8eSopenharmony_ci * lost. 307961847f8eSopenharmony_ci * 308061847f8eSopenharmony_ci * @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters. 308161847f8eSopenharmony_ci * @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits, 308261847f8eSopenharmony_ci * and underscores (_), and cannot exceed 128 characters. 308361847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the function. 308461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 308561847f8eSopenharmony_ci * <br>2.Parameter verification failed. 308661847f8eSopenharmony_ci * @throws { BusinessError } 15100004 - Not found. 308761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 308861847f8eSopenharmony_ci * @since 9 308961847f8eSopenharmony_ci */ 309061847f8eSopenharmony_ci deleteKVStore(appId: string, storeId: string): Promise<void>; 309161847f8eSopenharmony_ci 309261847f8eSopenharmony_ci /** 309361847f8eSopenharmony_ci * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by 309461847f8eSopenharmony_ci * calling the {@code deleteKVStore} method. 309561847f8eSopenharmony_ci * 309661847f8eSopenharmony_ci * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters. 309761847f8eSopenharmony_ci * @param { AsyncCallback<string[]> } callback - {string[]}: the storeId of all created KVStore databases. 309861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 309961847f8eSopenharmony_ci * <br>2.Parameter verification failed. 310061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 310161847f8eSopenharmony_ci * @since 9 310261847f8eSopenharmony_ci */ 310361847f8eSopenharmony_ci getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void; 310461847f8eSopenharmony_ci 310561847f8eSopenharmony_ci /** 310661847f8eSopenharmony_ci * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by 310761847f8eSopenharmony_ci * calling the {@code deleteKVStore} method. 310861847f8eSopenharmony_ci * 310961847f8eSopenharmony_ci * @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters. 311061847f8eSopenharmony_ci * @returns { Promise<string[]> } {string[]}: the storeId of all created KVStore databases. 311161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified. 311261847f8eSopenharmony_ci * <br>2.Parameter verification failed. 311361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 311461847f8eSopenharmony_ci * @since 9 311561847f8eSopenharmony_ci */ 311661847f8eSopenharmony_ci getAllKVStoreId(appId: string): Promise<string[]>; 311761847f8eSopenharmony_ci 311861847f8eSopenharmony_ci /** 311961847f8eSopenharmony_ci * Register a death callback to get notification when the data manager service is terminated. 312061847f8eSopenharmony_ci * <p>If the data manager service is terminated,you need to re-subscribe to data change notifications and synchronization 312161847f8eSopenharmony_ci * completion notifications, and calling the sync method will return a failure. 312261847f8eSopenharmony_ci * 312361847f8eSopenharmony_ci * @param { 'distributedDataServiceDie' } event - Subscribed event name, fixed as 'distributedDataServiceDie', as a service status change events. 312461847f8eSopenharmony_ci * @param { Callback<void> } deathCallback - callback to be invoked when the data manager service is terminated. 312561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 312661847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 312761847f8eSopenharmony_ci * <br>3.Parameter verification failed. 312861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 312961847f8eSopenharmony_ci * @since 9 313061847f8eSopenharmony_ci */ 313161847f8eSopenharmony_ci on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void; 313261847f8eSopenharmony_ci 313361847f8eSopenharmony_ci /** 313461847f8eSopenharmony_ci * Unregister the death callback. Not notification will be received when the data manager service is terminated. 313561847f8eSopenharmony_ci * <p>The unregistered death callback must be a registered death callback of the database. If no death callback parameter 313661847f8eSopenharmony_ci * is passed, all database death callbacks will be unregistered. 313761847f8eSopenharmony_ci * 313861847f8eSopenharmony_ci * @param { 'distributedDataServiceDie' } event - Unsubscribe event name, fixed as 'distributedDataServiceDie', as a service status change events. 313961847f8eSopenharmony_ci * @param { Callback<void> } deathCallback - the data manager service is terminated callback which has been registered. 314061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified; 314161847f8eSopenharmony_ci * <br>2.Incorrect parameters types; 314261847f8eSopenharmony_ci * <br>3.Parameter verification failed. 314361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 314461847f8eSopenharmony_ci * @since 9 314561847f8eSopenharmony_ci */ 314661847f8eSopenharmony_ci off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void; 314761847f8eSopenharmony_ci } 314861847f8eSopenharmony_ci} 314961847f8eSopenharmony_ci 315061847f8eSopenharmony_ciexport default distributedKVStore;