diff --git a/lib/src/backend/impls/objectbox/backend/internal.dart b/lib/src/backend/impls/objectbox/backend/internal.dart index 0d6926d3..9a4bf80b 100644 --- a/lib/src/backend/impls/objectbox/backend/internal.dart +++ b/lib/src/backend/impls/objectbox/backend/internal.dart @@ -516,8 +516,11 @@ class _ObjectBoxBackendImpl implements FMTCObjectBoxBackendInternal { required String value, }) => _sendCmdOneShot( - type: _CmdType.setMetadata, - args: {'storeName': storeName, 'key': key, 'value': value}, + type: _CmdType.setBulkMetadata, + args: { + 'storeName': storeName, + 'kvs': {key: value}, + }, ); @override diff --git a/lib/src/backend/impls/objectbox/backend/internal_workers/standard/cmd_type.dart b/lib/src/backend/impls/objectbox/backend/internal_workers/standard/cmd_type.dart index 8fb68691..f2f4b36a 100644 --- a/lib/src/backend/impls/objectbox/backend/internal_workers/standard/cmd_type.dart +++ b/lib/src/backend/impls/objectbox/backend/internal_workers/standard/cmd_type.dart @@ -29,7 +29,6 @@ enum _CmdType { removeOldestTilesAboveLimit, removeTilesOlderThan, readMetadata, - setMetadata, setBulkMetadata, removeMetadata, resetMetadata, diff --git a/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart b/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart index c063d4d1..bc57c8ad 100644 --- a/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart +++ b/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart @@ -659,35 +659,6 @@ Future _worker( ); query.close(); - case _CmdType.setMetadata: - final storeName = cmd.args['storeName']! as String; - final key = cmd.args['key']! as String; - final value = cmd.args['value']! as String; - - final stores = root.box(); - - final query = - stores.query(ObjectBoxStore_.name.equals(storeName)).build(); - - root.runInTransaction( - TxMode.write, - () { - final store = query.findUnique() ?? - (throw StoreNotExists(storeName: storeName)); - query.close(); - - stores.put( - store - ..metadataJson = jsonEncode( - (jsonDecode(store.metadataJson) as Map) - ..[key] = value, - ), - mode: PutMode.update, - ); - }, - ); - - sendRes(id: cmd.id); case _CmdType.setBulkMetadata: final storeName = cmd.args['storeName']! as String; final kvs = cmd.args['kvs']! as Map;