-
Notifications
You must be signed in to change notification settings - Fork 17
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
How do we drop and recreate the entire collection without impacting the reading thread? #156
Comments
@leemaguire : Can you please throw some lights on the above? I am actually stuck with that. Thanks for your help. |
Hi @vtharmalingam, that function is not currently exposed. I'll get a PR up that exposes the functionality soon. |
Thank you very much for the update, @leemaguire. Really appreciated. |
@leemaguire : |
For the meantime you can do this until we expose the correct API to remove all objects: auto res = realm.objects<AllTypesObject>();
realm.write([&] {
while (realm.objects<AllTypesObject>().size() > 0) {
auto obj = realm.objects<AllTypesObject>()[0];
realm.remove(obj);
}
}); |
Sure, this is really helpful. Thank you @leemaguire, as always! |
Hi,
Thanks |
Hi,
I have a use case wherein I need to drop my table/collection every 30 minutes (or so) and recreate it with new data. The important requirement is that the other thread that reads should not run out of data (from the said table) at any moment. The main thread should drop and recreate the collection without impacting the reading thread, which has it's own realm instance.
So I have two Qs here:
realm_instance. rite([&] { //drop the collection }
?BTW, my use case can even let me build a new collection while loading the new data, so that can swap the name post-loading, if that is an option available too.
Please advise. Thanks for your help in advance.
Regards,
Tharma
The text was updated successfully, but these errors were encountered: