feat: Make possible to overwrite boxcollection opener in Hive Collections Database
This commit is contained in:
parent
6ab9483d73
commit
efe8e7e5ac
|
|
@ -38,6 +38,12 @@ class HiveCollectionsDatabase extends DatabaseApi {
|
||||||
final String name;
|
final String name;
|
||||||
final String? path;
|
final String? path;
|
||||||
final HiveCipher? key;
|
final HiveCipher? key;
|
||||||
|
final Future<BoxCollection> Function(
|
||||||
|
String name,
|
||||||
|
Set<String> boxNames, {
|
||||||
|
String? path,
|
||||||
|
HiveCipher? key,
|
||||||
|
}) collectionFactory;
|
||||||
late BoxCollection _collection;
|
late BoxCollection _collection;
|
||||||
late CollectionBox<String> _clientBox;
|
late CollectionBox<String> _clientBox;
|
||||||
late CollectionBox<Map> _accountDataBox;
|
late CollectionBox<Map> _accountDataBox;
|
||||||
|
|
@ -118,13 +124,18 @@ class HiveCollectionsDatabase extends DatabaseApi {
|
||||||
|
|
||||||
String get _seenDeviceKeysBoxName => 'box_seen_device_keys';
|
String get _seenDeviceKeysBoxName => 'box_seen_device_keys';
|
||||||
|
|
||||||
HiveCollectionsDatabase(this.name, this.path, {this.key});
|
HiveCollectionsDatabase(
|
||||||
|
this.name,
|
||||||
|
this.path, {
|
||||||
|
this.key,
|
||||||
|
this.collectionFactory = BoxCollection.open,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get maxFileSize => 0;
|
int get maxFileSize => 0;
|
||||||
|
|
||||||
Future<void> open() async {
|
Future<void> open() async {
|
||||||
_collection = await BoxCollection.open(
|
_collection = await collectionFactory(
|
||||||
name,
|
name,
|
||||||
{
|
{
|
||||||
_clientBoxName,
|
_clientBoxName,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue