I'm using ROS 2.0
with the latest client SDK for Xamarin
. In my app a user has several DataStore
objects (each represented by a separate realm). The user can create and delete DataStores
(realms). Creation just works fine but calling Realm.DeleteRealm(someDataStore.Realm.Config);
doesn't delete the realm file on the server.
I'm disposing the Realm before trying to delete it by calling:
someDataStore.Realm.Dispose();
Realm.DeleteRealm(someDataStore.Realm.Config);
But it's still there on ROS
. As Realm Studio doesn't support delete a realm file, how to clear unused realms from ROS
?
You're right - by design, the Realm.DeleteRealm
method will only delete the local copy and not the remote Realm. If you're absolutely certain you need to delete the remote Realm, you can use ROS's REST API to do so:
wget --method DELETE --header 'Authorization: %ADMIN-TOKEN%' http://%ROS-URL%/realms/files/%REALM-PATH%
where
%REALM-PATH%
is the url-encoded virtual path of the Realm file you want to delete, e.g. /some-user-id/myrealm
will become some-user-id%2Fmyrealm
. %ADMIN-TOKEN%
can be found in %PATH-TO-ROS%/data/keys/admin.json
.%ROS-URL%
is evidently the url of your ROS instance.Keep in mind that if you delete the remote file, you should also delete any local copies from all apps that have synced with it or you'll get an error (i.e. a local copy will not try to re-sync itself with the deleted remote one).