161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2021 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_ci 2361847f8eSopenharmony_ci/** 2461847f8eSopenharmony_ci * Providers interfaces to creat a {@link KVManager} instance. 2561847f8eSopenharmony_ci * 2661847f8eSopenharmony_ci * @namespace distributedData 2761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 2861847f8eSopenharmony_ci * @since 7 2961847f8eSopenharmony_ci * @deprecated since 9 3061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore 3161847f8eSopenharmony_ci */ 3261847f8eSopenharmony_cideclare namespace distributedData { 3361847f8eSopenharmony_ci /** 3461847f8eSopenharmony_ci * Provides configuration information for {@link KVManager} instances, 3561847f8eSopenharmony_ci * including the caller's package name and distributed network type. 3661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 3761847f8eSopenharmony_ci * @since 7 3861847f8eSopenharmony_ci * @deprecated since 9 3961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManagerConfig 4061847f8eSopenharmony_ci */ 4161847f8eSopenharmony_ci interface KVManagerConfig { 4261847f8eSopenharmony_ci /** 4361847f8eSopenharmony_ci * Indicates the user information 4461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 4561847f8eSopenharmony_ci * @since 7 4661847f8eSopenharmony_ci * @deprecated since 9 4761847f8eSopenharmony_ci */ 4861847f8eSopenharmony_ci userInfo: UserInfo; 4961847f8eSopenharmony_ci 5061847f8eSopenharmony_ci /** 5161847f8eSopenharmony_ci * Indicates the bundleName 5261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 5361847f8eSopenharmony_ci * @since 7 5461847f8eSopenharmony_ci * @deprecated since 9 5561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManagerConfig#bundleName 5661847f8eSopenharmony_ci */ 5761847f8eSopenharmony_ci bundleName: string; 5861847f8eSopenharmony_ci } 5961847f8eSopenharmony_ci 6061847f8eSopenharmony_ci /** 6161847f8eSopenharmony_ci * Manages user information. 6261847f8eSopenharmony_ci * 6361847f8eSopenharmony_ci * <p>This class provides methods for obtaining the user ID and type, setting the user ID and type, 6461847f8eSopenharmony_ci * and checking whether two users are the same. 6561847f8eSopenharmony_ci * 6661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 6761847f8eSopenharmony_ci * @since 7 6861847f8eSopenharmony_ci * @deprecated since 9 6961847f8eSopenharmony_ci */ 7061847f8eSopenharmony_ci interface UserInfo { 7161847f8eSopenharmony_ci /** 7261847f8eSopenharmony_ci * Indicates the user ID to set 7361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 7461847f8eSopenharmony_ci * @since 7 7561847f8eSopenharmony_ci * @deprecated since 9 7661847f8eSopenharmony_ci */ 7761847f8eSopenharmony_ci userId?: string; 7861847f8eSopenharmony_ci 7961847f8eSopenharmony_ci /** 8061847f8eSopenharmony_ci * Indicates the user type to set 8161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 8261847f8eSopenharmony_ci * @since 7 8361847f8eSopenharmony_ci * @deprecated since 9 8461847f8eSopenharmony_ci */ 8561847f8eSopenharmony_ci userType?: UserType; 8661847f8eSopenharmony_ci } 8761847f8eSopenharmony_ci 8861847f8eSopenharmony_ci /** 8961847f8eSopenharmony_ci * Enumerates user types. 9061847f8eSopenharmony_ci * 9161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 9261847f8eSopenharmony_ci * @since 7 9361847f8eSopenharmony_ci * @deprecated since 9 9461847f8eSopenharmony_ci */ 9561847f8eSopenharmony_ci enum UserType { 9661847f8eSopenharmony_ci /** 9761847f8eSopenharmony_ci * Indicates a user that logs in to different devices using the same account. 9861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 9961847f8eSopenharmony_ci * @since 7 10061847f8eSopenharmony_ci * @deprecated since 9 10161847f8eSopenharmony_ci */ 10261847f8eSopenharmony_ci SAME_USER_ID = 0 10361847f8eSopenharmony_ci } 10461847f8eSopenharmony_ci 10561847f8eSopenharmony_ci /** 10661847f8eSopenharmony_ci * KVStore constants 10761847f8eSopenharmony_ci * 10861847f8eSopenharmony_ci * @namespace Constants 10961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 11061847f8eSopenharmony_ci * @since 7 11161847f8eSopenharmony_ci * @deprecated since 9 11261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Constants 11361847f8eSopenharmony_ci */ 11461847f8eSopenharmony_ci namespace Constants { 11561847f8eSopenharmony_ci /** 11661847f8eSopenharmony_ci * max key length. 11761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 11861847f8eSopenharmony_ci * @since 7 11961847f8eSopenharmony_ci * @deprecated since 9 12061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH 12161847f8eSopenharmony_ci */ 12261847f8eSopenharmony_ci const MAX_KEY_LENGTH = 1024; 12361847f8eSopenharmony_ci 12461847f8eSopenharmony_ci /** 12561847f8eSopenharmony_ci * max value length. 12661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 12761847f8eSopenharmony_ci * @since 7 12861847f8eSopenharmony_ci * @deprecated since 9 12961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Constants#MAX_VALUE_LENGTH 13061847f8eSopenharmony_ci */ 13161847f8eSopenharmony_ci const MAX_VALUE_LENGTH = 4194303; 13261847f8eSopenharmony_ci 13361847f8eSopenharmony_ci /** 13461847f8eSopenharmony_ci * max device coordinate key length. 13561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 13661847f8eSopenharmony_ci * @since 7 13761847f8eSopenharmony_ci * @deprecated since 9 13861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH_DEVICEs 13961847f8eSopenharmony_ci */ 14061847f8eSopenharmony_ci const MAX_KEY_LENGTH_DEVICE = 896; 14161847f8eSopenharmony_ci 14261847f8eSopenharmony_ci /** 14361847f8eSopenharmony_ci * max store id length. 14461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 14561847f8eSopenharmony_ci * @since 7 14661847f8eSopenharmony_ci * @deprecated since 9 14761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Constants#MAX_STORE_ID_LENGTH 14861847f8eSopenharmony_ci */ 14961847f8eSopenharmony_ci const MAX_STORE_ID_LENGTH = 128; 15061847f8eSopenharmony_ci 15161847f8eSopenharmony_ci /** 15261847f8eSopenharmony_ci * max query length. 15361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 15461847f8eSopenharmony_ci * @since 7 15561847f8eSopenharmony_ci * @deprecated since 9 15661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Constants#MAX_QUERY_LENGTH 15761847f8eSopenharmony_ci */ 15861847f8eSopenharmony_ci const MAX_QUERY_LENGTH = 512000; 15961847f8eSopenharmony_ci 16061847f8eSopenharmony_ci /** 16161847f8eSopenharmony_ci * max batch operation size. 16261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 16361847f8eSopenharmony_ci * @since 7 16461847f8eSopenharmony_ci * @deprecated since 9 16561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Constants#MAX_BATCH_SIZE 16661847f8eSopenharmony_ci */ 16761847f8eSopenharmony_ci const MAX_BATCH_SIZE = 128; 16861847f8eSopenharmony_ci } 16961847f8eSopenharmony_ci 17061847f8eSopenharmony_ci /** 17161847f8eSopenharmony_ci * Indicates the {@code ValueType}. 17261847f8eSopenharmony_ci * 17361847f8eSopenharmony_ci * <p>{@code ValueType} is obtained based on the value. 17461847f8eSopenharmony_ci * 17561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 17661847f8eSopenharmony_ci * @since 7 17761847f8eSopenharmony_ci * @deprecated since 9 17861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ValueType 17961847f8eSopenharmony_ci */ 18061847f8eSopenharmony_ci enum ValueType { 18161847f8eSopenharmony_ci /** 18261847f8eSopenharmony_ci * Indicates that the value type is string. 18361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 18461847f8eSopenharmony_ci * @since 7 18561847f8eSopenharmony_ci * @deprecated since 9 18661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ValueType#STRING 18761847f8eSopenharmony_ci */ 18861847f8eSopenharmony_ci STRING = 0, 18961847f8eSopenharmony_ci 19061847f8eSopenharmony_ci /** 19161847f8eSopenharmony_ci * Indicates that the value type is int. 19261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 19361847f8eSopenharmony_ci * @since 7 19461847f8eSopenharmony_ci * @deprecated since 9 19561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ValueType#INTEGER 19661847f8eSopenharmony_ci */ 19761847f8eSopenharmony_ci INTEGER = 1, 19861847f8eSopenharmony_ci 19961847f8eSopenharmony_ci /** 20061847f8eSopenharmony_ci * Indicates that the value type is float. 20161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 20261847f8eSopenharmony_ci * @since 7 20361847f8eSopenharmony_ci * @deprecated since 9 20461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ValueType#FLOAT 20561847f8eSopenharmony_ci */ 20661847f8eSopenharmony_ci FLOAT = 2, 20761847f8eSopenharmony_ci 20861847f8eSopenharmony_ci /** 20961847f8eSopenharmony_ci * Indicates that the value type is byte array. 21061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 21161847f8eSopenharmony_ci * @since 7 21261847f8eSopenharmony_ci * @deprecated since 9 21361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ValueType#BYTE_ARRAY 21461847f8eSopenharmony_ci * */ 21561847f8eSopenharmony_ci BYTE_ARRAY = 3, 21661847f8eSopenharmony_ci 21761847f8eSopenharmony_ci /** 21861847f8eSopenharmony_ci * Indicates that the value type is boolean. 21961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 22061847f8eSopenharmony_ci * @since 7 22161847f8eSopenharmony_ci * @deprecated since 9 22261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ValueType#BOOLEAN 22361847f8eSopenharmony_ci * */ 22461847f8eSopenharmony_ci BOOLEAN = 4, 22561847f8eSopenharmony_ci 22661847f8eSopenharmony_ci /** 22761847f8eSopenharmony_ci * Indicates that the value type is double. 22861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 22961847f8eSopenharmony_ci * @since 7 23061847f8eSopenharmony_ci * @deprecated since 9 23161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ValueType#DOUBLE 23261847f8eSopenharmony_ci */ 23361847f8eSopenharmony_ci DOUBLE = 5 23461847f8eSopenharmony_ci } 23561847f8eSopenharmony_ci 23661847f8eSopenharmony_ci /** 23761847f8eSopenharmony_ci * Obtains {@code Value} objects stored in a {@link KVStore} database. 23861847f8eSopenharmony_ci * 23961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 24061847f8eSopenharmony_ci * @since 7 24161847f8eSopenharmony_ci * @deprecated since 9 24261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Value 24361847f8eSopenharmony_ci */ 24461847f8eSopenharmony_ci interface Value { 24561847f8eSopenharmony_ci /** 24661847f8eSopenharmony_ci * Indicates value type 24761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 24861847f8eSopenharmony_ci * @see ValueType 24961847f8eSopenharmony_ci * @type {number} 25061847f8eSopenharmony_ci * @memberof Value 25161847f8eSopenharmony_ci * @since 7 25261847f8eSopenharmony_ci * @deprecated since 9 25361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Value#type 25461847f8eSopenharmony_ci */ 25561847f8eSopenharmony_ci type: ValueType; 25661847f8eSopenharmony_ci /** 25761847f8eSopenharmony_ci * Indicates value 25861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 25961847f8eSopenharmony_ci * @since 7 26061847f8eSopenharmony_ci * @deprecated since 9 26161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Value#value 26261847f8eSopenharmony_ci */ 26361847f8eSopenharmony_ci value: Uint8Array | string | number | boolean; 26461847f8eSopenharmony_ci } 26561847f8eSopenharmony_ci 26661847f8eSopenharmony_ci /** 26761847f8eSopenharmony_ci * Provides key-value pairs stored in the distributed database. 26861847f8eSopenharmony_ci * 26961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 27061847f8eSopenharmony_ci * @since 7 27161847f8eSopenharmony_ci * @deprecated since 9 27261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Entry 27361847f8eSopenharmony_ci */ 27461847f8eSopenharmony_ci interface Entry { 27561847f8eSopenharmony_ci /** 27661847f8eSopenharmony_ci * Indicates key 27761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 27861847f8eSopenharmony_ci * @since 7 27961847f8eSopenharmony_ci * @deprecated since 9 28061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Entry#key 28161847f8eSopenharmony_ci */ 28261847f8eSopenharmony_ci key: string; 28361847f8eSopenharmony_ci /** 28461847f8eSopenharmony_ci * Indicates value 28561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 28661847f8eSopenharmony_ci * @since 7 28761847f8eSopenharmony_ci * @deprecated since 9 28861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Entry#value 28961847f8eSopenharmony_ci */ 29061847f8eSopenharmony_ci value: Value; 29161847f8eSopenharmony_ci } 29261847f8eSopenharmony_ci 29361847f8eSopenharmony_ci /** 29461847f8eSopenharmony_ci * Receives notifications of all data changes, including data insertion, update, and deletion. 29561847f8eSopenharmony_ci * 29661847f8eSopenharmony_ci * <p>If you have subscribed to {@code KVStore}, you will receive data change notifications and obtain the changed data 29761847f8eSopenharmony_ci * from the parameters in callback methods upon data insertion, update, or deletion. 29861847f8eSopenharmony_ci * 29961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 30061847f8eSopenharmony_ci * @since 7 30161847f8eSopenharmony_ci * @deprecated since 9 30261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ChangeNotification 30361847f8eSopenharmony_ci */ 30461847f8eSopenharmony_ci interface ChangeNotification { 30561847f8eSopenharmony_ci /** 30661847f8eSopenharmony_ci * Indicates data addition records. 30761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 30861847f8eSopenharmony_ci * @since 7 30961847f8eSopenharmony_ci * @deprecated since 9 31061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ChangeNotification#insertEntries 31161847f8eSopenharmony_ci */ 31261847f8eSopenharmony_ci insertEntries: Entry[]; 31361847f8eSopenharmony_ci /** 31461847f8eSopenharmony_ci * Indicates data update records. 31561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 31661847f8eSopenharmony_ci * @since 7 31761847f8eSopenharmony_ci * @deprecated since 9 31861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ChangeNotification#updateEntries 31961847f8eSopenharmony_ci */ 32061847f8eSopenharmony_ci updateEntries: Entry[]; 32161847f8eSopenharmony_ci /** 32261847f8eSopenharmony_ci * Indicates data deletion records. 32361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 32461847f8eSopenharmony_ci * @since 7 32561847f8eSopenharmony_ci * @deprecated since 9 32661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ChangeNotification#deleteEntries 32761847f8eSopenharmony_ci */ 32861847f8eSopenharmony_ci deleteEntries: Entry[]; 32961847f8eSopenharmony_ci /** 33061847f8eSopenharmony_ci * Indicates from device id. 33161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 33261847f8eSopenharmony_ci * @since 7 33361847f8eSopenharmony_ci * @deprecated since 9 33461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.ChangeNotification#deviceId 33561847f8eSopenharmony_ci */ 33661847f8eSopenharmony_ci deviceId: string; 33761847f8eSopenharmony_ci } 33861847f8eSopenharmony_ci 33961847f8eSopenharmony_ci /** 34061847f8eSopenharmony_ci * Indicates the database synchronization mode. 34161847f8eSopenharmony_ci * 34261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 34361847f8eSopenharmony_ci * @since 7 34461847f8eSopenharmony_ci * @deprecated since 9 34561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SyncMode 34661847f8eSopenharmony_ci */ 34761847f8eSopenharmony_ci enum SyncMode { 34861847f8eSopenharmony_ci /** 34961847f8eSopenharmony_ci * Indicates that data is only pulled from the remote end. 35061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 35161847f8eSopenharmony_ci * @since 7 35261847f8eSopenharmony_ci * @deprecated since 9 35361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SyncMode#PULL_ONLY 35461847f8eSopenharmony_ci */ 35561847f8eSopenharmony_ci PULL_ONLY = 0, 35661847f8eSopenharmony_ci /** 35761847f8eSopenharmony_ci * Indicates that data is only pushed from the local end. 35861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 35961847f8eSopenharmony_ci * @since 7 36061847f8eSopenharmony_ci * @deprecated since 9 36161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_ONLY 36261847f8eSopenharmony_ci */ 36361847f8eSopenharmony_ci PUSH_ONLY = 1, 36461847f8eSopenharmony_ci /** 36561847f8eSopenharmony_ci * Indicates that data is pushed from the local end, and then pulled from the remote end. 36661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 36761847f8eSopenharmony_ci * @since 7 36861847f8eSopenharmony_ci * @deprecated since 9 36961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_PULL 37061847f8eSopenharmony_ci */ 37161847f8eSopenharmony_ci PUSH_PULL = 2 37261847f8eSopenharmony_ci } 37361847f8eSopenharmony_ci 37461847f8eSopenharmony_ci /** 37561847f8eSopenharmony_ci * Describes the subscription type. 37661847f8eSopenharmony_ci * 37761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 37861847f8eSopenharmony_ci * @since 7 37961847f8eSopenharmony_ci * @deprecated since 9 38061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SubscribeType 38161847f8eSopenharmony_ci */ 38261847f8eSopenharmony_ci enum SubscribeType { 38361847f8eSopenharmony_ci /** 38461847f8eSopenharmony_ci * Subscription to local data changes 38561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 38661847f8eSopenharmony_ci * @since 7 38761847f8eSopenharmony_ci * @deprecated since 9 38861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_LOCAL 38961847f8eSopenharmony_ci */ 39061847f8eSopenharmony_ci SUBSCRIBE_TYPE_LOCAL = 0, 39161847f8eSopenharmony_ci 39261847f8eSopenharmony_ci /** 39361847f8eSopenharmony_ci * Subscription to remote data changes 39461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 39561847f8eSopenharmony_ci * @since 7 39661847f8eSopenharmony_ci * @deprecated since 9 39761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_REMOTE 39861847f8eSopenharmony_ci */ 39961847f8eSopenharmony_ci SUBSCRIBE_TYPE_REMOTE = 1, 40061847f8eSopenharmony_ci 40161847f8eSopenharmony_ci /** 40261847f8eSopenharmony_ci * Subscription to both local and remote data changes 40361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 40461847f8eSopenharmony_ci * @since 7 40561847f8eSopenharmony_ci * @deprecated since 9 40661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_ALL 40761847f8eSopenharmony_ci */ 40861847f8eSopenharmony_ci SUBSCRIBE_TYPE_ALL = 2, 40961847f8eSopenharmony_ci } 41061847f8eSopenharmony_ci 41161847f8eSopenharmony_ci /** 41261847f8eSopenharmony_ci * Describes the {@code KVStore} type. 41361847f8eSopenharmony_ci * 41461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 41561847f8eSopenharmony_ci * @since 7 41661847f8eSopenharmony_ci * @deprecated since 9 41761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreType 41861847f8eSopenharmony_ci */ 41961847f8eSopenharmony_ci enum KVStoreType { 42061847f8eSopenharmony_ci /** 42161847f8eSopenharmony_ci * Device-collaboration database, as specified by {@code DeviceKVStore} 42261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 42361847f8eSopenharmony_ci * @since 7 42461847f8eSopenharmony_ci * @deprecated since 9 42561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreType#DEVICE_COLLABORATION 42661847f8eSopenharmony_ci */ 42761847f8eSopenharmony_ci DEVICE_COLLABORATION = 0, 42861847f8eSopenharmony_ci 42961847f8eSopenharmony_ci /** 43061847f8eSopenharmony_ci * Single-version database, as specified by {@code SingleKVStore} 43161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 43261847f8eSopenharmony_ci * @since 7 43361847f8eSopenharmony_ci * @deprecated since 9 43461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreType#SINGLE_VERSION 43561847f8eSopenharmony_ci */ 43661847f8eSopenharmony_ci SINGLE_VERSION = 1, 43761847f8eSopenharmony_ci 43861847f8eSopenharmony_ci /** 43961847f8eSopenharmony_ci * Multi-version database, as specified by {@code MultiKVStore} 44061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 44161847f8eSopenharmony_ci * @since 7 44261847f8eSopenharmony_ci * @deprecated since 9 44361847f8eSopenharmony_ci */ 44461847f8eSopenharmony_ci MULTI_VERSION = 2, 44561847f8eSopenharmony_ci } 44661847f8eSopenharmony_ci 44761847f8eSopenharmony_ci /** 44861847f8eSopenharmony_ci * Describes the {@code KVStore} type. 44961847f8eSopenharmony_ci * 45061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 45161847f8eSopenharmony_ci * @since 7 45261847f8eSopenharmony_ci * @deprecated since 9 45361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SecurityLevel 45461847f8eSopenharmony_ci */ 45561847f8eSopenharmony_ci enum SecurityLevel { 45661847f8eSopenharmony_ci /** 45761847f8eSopenharmony_ci * NO_LEVEL: mains not set the security level. 45861847f8eSopenharmony_ci * 45961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 46061847f8eSopenharmony_ci * @since 7 46161847f8eSopenharmony_ci * @deprecated since 9 46261847f8eSopenharmony_ci */ 46361847f8eSopenharmony_ci NO_LEVEL = 0, 46461847f8eSopenharmony_ci 46561847f8eSopenharmony_ci /** 46661847f8eSopenharmony_ci * S0: mains the db is public. 46761847f8eSopenharmony_ci * There is no impact even if the data is leaked. 46861847f8eSopenharmony_ci * 46961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 47061847f8eSopenharmony_ci * @since 7 47161847f8eSopenharmony_ci * @deprecated since 9 47261847f8eSopenharmony_ci */ 47361847f8eSopenharmony_ci S0 = 1, 47461847f8eSopenharmony_ci 47561847f8eSopenharmony_ci /** 47661847f8eSopenharmony_ci * S1: mains the db is low level security 47761847f8eSopenharmony_ci * There are some low impact, when the data is leaked. 47861847f8eSopenharmony_ci * 47961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 48061847f8eSopenharmony_ci * @since 7 48161847f8eSopenharmony_ci * @deprecated since 9 48261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SecurityLevel#S1 48361847f8eSopenharmony_ci */ 48461847f8eSopenharmony_ci S1 = 2, 48561847f8eSopenharmony_ci 48661847f8eSopenharmony_ci /** 48761847f8eSopenharmony_ci * S2: mains the db is middle level security 48861847f8eSopenharmony_ci * There are some major impact, when the data is leaked. 48961847f8eSopenharmony_ci * 49061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 49161847f8eSopenharmony_ci * @since 7 49261847f8eSopenharmony_ci * @deprecated since 9 49361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SecurityLevel#S2 49461847f8eSopenharmony_ci */ 49561847f8eSopenharmony_ci S2 = 3, 49661847f8eSopenharmony_ci 49761847f8eSopenharmony_ci /** 49861847f8eSopenharmony_ci * S3: mains the db is high level security 49961847f8eSopenharmony_ci * There are some severity impact, when the data is leaked. 50061847f8eSopenharmony_ci * 50161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 50261847f8eSopenharmony_ci * @since 7 50361847f8eSopenharmony_ci * @deprecated since 9 50461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SecurityLevel#S3 50561847f8eSopenharmony_ci */ 50661847f8eSopenharmony_ci S3 = 5, 50761847f8eSopenharmony_ci 50861847f8eSopenharmony_ci /** 50961847f8eSopenharmony_ci * S4: mains the db is critical level security 51061847f8eSopenharmony_ci * There are some critical impact, when the data is leaked. 51161847f8eSopenharmony_ci * 51261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 51361847f8eSopenharmony_ci * @since 7 51461847f8eSopenharmony_ci * @deprecated since 9 51561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SecurityLevel#S4 51661847f8eSopenharmony_ci */ 51761847f8eSopenharmony_ci S4 = 6, 51861847f8eSopenharmony_ci } 51961847f8eSopenharmony_ci 52061847f8eSopenharmony_ci /** 52161847f8eSopenharmony_ci * Provides configuration options for creating a {@code KVStore}. 52261847f8eSopenharmony_ci * 52361847f8eSopenharmony_ci * <p>You can determine whether to create another database if a {@code KVStore} database is missing, 52461847f8eSopenharmony_ci * whether to encrypt the database, and the database type. 52561847f8eSopenharmony_ci * 52661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 52761847f8eSopenharmony_ci * @since 7 52861847f8eSopenharmony_ci * @deprecated since 9 52961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options 53061847f8eSopenharmony_ci */ 53161847f8eSopenharmony_ci interface Options { 53261847f8eSopenharmony_ci /** 53361847f8eSopenharmony_ci * Indicates whether to create a database when the database file does not exist 53461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 53561847f8eSopenharmony_ci * @since 7 53661847f8eSopenharmony_ci * @deprecated since 9 53761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options#createIfMissing 53861847f8eSopenharmony_ci */ 53961847f8eSopenharmony_ci createIfMissing?: boolean; 54061847f8eSopenharmony_ci /** 54161847f8eSopenharmony_ci * Indicates setting whether database files are encrypted 54261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 54361847f8eSopenharmony_ci * @since 7 54461847f8eSopenharmony_ci * @deprecated since 9 54561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options#encrypt 54661847f8eSopenharmony_ci */ 54761847f8eSopenharmony_ci encrypt?: boolean; 54861847f8eSopenharmony_ci /** 54961847f8eSopenharmony_ci * Indicates setting whether to back up database files 55061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 55161847f8eSopenharmony_ci * @since 7 55261847f8eSopenharmony_ci * @deprecated since 9 55361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options#backup 55461847f8eSopenharmony_ci */ 55561847f8eSopenharmony_ci backup?: boolean; 55661847f8eSopenharmony_ci /** 55761847f8eSopenharmony_ci * Indicates setting whether database files are automatically synchronized 55861847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 55961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 56061847f8eSopenharmony_ci * @since 7 56161847f8eSopenharmony_ci * @deprecated since 9 56261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options#autoSync 56361847f8eSopenharmony_ci */ 56461847f8eSopenharmony_ci autoSync?: boolean; 56561847f8eSopenharmony_ci /** 56661847f8eSopenharmony_ci * Indicates setting the database type 56761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 56861847f8eSopenharmony_ci * @since 7 56961847f8eSopenharmony_ci * @deprecated since 9 57061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options#kvStoreType 57161847f8eSopenharmony_ci */ 57261847f8eSopenharmony_ci kvStoreType?: KVStoreType; 57361847f8eSopenharmony_ci /** 57461847f8eSopenharmony_ci * Indicates setting the database security level 57561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 57661847f8eSopenharmony_ci * @since 7 57761847f8eSopenharmony_ci * @deprecated since 9 57861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options#securityLevel 57961847f8eSopenharmony_ci */ 58061847f8eSopenharmony_ci securityLevel?: SecurityLevel; 58161847f8eSopenharmony_ci /** 58261847f8eSopenharmony_ci * Indicates schema object 58361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 58461847f8eSopenharmony_ci * @since 8 58561847f8eSopenharmony_ci * @deprecated since 9 58661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Options#schema 58761847f8eSopenharmony_ci */ 58861847f8eSopenharmony_ci schema?: Schema; 58961847f8eSopenharmony_ci } 59061847f8eSopenharmony_ci 59161847f8eSopenharmony_ci /** 59261847f8eSopenharmony_ci * Represents the database schema. 59361847f8eSopenharmony_ci * 59461847f8eSopenharmony_ci * You can create Schema objects and put them in Options when creating or opening the database. 59561847f8eSopenharmony_ci * 59661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 59761847f8eSopenharmony_ci * @since 8 59861847f8eSopenharmony_ci * @deprecated since 9 59961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Schema 60061847f8eSopenharmony_ci */ 60161847f8eSopenharmony_ci class Schema { 60261847f8eSopenharmony_ci /** 60361847f8eSopenharmony_ci * A constructor used to create a Schema instance. 60461847f8eSopenharmony_ci * 60561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 60661847f8eSopenharmony_ci * @since 8 60761847f8eSopenharmony_ci * @deprecated since 9 60861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Schema#constructor 60961847f8eSopenharmony_ci */ 61061847f8eSopenharmony_ci constructor() 61161847f8eSopenharmony_ci 61261847f8eSopenharmony_ci /** 61361847f8eSopenharmony_ci * Indicates the root json object. 61461847f8eSopenharmony_ci * 61561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 61661847f8eSopenharmony_ci * @since 8 61761847f8eSopenharmony_ci * @deprecated since 9 61861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Schema#root 61961847f8eSopenharmony_ci */ 62061847f8eSopenharmony_ci root: FieldNode; 62161847f8eSopenharmony_ci /** 62261847f8eSopenharmony_ci * Indicates the string array of json. 62361847f8eSopenharmony_ci * 62461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 62561847f8eSopenharmony_ci * @since 8 62661847f8eSopenharmony_ci * @deprecated since 9 62761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Schema#indexes 62861847f8eSopenharmony_ci */ 62961847f8eSopenharmony_ci indexes: Array<string>; 63061847f8eSopenharmony_ci /** 63161847f8eSopenharmony_ci * Indicates the mode of schema. 63261847f8eSopenharmony_ci * 63361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 63461847f8eSopenharmony_ci * @since 8 63561847f8eSopenharmony_ci * @deprecated since 9 63661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Schema#mode 63761847f8eSopenharmony_ci */ 63861847f8eSopenharmony_ci mode: number; 63961847f8eSopenharmony_ci /** 64061847f8eSopenharmony_ci * Indicates the skip size of schema. 64161847f8eSopenharmony_ci * 64261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 64361847f8eSopenharmony_ci * @since 8 64461847f8eSopenharmony_ci * @deprecated since 9 64561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Schema#skip 64661847f8eSopenharmony_ci */ 64761847f8eSopenharmony_ci skip: number; 64861847f8eSopenharmony_ci } 64961847f8eSopenharmony_ci 65061847f8eSopenharmony_ci /** 65161847f8eSopenharmony_ci * Represents a node of a {@link Schema} instance. 65261847f8eSopenharmony_ci * 65361847f8eSopenharmony_ci * <p>Through the {@link Schema} instance, you can define the fields contained in the values stored in a database. 65461847f8eSopenharmony_ci * 65561847f8eSopenharmony_ci * <p>A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. 65661847f8eSopenharmony_ci * 65761847f8eSopenharmony_ci * <p>The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. 65861847f8eSopenharmony_ci * 65961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 66061847f8eSopenharmony_ci * @since 8 66161847f8eSopenharmony_ci * @deprecated since 9 66261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.FieldNode 66361847f8eSopenharmony_ci */ 66461847f8eSopenharmony_ci class FieldNode { 66561847f8eSopenharmony_ci /** 66661847f8eSopenharmony_ci * A constructor used to create a FieldNode instance with the specified field. 66761847f8eSopenharmony_ci * name Indicates the field node name. 66861847f8eSopenharmony_ci * 66961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 67061847f8eSopenharmony_ci * @since 8 67161847f8eSopenharmony_ci * @deprecated since 9 67261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.FieldNode#constructor 67361847f8eSopenharmony_ci */ 67461847f8eSopenharmony_ci constructor(name: string) 67561847f8eSopenharmony_ci 67661847f8eSopenharmony_ci /** 67761847f8eSopenharmony_ci * Adds a child node to this {@code FieldNode}. 67861847f8eSopenharmony_ci * 67961847f8eSopenharmony_ci * <p>Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. 68061847f8eSopenharmony_ci * 68161847f8eSopenharmony_ci * @param child The field node to append. 68261847f8eSopenharmony_ci * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. 68361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 68461847f8eSopenharmony_ci * @since 8 68561847f8eSopenharmony_ci * @deprecated since 9 68661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.FieldNode#appendChild 68761847f8eSopenharmony_ci */ 68861847f8eSopenharmony_ci appendChild(child: FieldNode): boolean; 68961847f8eSopenharmony_ci 69061847f8eSopenharmony_ci /** 69161847f8eSopenharmony_ci * Indicates the default value of field node. 69261847f8eSopenharmony_ci * 69361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 69461847f8eSopenharmony_ci * @since 8 69561847f8eSopenharmony_ci * @deprecated since 9 69661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.FieldNode#default 69761847f8eSopenharmony_ci */ 69861847f8eSopenharmony_ci default: string; 69961847f8eSopenharmony_ci /** 70061847f8eSopenharmony_ci * Indicates the nullable of database field. 70161847f8eSopenharmony_ci * 70261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 70361847f8eSopenharmony_ci * @since 8 70461847f8eSopenharmony_ci * @deprecated since 9 70561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.FieldNode#nullable 70661847f8eSopenharmony_ci */ 70761847f8eSopenharmony_ci nullable: boolean; 70861847f8eSopenharmony_ci /** 70961847f8eSopenharmony_ci * Indicates the type of value. 71061847f8eSopenharmony_ci * 71161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 71261847f8eSopenharmony_ci * @since 8 71361847f8eSopenharmony_ci * @deprecated since 9 71461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.FieldNode#type 71561847f8eSopenharmony_ci */ 71661847f8eSopenharmony_ci type: number; 71761847f8eSopenharmony_ci } 71861847f8eSopenharmony_ci 71961847f8eSopenharmony_ci /** 72061847f8eSopenharmony_ci * Provide methods to obtain the result set of the {@code KvStore} database. 72161847f8eSopenharmony_ci * 72261847f8eSopenharmony_ci * <p>The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} class. This interface also provides 72361847f8eSopenharmony_ci * methods for moving the data read position in the result set. 72461847f8eSopenharmony_ci * 72561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 72661847f8eSopenharmony_ci * @since 7 72761847f8eSopenharmony_ci * @deprecated since 9 72861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet 72961847f8eSopenharmony_ci */ 73061847f8eSopenharmony_ci interface KvStoreResultSet { 73161847f8eSopenharmony_ci /** 73261847f8eSopenharmony_ci * Obtains the number of lines in a result set. 73361847f8eSopenharmony_ci * 73461847f8eSopenharmony_ci * @returns Returns the number of lines. 73561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 73661847f8eSopenharmony_ci * @since 8 73761847f8eSopenharmony_ci * @deprecated since 9 73861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getCount 73961847f8eSopenharmony_ci */ 74061847f8eSopenharmony_ci getCount(): number; 74161847f8eSopenharmony_ci 74261847f8eSopenharmony_ci /** 74361847f8eSopenharmony_ci * Obtains the current read position in a result set. 74461847f8eSopenharmony_ci * 74561847f8eSopenharmony_ci * @returns Returns the current read position. The read position starts with 0. 74661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 74761847f8eSopenharmony_ci * @since 8 74861847f8eSopenharmony_ci * @deprecated since 9 74961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getPosition 75061847f8eSopenharmony_ci */ 75161847f8eSopenharmony_ci getPosition(): number; 75261847f8eSopenharmony_ci 75361847f8eSopenharmony_ci /** 75461847f8eSopenharmony_ci * Moves the read position to the first line. 75561847f8eSopenharmony_ci * 75661847f8eSopenharmony_ci * <p>If the result set is empty, false is returned. 75761847f8eSopenharmony_ci * 75861847f8eSopenharmony_ci * @returns Returns true if the operation succeeds; return false otherwise. 75961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 76061847f8eSopenharmony_ci * @since 8 76161847f8eSopenharmony_ci * @deprecated since 9 76261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToFirst 76361847f8eSopenharmony_ci */ 76461847f8eSopenharmony_ci moveToFirst(): boolean; 76561847f8eSopenharmony_ci 76661847f8eSopenharmony_ci /** 76761847f8eSopenharmony_ci * Moves the read position to the last line. 76861847f8eSopenharmony_ci * 76961847f8eSopenharmony_ci * <p>If the result set is empty, false is returned. 77061847f8eSopenharmony_ci * 77161847f8eSopenharmony_ci * @returns Returns true if the operation succeeds; return false otherwise. 77261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 77361847f8eSopenharmony_ci * @since 8 77461847f8eSopenharmony_ci * @deprecated since 9 77561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToLast 77661847f8eSopenharmony_ci */ 77761847f8eSopenharmony_ci moveToLast(): boolean; 77861847f8eSopenharmony_ci 77961847f8eSopenharmony_ci /** 78061847f8eSopenharmony_ci * Moves the read position to the next line. 78161847f8eSopenharmony_ci * 78261847f8eSopenharmony_ci * <p>If the result set is empty or the data in the last line is being read, false is returned. 78361847f8eSopenharmony_ci * 78461847f8eSopenharmony_ci * @returns Returns true if the operation succeeds; return false otherwise. 78561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 78661847f8eSopenharmony_ci * @since 8 78761847f8eSopenharmony_ci * @deprecated since 9 78861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToNext 78961847f8eSopenharmony_ci */ 79061847f8eSopenharmony_ci moveToNext(): boolean; 79161847f8eSopenharmony_ci 79261847f8eSopenharmony_ci /** 79361847f8eSopenharmony_ci * Moves the read position to the previous line. 79461847f8eSopenharmony_ci * 79561847f8eSopenharmony_ci * <p>If the result set is empty or the data in the first line is being read, false is returned. 79661847f8eSopenharmony_ci * 79761847f8eSopenharmony_ci * @returns Returns true if the operation succeeds; return false otherwise. 79861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 79961847f8eSopenharmony_ci * @since 8 80061847f8eSopenharmony_ci * @deprecated since 9 80161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPrevious 80261847f8eSopenharmony_ci */ 80361847f8eSopenharmony_ci moveToPrevious(): boolean; 80461847f8eSopenharmony_ci 80561847f8eSopenharmony_ci /** 80661847f8eSopenharmony_ci * Moves the read position by a relative offset to the current position. 80761847f8eSopenharmony_ci * 80861847f8eSopenharmony_ci * @param offset Indicates the relative offset to the current position. A negative offset indicates moving backwards, and a 80961847f8eSopenharmony_ci * positive offset indicates moving forwards. For example, if the current position is entry 1 and this offset is 2, 81061847f8eSopenharmony_ci * the destination position will be entry 3; if the current position is entry 3 and this offset is -2, 81161847f8eSopenharmony_ci * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the 81261847f8eSopenharmony_ci * final position is invalid, false will be returned. 81361847f8eSopenharmony_ci * @returns Returns true if the operation succeeds; return false otherwise. 81461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 81561847f8eSopenharmony_ci * @since 8 81661847f8eSopenharmony_ci * @deprecated since 9 81761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#move 81861847f8eSopenharmony_ci */ 81961847f8eSopenharmony_ci move(offset: number): boolean; 82061847f8eSopenharmony_ci 82161847f8eSopenharmony_ci /** 82261847f8eSopenharmony_ci * Moves the read position from 0 to an absolute position. 82361847f8eSopenharmony_ci * 82461847f8eSopenharmony_ci * @param position Indicates the absolute position. 82561847f8eSopenharmony_ci * @returns Returns true if the operation succeeds; return false otherwise. 82661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 82761847f8eSopenharmony_ci * @since 8 82861847f8eSopenharmony_ci * @deprecated since 9 82961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPosition 83061847f8eSopenharmony_ci */ 83161847f8eSopenharmony_ci moveToPosition(position: number): boolean; 83261847f8eSopenharmony_ci 83361847f8eSopenharmony_ci /** 83461847f8eSopenharmony_ci * Checks whether the read position is the first line. 83561847f8eSopenharmony_ci * 83661847f8eSopenharmony_ci * @returns Returns true if the read position is the first line; returns false otherwise. 83761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 83861847f8eSopenharmony_ci * @since 8 83961847f8eSopenharmony_ci * @deprecated since 9 84061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isFirst 84161847f8eSopenharmony_ci */ 84261847f8eSopenharmony_ci isFirst(): boolean; 84361847f8eSopenharmony_ci 84461847f8eSopenharmony_ci /** 84561847f8eSopenharmony_ci * Checks whether the read position is the last line. 84661847f8eSopenharmony_ci * 84761847f8eSopenharmony_ci * @returns Returns true if the read position is the last line; returns false otherwise. 84861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 84961847f8eSopenharmony_ci * @since 8 85061847f8eSopenharmony_ci * @deprecated since 9 85161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isLast 85261847f8eSopenharmony_ci */ 85361847f8eSopenharmony_ci isLast(): boolean; 85461847f8eSopenharmony_ci 85561847f8eSopenharmony_ci /** 85661847f8eSopenharmony_ci * Checks whether the read position is before the last line. 85761847f8eSopenharmony_ci * 85861847f8eSopenharmony_ci * @returns Returns true if the read position is before the first line; returns false otherwise. 85961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 86061847f8eSopenharmony_ci * @since 8 86161847f8eSopenharmony_ci * @deprecated since 9 86261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isBeforeFirst 86361847f8eSopenharmony_ci */ 86461847f8eSopenharmony_ci isBeforeFirst(): boolean; 86561847f8eSopenharmony_ci 86661847f8eSopenharmony_ci /** 86761847f8eSopenharmony_ci * Checks whether the read position is after the last line. 86861847f8eSopenharmony_ci * 86961847f8eSopenharmony_ci * @returns Returns true if the read position is after the last line; returns false otherwise. 87061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 87161847f8eSopenharmony_ci * @since 8 87261847f8eSopenharmony_ci * @deprecated since 9 87361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isAfterLast 87461847f8eSopenharmony_ci */ 87561847f8eSopenharmony_ci isAfterLast(): boolean; 87661847f8eSopenharmony_ci 87761847f8eSopenharmony_ci /** 87861847f8eSopenharmony_ci * Obtains a key-value pair. 87961847f8eSopenharmony_ci * 88061847f8eSopenharmony_ci * @returns Returns a key-value pair. 88161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 88261847f8eSopenharmony_ci * @since 8 88361847f8eSopenharmony_ci * @deprecated since 9 88461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getEntry 88561847f8eSopenharmony_ci */ 88661847f8eSopenharmony_ci getEntry(): Entry; 88761847f8eSopenharmony_ci } 88861847f8eSopenharmony_ci 88961847f8eSopenharmony_ci /** 89061847f8eSopenharmony_ci * Represents a database query using a predicate. 89161847f8eSopenharmony_ci * 89261847f8eSopenharmony_ci * <p>This class provides a constructor used to create a {@code Query} instance, which is used to query data matching specified 89361847f8eSopenharmony_ci * conditions in the database. 89461847f8eSopenharmony_ci * 89561847f8eSopenharmony_ci * <p>This class also provides methods for adding predicates to the {@code Query} instance. 89661847f8eSopenharmony_ci * 89761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 89861847f8eSopenharmony_ci * @since 8 89961847f8eSopenharmony_ci * @deprecated since 9 90061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query 90161847f8eSopenharmony_ci */ 90261847f8eSopenharmony_ci class Query { 90361847f8eSopenharmony_ci /** 90461847f8eSopenharmony_ci * A constructor used to create a Query instance. 90561847f8eSopenharmony_ci * 90661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 90761847f8eSopenharmony_ci * @since 8 90861847f8eSopenharmony_ci * @deprecated since 9 90961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#constructor 91061847f8eSopenharmony_ci */ 91161847f8eSopenharmony_ci constructor() 91261847f8eSopenharmony_ci 91361847f8eSopenharmony_ci /** 91461847f8eSopenharmony_ci * Resets this {@code Query} object. 91561847f8eSopenharmony_ci * 91661847f8eSopenharmony_ci * @returns Returns the reset {@code Query} object. 91761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 91861847f8eSopenharmony_ci * @since 8 91961847f8eSopenharmony_ci * @deprecated since 9 92061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#reset 92161847f8eSopenharmony_ci */ 92261847f8eSopenharmony_ci reset(): Query; 92361847f8eSopenharmony_ci 92461847f8eSopenharmony_ci /** 92561847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. 92661847f8eSopenharmony_ci * 92761847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 92861847f8eSopenharmony_ci * @param value IIndicates the long value. 92961847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 93061847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 93161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 93261847f8eSopenharmony_ci * @since 8 93361847f8eSopenharmony_ci * @deprecated since 9 93461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#equalTo 93561847f8eSopenharmony_ci */ 93661847f8eSopenharmony_ci equalTo(field: string, value: number | string | boolean): Query; 93761847f8eSopenharmony_ci 93861847f8eSopenharmony_ci /** 93961847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. 94061847f8eSopenharmony_ci * 94161847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 94261847f8eSopenharmony_ci * @param value Indicates the int value. 94361847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 94461847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 94561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 94661847f8eSopenharmony_ci * @since 8 94761847f8eSopenharmony_ci * @deprecated since 9 94861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#notEqualTo 94961847f8eSopenharmony_ci */ 95061847f8eSopenharmony_ci notEqualTo(field: string, value: number | string | boolean): Query; 95161847f8eSopenharmony_ci 95261847f8eSopenharmony_ci /** 95361847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the 95461847f8eSopenharmony_ci * specified int value. 95561847f8eSopenharmony_ci * 95661847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 95761847f8eSopenharmony_ci * @param value Indicates the int value. 95861847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 95961847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 96061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 96161847f8eSopenharmony_ci * @since 8 96261847f8eSopenharmony_ci * @deprecated since 9 96361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#greaterThan 96461847f8eSopenharmony_ci */ 96561847f8eSopenharmony_ci greaterThan(field: string, value: number | string | boolean): Query; 96661847f8eSopenharmony_ci 96761847f8eSopenharmony_ci /** 96861847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. 96961847f8eSopenharmony_ci * 97061847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 97161847f8eSopenharmony_ci * @param value Indicates the int value. 97261847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 97361847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 97461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 97561847f8eSopenharmony_ci * @since 8 97661847f8eSopenharmony_ci * @deprecated since 9 97761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#lessThan 97861847f8eSopenharmony_ci */ 97961847f8eSopenharmony_ci lessThan(field: string, value: number | string): Query; 98061847f8eSopenharmony_ci 98161847f8eSopenharmony_ci /** 98261847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the 98361847f8eSopenharmony_ci * specified int value. 98461847f8eSopenharmony_ci * 98561847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 98661847f8eSopenharmony_ci * @param value Indicates the int value. 98761847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 98861847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 98961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 99061847f8eSopenharmony_ci * @since 8 99161847f8eSopenharmony_ci * @deprecated since 9 99261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#greaterThanOrEqualTo 99361847f8eSopenharmony_ci */ 99461847f8eSopenharmony_ci greaterThanOrEqualTo(field: string, value: number | string): Query; 99561847f8eSopenharmony_ci 99661847f8eSopenharmony_ci /** 99761847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the 99861847f8eSopenharmony_ci * specified int value. 99961847f8eSopenharmony_ci * 100061847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 100161847f8eSopenharmony_ci * @param value Indicates the int value. 100261847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 100361847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 100461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 100561847f8eSopenharmony_ci * @since 8 100661847f8eSopenharmony_ci * @deprecated since 9 100761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#lessThanOrEqualTo 100861847f8eSopenharmony_ci */ 100961847f8eSopenharmony_ci lessThanOrEqualTo(field: string, value: number | string): Query; 101061847f8eSopenharmony_ci 101161847f8eSopenharmony_ci /** 101261847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is null. 101361847f8eSopenharmony_ci * 101461847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 101561847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 101661847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 101761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 101861847f8eSopenharmony_ci * @since 8 101961847f8eSopenharmony_ci * @deprecated since 9 102061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#isNull 102161847f8eSopenharmony_ci */ 102261847f8eSopenharmony_ci isNull(field: string): Query; 102361847f8eSopenharmony_ci 102461847f8eSopenharmony_ci /** 102561847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. 102661847f8eSopenharmony_ci * 102761847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 102861847f8eSopenharmony_ci * @param valueList Indicates the int value list. 102961847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 103061847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 103161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 103261847f8eSopenharmony_ci * @since 8 103361847f8eSopenharmony_ci * @deprecated since 9 103461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#inNumber 103561847f8eSopenharmony_ci */ 103661847f8eSopenharmony_ci inNumber(field: string, valueList: number[]): Query; 103761847f8eSopenharmony_ci 103861847f8eSopenharmony_ci /** 103961847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. 104061847f8eSopenharmony_ci * 104161847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 104261847f8eSopenharmony_ci * @param valueList Indicates the string value list. 104361847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 104461847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 104561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 104661847f8eSopenharmony_ci * @since 8 104761847f8eSopenharmony_ci * @deprecated since 9 104861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#inString 104961847f8eSopenharmony_ci */ 105061847f8eSopenharmony_ci inString(field: string, valueList: string[]): Query; 105161847f8eSopenharmony_ci 105261847f8eSopenharmony_ci /** 105361847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. 105461847f8eSopenharmony_ci * 105561847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 105661847f8eSopenharmony_ci * @param valueList Indicates the int value list. 105761847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 105861847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 105961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 106061847f8eSopenharmony_ci * @since 8 106161847f8eSopenharmony_ci * @deprecated since 9 106261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#notInNumber 106361847f8eSopenharmony_ci */ 106461847f8eSopenharmony_ci notInNumber(field: string, valueList: number[]): Query; 106561847f8eSopenharmony_ci 106661847f8eSopenharmony_ci /** 106761847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. 106861847f8eSopenharmony_ci * 106961847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 107061847f8eSopenharmony_ci * @param valueList Indicates the string value list. 107161847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 107261847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 107361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 107461847f8eSopenharmony_ci * @since 8 107561847f8eSopenharmony_ci * @deprecated since 9 107661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#notInString 107761847f8eSopenharmony_ci */ 107861847f8eSopenharmony_ci notInString(field: string, valueList: string[]): Query; 107961847f8eSopenharmony_ci 108061847f8eSopenharmony_ci /** 108161847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. 108261847f8eSopenharmony_ci * 108361847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 108461847f8eSopenharmony_ci * @param value Indicates the string value. 108561847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 108661847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 108761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 108861847f8eSopenharmony_ci * @since 8 108961847f8eSopenharmony_ci * @deprecated since 9 109061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#like 109161847f8eSopenharmony_ci */ 109261847f8eSopenharmony_ci like(field: string, value: string): Query; 109361847f8eSopenharmony_ci 109461847f8eSopenharmony_ci /** 109561847f8eSopenharmony_ci * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. 109661847f8eSopenharmony_ci * 109761847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 109861847f8eSopenharmony_ci * @param value Indicates the string value. 109961847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 110061847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 110161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 110261847f8eSopenharmony_ci * @since 8 110361847f8eSopenharmony_ci * @deprecated since 9 110461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#unlike 110561847f8eSopenharmony_ci */ 110661847f8eSopenharmony_ci unlike(field: string, value: string): Query; 110761847f8eSopenharmony_ci 110861847f8eSopenharmony_ci /** 110961847f8eSopenharmony_ci * Constructs a {@code Query} object with the and condition. 111061847f8eSopenharmony_ci * 111161847f8eSopenharmony_ci * <p>Multiple predicates should be connected using the and or or condition. 111261847f8eSopenharmony_ci * 111361847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 111461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 111561847f8eSopenharmony_ci * @since 8 111661847f8eSopenharmony_ci * @deprecated since 9 111761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#and 111861847f8eSopenharmony_ci */ 111961847f8eSopenharmony_ci and(): Query; 112061847f8eSopenharmony_ci 112161847f8eSopenharmony_ci /** 112261847f8eSopenharmony_ci * Constructs a {@code Query} object with the or condition. 112361847f8eSopenharmony_ci * 112461847f8eSopenharmony_ci * <p>Multiple predicates should be connected using the and or or condition. 112561847f8eSopenharmony_ci * 112661847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 112761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 112861847f8eSopenharmony_ci * @since 8 112961847f8eSopenharmony_ci * @deprecated since 9 113061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#or 113161847f8eSopenharmony_ci */ 113261847f8eSopenharmony_ci or(): Query; 113361847f8eSopenharmony_ci 113461847f8eSopenharmony_ci /** 113561847f8eSopenharmony_ci * Constructs a {@code Query} object to sort the query results in ascending order. 113661847f8eSopenharmony_ci * 113761847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 113861847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 113961847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 114061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 114161847f8eSopenharmony_ci * @since 8 114261847f8eSopenharmony_ci * @deprecated since 9 114361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#orderByAsc 114461847f8eSopenharmony_ci */ 114561847f8eSopenharmony_ci orderByAsc(field: string): Query; 114661847f8eSopenharmony_ci 114761847f8eSopenharmony_ci /** 114861847f8eSopenharmony_ci * Constructs a {@code Query} object to sort the query results in descending order. 114961847f8eSopenharmony_ci * 115061847f8eSopenharmony_ci * @param field Indicates the field, which must start with $. and cannot contain ^. 115161847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 115261847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 115361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 115461847f8eSopenharmony_ci * @since 8 115561847f8eSopenharmony_ci * @deprecated since 9 115661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#orderByDesc 115761847f8eSopenharmony_ci */ 115861847f8eSopenharmony_ci orderByDesc(field: string): Query; 115961847f8eSopenharmony_ci 116061847f8eSopenharmony_ci /** 116161847f8eSopenharmony_ci * Constructs a {@code Query} object to specify the number of results and the start position. 116261847f8eSopenharmony_ci * 116361847f8eSopenharmony_ci * @param total Indicates the number of results. 116461847f8eSopenharmony_ci * @param offset Indicates the start position. 116561847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 116661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 116761847f8eSopenharmony_ci * @since 8 116861847f8eSopenharmony_ci * @deprecated since 9 116961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#limit 117061847f8eSopenharmony_ci */ 117161847f8eSopenharmony_ci limit(total: number, offset: number): Query; 117261847f8eSopenharmony_ci 117361847f8eSopenharmony_ci /** 117461847f8eSopenharmony_ci * Creates a {@code query} condition with a specified field that is not null. 117561847f8eSopenharmony_ci * 117661847f8eSopenharmony_ci * @param field Indicates the specified field. 117761847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 117861847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 117961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 118061847f8eSopenharmony_ci * @since 8 118161847f8eSopenharmony_ci * @deprecated since 9 118261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#isNotNull 118361847f8eSopenharmony_ci */ 118461847f8eSopenharmony_ci isNotNull(field: string): Query; 118561847f8eSopenharmony_ci 118661847f8eSopenharmony_ci /** 118761847f8eSopenharmony_ci * Creates a query condition group with a left bracket. 118861847f8eSopenharmony_ci * 118961847f8eSopenharmony_ci * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a 119061847f8eSopenharmony_ci * whole to combine with other query conditions. 119161847f8eSopenharmony_ci * 119261847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 119361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 119461847f8eSopenharmony_ci * @since 8 119561847f8eSopenharmony_ci * @deprecated since 9 119661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#beginGroup 119761847f8eSopenharmony_ci */ 119861847f8eSopenharmony_ci beginGroup(): Query; 119961847f8eSopenharmony_ci 120061847f8eSopenharmony_ci /** 120161847f8eSopenharmony_ci * Creates a query condition group with a right bracket. 120261847f8eSopenharmony_ci * 120361847f8eSopenharmony_ci * <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a 120461847f8eSopenharmony_ci * whole to combine with other query conditions. 120561847f8eSopenharmony_ci * 120661847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 120761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 120861847f8eSopenharmony_ci * @since 8 120961847f8eSopenharmony_ci * @deprecated since 9 121061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#endGroup 121161847f8eSopenharmony_ci */ 121261847f8eSopenharmony_ci endGroup(): Query; 121361847f8eSopenharmony_ci 121461847f8eSopenharmony_ci /** 121561847f8eSopenharmony_ci * Creates a query condition with a specified key prefix. 121661847f8eSopenharmony_ci * 121761847f8eSopenharmony_ci * @param prefix Indicates the specified key prefix. 121861847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 121961847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 122061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 122161847f8eSopenharmony_ci * @since 8 122261847f8eSopenharmony_ci * @deprecated since 9 122361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#prefixKey 122461847f8eSopenharmony_ci */ 122561847f8eSopenharmony_ci prefixKey(prefix: string): Query; 122661847f8eSopenharmony_ci 122761847f8eSopenharmony_ci /** 122861847f8eSopenharmony_ci * Sets a specified index that will be preferentially used for query. 122961847f8eSopenharmony_ci * 123061847f8eSopenharmony_ci * @param index Indicates the index to set. 123161847f8eSopenharmony_ci * @returns Returns the {@coed Query} object. 123261847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 123361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 123461847f8eSopenharmony_ci * @since 8 123561847f8eSopenharmony_ci * @deprecated since 9 123661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#setSuggestIndex 123761847f8eSopenharmony_ci */ 123861847f8eSopenharmony_ci setSuggestIndex(index: string): Query; 123961847f8eSopenharmony_ci 124061847f8eSopenharmony_ci /** 124161847f8eSopenharmony_ci * Add device ID key prefix.Used by {@code DeviceKVStore}. 124261847f8eSopenharmony_ci * 124361847f8eSopenharmony_ci * @param deviceId Specify device id to query from. 124461847f8eSopenharmony_ci * @returns Returns the {@code Query} object with device ID prefix added. 124561847f8eSopenharmony_ci * @throws Throws this exception if input is invalid. 124661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 124761847f8eSopenharmony_ci * @since 8 124861847f8eSopenharmony_ci * @deprecated since 9 124961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#deviceId 125061847f8eSopenharmony_ci */ 125161847f8eSopenharmony_ci deviceId(deviceId: string): Query; 125261847f8eSopenharmony_ci 125361847f8eSopenharmony_ci /** 125461847f8eSopenharmony_ci * Get a String that represents this {@code Query}. 125561847f8eSopenharmony_ci * 125661847f8eSopenharmony_ci * <p>The String would be parsed to DB query format. 125761847f8eSopenharmony_ci * The String length should be no longer than 500kb. 125861847f8eSopenharmony_ci * 125961847f8eSopenharmony_ci * @returns String representing this {@code Query}. 126061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 126161847f8eSopenharmony_ci * @since 8 126261847f8eSopenharmony_ci * @deprecated since 9 126361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.Query#getSqlLike 126461847f8eSopenharmony_ci */ 126561847f8eSopenharmony_ci getSqlLike(): string; 126661847f8eSopenharmony_ci } 126761847f8eSopenharmony_ci 126861847f8eSopenharmony_ci /** 126961847f8eSopenharmony_ci * Represents a key-value distributed database and provides methods for adding, deleting, modifying, querying, 127061847f8eSopenharmony_ci * and subscribing to distributed data. 127161847f8eSopenharmony_ci * 127261847f8eSopenharmony_ci * <p>You can create distributed databases of different types by {@link KVManager#getKVStore (Options, String)} 127361847f8eSopenharmony_ci * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, 127461847f8eSopenharmony_ci * including {@code SingleKVStore}. 127561847f8eSopenharmony_ci * 127661847f8eSopenharmony_ci * 127761847f8eSopenharmony_ci * @version 1 127861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 127961847f8eSopenharmony_ci * @since 7 128061847f8eSopenharmony_ci * @deprecated since 9 128161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore 128261847f8eSopenharmony_ci */ 128361847f8eSopenharmony_ci interface KVStore { 128461847f8eSopenharmony_ci /** 128561847f8eSopenharmony_ci * Writes a key-value pair of the string type into the {@code KvStore} database. 128661847f8eSopenharmony_ci * 128761847f8eSopenharmony_ci * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. 128861847f8eSopenharmony_ci * 128961847f8eSopenharmony_ci * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 129061847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 129161847f8eSopenharmony_ci * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. 129261847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 129361847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 129461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 129561847f8eSopenharmony_ci * @since 7 129661847f8eSopenharmony_ci * @deprecated since 9 129761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#put 129861847f8eSopenharmony_ci */ 129961847f8eSopenharmony_ci put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback<void>): void; 130061847f8eSopenharmony_ci 130161847f8eSopenharmony_ci /** 130261847f8eSopenharmony_ci * Writes a key-value pair of the string type into the {@code KvStore} database. 130361847f8eSopenharmony_ci * 130461847f8eSopenharmony_ci * <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. 130561847f8eSopenharmony_ci * 130661847f8eSopenharmony_ci * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 130761847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 130861847f8eSopenharmony_ci * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. 130961847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 131061847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 131161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 131261847f8eSopenharmony_ci * @since 7 131361847f8eSopenharmony_ci * @deprecated since 9 131461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#put 131561847f8eSopenharmony_ci */ 131661847f8eSopenharmony_ci put(key: string, value: Uint8Array | string | number | boolean): Promise<void>; 131761847f8eSopenharmony_ci 131861847f8eSopenharmony_ci /** 131961847f8eSopenharmony_ci * Deletes the key-value pair based on a specified key. 132061847f8eSopenharmony_ci * 132161847f8eSopenharmony_ci * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 132261847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 132361847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 132461847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and 132561847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. 132661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 132761847f8eSopenharmony_ci * @since 7 132861847f8eSopenharmony_ci * @deprecated since 9 132961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#delete 133061847f8eSopenharmony_ci */ 133161847f8eSopenharmony_ci delete(key: string, callback: AsyncCallback<void>): void; 133261847f8eSopenharmony_ci 133361847f8eSopenharmony_ci /** 133461847f8eSopenharmony_ci * Deletes the key-value pair based on a specified key. 133561847f8eSopenharmony_ci * 133661847f8eSopenharmony_ci * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. 133761847f8eSopenharmony_ci * Spaces before and after the key will be cleared. 133861847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 133961847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and 134061847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. 134161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 134261847f8eSopenharmony_ci * @since 7 134361847f8eSopenharmony_ci * @deprecated since 9 134461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#delete 134561847f8eSopenharmony_ci */ 134661847f8eSopenharmony_ci delete(key: string): Promise<void>; 134761847f8eSopenharmony_ci 134861847f8eSopenharmony_ci /** 134961847f8eSopenharmony_ci * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in 135061847f8eSopenharmony_ci * {@code KvStoreObserver} will be invoked. 135161847f8eSopenharmony_ci * 135261847f8eSopenharmony_ci * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. 135361847f8eSopenharmony_ci * @param listener Indicates the observer of data change events in the distributed database. 135461847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 135561847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, 135661847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 135761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 135861847f8eSopenharmony_ci * @since 7 135961847f8eSopenharmony_ci * @deprecated since 9 136061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#on 136161847f8eSopenharmony_ci */ 136261847f8eSopenharmony_ci on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void; 136361847f8eSopenharmony_ci 136461847f8eSopenharmony_ci /** 136561847f8eSopenharmony_ci * Subscribe the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. 136661847f8eSopenharmony_ci * 136761847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 136861847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, 136961847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 137061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 137161847f8eSopenharmony_ci * @since 7 137261847f8eSopenharmony_ci * @deprecated since 9 137361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#on 137461847f8eSopenharmony_ci */ 137561847f8eSopenharmony_ci on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void; 137661847f8eSopenharmony_ci 137761847f8eSopenharmony_ci /** 137861847f8eSopenharmony_ci * Unsubscribe the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. 137961847f8eSopenharmony_ci * 138061847f8eSopenharmony_ci * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. 138161847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 138261847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, 138361847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 138461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 138561847f8eSopenharmony_ci * @since 8 138661847f8eSopenharmony_ci * @deprecated since 9 138761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#off 138861847f8eSopenharmony_ci */ 138961847f8eSopenharmony_ci off(event: 'dataChange', listener?: Callback<ChangeNotification>): void; 139061847f8eSopenharmony_ci 139161847f8eSopenharmony_ci /** 139261847f8eSopenharmony_ci * UnRegister the {@code KvStore} database synchronization callback. 139361847f8eSopenharmony_ci * 139461847f8eSopenharmony_ci * @param syncCallback Indicates the callback used to send the synchronization result to caller. 139561847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 139661847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, 139761847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 139861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 139961847f8eSopenharmony_ci * @since 8 140061847f8eSopenharmony_ci * @deprecated since 9 140161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#off 140261847f8eSopenharmony_ci */ 140361847f8eSopenharmony_ci off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>>): void; 140461847f8eSopenharmony_ci 140561847f8eSopenharmony_ci /** 140661847f8eSopenharmony_ci * Inserts key-value pairs into the {@code KvStore} database in batches. 140761847f8eSopenharmony_ci * 140861847f8eSopenharmony_ci * @param entries Indicates the key-value pairs to be inserted in batches. 140961847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 141061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 141161847f8eSopenharmony_ci * @since 8 141261847f8eSopenharmony_ci * @deprecated since 9 141361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#putBatch 141461847f8eSopenharmony_ci */ 141561847f8eSopenharmony_ci putBatch(entries: Entry[], callback: AsyncCallback<void>): void; 141661847f8eSopenharmony_ci 141761847f8eSopenharmony_ci /** 141861847f8eSopenharmony_ci * Inserts key-value pairs into the {@code KvStore} database in batches. 141961847f8eSopenharmony_ci * 142061847f8eSopenharmony_ci * @param entries Indicates the key-value pairs to be inserted in batches. 142161847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 142261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 142361847f8eSopenharmony_ci * @since 8 142461847f8eSopenharmony_ci * @deprecated since 9 142561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#putBatch 142661847f8eSopenharmony_ci */ 142761847f8eSopenharmony_ci putBatch(entries: Entry[]): Promise<void>; 142861847f8eSopenharmony_ci 142961847f8eSopenharmony_ci /** 143061847f8eSopenharmony_ci * Deletes key-value pairs in batches from the {@code KvStore} database. 143161847f8eSopenharmony_ci * 143261847f8eSopenharmony_ci * @param keys Indicates the key-value pairs to be deleted in batches. 143361847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 143461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 143561847f8eSopenharmony_ci * @since 8 143661847f8eSopenharmony_ci * @deprecated since 9 143761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#deleteBatch 143861847f8eSopenharmony_ci */ 143961847f8eSopenharmony_ci deleteBatch(keys: string[], callback: AsyncCallback<void>): void; 144061847f8eSopenharmony_ci 144161847f8eSopenharmony_ci /** 144261847f8eSopenharmony_ci * Deletes key-value pairs in batches from the {@code KvStore} database. 144361847f8eSopenharmony_ci * 144461847f8eSopenharmony_ci * @param keys Indicates the key-value pairs to be deleted in batches. 144561847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 144661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 144761847f8eSopenharmony_ci * @since 8 144861847f8eSopenharmony_ci * @deprecated since 9 144961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#deleteBatch 145061847f8eSopenharmony_ci */ 145161847f8eSopenharmony_ci deleteBatch(keys: string[]): Promise<void>; 145261847f8eSopenharmony_ci 145361847f8eSopenharmony_ci /** 145461847f8eSopenharmony_ci * Starts a transaction operation in the {@code KvStore} database. 145561847f8eSopenharmony_ci * 145661847f8eSopenharmony_ci * <p>After the database transaction is started, you can submit or roll back the operation. 145761847f8eSopenharmony_ci * 145861847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 145961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 146061847f8eSopenharmony_ci * @since 8 146161847f8eSopenharmony_ci * @deprecated since 9 146261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#startTransaction 146361847f8eSopenharmony_ci */ 146461847f8eSopenharmony_ci startTransaction(callback: AsyncCallback<void>): void; 146561847f8eSopenharmony_ci 146661847f8eSopenharmony_ci /** 146761847f8eSopenharmony_ci * Starts a transaction operation in the {@code KvStore} database. 146861847f8eSopenharmony_ci * 146961847f8eSopenharmony_ci * <p>After the database transaction is started, you can submit or roll back the operation. 147061847f8eSopenharmony_ci * 147161847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 147261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 147361847f8eSopenharmony_ci * @since 8 147461847f8eSopenharmony_ci * @deprecated since 9 147561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#startTransaction 147661847f8eSopenharmony_ci */ 147761847f8eSopenharmony_ci startTransaction(): Promise<void>; 147861847f8eSopenharmony_ci 147961847f8eSopenharmony_ci /** 148061847f8eSopenharmony_ci * Submits a transaction operation in the {@code KvStore} database. 148161847f8eSopenharmony_ci * 148261847f8eSopenharmony_ci * @param callback 148361847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 148461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 148561847f8eSopenharmony_ci * @since 8 148661847f8eSopenharmony_ci * @deprecated since 9 148761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#commit 148861847f8eSopenharmony_ci */ 148961847f8eSopenharmony_ci commit(callback: AsyncCallback<void>): void; 149061847f8eSopenharmony_ci 149161847f8eSopenharmony_ci /** 149261847f8eSopenharmony_ci * Submits a transaction operation in the {@code KvStore} database. 149361847f8eSopenharmony_ci * 149461847f8eSopenharmony_ci * @param callback 149561847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 149661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 149761847f8eSopenharmony_ci * @since 8 149861847f8eSopenharmony_ci * @deprecated since 9 149961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#commit 150061847f8eSopenharmony_ci */ 150161847f8eSopenharmony_ci commit(): Promise<void>; 150261847f8eSopenharmony_ci 150361847f8eSopenharmony_ci /** 150461847f8eSopenharmony_ci * Rolls back a transaction operation in the {@code KvStore} database. 150561847f8eSopenharmony_ci * 150661847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 150761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 150861847f8eSopenharmony_ci * @since 8 150961847f8eSopenharmony_ci * @deprecated since 9 151061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#rollback 151161847f8eSopenharmony_ci */ 151261847f8eSopenharmony_ci rollback(callback: AsyncCallback<void>): void; 151361847f8eSopenharmony_ci 151461847f8eSopenharmony_ci /** 151561847f8eSopenharmony_ci * Rolls back a transaction operation in the {@code KvStore} database. 151661847f8eSopenharmony_ci * 151761847f8eSopenharmony_ci * @throws Throws this exception if a database error occurs. 151861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 151961847f8eSopenharmony_ci * @since 8 152061847f8eSopenharmony_ci * @deprecated since 9 152161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#rollback 152261847f8eSopenharmony_ci */ 152361847f8eSopenharmony_ci rollback(): Promise<void>; 152461847f8eSopenharmony_ci 152561847f8eSopenharmony_ci /** 152661847f8eSopenharmony_ci * Sets whether to enable synchronization. 152761847f8eSopenharmony_ci * 152861847f8eSopenharmony_ci * @param enabled Specifies whether to enable synchronization. The value true means to enable 152961847f8eSopenharmony_ci * synchronization, and false means the opposite. 153061847f8eSopenharmony_ci * @throws Throws this exception if an internal service error occurs. 153161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 153261847f8eSopenharmony_ci * @since 8 153361847f8eSopenharmony_ci * @deprecated since 9 153461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#enableSync 153561847f8eSopenharmony_ci */ 153661847f8eSopenharmony_ci enableSync(enabled: boolean, callback: AsyncCallback<void>): void; 153761847f8eSopenharmony_ci 153861847f8eSopenharmony_ci /** 153961847f8eSopenharmony_ci * Sets whether to enable synchronization. 154061847f8eSopenharmony_ci * 154161847f8eSopenharmony_ci * @param enabled Specifies whether to enable synchronization. The value true means to enable 154261847f8eSopenharmony_ci * synchronization, and false means the opposite. 154361847f8eSopenharmony_ci * @throws Throws this exception if an internal service error occurs. 154461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 154561847f8eSopenharmony_ci * @since 8 154661847f8eSopenharmony_ci * @deprecated since 9 154761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#enableSync 154861847f8eSopenharmony_ci */ 154961847f8eSopenharmony_ci enableSync(enabled: boolean): Promise<void>; 155061847f8eSopenharmony_ci 155161847f8eSopenharmony_ci /** 155261847f8eSopenharmony_ci * Sets synchronization range labels. 155361847f8eSopenharmony_ci * 155461847f8eSopenharmony_ci * <p>The labels determine the devices with which data will be synchronized. 155561847f8eSopenharmony_ci * 155661847f8eSopenharmony_ci * @param localLabels Indicates the synchronization labels of the local device. 155761847f8eSopenharmony_ci * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. 155861847f8eSopenharmony_ci * @throws Throws this exception if an internal service error occurs. 155961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 156061847f8eSopenharmony_ci * @since 8 156161847f8eSopenharmony_ci * @deprecated since 9 156261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncRange 156361847f8eSopenharmony_ci */ 156461847f8eSopenharmony_ci setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback<void>): void; 156561847f8eSopenharmony_ci 156661847f8eSopenharmony_ci /** 156761847f8eSopenharmony_ci * Sets synchronization range labels. 156861847f8eSopenharmony_ci * 156961847f8eSopenharmony_ci * <p>The labels determine the devices with which data will be synchronized. 157061847f8eSopenharmony_ci * 157161847f8eSopenharmony_ci * @param localLabels Indicates the synchronization labels of the local device. 157261847f8eSopenharmony_ci * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. 157361847f8eSopenharmony_ci * @throws Throws this exception if an internal service error occurs. 157461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 157561847f8eSopenharmony_ci * @since 8 157661847f8eSopenharmony_ci * @deprecated since 9 157761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncRange 157861847f8eSopenharmony_ci */ 157961847f8eSopenharmony_ci setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>; 158061847f8eSopenharmony_ci } 158161847f8eSopenharmony_ci 158261847f8eSopenharmony_ci /** 158361847f8eSopenharmony_ci * Provides methods related to single-version distributed databases. 158461847f8eSopenharmony_ci * 158561847f8eSopenharmony_ci * <p>To create a {@code SingleKVStore} database, 158661847f8eSopenharmony_ci * you can use the {@link data.distributed.common.KVManager#getKVStore(Options, String)} method 158761847f8eSopenharmony_ci * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. 158861847f8eSopenharmony_ci * This database synchronizes data to other databases in time sequence. 158961847f8eSopenharmony_ci * The {@code SingleKVStore} database does not support 159061847f8eSopenharmony_ci * synchronous transactions, or data search using snapshots. 159161847f8eSopenharmony_ci * 159261847f8eSopenharmony_ci * @version 1 159361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 159461847f8eSopenharmony_ci * @since 7 159561847f8eSopenharmony_ci * @deprecated since 9 159661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore 159761847f8eSopenharmony_ci */ 159861847f8eSopenharmony_ci interface SingleKVStore extends KVStore { 159961847f8eSopenharmony_ci /** 160061847f8eSopenharmony_ci * Obtains the {@code String} value of a specified key. 160161847f8eSopenharmony_ci * 160261847f8eSopenharmony_ci * @param key Indicates the key of the boolean value to be queried. 160361847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 160461847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. 160561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 160661847f8eSopenharmony_ci * @since 7 160761847f8eSopenharmony_ci * @deprecated since 9 160861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#get 160961847f8eSopenharmony_ci */ 161061847f8eSopenharmony_ci get(key: string, callback: AsyncCallback<Uint8Array | string | boolean | number>): void; 161161847f8eSopenharmony_ci 161261847f8eSopenharmony_ci /** 161361847f8eSopenharmony_ci * Obtains the {@code String} value of a specified key. 161461847f8eSopenharmony_ci * 161561847f8eSopenharmony_ci * @param key Indicates the key of the boolean value to be queried. 161661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 161761847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. 161861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 161961847f8eSopenharmony_ci * @since 7 162061847f8eSopenharmony_ci * @deprecated since 9 162161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#get 162261847f8eSopenharmony_ci */ 162361847f8eSopenharmony_ci get(key: string): Promise<Uint8Array | string | boolean | number>; 162461847f8eSopenharmony_ci 162561847f8eSopenharmony_ci /** 162661847f8eSopenharmony_ci * Obtains all key-value pairs that match a specified key prefix. 162761847f8eSopenharmony_ci * 162861847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 162961847f8eSopenharmony_ci * @returns Returns the list of all key-value pairs that match the specified key prefix. 163061847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 163161847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 163261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 163361847f8eSopenharmony_ci * @since 8 163461847f8eSopenharmony_ci * @deprecated since 9 163561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries 163661847f8eSopenharmony_ci */ 163761847f8eSopenharmony_ci getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void; 163861847f8eSopenharmony_ci 163961847f8eSopenharmony_ci /** 164061847f8eSopenharmony_ci * Obtains all key-value pairs that match a specified key prefix. 164161847f8eSopenharmony_ci * 164261847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 164361847f8eSopenharmony_ci * @returns Returns the list of all key-value pairs that match the specified key prefix. 164461847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 164561847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 164661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 164761847f8eSopenharmony_ci * @since 8 164861847f8eSopenharmony_ci * @deprecated since 9 164961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries 165061847f8eSopenharmony_ci */ 165161847f8eSopenharmony_ci getEntries(keyPrefix: string): Promise<Entry[]>; 165261847f8eSopenharmony_ci 165361847f8eSopenharmony_ci /** 165461847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the specified {@code Query} object. 165561847f8eSopenharmony_ci * 165661847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 165761847f8eSopenharmony_ci * @returns Returns the list of key-value pairs matching the specified {@code Query} object. 165861847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 165961847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 166061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 166161847f8eSopenharmony_ci * @since 8 166261847f8eSopenharmony_ci * @deprecated since 9 166361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries 166461847f8eSopenharmony_ci */ 166561847f8eSopenharmony_ci getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; 166661847f8eSopenharmony_ci 166761847f8eSopenharmony_ci /** 166861847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the specified {@code Query} object. 166961847f8eSopenharmony_ci * 167061847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 167161847f8eSopenharmony_ci * @returns Returns the list of key-value pairs matching the specified {@code Query} object. 167261847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 167361847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 167461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 167561847f8eSopenharmony_ci * @since 8 167661847f8eSopenharmony_ci * @deprecated since 9 167761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries 167861847f8eSopenharmony_ci */ 167961847f8eSopenharmony_ci getEntries(query: Query): Promise<Entry[]>; 168061847f8eSopenharmony_ci 168161847f8eSopenharmony_ci /** 168261847f8eSopenharmony_ci * Obtains the result sets with a specified prefix from a {@code KvStore} database. The {@code KvStoreResultSet} object can be used to 168361847f8eSopenharmony_ci * query all key-value pairs that meet the search criteria. Each {@code KvStore} instance can have a maximum of four 168461847f8eSopenharmony_ci * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a 168561847f8eSopenharmony_ci * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects 168661847f8eSopenharmony_ci * in a timely manner. 168761847f8eSopenharmony_ci * 168861847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 168961847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 169061847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 169161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 169261847f8eSopenharmony_ci * @since 8 169361847f8eSopenharmony_ci * @deprecated since 9 169461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet 169561847f8eSopenharmony_ci */ 169661847f8eSopenharmony_ci getResultSet(keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void; 169761847f8eSopenharmony_ci 169861847f8eSopenharmony_ci /** 169961847f8eSopenharmony_ci * Obtains the result sets with a specified prefix from a {@code KvStore} database. The {@code KvStoreResultSet} object can be used to 170061847f8eSopenharmony_ci * query all key-value pairs that meet the search criteria. Each {@code KvStore} instance can have a maximum of four 170161847f8eSopenharmony_ci * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a 170261847f8eSopenharmony_ci * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects 170361847f8eSopenharmony_ci * in a timely manner. 170461847f8eSopenharmony_ci * 170561847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 170661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 170761847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 170861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 170961847f8eSopenharmony_ci * @since 8 171061847f8eSopenharmony_ci * @deprecated since 9 171161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet 171261847f8eSopenharmony_ci */ 171361847f8eSopenharmony_ci getResultSet(keyPrefix: string): Promise<KvStoreResultSet>; 171461847f8eSopenharmony_ci 171561847f8eSopenharmony_ci /** 171661847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. 171761847f8eSopenharmony_ci * 171861847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 171961847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 172061847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 172161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 172261847f8eSopenharmony_ci * @since 8 172361847f8eSopenharmony_ci * @deprecated since 9 172461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet 172561847f8eSopenharmony_ci */ 172661847f8eSopenharmony_ci getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void; 172761847f8eSopenharmony_ci 172861847f8eSopenharmony_ci /** 172961847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. 173061847f8eSopenharmony_ci * 173161847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 173261847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 173361847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 173461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 173561847f8eSopenharmony_ci * @since 8 173661847f8eSopenharmony_ci * @deprecated since 9 173761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet 173861847f8eSopenharmony_ci */ 173961847f8eSopenharmony_ci getResultSet(query: Query): Promise<KvStoreResultSet>; 174061847f8eSopenharmony_ci 174161847f8eSopenharmony_ci /** 174261847f8eSopenharmony_ci * Closes a {@code KvStoreResultSet} object returned by getResultSet. 174361847f8eSopenharmony_ci * 174461847f8eSopenharmony_ci * @param resultSet Indicates the {@code KvStoreResultSet} object to close. 174561847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 174661847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 174761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 174861847f8eSopenharmony_ci * @since 8 174961847f8eSopenharmony_ci * @deprecated since 9 175061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#closeResultSet 175161847f8eSopenharmony_ci */ 175261847f8eSopenharmony_ci closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void; 175361847f8eSopenharmony_ci 175461847f8eSopenharmony_ci /** 175561847f8eSopenharmony_ci * Closes a {@code KvStoreResultSet} object returned by getResultSet. 175661847f8eSopenharmony_ci * 175761847f8eSopenharmony_ci * @param resultSet Indicates the {@code KvStoreResultSet} object to close. 175861847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 175961847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 176061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 176161847f8eSopenharmony_ci * @since 8 176261847f8eSopenharmony_ci * @deprecated since 9 176361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#closeResultSet 176461847f8eSopenharmony_ci */ 176561847f8eSopenharmony_ci closeResultSet(resultSet: KvStoreResultSet): Promise<void>; 176661847f8eSopenharmony_ci 176761847f8eSopenharmony_ci /** 176861847f8eSopenharmony_ci * Obtains the number of results matching the specified {@code Query} object. 176961847f8eSopenharmony_ci * 177061847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 177161847f8eSopenharmony_ci * @returns Returns the number of results matching the specified {@code Query} object. 177261847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 177361847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 177461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 177561847f8eSopenharmony_ci * @since 8 177661847f8eSopenharmony_ci * @deprecated since 9 177761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSize 177861847f8eSopenharmony_ci */ 177961847f8eSopenharmony_ci getResultSize(query: Query, callback: AsyncCallback<number>): void; 178061847f8eSopenharmony_ci 178161847f8eSopenharmony_ci /** 178261847f8eSopenharmony_ci * Obtains the number of results matching the specified {@code Query} object. 178361847f8eSopenharmony_ci * 178461847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 178561847f8eSopenharmony_ci * @returns Returns the number of results matching the specified {@code Query} object. 178661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 178761847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 178861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 178961847f8eSopenharmony_ci * @since 8 179061847f8eSopenharmony_ci * @deprecated since 9 179161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSize 179261847f8eSopenharmony_ci */ 179361847f8eSopenharmony_ci getResultSize(query: Query): Promise<number>; 179461847f8eSopenharmony_ci 179561847f8eSopenharmony_ci /** 179661847f8eSopenharmony_ci * void removeDeviceData({@link String} deviceId) throws {@link KvStoreException} 179761847f8eSopenharmony_ci * 179861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 179961847f8eSopenharmony_ci * @since 8 180061847f8eSopenharmony_ci * @deprecated since 9 180161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#removeDeviceData 180261847f8eSopenharmony_ci */ 180361847f8eSopenharmony_ci removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void; 180461847f8eSopenharmony_ci 180561847f8eSopenharmony_ci /** 180661847f8eSopenharmony_ci * void removeDeviceData({@link String} deviceId) throws {@link KvStoreException} 180761847f8eSopenharmony_ci * 180861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 180961847f8eSopenharmony_ci * @since 8 181061847f8eSopenharmony_ci * @deprecated since 9 181161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#removeDeviceData 181261847f8eSopenharmony_ci */ 181361847f8eSopenharmony_ci removeDeviceData(deviceId: string): Promise<void>; 181461847f8eSopenharmony_ci 181561847f8eSopenharmony_ci /** 181661847f8eSopenharmony_ci * Synchronize the database to the specified devices with the specified delay allowed. 181761847f8eSopenharmony_ci * 181861847f8eSopenharmony_ci * @param deviceIds Indicates the list of devices to which to synchronize the database. 181961847f8eSopenharmony_ci * @param mode Indicates the synchronization mode. The value can be {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. 182061847f8eSopenharmony_ci * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. 182161847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 182261847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 182361847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 182461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 182561847f8eSopenharmony_ci * @since 7 182661847f8eSopenharmony_ci * @deprecated since 9 182761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#sync 182861847f8eSopenharmony_ci */ 182961847f8eSopenharmony_ci sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; 183061847f8eSopenharmony_ci 183161847f8eSopenharmony_ci /** 183261847f8eSopenharmony_ci * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback 183361847f8eSopenharmony_ci * in the {@code KvStoreObserver} will be invoked. 183461847f8eSopenharmony_ci * 183561847f8eSopenharmony_ci * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. 183661847f8eSopenharmony_ci * @param listener Indicates the observer of data change events in the distributed database. 183761847f8eSopenharmony_ci * @throws Throws this exception if no {@code SingleKvStore} database is available. 183861847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 183961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 184061847f8eSopenharmony_ci * @since 8 184161847f8eSopenharmony_ci * @deprecated since 9 184261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#on 184361847f8eSopenharmony_ci */ 184461847f8eSopenharmony_ci on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void; 184561847f8eSopenharmony_ci 184661847f8eSopenharmony_ci /** 184761847f8eSopenharmony_ci * Register a SingleKvStore database synchronization callback. 184861847f8eSopenharmony_ci * <p> Sync result is returned through asynchronous callback. 184961847f8eSopenharmony_ci * 185061847f8eSopenharmony_ci * @param syncCallback Indicates the callback used to send the synchronization result to the caller. 185161847f8eSopenharmony_ci * @throws Throws this exception if no {@code SingleKvStore} database is available. 185261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 185361847f8eSopenharmony_ci * @since 8 185461847f8eSopenharmony_ci * @deprecated since 9 185561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#on 185661847f8eSopenharmony_ci */ 185761847f8eSopenharmony_ci on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void; 185861847f8eSopenharmony_ci 185961847f8eSopenharmony_ci /** 186061847f8eSopenharmony_ci * Unsubscribe the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. 186161847f8eSopenharmony_ci * 186261847f8eSopenharmony_ci * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. 186361847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 186461847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, 186561847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 186661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 186761847f8eSopenharmony_ci * @since 8 186861847f8eSopenharmony_ci * @deprecated since 9 186961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#off 187061847f8eSopenharmony_ci */ 187161847f8eSopenharmony_ci off(event: 'dataChange', listener?: Callback<ChangeNotification>): void; 187261847f8eSopenharmony_ci 187361847f8eSopenharmony_ci /** 187461847f8eSopenharmony_ci * UnRegister the SingleKvStore database synchronization callback. 187561847f8eSopenharmony_ci * 187661847f8eSopenharmony_ci * @throws Throws this exception if no {@code SingleKvStore} database is available. 187761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 187861847f8eSopenharmony_ci * @since 8 187961847f8eSopenharmony_ci * @deprecated since 9 188061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#off 188161847f8eSopenharmony_ci */ 188261847f8eSopenharmony_ci off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>>): void; 188361847f8eSopenharmony_ci 188461847f8eSopenharmony_ci /** 188561847f8eSopenharmony_ci * Sets the default delay allowed for database synchronization 188661847f8eSopenharmony_ci * 188761847f8eSopenharmony_ci * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. 188861847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 188961847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 189061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 189161847f8eSopenharmony_ci * @since 8 189261847f8eSopenharmony_ci * @deprecated since 9 189361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncParam 189461847f8eSopenharmony_ci */ 189561847f8eSopenharmony_ci setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void; 189661847f8eSopenharmony_ci 189761847f8eSopenharmony_ci /** 189861847f8eSopenharmony_ci * Sets the default delay allowed for database synchronization 189961847f8eSopenharmony_ci * 190061847f8eSopenharmony_ci * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. 190161847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, 190261847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. 190361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 190461847f8eSopenharmony_ci * @since 8 190561847f8eSopenharmony_ci * @deprecated since 9 190661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncParam 190761847f8eSopenharmony_ci */ 190861847f8eSopenharmony_ci setSyncParam(defaultAllowedDelayMs: number): Promise<void>; 190961847f8eSopenharmony_ci 191061847f8eSopenharmony_ci /** 191161847f8eSopenharmony_ci * Get the security level of the database. 191261847f8eSopenharmony_ci * 191361847f8eSopenharmony_ci * @returns SecurityLevel {@code SecurityLevel} the security level of the database. 191461847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, 191561847f8eSopenharmony_ci * {@code IPC_ERROR}, and {@code DB_ERROR}. 191661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 191761847f8eSopenharmony_ci * @since 8 191861847f8eSopenharmony_ci * @deprecated since 9 191961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getSecurityLevel 192061847f8eSopenharmony_ci */ 192161847f8eSopenharmony_ci getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void; 192261847f8eSopenharmony_ci 192361847f8eSopenharmony_ci /** 192461847f8eSopenharmony_ci * Get the security level of the database. 192561847f8eSopenharmony_ci * 192661847f8eSopenharmony_ci * @returns SecurityLevel {@code SecurityLevel} the security level of the database. 192761847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, 192861847f8eSopenharmony_ci * {@code IPC_ERROR}, and {@code DB_ERROR}. 192961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 193061847f8eSopenharmony_ci * @since 8 193161847f8eSopenharmony_ci * @deprecated since 9 193261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.SingleKVStore#getSecurityLevel 193361847f8eSopenharmony_ci */ 193461847f8eSopenharmony_ci getSecurityLevel(): Promise<SecurityLevel>; 193561847f8eSopenharmony_ci } 193661847f8eSopenharmony_ci 193761847f8eSopenharmony_ci /** 193861847f8eSopenharmony_ci * Manages distributed data by device in a distributed system. 193961847f8eSopenharmony_ci * 194061847f8eSopenharmony_ci * <p>To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} 194161847f8eSopenharmony_ci * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed 194261847f8eSopenharmony_ci * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry 194361847f8eSopenharmony_ci * into the database, the system automatically adds the ID of the device running the application to the key. 194461847f8eSopenharmony_ci * 194561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 194661847f8eSopenharmony_ci * @since 8 194761847f8eSopenharmony_ci * @deprecated since 9 194861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore 194961847f8eSopenharmony_ci */ 195061847f8eSopenharmony_ci interface DeviceKVStore extends KVStore { 195161847f8eSopenharmony_ci /** 195261847f8eSopenharmony_ci * Obtains the {@code String} value matching a specified device ID and key. 195361847f8eSopenharmony_ci * 195461847f8eSopenharmony_ci * @param deviceId Indicates the device to be queried. 195561847f8eSopenharmony_ci * @param key Indicates the key of the value to be queried. 195661847f8eSopenharmony_ci * @returns Returns the value matching the given criteria. 195761847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 195861847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. 195961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 196061847f8eSopenharmony_ci * @since 8 196161847f8eSopenharmony_ci * @deprecated since 9 196261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#get 196361847f8eSopenharmony_ci */ 196461847f8eSopenharmony_ci get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void; 196561847f8eSopenharmony_ci 196661847f8eSopenharmony_ci /** 196761847f8eSopenharmony_ci * Obtains the {@code String} value matching a specified device ID and key. 196861847f8eSopenharmony_ci * 196961847f8eSopenharmony_ci * @param deviceId Indicates the device to be queried. 197061847f8eSopenharmony_ci * @param key Indicates the key of the value to be queried. 197161847f8eSopenharmony_ci * @returns Returns the value matching the given criteria. 197261847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 197361847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. 197461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 197561847f8eSopenharmony_ci * @since 8 197661847f8eSopenharmony_ci * @deprecated since 9 197761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#get 197861847f8eSopenharmony_ci */ 197961847f8eSopenharmony_ci get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array>; 198061847f8eSopenharmony_ci 198161847f8eSopenharmony_ci /** 198261847f8eSopenharmony_ci * Obtains all key-value pairs matching a specified device ID and key prefix. 198361847f8eSopenharmony_ci * 198461847f8eSopenharmony_ci * @param deviceId Identifies the device whose data is to be queried. 198561847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 198661847f8eSopenharmony_ci * @returns Returns the list of all key-value pairs meeting the given criteria. 198761847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 198861847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 198961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 199061847f8eSopenharmony_ci * @since 8 199161847f8eSopenharmony_ci * @deprecated since 9 199261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries 199361847f8eSopenharmony_ci */ 199461847f8eSopenharmony_ci getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void; 199561847f8eSopenharmony_ci 199661847f8eSopenharmony_ci /** 199761847f8eSopenharmony_ci * Obtains all key-value pairs matching a specified device ID and key prefix. 199861847f8eSopenharmony_ci * 199961847f8eSopenharmony_ci * @param deviceId Identifies the device whose data is to be queried. 200061847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 200161847f8eSopenharmony_ci * @returns Returns the list of all key-value pairs meeting the given criteria. 200261847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 200361847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 200461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 200561847f8eSopenharmony_ci * @since 8 200661847f8eSopenharmony_ci * @deprecated since 9 200761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries 200861847f8eSopenharmony_ci */ 200961847f8eSopenharmony_ci getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>; 201061847f8eSopenharmony_ci 201161847f8eSopenharmony_ci /** 201261847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the specified {@code Query} object. 201361847f8eSopenharmony_ci * 201461847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 201561847f8eSopenharmony_ci * @returns Returns the list of key-value pairs matching the specified {@code Query} object. 201661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 201761847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 201861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 201961847f8eSopenharmony_ci * @since 8 202061847f8eSopenharmony_ci * @deprecated since 9 202161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries 202261847f8eSopenharmony_ci */ 202361847f8eSopenharmony_ci getEntries(query: Query, callback: AsyncCallback<Entry[]>): void; 202461847f8eSopenharmony_ci 202561847f8eSopenharmony_ci /** 202661847f8eSopenharmony_ci * Obtains the list of key-value pairs matching the specified {@code Query} object. 202761847f8eSopenharmony_ci * 202861847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 202961847f8eSopenharmony_ci * @returns Returns the list of key-value pairs matching the specified {@code Query} object. 203061847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 203161847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 203261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 203361847f8eSopenharmony_ci * @since 8 203461847f8eSopenharmony_ci * @deprecated since 9 203561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries 203661847f8eSopenharmony_ci */ 203761847f8eSopenharmony_ci getEntries(query: Query): Promise<Entry[]>; 203861847f8eSopenharmony_ci 203961847f8eSopenharmony_ci /** 204061847f8eSopenharmony_ci * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. 204161847f8eSopenharmony_ci * 204261847f8eSopenharmony_ci * @param deviceId Indicates the ID of the device to which the key-value pairs belong. 204361847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 204461847f8eSopenharmony_ci * @returns Returns the list of key-value pairs matching the specified {@code Query} object. 204561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 204661847f8eSopenharmony_ci * @since 8 204761847f8eSopenharmony_ci * @deprecated since 9 204861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries 204961847f8eSopenharmony_ci */ 205061847f8eSopenharmony_ci getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void; 205161847f8eSopenharmony_ci 205261847f8eSopenharmony_ci /** 205361847f8eSopenharmony_ci * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. 205461847f8eSopenharmony_ci * 205561847f8eSopenharmony_ci * @param deviceId Indicates the ID of the device to which the key-value pairs belong. 205661847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 205761847f8eSopenharmony_ci * @returns Returns the list of key-value pairs matching the specified {@code Query} object. 205861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 205961847f8eSopenharmony_ci * @since 8 206061847f8eSopenharmony_ci * @deprecated since 9 206161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries 206261847f8eSopenharmony_ci */ 206361847f8eSopenharmony_ci getEntries(deviceId: string, query: Query): Promise<Entry[]>; 206461847f8eSopenharmony_ci 206561847f8eSopenharmony_ci /** 206661847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. 206761847f8eSopenharmony_ci * 206861847f8eSopenharmony_ci * <p>The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} 206961847f8eSopenharmony_ci * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, 207061847f8eSopenharmony_ci * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary 207161847f8eSopenharmony_ci * {@code KvStoreResultSet} objects in a timely manner. 207261847f8eSopenharmony_ci * 207361847f8eSopenharmony_ci * @param deviceId Identifies the device whose data is to be queried. 207461847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 207561847f8eSopenharmony_ci * @returns Returns the {@code KvStoreResultSet} objects. 207661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 207761847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 207861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 207961847f8eSopenharmony_ci * @since 8 208061847f8eSopenharmony_ci * @deprecated since 9 208161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet 208261847f8eSopenharmony_ci */ 208361847f8eSopenharmony_ci getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void; 208461847f8eSopenharmony_ci 208561847f8eSopenharmony_ci /** 208661847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. 208761847f8eSopenharmony_ci * 208861847f8eSopenharmony_ci * <p>The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} 208961847f8eSopenharmony_ci * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, 209061847f8eSopenharmony_ci * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary 209161847f8eSopenharmony_ci * {@code KvStoreResultSet} objects in a timely manner. 209261847f8eSopenharmony_ci * 209361847f8eSopenharmony_ci * @param deviceId Identifies the device whose data is to be queried. 209461847f8eSopenharmony_ci * @param keyPrefix Indicates the key prefix to match. 209561847f8eSopenharmony_ci * @returns Returns the {@code KvStoreResultSet} objects. 209661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 209761847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 209861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 209961847f8eSopenharmony_ci * @since 8 210061847f8eSopenharmony_ci * @deprecated since 9 210161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet 210261847f8eSopenharmony_ci */ 210361847f8eSopenharmony_ci getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet>; 210461847f8eSopenharmony_ci 210561847f8eSopenharmony_ci /** 210661847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. 210761847f8eSopenharmony_ci * 210861847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 210961847f8eSopenharmony_ci * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. 211061847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 211161847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 211261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 211361847f8eSopenharmony_ci * @since 8 211461847f8eSopenharmony_ci * @deprecated since 9 211561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet 211661847f8eSopenharmony_ci */ 211761847f8eSopenharmony_ci getResultSet(query: Query, callback: AsyncCallback<KvStoreResultSet>): void; 211861847f8eSopenharmony_ci 211961847f8eSopenharmony_ci /** 212061847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. 212161847f8eSopenharmony_ci * 212261847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 212361847f8eSopenharmony_ci * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. 212461847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 212561847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 212661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 212761847f8eSopenharmony_ci * @since 8 212861847f8eSopenharmony_ci * @deprecated since 9 212961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet 213061847f8eSopenharmony_ci */ 213161847f8eSopenharmony_ci getResultSet(query: Query): Promise<KvStoreResultSet>; 213261847f8eSopenharmony_ci 213361847f8eSopenharmony_ci /** 213461847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. 213561847f8eSopenharmony_ci * 213661847f8eSopenharmony_ci * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. 213761847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 213861847f8eSopenharmony_ci * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. 213961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 214061847f8eSopenharmony_ci * @since 8 214161847f8eSopenharmony_ci * @deprecated since 9 214261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet 214361847f8eSopenharmony_ci */ 214461847f8eSopenharmony_ci getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreResultSet>): void; 214561847f8eSopenharmony_ci 214661847f8eSopenharmony_ci /** 214761847f8eSopenharmony_ci * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. 214861847f8eSopenharmony_ci * 214961847f8eSopenharmony_ci * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. 215061847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 215161847f8eSopenharmony_ci * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. 215261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 215361847f8eSopenharmony_ci * @since 8 215461847f8eSopenharmony_ci * @deprecated since 9 215561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet 215661847f8eSopenharmony_ci */ 215761847f8eSopenharmony_ci getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet>; 215861847f8eSopenharmony_ci 215961847f8eSopenharmony_ci /** 216061847f8eSopenharmony_ci * Closes a {@code KvStoreResultSet} object returned by getResultSet. 216161847f8eSopenharmony_ci * 216261847f8eSopenharmony_ci * @param resultSet Indicates the {@code KvStoreResultSet} object to close. 216361847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 216461847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 216561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 216661847f8eSopenharmony_ci * @since 8 216761847f8eSopenharmony_ci * @deprecated since 9 216861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#closeResultSet 216961847f8eSopenharmony_ci */ 217061847f8eSopenharmony_ci closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback<void>): void; 217161847f8eSopenharmony_ci 217261847f8eSopenharmony_ci /** 217361847f8eSopenharmony_ci * Closes a {@code KvStoreResultSet} object returned by getResultSet. 217461847f8eSopenharmony_ci * 217561847f8eSopenharmony_ci * @param resultSet Indicates the {@code KvStoreResultSet} object to close. 217661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 217761847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 217861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 217961847f8eSopenharmony_ci * @since 8 218061847f8eSopenharmony_ci * @deprecated since 9 218161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#closeResultSet 218261847f8eSopenharmony_ci */ 218361847f8eSopenharmony_ci closeResultSet(resultSet: KvStoreResultSet): Promise<void>; 218461847f8eSopenharmony_ci 218561847f8eSopenharmony_ci /** 218661847f8eSopenharmony_ci * Obtains the number of results matching the specified {@code Query} object. 218761847f8eSopenharmony_ci * 218861847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 218961847f8eSopenharmony_ci * @returns Returns the number of results matching the specified {@code Query} object. 219061847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 219161847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 219261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 219361847f8eSopenharmony_ci * @since 8 219461847f8eSopenharmony_ci * @deprecated since 9 219561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize 219661847f8eSopenharmony_ci */ 219761847f8eSopenharmony_ci getResultSize(query: Query, callback: AsyncCallback<number>): void; 219861847f8eSopenharmony_ci 219961847f8eSopenharmony_ci /** 220061847f8eSopenharmony_ci * Obtains the number of results matching the specified {@code Query} object. 220161847f8eSopenharmony_ci * 220261847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 220361847f8eSopenharmony_ci * @returns Returns the number of results matching the specified {@code Query} object. 220461847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 220561847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 220661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 220761847f8eSopenharmony_ci * @since 8 220861847f8eSopenharmony_ci * @deprecated since 9 220961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize 221061847f8eSopenharmony_ci */ 221161847f8eSopenharmony_ci getResultSize(query: Query): Promise<number>; 221261847f8eSopenharmony_ci 221361847f8eSopenharmony_ci /** 221461847f8eSopenharmony_ci * Obtains the number of results matching a specified device ID and {@code Query} object. 221561847f8eSopenharmony_ci * 221661847f8eSopenharmony_ci * @param deviceId Indicates the ID of the device to which the results belong. 221761847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 221861847f8eSopenharmony_ci * @returns Returns the number of results matching the specified {@code Query} object. 221961847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 222061847f8eSopenharmony_ci * @since 8 222161847f8eSopenharmony_ci * @deprecated since 9 222261847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize 222361847f8eSopenharmony_ci */ 222461847f8eSopenharmony_ci getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void; 222561847f8eSopenharmony_ci 222661847f8eSopenharmony_ci /** 222761847f8eSopenharmony_ci * Obtains the number of results matching a specified device ID and {@code Query} object. 222861847f8eSopenharmony_ci * 222961847f8eSopenharmony_ci * @param deviceId Indicates the ID of the device to which the results belong. 223061847f8eSopenharmony_ci * @param query Indicates the {@code Query} object. 223161847f8eSopenharmony_ci * @returns Returns the number of results matching the specified {@code Query} object. 223261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 223361847f8eSopenharmony_ci * @since 8 223461847f8eSopenharmony_ci * @deprecated since 9 223561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize 223661847f8eSopenharmony_ci */ 223761847f8eSopenharmony_ci getResultSize(deviceId: string, query: Query): Promise<number>; 223861847f8eSopenharmony_ci 223961847f8eSopenharmony_ci /** 224061847f8eSopenharmony_ci * Removes data of a specified device from the current database. This method is used to remove only the data 224161847f8eSopenharmony_ci * synchronized from remote devices. This operation does not synchronize data to other databases or affect 224261847f8eSopenharmony_ci * subsequent data synchronization. 224361847f8eSopenharmony_ci * 224461847f8eSopenharmony_ci * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. 224561847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 224661847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 224761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 224861847f8eSopenharmony_ci * @since 8 224961847f8eSopenharmony_ci * @deprecated since 9 225061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#removeDeviceData 225161847f8eSopenharmony_ci */ 225261847f8eSopenharmony_ci removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void; 225361847f8eSopenharmony_ci 225461847f8eSopenharmony_ci /** 225561847f8eSopenharmony_ci * Removes data of a specified device from the current database. This method is used to remove only the data 225661847f8eSopenharmony_ci * synchronized from remote devices. This operation does not synchronize data to other databases or affect 225761847f8eSopenharmony_ci * subsequent data synchronization. 225861847f8eSopenharmony_ci * 225961847f8eSopenharmony_ci * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. 226061847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, 226161847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. 226261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 226361847f8eSopenharmony_ci * @since 8 226461847f8eSopenharmony_ci * @deprecated since 9 226561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#removeDeviceData 226661847f8eSopenharmony_ci */ 226761847f8eSopenharmony_ci removeDeviceData(deviceId: string): Promise<void>; 226861847f8eSopenharmony_ci 226961847f8eSopenharmony_ci /** 227061847f8eSopenharmony_ci * Synchronize the {@code DeviceKVStore} databases. 227161847f8eSopenharmony_ci * 227261847f8eSopenharmony_ci * <p>This method returns immediately and sync result will be returned through asynchronous callback. 227361847f8eSopenharmony_ci * 227461847f8eSopenharmony_ci * @permission ohos.permission.DISTRIBUTED_DATASYNC 227561847f8eSopenharmony_ci * @param deviceIds Indicates the list of IDs of devices whose 227661847f8eSopenharmony_ci * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. 227761847f8eSopenharmony_ci * {@code DeviceKVStore} databases are to be synchronized. 227861847f8eSopenharmony_ci * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or 227961847f8eSopenharmony_ci * {@code PUSH_PULL}. 228061847f8eSopenharmony_ci * @throws Throws this exception if no DeviceKVStore database is available. 228161847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 228261847f8eSopenharmony_ci * @since 8 228361847f8eSopenharmony_ci * @deprecated since 9 228461847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#sync 228561847f8eSopenharmony_ci */ 228661847f8eSopenharmony_ci sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; 228761847f8eSopenharmony_ci 228861847f8eSopenharmony_ci /** 228961847f8eSopenharmony_ci * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the 229061847f8eSopenharmony_ci * callback in the {@code KvStoreObserver} will be invoked. 229161847f8eSopenharmony_ci * 229261847f8eSopenharmony_ci * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. 229361847f8eSopenharmony_ci * @param listener Indicates the observer of data change events in the distributed database. 229461847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 229561847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, 229661847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 229761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 229861847f8eSopenharmony_ci * @since 8 229961847f8eSopenharmony_ci * @deprecated since 9 230061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on 230161847f8eSopenharmony_ci */ 230261847f8eSopenharmony_ci on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void; 230361847f8eSopenharmony_ci 230461847f8eSopenharmony_ci 230561847f8eSopenharmony_ci /** 230661847f8eSopenharmony_ci * Register a DeviceKVStore database synchronization callback. 230761847f8eSopenharmony_ci * 230861847f8eSopenharmony_ci * <p>Sync result is returned through asynchronous callback. 230961847f8eSopenharmony_ci * 231061847f8eSopenharmony_ci * @param syncCallback Indicates the callback used to send the synchronization result to the caller. 231161847f8eSopenharmony_ci * @throws Throws this exception if no DeviceKVStore database is available. 231261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 231361847f8eSopenharmony_ci * @since 8 231461847f8eSopenharmony_ci * @deprecated since 9 231561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on 231661847f8eSopenharmony_ci */ 231761847f8eSopenharmony_ci on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void; 231861847f8eSopenharmony_ci 231961847f8eSopenharmony_ci /** 232061847f8eSopenharmony_ci * Unsubscribe the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. 232161847f8eSopenharmony_ci * 232261847f8eSopenharmony_ci * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. 232361847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 232461847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, 232561847f8eSopenharmony_ci * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. 232661847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 232761847f8eSopenharmony_ci * @since 8 232861847f8eSopenharmony_ci * @deprecated since 9 232961847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off 233061847f8eSopenharmony_ci */ 233161847f8eSopenharmony_ci off(event: 'dataChange', listener?: Callback<ChangeNotification>): void; 233261847f8eSopenharmony_ci 233361847f8eSopenharmony_ci /** 233461847f8eSopenharmony_ci * UnRegister the DeviceKVStore database synchronization callback. 233561847f8eSopenharmony_ci * 233661847f8eSopenharmony_ci * @throws Throws this exception if no DeviceKVStore database is available. 233761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 233861847f8eSopenharmony_ci * @since 8 233961847f8eSopenharmony_ci * @deprecated since 9 234061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off 234161847f8eSopenharmony_ci */ 234261847f8eSopenharmony_ci off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>>): void; 234361847f8eSopenharmony_ci } 234461847f8eSopenharmony_ci 234561847f8eSopenharmony_ci /** 234661847f8eSopenharmony_ci * Creates a {@link KVManager} instance based on the configuration information. 234761847f8eSopenharmony_ci * 234861847f8eSopenharmony_ci * <p>You must pass {@link KVManagerConfig} to provide configuration information 234961847f8eSopenharmony_ci * for creating the {@link KVManager} instance. 235061847f8eSopenharmony_ci * 235161847f8eSopenharmony_ci * @param config Indicates the {@link KVStore} configuration information, 235261847f8eSopenharmony_ci * including the user information and package name. 235361847f8eSopenharmony_ci * @returns Returns the {@code KVManager} instance. 235461847f8eSopenharmony_ci * @throws Throws exception if input is invalid. 235561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 235661847f8eSopenharmony_ci * @since 7 235761847f8eSopenharmony_ci * @deprecated since 9 235861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore#createKVManager 235961847f8eSopenharmony_ci */ 236061847f8eSopenharmony_ci function createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void; 236161847f8eSopenharmony_ci 236261847f8eSopenharmony_ci /** 236361847f8eSopenharmony_ci * Creates a {@link KVManager} instance based on the configuration information. 236461847f8eSopenharmony_ci * 236561847f8eSopenharmony_ci * <p>You must pass {@link KVManagerConfig} to provide configuration information 236661847f8eSopenharmony_ci * for creating the {@link KVManager} instance. 236761847f8eSopenharmony_ci * 236861847f8eSopenharmony_ci * @param config Indicates the {@link KVStore} configuration information, 236961847f8eSopenharmony_ci * including the user information and package name. 237061847f8eSopenharmony_ci * @returns Returns the {@code KVManager} instance. 237161847f8eSopenharmony_ci * @throws Throws exception if input is invalid. 237261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 237361847f8eSopenharmony_ci * @since 7 237461847f8eSopenharmony_ci * @deprecated since 9 237561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore#createKVManager 237661847f8eSopenharmony_ci */ 237761847f8eSopenharmony_ci function createKVManager(config: KVManagerConfig): Promise<KVManager>; 237861847f8eSopenharmony_ci 237961847f8eSopenharmony_ci /** 238061847f8eSopenharmony_ci * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. 238161847f8eSopenharmony_ci * 238261847f8eSopenharmony_ci * @version 1 238361847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 238461847f8eSopenharmony_ci * @since 7 238561847f8eSopenharmony_ci * @deprecated since 9 238661847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager 238761847f8eSopenharmony_ci */ 238861847f8eSopenharmony_ci interface KVManager { 238961847f8eSopenharmony_ci /** 239061847f8eSopenharmony_ci * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. 239161847f8eSopenharmony_ci * 239261847f8eSopenharmony_ci * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, 239361847f8eSopenharmony_ci * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. 239461847f8eSopenharmony_ci * @param storeId Identifies the {@code KVStore} database. 239561847f8eSopenharmony_ci * The value of this parameter must be unique for the same application, 239661847f8eSopenharmony_ci * and different applications can share the same value. 239761847f8eSopenharmony_ci * @returns Returns a {@code KVStore}, or {@code SingleKVStore}. 239861847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 239961847f8eSopenharmony_ci * @since 7 240061847f8eSopenharmony_ci * @deprecated since 9 240161847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#getKVStore 240261847f8eSopenharmony_ci */ 240361847f8eSopenharmony_ci getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T>; 240461847f8eSopenharmony_ci 240561847f8eSopenharmony_ci /** 240661847f8eSopenharmony_ci * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. 240761847f8eSopenharmony_ci * 240861847f8eSopenharmony_ci * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, 240961847f8eSopenharmony_ci * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. 241061847f8eSopenharmony_ci * @param storeId Identifies the {@code KVStore} database. 241161847f8eSopenharmony_ci * The value of this parameter must be unique for the same application, 241261847f8eSopenharmony_ci * and different applications can share the same value. 241361847f8eSopenharmony_ci * @returns Returns a {@code KVStore}, or {@code SingleKVStore}. 241461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 241561847f8eSopenharmony_ci * @since 7 241661847f8eSopenharmony_ci * @deprecated since 9 241761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#getKVStore 241861847f8eSopenharmony_ci */ 241961847f8eSopenharmony_ci getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void; 242061847f8eSopenharmony_ci 242161847f8eSopenharmony_ci /** 242261847f8eSopenharmony_ci * Closes the {@code KvStore} database. 242361847f8eSopenharmony_ci * 242461847f8eSopenharmony_ci * <p>Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your 242561847f8eSopenharmony_ci * thread may crash. 242661847f8eSopenharmony_ci * 242761847f8eSopenharmony_ci * <p>The {@code KvStore} database to close must be an object created by using the {@code getKvStore} method. Before using this 242861847f8eSopenharmony_ci * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStore}, 242961847f8eSopenharmony_ci * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error 243061847f8eSopenharmony_ci * will be returned. 243161847f8eSopenharmony_ci * 243261847f8eSopenharmony_ci * @param kvStore Indicates the {@code KvStore} database to close. 243361847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 243461847f8eSopenharmony_ci * occurs:{@code INVALID_ARGUMENT}, {@code SERVER_UNAVAILABLE}, 243561847f8eSopenharmony_ci * {@code STORE_NOT_OPEN}, {@code STORE_NOT_FOUND}, {@code DB_ERROR}, 243661847f8eSopenharmony_ci * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. 243761847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 243861847f8eSopenharmony_ci * @since 8 243961847f8eSopenharmony_ci * @deprecated since 9 244061847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#closeKVStore 244161847f8eSopenharmony_ci */ 244261847f8eSopenharmony_ci closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback<void>): void; 244361847f8eSopenharmony_ci 244461847f8eSopenharmony_ci /** 244561847f8eSopenharmony_ci * Closes the {@code KvStore} database. 244661847f8eSopenharmony_ci * 244761847f8eSopenharmony_ci * <p>Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your 244861847f8eSopenharmony_ci * thread may crash. 244961847f8eSopenharmony_ci * 245061847f8eSopenharmony_ci * <p>The {@code KvStore} database to close must be an object created by using the {@code getKvStore} method. Before using this 245161847f8eSopenharmony_ci * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStore}, 245261847f8eSopenharmony_ci * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error 245361847f8eSopenharmony_ci * will be returned. 245461847f8eSopenharmony_ci * 245561847f8eSopenharmony_ci * @param kvStore Indicates the {@code KvStore} database to close. 245661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 245761847f8eSopenharmony_ci * occurs:{@code INVALID_ARGUMENT}, {@code SERVER_UNAVAILABLE}, 245861847f8eSopenharmony_ci * {@code STORE_NOT_OPEN}, {@code STORE_NOT_FOUND}, {@code DB_ERROR}, 245961847f8eSopenharmony_ci * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. 246061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 246161847f8eSopenharmony_ci * @since 8 246261847f8eSopenharmony_ci * @deprecated since 9 246361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#closeKVStore 246461847f8eSopenharmony_ci */ 246561847f8eSopenharmony_ci closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise<void>; 246661847f8eSopenharmony_ci 246761847f8eSopenharmony_ci /** 246861847f8eSopenharmony_ci * Deletes the {@code KvStore} database identified by storeId. 246961847f8eSopenharmony_ci * 247061847f8eSopenharmony_ci * <p>Before using this method, close all {@code KvStore} instances in use that are identified by the same storeId. 247161847f8eSopenharmony_ci * 247261847f8eSopenharmony_ci * <p>You can use this method to delete a {@code KvStore} database not in use. After the database is deleted, all its data will be 247361847f8eSopenharmony_ci * lost. 247461847f8eSopenharmony_ci * 247561847f8eSopenharmony_ci * @param storeId Identifies the {@code KvStore} database to delete. 247661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 247761847f8eSopenharmony_ci * occurs: {@code INVALID_ARGUMENT}, 247861847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code STORE_NOT_FOUND}, 247961847f8eSopenharmony_ci * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. 248061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 248161847f8eSopenharmony_ci * @since 8 248261847f8eSopenharmony_ci * @deprecated since 9 248361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#deleteKVStore 248461847f8eSopenharmony_ci */ 248561847f8eSopenharmony_ci deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void; 248661847f8eSopenharmony_ci 248761847f8eSopenharmony_ci /** 248861847f8eSopenharmony_ci * Deletes the {@code KvStore} database identified by storeId. 248961847f8eSopenharmony_ci * 249061847f8eSopenharmony_ci * <p>Before using this method, close all {@code KvStore} instances in use that are identified by the same storeId. 249161847f8eSopenharmony_ci * 249261847f8eSopenharmony_ci * <p>You can use this method to delete a {@code KvStore} database not in use. After the database is deleted, all its data will be 249361847f8eSopenharmony_ci * lost. 249461847f8eSopenharmony_ci * 249561847f8eSopenharmony_ci * @param storeId Identifies the {@code KvStore} database to delete. 249661847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 249761847f8eSopenharmony_ci * occurs: {@code INVALID_ARGUMENT}, 249861847f8eSopenharmony_ci * {@code SERVER_UNAVAILABLE}, {@code STORE_NOT_FOUND}, 249961847f8eSopenharmony_ci * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. 250061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 250161847f8eSopenharmony_ci * @since 8 250261847f8eSopenharmony_ci * @deprecated since 9 250361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#deleteKVStore 250461847f8eSopenharmony_ci */ 250561847f8eSopenharmony_ci deleteKVStore(appId: string, storeId: string): Promise<void>; 250661847f8eSopenharmony_ci 250761847f8eSopenharmony_ci /** 250861847f8eSopenharmony_ci * Obtains the storeId of all {@code KvStore} databases that are created by using the {@code getKvStore} method and not deleted by 250961847f8eSopenharmony_ci * calling the {@code deleteKvStore} method. 251061847f8eSopenharmony_ci * 251161847f8eSopenharmony_ci * @returns Returns the storeId of all created {@code KvStore} databases. 251261847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 251361847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code DB_ERROR}, 251461847f8eSopenharmony_ci * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. 251561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 251661847f8eSopenharmony_ci * @since 8 251761847f8eSopenharmony_ci * @deprecated since 9 251861847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#getAllKVStoreId 251961847f8eSopenharmony_ci */ 252061847f8eSopenharmony_ci getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void; 252161847f8eSopenharmony_ci 252261847f8eSopenharmony_ci /** 252361847f8eSopenharmony_ci * Obtains the storeId of all {@code KvStore} databases that are created by using the {@code getKvStore} method and not deleted by 252461847f8eSopenharmony_ci * calling the {@code deleteKvStore} method. 252561847f8eSopenharmony_ci * 252661847f8eSopenharmony_ci * @returns Returns the storeId of all created {@code KvStore} databases. 252761847f8eSopenharmony_ci * @throws Throws this exception if any of the following errors 252861847f8eSopenharmony_ci * occurs: {@code SERVER_UNAVAILABLE}, {@code DB_ERROR}, 252961847f8eSopenharmony_ci * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. 253061847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.Core 253161847f8eSopenharmony_ci * @since 8 253261847f8eSopenharmony_ci * @deprecated since 9 253361847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#getAllKVStoreId 253461847f8eSopenharmony_ci */ 253561847f8eSopenharmony_ci getAllKVStoreId(appId: string): Promise<string[]>; 253661847f8eSopenharmony_ci 253761847f8eSopenharmony_ci /** 253861847f8eSopenharmony_ci * register DeviceChangeCallback to get notification when device's status changed 253961847f8eSopenharmony_ci * 254061847f8eSopenharmony_ci * @param deathCallback device change callback {@code DeviceChangeCallback} 254161847f8eSopenharmony_ci * @throws exception maybe occurs. 254261847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 254361847f8eSopenharmony_ci * @since 8 254461847f8eSopenharmony_ci * @deprecated since 9 254561847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#on 254661847f8eSopenharmony_ci */ 254761847f8eSopenharmony_ci on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void; 254861847f8eSopenharmony_ci 254961847f8eSopenharmony_ci /** 255061847f8eSopenharmony_ci * unRegister DeviceChangeCallback and can not receive notification 255161847f8eSopenharmony_ci * 255261847f8eSopenharmony_ci * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. 255361847f8eSopenharmony_ci * @throws exception maybe occurs. 255461847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 255561847f8eSopenharmony_ci * @since 8 255661847f8eSopenharmony_ci * @deprecated since 9 255761847f8eSopenharmony_ci * @useinstead ohos.data.distributedKVStore.KVManager#off 255861847f8eSopenharmony_ci */ 255961847f8eSopenharmony_ci off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void; 256061847f8eSopenharmony_ci } 256161847f8eSopenharmony_ci} 256261847f8eSopenharmony_ci 256361847f8eSopenharmony_ci/** 256461847f8eSopenharmony_ci * Providers interfaces to creat a {@link KVManager} instance. 256561847f8eSopenharmony_ci * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore 256661847f8eSopenharmony_ci * @since 7 256761847f8eSopenharmony_ci * @deprecated since 9 256861847f8eSopenharmony_ci */ 256961847f8eSopenharmony_ciexport default distributedData;