Skip to content
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

RealmDictionary - 6b: allow comparison of ByteArray values by content #1254

Conversation

edualonso
Copy link
Contributor

@edualonso edualonso commented Jan 31, 2023

Revisited logic to allow comparison of byte arrays at structural level to facilitate remove operations on Map.values, Map.entries.

Pull request plan:

  • basic infrastructure and API: RealmMap and RealmDictionary interfaces and associated helper functions (stubs)
  • setting up exhaustive testing infrastructure, add support for copyToRealm for objects with dictionaries and interface functions get, put, putAll, remove and clear for all types except RealmAny (it will be done once the interface implementation is complete)
  • support for entries (i.e. RealmMapEntrySet, UnmanagedRealmMapEntry and ManagedRealmMapEntry) and internal entry set iterator (which enables iterating through the dictionary's k-v pairs externally)
  • containsKey, containsValue - currently missing support in the C-API ([C-API] - add support for Dictionary::get_keys(), Dictionary::contains(StringData key) and Dictionary::find_any(Mixed value) realm-core#6181)
  • values - this change entails refactoring RealmResults to contain primitive values
  • support for RealmAny
  • support for Deleteable and (dictionaries don't own objects like sets and lists do so removing them from the dictionary won't remove them from the realm) asFlow - currently blocked by [C-API] realm_dictionary_add_notification_callback does not return the actual keys of the values that change realm-core#6228
  • THIS PR: allow ByteArrays to be compared structurally to allow remove operations on entry set and values
  • support for copyFromRealm
  • support for dynamic realms
  • sync testing
  • documentation
  • changelog entry

Eduardo López added 30 commits January 17, 2023 14:22
…tAll, remove and clear for all types except RealmAny
…y-3-entryset

# Conflicts:
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/RealmDictionaryExt.kt
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt
#	packages/test-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/RealmDictionaryTests.kt
…underlying dictionary is modified in any way while iterating
…and added tests for setting new values to managed entries
…ove-clear

# Conflicts:
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/RealmDictionaryExt.kt
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmMap.kt
…ove-clear

# Conflicts:
#	packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt
# Conflicts:
#	packages/cinterop/src/nativeDarwin/kotlin/io/realm/kotlin/internal/interop/RealmInterop.kt
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/ext/RealmDictionaryExt.kt
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt
#	packages/test-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/RealmDictionaryTests.kt
# Conflicts:
#	packages/test-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/RealmDictionaryTests.kt
if (classifier != ByteArray::class && classifier != RealmObject::class) {
// Ignore RealmObject: structural equality cannot be assessed for this type when removing
// entries from the entry set
if (classifier != RealmObject::class) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After talking. We should add a TODO linking to #1097

Eduardo López added 24 commits January 31, 2023 16:46
…b-revisited-comparison-semantics-for-bytearray
…b-revisited-comparison-semantics-for-bytearray
…b-revisited-comparison-semantics-for-bytearray
# Conflicts:
#	packages/test-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/RealmDictionaryTests.kt
…b-revisited-comparison-semantics-for-bytearray
…ects

# Conflicts:
#	packages/test-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/RealmDictionaryTests.kt
…b-revisited-comparison-semantics-for-bytearray
…b-revisited-comparison-semantics-for-bytearray
…d-keys

# Conflicts:
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt
…b-revisited-comparison-semantics-for-bytearray
Base automatically changed from el/dictionary-6-contains-and-keys to el/dictionary-feature February 1, 2023 16:24
…comparison-semantics-for-bytearray

# Conflicts:
#	packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt
#	packages/test-base/src/androidAndroidTest/kotlin/io/realm/kotlin/test/shared/RealmDictionaryTests.kt
@edualonso edualonso merged commit c4d2fc3 into el/dictionary-feature Feb 1, 2023
@edualonso edualonso deleted the el/dictionary-6b-revisited-comparison-semantics-for-bytearray branch February 1, 2023 18:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants