hive icon indicating copy to clipboard operation
hive copied to clipboard

Nested type registries

Open themisir opened this issue 3 years ago • 3 comments

The goal of this PR is to add nested registries to hive in order to increase typeId limit for the models.

The original implementation has been written by @xal with https://github.com/hivedb/hive/pull/804.

The final design adds the following api to the hive TypeRegistry interface (which is accessible through Hive singleton value).

Hive.registerNestedAdapters((registry) {
  registry.registerAdapter<User>(UserAdapter());
}, parentTypeId: 3);

Basically put the registerNestedAdapters method lets users to allocate a single typeId and use it for a nested type registry which can be used for registering multiple types with a single id. The nested type registry has similar characteristics as the global type registry like 256 typeId space for each nested registry, typeIds should be unique and should not be changed after being written to the disk.

themisir avatar Jan 05 '23 19:01 themisir

Please make this possible, we are struggling!

Mamasodikov avatar Apr 09 '23 18:04 Mamasodikov

The feature is ready, but there's some issues with web builds needs to be fixed. I will take a look when I have some free time, but can't promise any ETA.

themisir avatar Apr 09 '23 18:04 themisir

The feature is ready, but there's some issues with web builds needs to be fixed. I will take a look when I have some free time, but can't promise any ETA.

I will wait for it! In our case, it takes so much effort to convert our super (multimodule) app to any other db option. We are dependent on Hive. All we can do is increase the typeId limit. I tried to get multiple instances from hive using HiveImpl() low-level API but it doesn't work. (says "Did you forget to use openBox)

Mamasodikov avatar Apr 09 '23 18:04 Mamasodikov