Uploaded image for project: 'Realm Java SDK'
  1. Realm Java SDK
  2. RJAVA-321

Open realm files as readonly

      Goal

      I'm using realm databases as separate files downloaded from server and use their MD5 hash to check if file needs to be updated or downloaded again.
      But when realm upgrades, internal format will change and this can cause problem.
      I didn't upgraded realm from version 2 until now because of this. I saw there's a readonly() future so I upgraded my realm and I noticed that it's only for assets!
      1- In documents I never saw anything about this error :
      Only Realms provided using 'assetFile(path)' can be marked read-only. No such Realm was provided.

      This is documents for readonly :
      Setting this will cause the Realm to become read only and all write transactions made against this Realm will fail with an IllegalStateException.
      This in particular mean that initialData(Realm.Transaction) will not work in combination with a read only Realm and setting this will result in a IllegalStateException being thrown.
      Marking a Realm as read only only applies to the Realm in this process. Other processes can still write to the Realm.

      Expected Results

      RealmConfiguration.Builder()
      .name(name)
      .encryptionKey(k)
      .modules(new MyModules())
      .readOnly()
      .build());

      This should work for every realm file! not just for assets

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: