1# JS API Changes of the Distributed Data Management Subsystem 2 3The table below lists the APIs changes of the distributed data management subsystem in OpenHarmony 3.1 Release over OpenHarmony 3.0 LTS. 4 5## API Changes 6 7| Module| Class| Method/Attribute/Enumeration/Constant| Change Type| 8|---|---|---|---| 9| ohos.data.rdb | RdbPredicates | inAllDevices(): RdbPredicates; | Added| 10| ohos.data.rdb | RdbPredicates | inDevices(devices: Array\<string>): RdbPredicates; | Added| 11| ohos.data.rdb | RdbStore | off(event:'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void; | Added| 12| ohos.data.rdb | RdbStore | on(event: 'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void; | Added| 13| ohos.data.rdb | RdbStore | sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback\<Array\<[string, number]>>): void;<br>sync(mode: SyncMode, predicates: RdbPredicates): Promise\<Array\<[string, number]>>; | Added| 14| ohos.data.rdb | RdbStore | obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\<string>): void;<br>obtainDistributedTableName(device: string, table: string): Promise\<string>; | Added| 15| ohos.data.rdb | RdbStore | setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void;<br>setDistributedTables(tables: Array\<string>): Promise\<void>; | Added| 16| ohos.data.rdb | RdbStore | rollBack():void; | Added| 17| ohos.data.rdb | RdbStore | commit():void; | Added| 18| ohos.data.rdb | RdbStore | beginTransaction():void; | Added| 19| ohos.data.rdb | RdbStore | querySql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<ResultSet>): void;<br>querySql(sql: string, bindArgs?: Array\<ValueType>): Promise\<ResultSet>; | Added| 20| ohos.data.rdb | SubscribeType | SUBSCRIBE_TYPE_REMOTE = 0 | Added| 21| ohos.data.rdb | SyncMode | SYNC_MODE_PULL = 1 | Added| 22| ohos.data.rdb | SyncMode | SYNC_MODE_PUSH = 0 | Added| 23| ohos.data.distributedDataObject | DistributedObject | off(type: 'status', callback?: Callback\<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }>): void; | Added| 24| ohos.data.distributedDataObject | DistributedObject | on(type: 'status', callback: Callback\<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }>): void; | Added| 25| ohos.data.distributedDataObject | DistributedObject | off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void; | Added| 26| ohos.data.distributedDataObject | DistributedObject | on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void; | Added| 27| ohos.data.distributedDataObject | DistributedObject | setSessionId(sessionId?: string): boolean; | Added| 28| ohos.data.distributedDataObject | distributedDataObject | genSessionId(): string; | Added| 29| ohos.data.distributedDataObject | distributedDataObject | createDistributedObject(source: object): DistributedObject; | Added| 30| ohos.data.distributedData | KVManager | off(event: 'distributedDataServiceDie', deathCallback?: Callback\<void>): void; | Added| 31| ohos.data.distributedData | KVManager | on(event: 'distributedDataServiceDie', deathCallback: Callback\<void>): void; | Added| 32| ohos.data.distributedData | KVManager | getAllKVStoreId(appId: string, callback: AsyncCallback\<string[]>): void;<br>getAllKVStoreId(appId: string): Promise\<string[]>; | Added| 33| ohos.data.distributedData | KVManager | deleteKVStore(appId: string, storeId: string, callback: AsyncCallback\<void>): void;<br>deleteKVStore(appId: string, storeId: string): Promise\<void>; | Added| 34| ohos.data.distributedData | KVManager | closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback\<void>): void;<br>closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise\<void>; | Added| 35| ohos.data.distributedData | DeviceKVStore | off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void; | Added| 36| ohos.data.distributedData | DeviceKVStore | on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void; | Added| 37| ohos.data.distributedData | DeviceKVStore | sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void; | Added| 38| ohos.data.distributedData | DeviceKVStore | removeDeviceData(deviceId: string, callback: AsyncCallback\<void>): void;<br>removeDeviceData(deviceId: string): Promise\<void>; | Added| 39| ohos.data.distributedData | DeviceKVStore | getResultSize(query: Query, callback: AsyncCallback\<number>): void;<br>getResultSize(query: Query): Promise\<number>;<br>getResultSize(deviceId: string, query: Query, callback: AsyncCallback\<number>): void;<br>getResultSize(deviceId: string, query: Query): Promise\<number>; | Added| 40| ohos.data.distributedData | DeviceKVStore | closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback\<void>): void;<br>closeResultSet(resultSet: KvStoreResultSet): Promise\<void>; | Added| 41| ohos.data.distributedData | DeviceKVStore | getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback\<KvStoreResultSet>): void;<br>getResultSet(deviceId: string, keyPrefix: string): Promise\<KvStoreResultSet>;<br>getResultSet(query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>getResultSet(query: Query): Promise\<KvStoreResultSet>;<br>getResultSet(deviceId: string, query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>getResultSet(deviceId: string, query: Query): Promise\<KvStoreResultSet>; | Added| 42| ohos.data.distributedData | DeviceKVStore | getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;<br>getEntries(deviceId: string, keyPrefix: string): Promise\<Entry[]>;<br>getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;<br>getEntries(query: Query): Promise\<Entry[]>;<br>getEntries(deviceId: string, query: Query, callback: AsyncCallback\<Entry[]>): void;<br>getEntries(deviceId: string, query: Query): Promise\<Entry[]>; | Added| 43| ohos.data.distributedData | DeviceKVStore | get(deviceId: string, key: string, callback: AsyncCallback\<boolean\|string\|number\|Uint8Array>): void;<br>get(deviceId: string, key: string): Promise\<boolean\|string\|number\|Uint8Array>; | Added| 44| ohos.data.distributedData | SingleKVStore | getSecurityLevel(callback: AsyncCallback\<SecurityLevel>): void;<br>getSecurityLevel(): Promise\<SecurityLevel>; | Added| 45| ohos.data.distributedData | SingleKVStore | setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback\<void>): void;<br>setSyncParam(defaultAllowedDelayMs: number): Promise\<void>; | Added| 46| ohos.data.distributedData | SingleKVStore | off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void; | Added| 47| ohos.data.distributedData | SingleKVStore | on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void; | Added| 48| ohos.data.distributedData | SingleKVStore | removeDeviceData(deviceId: string, callback: AsyncCallback\<void>): void;<br>removeDeviceData(deviceId: string): Promise\<void>; | Added| 49| ohos.data.distributedData | SingleKVStore | getResultSize(query: Query, callback: AsyncCallback\<number>): void;<br>getResultSize(query: Query): Promise\<number>; | Added| 50| ohos.data.distributedData | SingleKVStore | closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback\<void>): void;<br>closeResultSet(resultSet: KvStoreResultSet): Promise\<void>; | Added| 51| ohos.data.distributedData | SingleKVStore | getResultSet(keyPrefix: string, callback: AsyncCallback\<KvStoreResultSet>): void;<br>getResultSet(keyPrefix: string): Promise\<KvStoreResultSet>;<br>getResultSet(query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>getResultSet(query: Query): Promise\<KvStoreResultSet>; | Added| 52| ohos.data.distributedData | SingleKVStore | getEntries(keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;<br>getEntries(keyPrefix: string): Promise\<Entry[]>;<br>getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;<br>getEntries(query: Query): Promise\<Entry[]>; | Added| 53| ohos.data.distributedData | KVStore | setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback\<void>): void;<br>setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise\<void>; | Added| 54| ohos.data.distributedData | KVStore | enableSync(enabled: boolean, callback: AsyncCallback\<void>): void;<br>enableSync(enabled: boolean): Promise\<void>; | Added| 55| ohos.data.distributedData | KVStore | rollback(callback: AsyncCallback\<void>): void;<br>rollback(): Promise\<void>; | Added| 56| ohos.data.distributedData | KVStore | commit(callback: AsyncCallback\<void>): void;<br>commit(): Promise\<void>; | Added| 57| ohos.data.distributedData | KVStore | startTransaction(callback: AsyncCallback\<void>): void;<br>startTransaction(): Promise\<void>; | Added| 58| ohos.data.distributedData | KVStore | deleteBatch(keys: string[], callback: AsyncCallback\<void>): void;<br>deleteBatch(keys: string[]): Promise\<void>; | Added| 59| ohos.data.distributedData | KVStore | putBatch(entries: Entry[], callback: AsyncCallback\<void>): void;<br>putBatch(entries: Entry[]): Promise\<void>; | Added| 60| ohos.data.distributedData | KVStore | off(event:'dataChange', observer?: Callback\<ChangeNotification>): void; | Added| 61| ohos.data.distributedData | Query | getSqlLike():string; | Added| 62| ohos.data.distributedData | Query | deviceId(deviceId:string):Query; | Added| 63| ohos.data.distributedData | Query | setSuggestIndex(index: string): Query; | Added| 64| ohos.data.distributedData | Query | prefixKey(prefix: string): Query; | Added| 65| ohos.data.distributedData | Query | endGroup(): Query; | Added| 66| ohos.data.distributedData | Query | beginGroup(): Query; | Added| 67| ohos.data.distributedData | Query | isNotNull(field: string): Query; | Added| 68| ohos.data.distributedData | Query | limit(total: number, offset: number): Query; | Added| 69| ohos.data.distributedData | Query | orderByDesc(field: string): Query; | Added| 70| ohos.data.distributedData | Query | orderByAsc(field: string): Query; | Added| 71| ohos.data.distributedData | Query | or(): Query; | Added| 72| ohos.data.distributedData | Query | and(): Query; | Added| 73| ohos.data.distributedData | Query | unlike(field: string, value: string): Query; | Added| 74| ohos.data.distributedData | Query | like(field: string, value: string): Query; | Added| 75| ohos.data.distributedData | Query | notInString(field: string, valueList: string[]): Query; | Added| 76| ohos.data.distributedData | Query | notInNumber(field: string, valueList: number[]): Query; | Added| 77| ohos.data.distributedData | Query | inString(field: string, valueList: string[]): Query; | Added| 78| ohos.data.distributedData | Query | inNumber(field: string, valueList: number[]): Query; | Added| 79| ohos.data.distributedData | Query | isNull(field: string): Query; | Added| 80| ohos.data.distributedData | Query | lessThanOrEqualTo(field: string, value: number\|string): Query; | Added| 81| ohos.data.distributedData | Query | greaterThanOrEqualTo(field: string, value: number\|string): Query; | Added| 82| ohos.data.distributedData | Query | lessThan(field: string, value: number\|string): Query; | Added| 83| ohos.data.distributedData | Query | greaterThan(field: string, value: number\|string\|boolean): Query; | Added| 84| ohos.data.distributedData | Query | notEqualTo(field: string, value: number\|string\|boolean): Query; | Added| 85| ohos.data.distributedData | Query | equalTo(field: string, value: number\|string\|boolean): Query; | Added| 86| ohos.data.distributedData | Query | reset(): Query; | Added| 87| ohos.data.distributedData | Query | constructor() | Added| 88| ohos.data.distributedData | KvStoreResultSet | getEntry(): Entry; | Added| 89| ohos.data.distributedData | KvStoreResultSet | isAfterLast(): boolean; | Added| 90| ohos.data.distributedData | KvStoreResultSet | isBeforeFirst(): boolean; | Added| 91| ohos.data.distributedData | KvStoreResultSet | isLast(): boolean; | Added| 92| ohos.data.distributedData | KvStoreResultSet | isFirst(): boolean; | Added| 93| ohos.data.distributedData | KvStoreResultSet | moveToPosition(position: number): boolean; | Added| 94| ohos.data.distributedData | KvStoreResultSet | move(offset: number): boolean; | Added| 95| ohos.data.distributedData | KvStoreResultSet | moveToPrevious(): boolean; | Added| 96| ohos.data.distributedData | KvStoreResultSet | moveToNext(): boolean; | Added| 97| ohos.data.distributedData | KvStoreResultSet | moveToLast(): boolean; | Added| 98| ohos.data.distributedData | KvStoreResultSet | moveToFirst(): boolean; | Added| 99| ohos.data.distributedData | KvStoreResultSet | getPosition(): number; | Added| 100| ohos.data.distributedData | KvStoreResultSet | getCount(): number; | Added| 101| ohos.data.distributedData | FieldNode | type: number; | Added| 102| ohos.data.distributedData | FieldNode | nullable: boolean; | Added| 103| ohos.data.distributedData | FieldNode | default: string; | Added| 104| ohos.data.distributedData | FieldNode | appendChild(child: FieldNode): boolean; | Added| 105| ohos.data.distributedData | FieldNode | constructor(name: string) | Added| 106| ohos.data.distributedData | Schema | skip: number; | Added| 107| ohos.data.distributedData | Schema | mode: number; | Added| 108| ohos.data.distributedData | Schema | indexes: Array\<string>; | Added| 109| ohos.data.distributedData | Schema | root: FieldNode; | Added| 110| ohos.data.distributedData | Schema | constructor() | Added| 111| ohos.data.distributedData | Options | schema?: Schema; | Added| 112