-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A new chapter: Hive v4 #1225
Comments
Great news! I love Isar, but I also still use Hive in the same project, because it's just a simple key-value storage. I use it to store cache, counters, json responses, lists and maps. I don't need complex stuff like indexes and queries, because I already have that data in isar. |
Hey Simon, thanks for an update! I am wondering what's your plans regarding storage migration. How do you think to handle the transition to make sure existing applications won't lose any data. Also considering both hive and isar has (or had) their own way of encoding data types, not sure about isar, but hive also have support for writing custom encoders/serializers. What's the plan for migrating them? |
That's indeed the biggest problem to solve. I think the best approach for now is to let the hive generator generate migration code. For custom encoders & decoders I didn't find a solution yet. Maybe we can just deprecate them and ask users who rely on them to stay on Hive v2 |
Are you planning to support database queries like Isar does? If so, then it's tough, I don't have an idea to create smooth migration plan. If not (only key to value lookups), maybe we can continue using the existing hive generated (and custom) encoders to encode structs into byte stream and store it within isar with its respective key. |
This is really exciting news!
In my opinion, a migration to Isar as the data store should focus solely on that and leave out advanced functionality that Isar could provide. That simplifies the migration and maintains the simplicity of Hive. If you need more advanced functionality, using Isar directly is likely a better fit. |
Yeah agreed! I think Hive has a good feature set and if someone is looking for queries, Isar should be used directly. The only feature I think would be valuable for Hive is (optional) atomic transactions. |
I merged my work in the main branch. Check it out and provide feedback please 💜 |
Hey @simc , that plan sounds great! I wanted to use Isar but decided to stick with Hive, as Hive supports Flutter on the web. With the migration to Isar as the engine for Hive, will it still work over IndexedDB? |
This is promising, but I have a few questions. Is there a list of things that Hive v4 will lack vs. v2? Will there be a v2 support branch if v4 will not have feature parity? Also what of Hive v3, is it being abandoned? BTW, thanks for all this work! Glad to hear Hive will live on in one form or another. |
No. Isar web uses SQLite compiled to WASM and so will Hive.
I don't think there is anything Hive v4 will lack. The API is almost identical with a few minor differences. Edit:
To my knowledge Hive v3 was never released as a stable version and I don't have time to maintain it unfortunately. |
I published the first version of Hive v4 and I'd love to hear your feedback |
Does "No more code generation" mean that we don't need to reference a generated file like part 'main.g.dart';? If so sounds pretty good. As a follow-on, does this also hold for Isar 4.0? |
@simc, thanks for reply. Can you confirm that given this issue: isar/isar#1362 (Isar on the web supports only in-memory sqlite), in practice, Hive v4 cannot be used as a persistency service on the web? |
Not right now that's correct @t-kozak. I hope to implement that before a stable release |
Because MY_APP depends on hive ^4.0.0 which doesn't match any versions, version solving failed. You can try the following suggestion to make the pubspec resolve:
|
@pishguy You can use |
@simc we're working on testing this and noticed that it's leveraging Isar 4 Alpha. Any timeline on Isar 4 getting to stable? Also, any chance that Hive 4 could leverage Isar 3? |
Hi @simc, First of all, I want to express my sincere appreciation for all your hard work on Hive and the dedication you've shown to the community. Hive has been an invaluable tool for me, and I'm excited to see its future unfold with Hive v4. I'm sure many of us are eager to get our hands on the new Hive v4. Do you have a rough estimate of when we can expect a release candidate or a beta version? Lastly, cheers from Munich! 🍻 Looking forward to Hive's continued evolution and success. |
@simc Do you have any rough time schedule when a stable release for Hive v4 will be available? |
Please make it happen i can't wait to see Hive V4.0.0 official release |
At the same week US starts using metric system 👀. |
LGTM! |
flutter: 3.19.6
|
Any updates V4 stable release? |
For anyone still on v2, I released hive_ce that supports WASM compilation and Sets. Also the hive_ce_generator generates a import 'package:your_package/hive_registrar.g.dart';
void main() {
final path = Directory.current.path;
Hive
..init(path)
..registerAdapters();
} |
This comment was marked as resolved.
This comment was marked as resolved.
hive_flutter: ^1.1.0 Hive is not persisting data after flutter mobile app gets terminated.. Is there any solution for this ?? |
Flutter secured storage |
I switched to objectbox recently. |
I just use hive_ce since that was easier than migrating to an entirely different storage solution |
Actually, it's not different, it's just a package with a different name that contains traces of each version of Hive. Also |
I'm the maintainer of hive_ce so I know what it is. I have many apps that are using Hive v2 in production, and I see no easy way to migrate to v4. Even if there was a way to migrate from v2 to v4, I have little to no faith in the future support of Hive. Please do not recommend using Hive v4 in production applications. I wouldn't even recommend using hive_ce for new projects unless you intend to contribute. I am aware of Hive v4 not requiring code generation, but you lose the efficient binary storage of Hive v2 which was like... the entire point of choosing Hive over other options... |
Actually, I'm not fully aware of the advantages of binary storage. But based on my research, I believe the new Hive may be faster than the old one. |
Well it doesn't really matter if it's a dead package |
Okay, I respect your decisions. |
do you face any issue while application move to terminate state?? on restart does it restore previous save data ?? |
does it keep you data saved when mobile app gets terminated or crash ?? |
@appconsultio Sure it does, and tbh i would be suprised if hive wouldn't do that too. Are you sure you're doing everything correctly on app startup? |
I'm still using Hive and is working fine after phone restart or crash, the only place I have issues is on web. |
@oscarshaitan If you're having issues opening boxes on startup, does making them lazy help? |
Yes Im thinking on moving some to lazy. I'm going to join to your discord so I can make more questions there |
@simc Thank you for all the great work. Any idea when we can expect a release version of Hive v4 based on Isar? |
I believe @simc has stopped supporting this package. The sad truth of the Open-Source Community is that we do not get paid, and hence the wobbly support for packages. |
RIP peace dear Bees |
Can someone suggest alternative since the V4 is dead now. |
I use Hive Community Edition: |
I love the way Hive V4 does, code-gen make the folder a bit messy tbh |
@chunghei0116 Doesn't Hive v4 still need code-gen from Also I'm making code-gen much better in this PR. With that change, you only need one generated adapters file per project. You can see how it works in the updated README. I'm waiting on feedback from users to release the feature. If you could try it out and put any feedback in a comment on that PR that would be very helpful! |
Thank you for your contribution! I’ll definitely give it a try in my new project. Since I’m currently working on an enterprise project, I need a stable and well-maintained package. Cheers! |
I just benchmarked Hive v2 vs v4 and the results are... not looking good... Here's the PR for the benchmark if you want to check it out: IO-Design-Team/hive_ce#43 |
Dear Hive Community,
I'd like to apologize for my lack of support and updates for Hive over the past year. Despite this, your commitment to the community has ensured that the package is still in a remarkably good state, and for that, I'm incredibly grateful.
As many of you know, I have spent a lot of time optimizing Isar to be as fast, reliable, and fun to use as possible. However, I recognize that a lot of you truly appreciate the simplicity of Hive. The thought of discontinuing Hive did cross my mind, but I now see a much more constructive way forward:
Over the next several weeks and months, I plan to invest my energy into the development of Hive v4. The primary focus will be to maintain the user-friendly interface and feature set that you've come to love. However, instead of continuing with the custom storage engine that has been causing several issues, we will transition Hive's data storage to Isar.
This significant change comes with several exciting advantages, including support for multiple isolates, significantly improving resource efficiency and reducing startup time, among others. Moreover, this will simplify the maintenance of Hive, ensuring its longevity through sustained support.
I cannot thank you enough for your continued support and use of Hive. Together, let's continue to make it a tool we all love and rely on. 💜
Simon
The text was updated successfully, but these errors were encountered: