2022-10-13 13:56:33 +00:00
|
|
|
|
/*
|
2022-10-14 05:47:38 +00:00
|
|
|
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-12-11 09:08:03 +00:00
|
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @kit ArkData
|
|
|
|
|
*/
|
|
|
|
|
|
2023-04-04 02:17:06 +00:00
|
|
|
|
import { AsyncCallback, Callback } from './@ohos.base';
|
2023-04-03 07:19:53 +00:00
|
|
|
|
import { ValuesBucket } from './@ohos.data.ValuesBucket';
|
2022-10-13 13:56:33 +00:00
|
|
|
|
import dataSharePredicates from './@ohos.data.dataSharePredicates';
|
2023-03-14 07:33:34 +00:00
|
|
|
|
import BaseContext from './application/BaseContext';
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2022-11-17 07:10:55 +00:00
|
|
|
|
* Provider interfaces to create a {@link KVManager} instance.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
*
|
|
|
|
|
* @namespace distributedKVStore
|
2022-10-13 13:56:33 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2022-10-14 05:47:38 +00:00
|
|
|
|
declare namespace distributedKVStore {
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Provides configuration information to create a {@link KVManager} instance,
|
|
|
|
|
* which includes the caller's package name and ability or hap context.
|
|
|
|
|
*
|
|
|
|
|
* @interface KVManagerConfig
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface KVManagerConfig {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the bundleName
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
bundleName: string;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the ability or hap context
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* if swap the area, you should close all the KV store and use the new Context to create the KVManager
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the ability or hap context
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* if swap the area, you should close all the KV store and use the new BaseContext to create the KVManager
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-21 09:47:24 +00:00
|
|
|
|
context: BaseContext;
|
2023-04-03 07:19:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* KVStore constants
|
|
|
|
|
*
|
|
|
|
|
* @interface Constants
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface Constants {
|
|
|
|
|
/**
|
|
|
|
|
* Max key length is 1024.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
readonly MAX_KEY_LENGTH: number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Max value length is 4194303.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
readonly MAX_VALUE_LENGTH: number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Max device coordinate key length is 896.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
readonly MAX_KEY_LENGTH_DEVICE: number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Max store id length is 128.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
readonly MAX_STORE_ID_LENGTH: number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Max query length is 512000.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
readonly MAX_QUERY_LENGTH: number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Max batch operation size is 128.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
readonly MAX_BATCH_SIZE: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the {@code ValueType}.
|
|
|
|
|
* <p>{@code ValueType} is obtained based on the value.
|
|
|
|
|
*
|
|
|
|
|
* @enum { number }
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
enum ValueType {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the value type is string.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
STRING,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the value type is int.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
INTEGER,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the value type is float.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
FLOAT,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the value type is byte array.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
BYTE_ARRAY,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the value type is boolean.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
BOOLEAN,
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that the value type is double.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
DOUBLE
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains {@code Value} objects stored in a {@link SingleKVStore} or {@link DeviceKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @interface Value
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface Value {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the value type
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
* @see ValueType
|
|
|
|
|
*/
|
|
|
|
|
type: ValueType;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the value
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
value: Uint8Array | string | number | boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides key-value pairs stored in the distributedKVStore.
|
|
|
|
|
*
|
|
|
|
|
* @interface Entry
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface Entry {
|
2022-10-13 13:56:33 +00:00
|
|
|
|
/**
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* Indicates the key
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
key: string;
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Indicates the value
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
value: Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Receive notifications of all data changes, including data insertion, update, and deletion.
|
|
|
|
|
* <p>If you have subscribed to {@code SingleKVStore} or {@code DeviceKVStore}, you will receive
|
|
|
|
|
* data change notifications and obtain the changed data from the parameters in callback methods
|
|
|
|
|
* upon data insertion, update or deletion.
|
|
|
|
|
*
|
|
|
|
|
* @interface ChangeNotification
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface ChangeNotification {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates data insertion records.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
insertEntries: Entry[];
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Indicates data update records.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
updateEntries: Entry[];
|
2022-11-17 13:47:16 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Indicates data deletion records.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
deleteEntries: Entry[];
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* Indicates the device id which brings the data change.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
deviceId: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the database synchronization mode.
|
|
|
|
|
*
|
|
|
|
|
* @enum { number }
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
enum SyncMode {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates that data is only pulled from the remote end.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
PULL_ONLY,
|
2022-11-17 13:47:16 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Indicates that data is only pushed from the local end.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
PUSH_ONLY,
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* Indicates that data is pushed from the local end, and then pulled from the remote end.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
PUSH_PULL
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Describes the subscription type.
|
|
|
|
|
*
|
|
|
|
|
* @enum { number }
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
enum SubscribeType {
|
|
|
|
|
/**
|
|
|
|
|
* Subscription to local data changes
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
SUBSCRIBE_TYPE_LOCAL,
|
2022-11-17 13:47:16 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Subscription to remote data changes
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
SUBSCRIBE_TYPE_REMOTE,
|
2022-11-17 13:47:16 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Subscription to both local and remote data changes
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
SUBSCRIBE_TYPE_ALL
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Describes the KVStore type.
|
|
|
|
|
*
|
|
|
|
|
* @enum { number }
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
enum KVStoreType {
|
|
|
|
|
/**
|
|
|
|
|
* Device-collaboration database, as specified by {@code DeviceKVStore}
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
DEVICE_COLLABORATION,
|
2022-11-17 13:47:16 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Single-version database, as specified by {@code SingleKVStore}
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
SINGLE_VERSION
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Describes the KVStore security level.
|
|
|
|
|
*
|
|
|
|
|
* @enum { number }
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
enum SecurityLevel {
|
|
|
|
|
/**
|
|
|
|
|
* S1: means the db is in the low security level
|
|
|
|
|
* There are some low impact when the data is leaked.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
S1,
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* S2: means the db is in the middle security level
|
|
|
|
|
* There are some major impact when the data is leaked.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
S2,
|
2022-11-17 13:47:16 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* S3: means the db is in the high security level
|
|
|
|
|
* There are some severity impact when the data is leaked.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
S3,
|
2022-11-17 13:47:16 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* S4: means the db is in the critical security level
|
|
|
|
|
* There are some critical impact when the data is leaked.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
S4
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides configuration options to create a {@code SingleKVStore} or {@code DeviceKVStore}.
|
|
|
|
|
*
|
|
|
|
|
* @interface Options
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface Options {
|
|
|
|
|
/**
|
|
|
|
|
* Indicates whether to create a database when the database file does not exist
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
createIfMissing?: boolean;
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* Indicates whether database files to be encrypted
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
encrypt?: boolean;
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Indicates whether to back up database files
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
backup?: boolean;
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
2023-04-03 07:19:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* Indicates whether database files are automatically synchronized
|
|
|
|
|
*
|
|
|
|
|
* @permission ohos.permission.DISTRIBUTED_DATASYNC
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
autoSync?: boolean;
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* Indicates the database type
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
2023-04-03 07:19:53 +00:00
|
|
|
|
*/
|
|
|
|
|
kvStoreType?: KVStoreType;
|
2022-10-13 13:56:33 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* Indicates the database security level
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
securityLevel: SecurityLevel;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the database schema
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
schema?: Schema;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Represents the database schema.
|
|
|
|
|
* You can set the schema object in options when create or open the database.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
class Schema {
|
|
|
|
|
/**
|
|
|
|
|
* A constructor used to create a Schema instance.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
constructor();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the root json object.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
root: FieldNode;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the string array of json.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
indexes: Array<string>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the mode of schema.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
mode: number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the skip size of schema.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
skip: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Represents a node of a {@link Schema} instance.
|
|
|
|
|
* <p>With a {@link Schema} instance, you can define the value fields which stored in the database.
|
|
|
|
|
* <p>A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node.
|
|
|
|
|
* <p>The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
class FieldNode {
|
|
|
|
|
/**
|
|
|
|
|
* A constructor used to create a FieldNode instance with the specified field.
|
|
|
|
|
* name Indicates the field node name.
|
|
|
|
|
*
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @param { string } name - It can not be empty.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:33:04 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
constructor(name: string);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds a child node to this {@code FieldNode}.
|
|
|
|
|
* <p>Add a child node to makes this node a non-leaf node and field value will be ignored if it has a child node.
|
|
|
|
|
*
|
|
|
|
|
* @param { FieldNode } child - The field node to append.
|
|
|
|
|
* @returns { boolean } Returns true if the child node is successfully added to this {@code FieldNode} and false otherwise.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:33:04 +00:00
|
|
|
|
* <br>2.Incorrect Parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
appendChild(child: FieldNode): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the default value of field node.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
default: string;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the nullable of database field.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
nullable: boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Indicates the type of value.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
type: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides methods to operate the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database.
|
|
|
|
|
* <p>The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or
|
|
|
|
|
* {@code DeviceKVStore} class. This interface also provides methods to move the data read
|
|
|
|
|
* position in the result set.
|
|
|
|
|
*
|
|
|
|
|
* @interface KVStoreResultSet
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface KVStoreResultSet {
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the number of lines in a result set.
|
|
|
|
|
*
|
|
|
|
|
* @returns { number } Returns the number of lines.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getCount(): number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the current read position in a result set.
|
|
|
|
|
*
|
|
|
|
|
* @returns { number } Returns the current read position. The read position starts with 0.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getPosition(): number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves the read position to the first line.
|
|
|
|
|
* <p>If the result set is empty, false is returned.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the operation succeeds; return false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
moveToFirst(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves the read position to the last line.
|
|
|
|
|
* <p>If the result set is empty, false is returned.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the operation succeeds; return false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
moveToLast(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves the read position to the next line.
|
|
|
|
|
* <p>If the result set is empty or the data in the last line is being read, false is returned.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the operation succeeds; return false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
moveToNext(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves the read position to the previous line.
|
|
|
|
|
* <p>If the result set is empty or the data in the first line is being read, false is returned.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the operation succeeds; return false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
moveToPrevious(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves the read position by a relative offset to the current position.
|
|
|
|
|
*
|
|
|
|
|
* @param { number } offset - Indicates the relative offset to the current position. A negative offset indicates moving
|
|
|
|
|
* backwards, and a positive offset indicates moving forwards. For example, if the current position is entry 1 and
|
|
|
|
|
* this offset is 2, the destination position will be entry 3; if the current position is entry 3 and this offset is -2,
|
|
|
|
|
* the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the
|
|
|
|
|
* final position is invalid, false will be returned.
|
|
|
|
|
* @returns { boolean } Returns true if the operation succeeds; return false otherwise.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:33:04 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
move(offset: number): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Moves the read position from 0 to an absolute position.
|
|
|
|
|
*
|
|
|
|
|
* @param { number } position - Indicates the absolute position.
|
|
|
|
|
* @returns { boolean } Returns true if the operation succeeds; return false otherwise.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:33:04 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
moveToPosition(position: number): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether the read position is the first line.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the read position is the first line; returns false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
isFirst(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether the read position is the last line.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the read position is the last line; returns false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
isLast(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether the read position is before the last line.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the read position is before the first line; returns false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
isBeforeFirst(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Checks whether the read position is after the last line.
|
|
|
|
|
*
|
|
|
|
|
* @returns { boolean } Returns true if the read position is after the last line; returns false otherwise.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
isAfterLast(): boolean;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains a key-value pair.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Entry } Returns a key-value pair.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntry(): Entry;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Represents a database query using predicates.
|
|
|
|
|
* <p>This class provides a constructor used to create a {@code Query} instance, which is used to query data
|
|
|
|
|
* matching specified conditions in the database.
|
|
|
|
|
* <p>This class also provides methods to add predicates to the {@code Query} instance.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
class Query {
|
|
|
|
|
/**
|
|
|
|
|
* A constructor used to create a Query instance.
|
|
|
|
|
*
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
constructor();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Resets this {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Query } Returns the reset {@code Query} object.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
reset(): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { number | string | boolean } value - Indicates the value to be compared.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
equalTo(field: string, value: number | string | boolean): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { number | string | boolean } value - Indicates the value to be compared.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
notEqualTo(field: string, value: number | string | boolean): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the
|
|
|
|
|
* specified int value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { number | string | boolean } value - Indicates the value to be compared.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
greaterThan(field: string, value: number | string | boolean): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { number | string } value - Indicates the value to be compared.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
lessThan(field: string, value: number | string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is greater than or
|
|
|
|
|
* equal to the specified int value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { number | string } value - Indicates the value to be compared.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
greaterThanOrEqualTo(field: string, value: number | string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the
|
|
|
|
|
* specified int value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { number | string } value - Indicates the value to be compared.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
lessThanOrEqualTo(field: string, value: number | string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is null.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
isNull(field: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { number[] } valueList - Indicates the int value list.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
inNumber(field: string, valueList: number[]): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { string[] } valueList - Indicates the string value list.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
inString(field: string, valueList: string[]): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { number[] } valueList - Indicates the int value list.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
notInNumber(field: string, valueList: number[]): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { string[] } valueList - Indicates the string value list.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
notInString(field: string, valueList: string[]): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { string } value - Indicates the string value.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
like(field: string, value: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { string } value - Indicates the string value.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
unlike(field: string, value: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object with the and condition.
|
|
|
|
|
* <p>Multiple predicates should be connected using the and or or condition.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
and(): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object with the or condition.
|
|
|
|
|
* <p>Multiple predicates should be connected using the and or or condition.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
or(): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to sort the query results in ascending order.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
orderByAsc(field: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to sort the query results in descending order.
|
|
|
|
|
*
|
2023-11-20 11:28:37 +00:00
|
|
|
|
* @param { string } field - Indicates the field, which cannot contain ^.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
orderByDesc(field: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs a {@code Query} object to specify the number of results and the start position.
|
|
|
|
|
*
|
|
|
|
|
* @param { number } total - Indicates the number of results.
|
|
|
|
|
* @param { number } offset - Indicates the start position.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
limit(total: number, offset: number): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a {@code Query} condition with a specified field that is not null.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } field - Indicates the specified field.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
isNotNull(field: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a query condition group with a left bracket.
|
|
|
|
|
* <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a
|
|
|
|
|
* whole to combine with other query conditions.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
beginGroup(): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a query condition group with a right bracket.
|
|
|
|
|
* <p>Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a
|
|
|
|
|
* whole to combine with other query conditions.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
endGroup(): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a query condition with a specified key prefix.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } prefix - Indicates the specified key prefix.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
prefixKey(prefix: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets a specified index that will be preferentially used for query.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } index - Indicates the index to set.
|
|
|
|
|
* @returns { Query } Returns the {@coed Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
setSuggestIndex(index: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Add device ID key prefix.Used by {@code DeviceKVStore}.
|
|
|
|
|
*
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @param { string } deviceId - Specify device id to query from, It can not be empty.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Query } Returns the {@code Query} object with device ID prefix added.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
deviceId(deviceId: string): Query;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a String that represents this {@code Query}.
|
|
|
|
|
* <p>The String would be parsed to DB query format.
|
|
|
|
|
* The String length should be no longer than 500kb.
|
|
|
|
|
*
|
|
|
|
|
* @returns { string } String representing this {@code Query}.
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getSqlLike(): string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides methods related to single-version distributed databases.
|
|
|
|
|
* <p>To create a {@code SingleKVStore} database,
|
|
|
|
|
* you can use the {@link data.distributed.common.KVManager#getKVStore(Options, String)} method
|
|
|
|
|
* with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}.
|
|
|
|
|
* This database synchronizes data to other databases in time sequence.
|
|
|
|
|
* The {@code SingleKVStore} database does not support
|
|
|
|
|
* synchronous transactions, or data search using snapshots.
|
|
|
|
|
*
|
|
|
|
|
* @interface SingleKVStore
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface SingleKVStore {
|
|
|
|
|
/**
|
|
|
|
|
* Writes a key-value pair of the string type into the {@code SingleKVStore} database.
|
|
|
|
|
* <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of put.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Writes a key-value pair of the string type into the {@code SingleKVStore} database.
|
|
|
|
|
* <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of put.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Writes a key-value pair of the string type into the {@code SingleKVStore} database.
|
|
|
|
|
* <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Writes a key-value pair of the string type into the {@code SingleKVStore} database.
|
|
|
|
|
* <p>If you do not want to synchronize this key-value pair to other devices, set the write option in the local database.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { Uint8Array | string | number | boolean } value - Indicates the value to be inserted.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
put(key: string, value: Uint8Array | string | number | boolean): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Inserts key-value pairs into the {@code SingleKVStore} database in batches.
|
|
|
|
|
*
|
|
|
|
|
* @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of putBatch.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Inserts key-value pairs into the {@code SingleKVStore} database in batches.
|
|
|
|
|
*
|
|
|
|
|
* @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of putBatch.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
putBatch(entries: Entry[], callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Inserts key-value pairs into the {@code SingleKVStore} database in batches.
|
|
|
|
|
*
|
|
|
|
|
* @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Inserts key-value pairs into the {@code SingleKVStore} database in batches.
|
|
|
|
|
*
|
|
|
|
|
* @param { Entry[] } entries - Indicates the key-value pairs to be inserted in batches.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
putBatch(entries: Entry[]): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Writes values of ValuesBucket type into the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of putBatch.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Writes values of ValuesBucket type into the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of putBatch.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
putBatch(value: Array<ValuesBucket>, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Writes values of ValuesBucket type into the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Writes values of ValuesBucket type into the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @param { Array<ValuesBucket> } value - Indicates the ValuesBucket array to be inserted.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
putBatch(value: Array<ValuesBucket>): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pair based on a specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of delete.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pair based on a specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of delete.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
delete(key: string, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pair based on a specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pair based on a specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}.
|
|
|
|
|
* Spaces before and after the key will be cleared.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
delete(key: string): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pairs based on the dataSharePredicates.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of delete.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pairs based on the dataSharePredicates.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of delete.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<void>);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pairs based on the dataSharePredicates.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Deletes the key-value pairs based on the dataSharePredicates.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
delete(predicates: dataSharePredicates.DataSharePredicates): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes key-value pairs in batches from the {@code SingleKVStore} database.
|
|
|
|
|
*
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of deleteBatch.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Deletes key-value pairs in batches from the {@code SingleKVStore} database.
|
|
|
|
|
*
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of deleteBatch.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
deleteBatch(keys: string[], callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes key-value pairs in batches from the {@code SingleKVStore} database.
|
|
|
|
|
*
|
2024-04-25 03:32:11 +00:00
|
|
|
|
* @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Deletes key-value pairs in batches from the {@code SingleKVStore} database.
|
|
|
|
|
*
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @param { string[] } keys - Indicates the key-value pairs to be deleted in batches, It can not be empty.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
deleteBatch(keys: string[]): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes data of the specified device from current database. This method is used to remove only the data
|
|
|
|
|
* synchronized from remote devices. This operation does not synchronize data to other databases or affect
|
|
|
|
|
* subsequent data synchronization.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of removeDeviceData.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Removes data of the specified device from current database. This method is used to remove only the data
|
|
|
|
|
* synchronized from remote devices. This operation does not synchronize data to other databases or affect
|
|
|
|
|
* subsequent data synchronization.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
removeDeviceData(deviceId: string): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the value of a specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* {Uint8Array|string|boolean|number}: the returned value specified by the key.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the value of a specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @returns { Promise<boolean | string | number | Uint8Array> }
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* {Uint8Array|string|boolean|number}: the returned value specified by the key.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
get(key: string): Promise<boolean | string | number | Uint8Array>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains all key-value pairs that match a specified key prefix.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
|
|
|
|
|
* that match the specified key prefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains all key-value pairs that match a specified key prefix.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
|
|
|
|
|
* specified key prefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(keyPrefix: string): Promise<Entry[]>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the list of key-value pairs matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
|
|
|
|
|
* matching the specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the list of key-value pairs matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the
|
|
|
|
|
* specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(query: Query): Promise<Entry[]>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
|
|
|
|
|
* object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
|
|
|
|
|
* four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
|
|
|
|
|
* method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
|
|
|
|
|
* object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
|
|
|
|
|
* four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
|
|
|
|
|
* method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
|
|
|
|
|
* object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
|
|
|
|
|
* four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
|
|
|
|
|
* method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet}
|
|
|
|
|
* object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created
|
|
|
|
|
* four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet
|
|
|
|
|
* method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(keyPrefix: string): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(query: Query): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Closes a {@code KVStoreResultSet} object returned by getResultSet method.
|
|
|
|
|
*
|
|
|
|
|
* @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of closeResultSet.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Closes a {@code KVStoreResultSet} object returned by getResultSet method.
|
|
|
|
|
*
|
|
|
|
|
* @param { KVStoreResultSet } resultSet - Indicates the {@code KVStoreResultSet} object to close.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
closeResultSet(resultSet: KVStoreResultSet): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the number of results matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<number> } callback - {number}: the number of results matching the
|
|
|
|
|
* specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getResultSize(query: Query, callback: AsyncCallback<number>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the number of results matching the specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<number> } {number}: the number of results matching the specified
|
|
|
|
|
* {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getResultSize(query: Query): Promise<number>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Backs up a database in the specified filename.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { string } file - Indicates the database backup filename, It can not be empty and
|
|
|
|
|
* The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of backup.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
backup(file: string, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Backs up a database in the specified filename.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { string } file - Indicates the database backup filename, It can not be empty and
|
|
|
|
|
* The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
backup(file: string): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Restores a database from a specified database file.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { string } file - Indicates the database backup filename, It can not be empty and
|
|
|
|
|
* The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of restore.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
restore(file: string, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Restores a database from a specified database file.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { string } file - Indicates the database backup filename, It can not be empty and
|
|
|
|
|
* The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
restore(file: string): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete database backup files based on the specified filenames.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and
|
|
|
|
|
* The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<Array<[string, number]>> } callback - {Array<[string, number]>}:
|
|
|
|
|
* the list of backup file and it's corresponding delete result which 0 means delete success
|
|
|
|
|
* and otherwise failed.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
deleteBackup(files: Array<string>, callback: AsyncCallback<Array<[string, number]>>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete database backup files based on the specified filenames.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { Array<string> } files - Indicates the backup filenames to be deleted, It can not be empty and
|
|
|
|
|
* The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<Array<[string, number]>> } {Array<[string, number]>}: the list of backup
|
|
|
|
|
* file and it's corresponding delete result which 0 means delete success and otherwise failed.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
deleteBackup(files: Array<string>): Promise<Array<[string, number]>>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Starts a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
* <p>After the database transaction is started, you can submit or roll back the operation.
|
|
|
|
|
*
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of startTransaction.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Starts a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
* <p>After the database transaction is started, you can submit or roll back the operation.
|
|
|
|
|
*
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of startTransaction.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
startTransaction(callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Starts a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
* <p>After the database transaction is started, you can submit or roll back the operation.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Starts a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
* <p>After the database transaction is started, you can submit or roll back the operation.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 14800047 - The WAL file size exceeds the default limit.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
startTransaction(): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Submits a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of commit.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
commit(callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Submits a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
commit(): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Rolls back a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of rollback.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
rollback(callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Rolls back a transaction operation in the {@code SingleKVStore} database.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
rollback(): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets whether to enable synchronization.
|
|
|
|
|
*
|
|
|
|
|
* @param { boolean } enabled - Specifies whether to enable synchronization. The value true
|
|
|
|
|
* means to enable synchronization, and false means the opposite.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of enableSync.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
enableSync(enabled: boolean, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets whether to enable synchronization.
|
|
|
|
|
*
|
|
|
|
|
* @param { boolean } enabled - Specifies whether to enable synchronization. The value true
|
|
|
|
|
* means to enable synchronization, and false means the opposite.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
enableSync(enabled: boolean): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets synchronization range labels.
|
|
|
|
|
* <p>The labels determine the devices with which data will be synchronized.
|
|
|
|
|
*
|
|
|
|
|
* @param { string[] } localLabels - Indicates the synchronization labels of the local device.
|
|
|
|
|
* @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which
|
|
|
|
|
* data will be synchronized.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of setSyncRange.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets synchronization range labels.
|
|
|
|
|
* <p>The labels determine the devices with which data will be synchronized.
|
|
|
|
|
*
|
|
|
|
|
* @param { string[] } localLabels - Indicates the synchronization labels of the local device.
|
|
|
|
|
* @param { string[] } remoteSupportLabels - Indicates the labels of the devices with which
|
|
|
|
|
* data will be synchronized.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the default delay allowed for database synchronization
|
|
|
|
|
*
|
|
|
|
|
* @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the
|
|
|
|
|
* database synchronization, in milliseconds.
|
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of setSyncParam.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Sets the default delay allowed for database synchronization
|
|
|
|
|
*
|
|
|
|
|
* @param { number } defaultAllowedDelayMs - Indicates the default delay allowed for the
|
|
|
|
|
* database synchronization, in milliseconds.
|
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
setSyncParam(defaultAllowedDelayMs: number): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Synchronize the database to the specified devices with the specified delay allowed.
|
|
|
|
|
*
|
|
|
|
|
* @permission ohos.permission.DISTRIBUTED_DATASYNC
|
|
|
|
|
* @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database.
|
|
|
|
|
* @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH},
|
|
|
|
|
* {@code PULL}, or {@code PUSH_PULL}.
|
|
|
|
|
* @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Synchronize the database to the specified devices with the specified delay allowed.
|
|
|
|
|
*
|
|
|
|
|
* @permission ohos.permission.DISTRIBUTED_DATASYNC
|
|
|
|
|
* @param { string[] } deviceIds - Indicates the list of devices to which to synchronize the database.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { SyncMode } mode - Indicates the synchronization mode. The value can be {@code PUSH},
|
|
|
|
|
* {@code PULL}, or {@code PUSH_PULL}.
|
|
|
|
|
* @param { number } delayMs - Indicates the delay allowed for the synchronization, in milliseconds.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register a callback to the database and when data in the distributed database has changed,
|
|
|
|
|
* the callback will be invoked.
|
|
|
|
|
*
|
|
|
|
|
* @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event.
|
|
|
|
|
* @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}.
|
|
|
|
|
* @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
|
|
|
|
|
* object indicates the data change events in the distributed database.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-14 03:39:20 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Register a callback to the database and when data in the distributed database has changed,
|
|
|
|
|
* the callback will be invoked.
|
|
|
|
|
*
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { 'dataChange' } event - Subscribed event name, fixed as 'dataChange', indicates the data change event.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @param { SubscribeType } type - Indicates the subscription type, which is defined in {@code SubscribeType}.
|
|
|
|
|
* @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
|
|
|
|
|
* object indicates the data change events in the distributed database.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotification>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register a databases synchronization callback to the database.
|
|
|
|
|
* <p> Sync result is returned through asynchronous callback.
|
|
|
|
|
*
|
|
|
|
|
* @param { 'syncComplete' } event - Subscribed event name, fixed as 'syncComplete', indicates the synchronization completion event.
|
|
|
|
|
* @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the
|
|
|
|
|
* deviceId and it's corresponding synchronization result which 0 means synchronization success
|
|
|
|
|
* and otherwise failed.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unsubscribe from the SingleKVStore database based on the specified subscribeType and listener.
|
|
|
|
|
*
|
2023-04-03 07:42:29 +00:00
|
|
|
|
* @param { 'dataChange' } event - The unsubscribe event name, fixed as 'dataChange', indicates the data change event.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { Callback<ChangeNotification> } listener - {ChangeNotification}: the {@code ChangeNotification}
|
|
|
|
|
* object indicates the data change events in the distributed database.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
off(event: 'dataChange', listener?: Callback<ChangeNotification>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unregister the database synchronization callback.
|
|
|
|
|
*
|
2023-04-03 07:42:29 +00:00
|
|
|
|
* @param { 'syncComplete' } event - The unsubscribe event name, fixed as 'syncComplete', indicates the synchronization completion event.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { Callback<Array<[string, number]>> } syncCallback - {Array<[string, number]>}: the
|
|
|
|
|
* deviceId and it's corresponding synchronization result which 0 means synchronization success
|
|
|
|
|
* and otherwise failed.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]>>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the security level of the database.
|
|
|
|
|
*
|
|
|
|
|
* @param { AsyncCallback<SecurityLevel> } callback - {SecurityLevel}: the {@code SecurityLevel}
|
|
|
|
|
* object indicates the security level of the database.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the security level of the database.
|
|
|
|
|
*
|
|
|
|
|
* @returns { Promise<SecurityLevel> } {SecurityLevel}: the {@code SecurityLevel} object indicates
|
|
|
|
|
* the security level of the database.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getSecurityLevel(): Promise<SecurityLevel>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides methods related to device-collaboration distributed databases.
|
|
|
|
|
* <p>To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKVStore(Options, String)}
|
|
|
|
|
* method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed
|
|
|
|
|
* data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry
|
|
|
|
|
* into the database, the system automatically adds the ID of the device running the application to the key.
|
|
|
|
|
*
|
|
|
|
|
* @interface DeviceKVStore
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface DeviceKVStore extends SingleKVStore {
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the value matching the local device ID and specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the value matching the local device ID and specified key.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @returns { Promise<boolean | string | number | Uint8Array> }
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
get(key: string): Promise<boolean | string | number | Uint8Array>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the value matching a specified device ID and key.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { string } deviceId - Indicates the device to be queried.
|
|
|
|
|
* @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { AsyncCallback<boolean | string | number | Uint8Array> } callback -
|
|
|
|
|
* {boolean | string | number | Uint8Array}: the returned value specified by the deviceId and key.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the value matching a specified device ID and key.
|
|
|
|
|
*
|
2024-04-28 08:24:56 +00:00
|
|
|
|
* @param { string } deviceId - Indicates the device to be queried.
|
|
|
|
|
* @param { string } key - Indicates the key of the value to be queried. The length must be less than {@code MAX_KEY_LENGTH}.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @returns { Promise<boolean | string | number | Uint8Array> }
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* {Uint8Array|string|boolean|number}: the returned value specified by the deviceId and key.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains all key-value pairs that match the local device ID and specified key prefix.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
|
|
|
|
|
* that match the local device ID and specified key prefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains all key-value pairs that match the local device ID and specified key prefix.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
|
|
|
|
|
* local device ID and specified key prefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(keyPrefix: string): Promise<Entry[]>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains all key-value pairs matching a specified device ID and key prefix.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be queried.
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
|
|
|
|
|
* that match the specified deviceId and key prefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains all key-value pairs matching a specified device ID and key prefix.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be queried.
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs that match the
|
|
|
|
|
* specified deviceId and key prefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
|
|
|
|
|
* matching the local device ID and specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(query: Query, callback: AsyncCallback<Entry[]>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the local device ID and
|
|
|
|
|
* specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(query: Query): Promise<Entry[]>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the list of key-value pairs matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<Entry[]> } callback - {Entry[]}: the list of all key-value pairs
|
|
|
|
|
* matching the specified deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the list of key-value pairs matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the key-value pairs belong.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<Entry[]> } {Entry[]}: the list of all key-value pairs matching the
|
|
|
|
|
* specified deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getEntries(deviceId: string, query: Query): Promise<Entry[]>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
|
|
|
|
|
* The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
|
|
|
|
|
* Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
|
|
|
|
|
* If you have created four objects, calling this method will return a failure. Therefore, you are advised to
|
|
|
|
|
* call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
|
|
|
|
|
* The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
|
|
|
|
|
* Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
|
|
|
|
|
* If you have created four objects, calling this method will return a failure. Therefore, you are advised to
|
|
|
|
|
* call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
|
|
|
|
|
* The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
|
|
|
|
|
* Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
|
|
|
|
|
* If you have created four objects, calling this method will return a failure. Therefore, you are advised to
|
|
|
|
|
* call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the result set with the local device ID and specified prefix from a {@code DeviceKVStore} database.
|
|
|
|
|
* The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria.
|
|
|
|
|
* Each {@code DeviceKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time.
|
|
|
|
|
* If you have created four objects, calling this method will return a failure. Therefore, you are advised to
|
|
|
|
|
* call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(keyPrefix: string): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
|
|
|
|
|
* <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
|
|
|
|
|
* calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
|
|
|
|
|
* {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be queried.
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
|
|
|
|
|
* <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
|
|
|
|
|
* calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
|
|
|
|
|
* {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be queried.
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
|
|
|
|
|
* <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
|
|
|
|
|
* calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
|
|
|
|
|
* {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be queried.
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix.
|
|
|
|
|
* <p>The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code DeviceKVStore}
|
|
|
|
|
* instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects,
|
|
|
|
|
* calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary
|
|
|
|
|
* {@code KVStoreResultSet} objects in a timely manner.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Identifies the device whose data is to be queried.
|
|
|
|
|
* @param { string } keyPrefix - Indicates the key prefix to match.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and keyPrefix.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(deviceId: string, keyPrefix: string): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(query: Query): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching the local device ID and specified predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the datasharePredicates.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId Indicates the ID of the device to which the results belong.
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
|
|
|
|
|
*
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @param { string } deviceId Indicates the ID of the device to which the results belong.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @param { AsyncCallback<KVStoreResultSet> } callback - {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(
|
|
|
|
|
deviceId: string,
|
|
|
|
|
predicates: dataSharePredicates.DataSharePredicates,
|
|
|
|
|
callback: AsyncCallback<KVStoreResultSet>
|
|
|
|
|
): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId Indicates the ID of the device to which the results belong.
|
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 13:01:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object.
|
|
|
|
|
*
|
2023-05-23 02:15:26 +00:00
|
|
|
|
* @param { string } deviceId Indicates the ID of the device to which the results belong.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @param { dataSharePredicates.DataSharePredicates } predicates - Indicates the dataSharePredicates.
|
|
|
|
|
* @returns { Promise<KVStoreResultSet> } {KVStoreResultSet}: the {@code KVStoreResultSet}
|
|
|
|
|
* object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @throws { BusinessError } 202 - Permission verification failed, application which is not a system application uses system API.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100001 - Over max limits.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 13:01:52 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.DataShare.Provider
|
|
|
|
|
* @systemapi
|
|
|
|
|
* @StageModelOnly
|
|
|
|
|
* @since 10
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the number of results matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<number> } callback - {number}: the number of results matching the
|
|
|
|
|
* local device ID and specified {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getResultSize(query: Query, callback: AsyncCallback<number>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the number of results matching the local device ID and specified {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<number> } {number}: the number of results matching the local device ID and specified
|
|
|
|
|
* {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getResultSize(query: Query): Promise<number>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the number of results matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the results belong.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @param { AsyncCallback<number> } callback - {number}: the number of results matching the
|
|
|
|
|
* specified deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the number of results matching a specified device ID and {@code Query} object.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } deviceId - Indicates the ID of the device to which the results belong.
|
|
|
|
|
* @param { Query } query - Indicates the {@code Query} object.
|
|
|
|
|
* @returns { Promise<number> } {number}: the number of results matching the specified
|
|
|
|
|
* deviceId and {@code Query} object.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
|
|
|
|
* @throws { BusinessError } 15100005 - Database or result set already closed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getResultSize(deviceId: string, query: Query): Promise<number>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates a {@link KVManager} instance based on the configuration information.
|
|
|
|
|
* <p>You must pass {@link KVManagerConfig} to provide configuration information
|
|
|
|
|
* to create a {@link KVManager} instance.
|
|
|
|
|
*
|
|
|
|
|
* @param { KVManagerConfig } config - Indicates the KVStore configuration information,
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* including the package name and context, and package name can not be empty.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { KVManager } : the {@code KVManager} instance.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
function createKVManager(config: KVManagerConfig): KVManager;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}.
|
|
|
|
|
*
|
|
|
|
|
* @interface KVManager
|
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
interface KVManager {
|
|
|
|
|
/**
|
|
|
|
|
* Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* for the same application, and different applications can share the same value. The storeId can consist
|
|
|
|
|
* of only letters, digits, and underscores (_), and cannot exceed 128 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { Options } options - Indicates the {@code Options} object used for creating and
|
|
|
|
|
* obtaining the KVStore database.
|
|
|
|
|
* @param { AsyncCallback<T> } callback - {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100002 - Open existed database with changed options.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getKVStore<T>(storeId: string, options: Options, callback: AsyncCallback<T>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}.
|
|
|
|
|
*
|
|
|
|
|
* @param { string } storeId - Identifies the KVStore database. The value of this parameter must be unique
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* for the same application, and different applications can share the same value. The storeId can consist
|
|
|
|
|
* of only letters, digits, and underscores (_), and cannot exceed 128 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { Options } options - Indicates the {@code Options} object used for creating and
|
|
|
|
|
* obtaining the KVStore database.
|
|
|
|
|
* @returns { Promise<T> } {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-05-22 13:00:43 +00:00
|
|
|
|
* @throws { BusinessError } 15100002 - Open existed database with changed options.
|
|
|
|
|
* @throws { BusinessError } 15100003 - Database corrupted.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getKVStore<T>(storeId: string, options: Options): Promise<T>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Closes the KVStore database.
|
|
|
|
|
* <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your
|
|
|
|
|
* thread may crash.
|
|
|
|
|
* <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this
|
|
|
|
|
* method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise
|
|
|
|
|
* closing the database will fail.
|
|
|
|
|
*
|
2024-04-18 10:07:23 +00:00
|
|
|
|
* @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits,
|
|
|
|
|
* and underscores (_), and cannot exceed 128 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of closeKVStore.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
closeKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Closes the KVStore database.
|
|
|
|
|
* <p>Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your
|
|
|
|
|
* thread may crash.
|
|
|
|
|
* <p>The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this
|
|
|
|
|
* method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise
|
|
|
|
|
* closing the database will fail.
|
|
|
|
|
*
|
2024-04-18 10:07:23 +00:00
|
|
|
|
* @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @param { string } storeId - Identifies the KVStore database to close. The storeId can consist of only letters, digits,
|
|
|
|
|
* and underscores (_), and cannot exceed 128 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
closeKVStore(appId: string, storeId: string): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the KVStore database identified by storeId.
|
|
|
|
|
* <p>Before using this method, close all KVStore instances in use that are identified by the same storeId.
|
|
|
|
|
* <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be
|
|
|
|
|
* lost.
|
|
|
|
|
*
|
2024-04-18 10:07:23 +00:00
|
|
|
|
* @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits,
|
|
|
|
|
* and underscores (_), and cannot exceed 128 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<void> } callback - the callback of deleteKVStore.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Deletes the KVStore database identified by storeId.
|
|
|
|
|
* <p>Before using this method, close all KVStore instances in use that are identified by the same storeId.
|
|
|
|
|
* <p>You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be
|
|
|
|
|
* lost.
|
|
|
|
|
*
|
2024-04-18 10:07:23 +00:00
|
|
|
|
* @param { string } appId - Identifies the application that the database belong to, and cannot exceed 256 characters.
|
2023-06-07 08:36:24 +00:00
|
|
|
|
* @param { string } storeId - Identifies the KVStore database to delete. The storeId can consist of only letters, digits,
|
|
|
|
|
* and underscores (_), and cannot exceed 128 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<void> } the promise returned by the function.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-05-22 13:38:47 +00:00
|
|
|
|
* @throws { BusinessError } 15100004 - Not found.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
deleteKVStore(appId: string, storeId: string): Promise<void>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by
|
|
|
|
|
* calling the {@code deleteKVStore} method.
|
|
|
|
|
*
|
2024-04-18 10:07:23 +00:00
|
|
|
|
* @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { AsyncCallback<string[]> } callback - {string[]}: the storeId of all created KVStore databases.
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by
|
|
|
|
|
* calling the {@code deleteKVStore} method.
|
|
|
|
|
*
|
2024-04-18 10:07:23 +00:00
|
|
|
|
* @param { string } appId - Identifies the application that obtains the databases, and cannot exceed 256 characters.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @returns { Promise<string[]> } {string[]}: the storeId of all created KVStore databases.
|
2024-04-23 09:58:35 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified.
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.Core
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
getAllKVStoreId(appId: string): Promise<string[]>;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register a death callback to get notification when the data manager service is terminated.
|
|
|
|
|
* <p>If the data manager service is terminated,you need to re-subscribe to data change notifications and synchronization
|
|
|
|
|
* completion notifications, and calling the sync method will return a failure.
|
|
|
|
|
*
|
|
|
|
|
* @param { 'distributedDataServiceDie' } event - Subscribed event name, fixed as 'distributedDataServiceDie', as a service status change events.
|
|
|
|
|
* @param { Callback<void> } deathCallback - callback to be invoked when the data manager service is terminated.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
|
|
|
|
on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Unregister the death callback. Not notification will be received when the data manager service is terminated.
|
|
|
|
|
* <p>The unregistered death callback must be a registered death callback of the database. If no death callback parameter
|
|
|
|
|
* is passed, all database death callbacks will be unregistered.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
*
|
2023-04-03 07:42:29 +00:00
|
|
|
|
* @param { 'distributedDataServiceDie' } event - Unsubscribe event name, fixed as 'distributedDataServiceDie', as a service status change events.
|
2023-04-03 07:19:53 +00:00
|
|
|
|
* @param { Callback<void> } deathCallback - the data manager service is terminated callback which has been registered.
|
2024-04-18 11:32:01 +00:00
|
|
|
|
* @throws { BusinessError } 401 - Parameter error.Possible causes:1.Mandatory parameters are left unspecified;
|
2024-04-29 03:28:27 +00:00
|
|
|
|
* <br>2.Incorrect parameters types;
|
|
|
|
|
* <br>3.Parameter verification failed.
|
2022-10-13 13:56:33 +00:00
|
|
|
|
* @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
|
|
|
|
|
* @since 9
|
|
|
|
|
*/
|
2023-04-03 07:19:53 +00:00
|
|
|
|
off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void;
|
|
|
|
|
}
|
2022-10-13 13:56:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-12 07:35:55 +00:00
|
|
|
|
export default distributedKVStore;
|