@react-native-ohos/react-native-mmkv 3.3.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MMKV/Core/CMakeLists.txt +172 -0
- package/MMKV/Core/CodedInputData.cpp +252 -0
- package/MMKV/Core/CodedInputData.h +87 -0
- package/MMKV/Core/CodedInputDataCrypt.cpp +280 -0
- package/MMKV/Core/CodedInputDataCrypt.h +87 -0
- package/MMKV/Core/CodedInputDataCrypt_OSX.cpp +62 -0
- package/MMKV/Core/CodedInputData_OSX.cpp +92 -0
- package/MMKV/Core/CodedOutputData.cpp +186 -0
- package/MMKV/Core/CodedOutputData.h +88 -0
- package/MMKV/Core/Core.xcodeproj/project.pbxproj +707 -0
- package/MMKV/Core/Core.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/MMKV/Core/Core.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/Core.xcscheme +67 -0
- package/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/MMKVWatchCore.xcscheme +67 -0
- package/MMKV/Core/InterProcessLock.cpp +186 -0
- package/MMKV/Core/InterProcessLock.h +119 -0
- package/MMKV/Core/InterProcessLock_Android.cpp +103 -0
- package/MMKV/Core/InterProcessLock_Win32.cpp +108 -0
- package/MMKV/Core/KeyValueHolder.cpp +236 -0
- package/MMKV/Core/KeyValueHolder.h +122 -0
- package/MMKV/Core/MMBuffer.cpp +210 -0
- package/MMKV/Core/MMBuffer.h +111 -0
- package/MMKV/Core/MMKV.cpp +1702 -0
- package/MMKV/Core/MMKV.h +595 -0
- package/MMKV/Core/MMKVLog.cpp +127 -0
- package/MMKV/Core/MMKVLog.h +86 -0
- package/MMKV/Core/MMKVLog_Android.cpp +134 -0
- package/MMKV/Core/MMKVMetaInfo.hpp +99 -0
- package/MMKV/Core/MMKVPredef.h +293 -0
- package/MMKV/Core/MMKV_Android.cpp +261 -0
- package/MMKV/Core/MMKV_IO.cpp +1905 -0
- package/MMKV/Core/MMKV_IO.h +57 -0
- package/MMKV/Core/MMKV_OSX.cpp +423 -0
- package/MMKV/Core/MMKV_OSX.h +57 -0
- package/MMKV/Core/MemoryFile.cpp +603 -0
- package/MMKV/Core/MemoryFile.h +194 -0
- package/MMKV/Core/MemoryFile_Android.cpp +236 -0
- package/MMKV/Core/MemoryFile_Linux.cpp +125 -0
- package/MMKV/Core/MemoryFile_OSX.cpp +142 -0
- package/MMKV/Core/MemoryFile_Win32.cpp +554 -0
- package/MMKV/Core/MiniPBCoder.cpp +672 -0
- package/MMKV/Core/MiniPBCoder.h +151 -0
- package/MMKV/Core/MiniPBCoder_OSX.cpp +237 -0
- package/MMKV/Core/PBEncodeItem.hpp +104 -0
- package/MMKV/Core/PBUtility.cpp +61 -0
- package/MMKV/Core/PBUtility.h +148 -0
- package/MMKV/Core/ScopedLock.hpp +69 -0
- package/MMKV/Core/ThreadLock.cpp +75 -0
- package/MMKV/Core/ThreadLock.h +81 -0
- package/MMKV/Core/ThreadLock_Win32.cpp +89 -0
- package/MMKV/Core/aes/AESCrypt.cpp +273 -0
- package/MMKV/Core/aes/AESCrypt.h +112 -0
- package/MMKV/Core/aes/openssl/openssl_aes-armv4.S +1243 -0
- package/MMKV/Core/aes/openssl/openssl_aes.h +130 -0
- package/MMKV/Core/aes/openssl/openssl_aes_core.cpp +1044 -0
- package/MMKV/Core/aes/openssl/openssl_aes_locl.h +38 -0
- package/MMKV/Core/aes/openssl/openssl_aesv8-armx.S +308 -0
- package/MMKV/Core/aes/openssl/openssl_arm_arch.h +84 -0
- package/MMKV/Core/aes/openssl/openssl_cfb128.cpp +97 -0
- package/MMKV/Core/aes/openssl/openssl_md32_common.h +254 -0
- package/MMKV/Core/aes/openssl/openssl_md5.h +49 -0
- package/MMKV/Core/aes/openssl/openssl_md5_dgst.cpp +166 -0
- package/MMKV/Core/aes/openssl/openssl_md5_locl.h +75 -0
- package/MMKV/Core/aes/openssl/openssl_md5_one.cpp +30 -0
- package/MMKV/Core/aes/openssl/openssl_opensslconf.h +271 -0
- package/MMKV/Core/core.vcxproj +288 -0
- package/MMKV/Core/core.vcxproj.filters +150 -0
- package/MMKV/Core/crc32/Checksum.h +75 -0
- package/MMKV/Core/crc32/crc32_armv8.cpp +134 -0
- package/MMKV/Core/crc32/zlib/CMakeLists.txt +60 -0
- package/MMKV/Core/crc32/zlib/crc32.cpp +55 -0
- package/MMKV/Core/crc32/zlib/crc32.h +48 -0
- package/MMKV/Core/crc32/zlib/zconf.h +380 -0
- package/MMKV/Core/crc32/zlib/zutil.h +25 -0
- package/MMKV/README.md +354 -0
- package/README.md +5 -0
- package/cpp/MMKVManagedBuffer.h +32 -0
- package/cpp/MmkvHostObject.cpp +355 -0
- package/cpp/MmkvHostObject.h +32 -0
- package/cpp/MmkvLogger.h +35 -0
- package/cpp/NativeMmkvModule.cpp +43 -0
- package/cpp/NativeMmkvModule.h +38 -0
- package/harmony/reactNativeMMKV/BuildProfile.ets +17 -0
- package/harmony/reactNativeMMKV/LICENSE +20 -0
- package/harmony/reactNativeMMKV/NOTICE +34 -0
- package/harmony/reactNativeMMKV/README.OpenSource +11 -0
- package/harmony/reactNativeMMKV/build-profile.json5 +9 -0
- package/harmony/reactNativeMMKV/hvigorfile.ts +6 -0
- package/harmony/reactNativeMMKV/index.ets +24 -0
- package/harmony/reactNativeMMKV/oh-package.json5 +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/CMakeLists.txt +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/ComponentDescriptors.h +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/EventEmitters.cpp +41 -0
- package/harmony/reactNativeMMKV/src/main/cpp/EventEmitters.h +182 -0
- package/harmony/reactNativeMMKV/src/main/cpp/HarmonyLogger.cpp +32 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.clang-format +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.dockerignore +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.github/FUNDING.yml +14 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.github/ISSUE_TEMPLATE/bug_report.md +45 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/.gitmodules +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/build.gradle +54 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/checkstyle.xml +156 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/debug.keystore +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/android-publish-private.gradle +207 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/android-publish.gradle +276 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/build_library.gradle +62 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/check.gradle +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradle.properties +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradlew +172 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/gradlew.bat +84 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/CMakeLists.txt +56 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/build.gradle +238 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/gradle.properties +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/proguard-rules.pro +9 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/androidTest/AndroidManifest.xml +11 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/androidTest/java/com/tencent/mmkv/MMKVTest.java +270 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/androidTest/java/com/tencent/mmkv/MMKVTestService.java +79 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/AndroidManifest.xml +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/aidl/com/tencent/mmkv/ParcelableMMKV.aidl +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/cpp/flutter-bridge.cpp +706 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/cpp/native-bridge.cpp +1244 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKV.java +2024 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVContentChangeNotification.java +34 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVContentProvider.java +174 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVHandler.java +63 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVLogLevel.java +52 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVProcessUtil.java +100 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/MMKVRecoverStrategic.java +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/NameSpace.java +214 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/NativeBuffer.java +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/ParcelableMMKV.java +108 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkv/src/main/java/com/tencent/mmkv/UnsupportedArchitectureException.java +27 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvannotation/build.gradle +34 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvannotation/src/main/AndroidManifest.xml +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvannotation/src/main/java/dalvik/annotation/optimization/FastNative.java +104 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/build.gradle +116 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/proguard-rules.pro +24 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/AndroidManifest.xml +54 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/aidl/com/tencent/mmkvdemo/IAshmemMMKV.aidl +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/cpp/CMakeLists.txt +50 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/cpp/mmkvdemo.cpp +245 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/Baseline.java +297 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/BenchMarkBaseService.java +363 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/FakeInfo.java +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/Info.java +69 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MainActivity.java +1029 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MultiProcessSharedPreferences.java +710 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MyApplication.java +130 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MyService.java +105 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/MyService_1.java +92 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/SQLiteKV.java +143 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/java/com/tencent/mmkvdemo/TestParcelable.java +70 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/kotlin/KotlinUsecase.kt +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/layout/activity_main.xml +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/values/colors.xml +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/values/strings.xml +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/mmkvdemo/src/main/res/values/styles.xml +11 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/pmd-ruleset.xml +44 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/proguard-rules/proguard-rules-android-lib.pro +54 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/proguard-rules/proguard-rules-test.pro +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Android/MMKV/settings.gradle +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/CHANGELOG.md +979 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/CODE_OF_CONDUCT.md +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/CONTRIBUTING.md +61 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CMakeLists.txt +207 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputData.cpp +248 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputData.h +86 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputDataCrypt.cpp +276 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputDataCrypt.h +86 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputDataCrypt_OSX.cpp +62 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedInputData_OSX.cpp +92 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedOutputData.cpp +182 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/CodedOutputData.h +86 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/project.pbxproj +703 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/Core.xcscheme +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/Core.xcodeproj/xcshareddata/xcschemes/MMKVWatchCore.xcscheme +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock.cpp +211 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock.h +124 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock_Android.cpp +104 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/InterProcessLock_Win32.cpp +108 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/KeyValueHolder.cpp +237 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/KeyValueHolder.h +122 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMBuffer.cpp +207 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMBuffer.h +119 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV.cpp +1791 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV.h +781 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVLog.cpp +127 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVLog.h +86 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVLog_Android.cpp +134 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVMetaInfo.hpp +99 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKVPredef.h +310 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_Android.cpp +365 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_IO.cpp +2049 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_IO.h +85 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_OSX.cpp +589 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MMKV_OSX.h +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile.cpp +716 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile.h +212 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_Android.cpp +247 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_Linux.cpp +126 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_OSX.cpp +173 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MemoryFile_Win32.cpp +655 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MiniPBCoder.cpp +668 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MiniPBCoder.h +150 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/MiniPBCoder_OSX.cpp +237 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/PBEncodeItem.hpp +102 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/PBUtility.cpp +61 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/PBUtility.h +148 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ScopedLock.hpp +69 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ThreadLock.cpp +75 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ThreadLock.h +81 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/ThreadLock_Win32.cpp +89 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/AESCrypt.cpp +293 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/AESCrypt.h +117 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aes.h +98 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aes_core.cpp +1044 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aes_locl.h +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_aesv8-armx.S +308 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_arm_arch.h +84 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_cfb128.cpp +97 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md32_common.h +254 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5.h +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5_dgst.cpp +166 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5_locl.h +75 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_md5_one.cpp +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/aes/openssl/openssl_opensslconf.h +271 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/core.vcxproj +288 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/core.vcxproj.filters +150 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/CMakeLists.txt +60 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/Checksum.h +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/crc32_armv8.cpp +134 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/crc32.cpp +55 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/crc32.h +48 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/zconf.h +380 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Core/crc32/zlib/zutil.h +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Dockerfile +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/LICENSE.TXT +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKV.podspec +40 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKV.xcworkspace/contents.xcworkspacedata +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKV.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKVAppExtension.podspec +37 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKVCore.podspec +47 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/MMKVWatchExtension.podspec +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Makefile +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/AppScope/app.json5 +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/AppScope/resources/base/element/string.json +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/AppScope/resources/base/media/app_icon.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/BuildProfile.ets +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/CHANGELOG.md +75 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/Index.ets +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/README.md +208 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/build-profile.json5 +40 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/consumer-rules.txt +61 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/example/Index.ets +686 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/example/Util.ets +31 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/hvigorfile.ts +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/obfuscation-rules.txt +18 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/oh-package.json5 +22 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/CMakeLists.txt +43 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/flutter-bridge.cpp +703 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/native_bridge.cpp +1840 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/types/libmmkv/index.d.ts +80 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/cpp/types/libmmkv/oh-package.json5 +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/MMKV.ets +1073 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/MMKVHandler.ets +111 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/MMKVLogLevel.ets +50 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/NativeBuffer.ets +34 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/ets/utils/Util.ts +24 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/MMKV/src/main/module.json5 +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/build-profile.json5 +62 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/dependencies/hvigor-4.3.0.tgz +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/dependencies/hvigor-ohos-plugin-4.3.0.tgz +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/build-profile.json5 +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/hvigorfile.ts +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/obfuscation-rules.txt +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/oh-package.json5 +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/CMakeLists.txt +54 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/napi_init.cpp +233 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/types/libentry/index.d.ts +1 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/cpp/types/libentry/oh-package.json5 +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/Util/Baseline.ets +188 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/Util/MyMMKVHandler.ets +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/Util/Util.ets +220 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/entryability/EntryAbility.ets +107 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/pages/Index.ets +766 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/ets/process/DemoProcess.ets +31 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/module.json5 +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/element/color.json +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/background.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/foreground.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/mock/mock-config.json5 +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/test/Ability.test.ets +55 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/test/List.test.ets +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/testability/TestAbility.ets +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/testability/pages/Index.ets +37 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets +110 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/module.json5 +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/element/color.json +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/media/icon.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/ohosTest/resources/base/profile/test_pages.json +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/test/List.test.ets +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/entry/src/test/LocalUnit.test.ets +53 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/hvigor/hvigor-config.json5 +21 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/hvigorfile.ts +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/OpenHarmony/oh-package.json5 +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/CMakeLists.txt +27 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/CMakeLists.txt +65 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/TestInterProcessLock.cpp +130 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/UnitTest.cpp +272 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/demo.cpp +1431 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/demo/process.cpp +78 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/CMakeLists.txt +87 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/callback.go +121 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/go.mod +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/golang-bridge.cpp +731 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/golang-bridge.h +131 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/mmkv.go +817 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/mmkv_test.go +33 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/test/go.mod +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/golang/test/main.go +455 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/src/CMakeLists.txt +83 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/POSIX/src/libmmkv.cpp +21 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/CMakeLists.txt +62 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/README.md +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/demo.py +368 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/libmmkv_python.cpp +454 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.appveyor.yml +35 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.clang-format +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.clang-tidy +77 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.cmake-format.yaml +73 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.codespell-ignore-lines +24 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.gitattributes +1 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/CODEOWNERS +9 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/CONTRIBUTING.md +388 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +61 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/dependabot.yml +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/labeler.yml +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/labeler_merged.yml +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/matchers/pylint.json +32 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/pull_request_template.md +19 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/ci.yml +1233 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/configure.yml +92 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/format.yml +60 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/labeler.yml +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/pip.yml +117 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.github/workflows/upstream.yml +116 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.pre-commit-config.yaml +156 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/.readthedocs.yml +20 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/CMakeLists.txt +375 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/LICENSE +29 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/MANIFEST.in +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/README.rst +181 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/SECURITY.md +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/Doxyfile +21 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/_static/css/custom.css +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/chrono.rst +81 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/custom.rst +93 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/eigen.rst +310 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/functional.rst +109 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/index.rst +43 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/overview.rst +170 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/stl.rst +249 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/cast/strings.rst +296 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/classes.rst +1335 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/embedding.rst +262 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/exceptions.rst +401 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/functions.rst +614 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/misc.rst +429 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/index.rst +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/numpy.rst +453 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/object.rst +286 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/advanced/smart_ptrs.rst +174 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/basics.rst +307 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/benchmark.py +89 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/benchmark.rst +95 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/changelog.rst +3121 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/classes.rst +555 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/cmake/index.rst +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/compiling.rst +726 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/conf.py +369 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/faq.rst +308 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/index.rst +48 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/installing.rst +105 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/limitations.rst +72 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11-logo.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/reference.rst +130 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/release.rst +143 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/requirements.in +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/requirements.txt +275 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/docs/upgrade.rst +594 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/attr.h +690 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/buffer_info.h +208 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/cast.h +1848 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/chrono.h +225 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/common.h +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/complex.h +74 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/class.h +754 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/common.h +1268 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/descr.h +172 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/init.h +434 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/internals.h +749 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/type_caster_base.h +1214 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/detail/typeid.h +65 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen/common.h +9 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen/matrix.h +714 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen/tensor.h +517 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eigen.h +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/embed.h +313 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/eval.h +156 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/functional.h +138 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/gil.h +219 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/gil_safe_call_once.h +91 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/iostream.h +265 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/numpy.h +2135 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/operators.h +202 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/options.h +92 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/pybind11.h +3026 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/pytypes.h +2604 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/stl/filesystem.h +115 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/stl.h +448 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/stl_bind.h +822 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/type_caster_pyobject_ptr.h +61 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/include/pybind11/typing.h +239 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/noxfile.py +107 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/__init__.py +19 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/__main__.py +63 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/_version.py +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/commands.py +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/py.typed +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pybind11/setup_helpers.py +500 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/pyproject.toml +87 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/setup.cfg +43 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/setup.py +149 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/CMakeLists.txt +589 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/conftest.py +224 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/constructor_stats.h +322 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/cross_module_gil_utils.cpp +111 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/cross_module_interleaved_error_already_set.cpp +54 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/eigen_tensor_avoid_stl_array.cpp +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/env.py +31 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_python_package/pytest.ini +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_python_package/test_files.py +296 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_setuptools/pytest.ini +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/extra_setuptools/test_setuphelper.py +153 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/local_bindings.h +92 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/object.h +205 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pybind11_cross_module_tests.cpp +149 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pybind11_tests.cpp +131 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pybind11_tests.h +98 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/pytest.ini +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/requirements.txt +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_async.cpp +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_async.py +26 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_buffers.cpp +259 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_buffers.py +230 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_builtin_casters.cpp +387 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_builtin_casters.py +530 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_call_policies.cpp +113 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_call_policies.py +249 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_callbacks.cpp +280 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_callbacks.py +227 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_chrono.cpp +81 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_chrono.py +207 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_class.cpp +656 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_class.py +503 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/CMakeLists.txt +80 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/embed.cpp +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/main.cpp +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +47 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +41 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +47 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_cmake_build/test.py +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_const_name.cpp +55 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_const_name.py +31 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_constants_and_functions.cpp +158 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_constants_and_functions.py +58 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_copy_move.cpp +544 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_copy_move.py +140 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_casters.cpp +217 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_casters.py +124 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_setup.cpp +41 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_custom_type_setup.py +50 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_docstring_options.cpp +129 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_docstring_options.py +66 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_matrix.cpp +443 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_matrix.py +816 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_tensor.cpp +18 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_tensor.inl +332 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eigen_tensor.py +290 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/CMakeLists.txt +54 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/catch.cpp +43 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/external_module.cpp +20 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/test_interpreter.cpp +488 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/test_interpreter.py +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_embed/test_trampoline.py +18 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_enum.cpp +133 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_enum.py +270 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eval.cpp +118 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eval.py +52 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_eval_call.py +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_exceptions.cpp +388 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_exceptions.h +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_exceptions.py +434 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_factory_constructors.cpp +430 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_factory_constructors.py +518 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_gil_scoped.cpp +144 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_gil_scoped.py +244 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_iostream.cpp +126 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_iostream.py +293 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_kwargs_and_defaults.cpp +325 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_kwargs_and_defaults.py +428 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_local_bindings.cpp +106 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_local_bindings.py +259 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_methods_and_attributes.cpp +492 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_methods_and_attributes.py +539 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_modules.cpp +125 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_modules.py +118 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_multiple_inheritance.cpp +341 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_multiple_inheritance.py +495 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_array.cpp +547 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_array.py +672 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_dtypes.cpp +639 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_dtypes.py +448 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_vectorize.cpp +107 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_numpy_vectorize.py +268 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_opaque_types.cpp +77 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_opaque_types.py +60 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_operator_overloading.cpp +281 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_operator_overloading.py +153 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pickling.cpp +194 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pickling.py +95 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_python_multiple_inheritance.cpp +45 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_python_multiple_inheritance.py +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pytypes.cpp +926 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_pytypes.py +1050 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_sequences_and_iterators.cpp +600 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_sequences_and_iterators.py +267 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_smart_ptr.cpp +473 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_smart_ptr.py +317 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl.cpp +549 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl.py +383 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl_binders.cpp +275 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_stl_binders.py +395 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_tagbased_polymorphic.cpp +147 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_tagbased_polymorphic.py +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_thread.cpp +66 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_thread.py +44 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_type_caster_pyobject_ptr.cpp +167 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_type_caster_pyobject_ptr.py +122 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_union.cpp +22 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_union.py +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_a.cpp +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_a.py +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_b.cpp +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_unnamed_namespace_b.py +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_vector_unique_ptr_member.cpp +54 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_vector_unique_ptr_member.py +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_virtual_functions.cpp +592 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/test_virtual_functions.py +460 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tests/valgrind-python.supp +117 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/FindCatch.cmake +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/FindEigen3.cmake +86 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/FindPythonLibsNew.cmake +310 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/JoinPaths.cmake +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/check-style.sh +44 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/cmake_uninstall.cmake.in +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/codespell_ignore_lines_from_errors.py +40 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/libsize.py +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/make_changelog.py +92 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11.pc.in +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11Common.cmake +429 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11Config.cmake.in +233 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11GuessPythonExtSuffix.cmake +86 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11NewTools.cmake +341 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pybind11Tools.cmake +239 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/pyproject.toml +3 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/setup_global.py.in +63 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/setup_main.py.in +44 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/pybind11/tools/test-pybind11GuessPythonExtSuffix.cmake +161 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/setup.py +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Python/unit_test.py +209 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/README.md +357 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/README_CN.md +301 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/SECURITY.md +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Script/dumpJavaSignature.py +144 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Script/formatCode.py +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/.clang-format +35 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32.sln +58 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/Win32Demo.cpp +548 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/Win32Demo.vcxproj +190 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/Win32Demo.vcxproj.filters +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/pch.cpp +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32Demo/pch.h +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/Win32DemoProcess.cpp +88 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/Win32DemoProcess.vcxproj +188 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/Win32DemoProcess.vcxproj.filters +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/pch.cpp +21 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/Win32/Win32DemoProcess/pch.h +24 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/.metadata +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/.vscode/launch.json +162 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/.vscode/settings.json +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/CHANGELOG.md +196 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/README.md +217 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/analysis_options.yaml +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/README.md +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/build.gradle +79 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/AndroidManifest.xml +41 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/java/com/tencent/mmkv_example/MainActivity.java +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/drawable/launch_background.xml +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/main/res/values/styles.xml +18 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/app/src/profile/AndroidManifest.xml +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/build.gradle +29 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/gradle.properties +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/settings.gradle +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/android/settings_aar.gradle +1 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/AppFrameworkInfo.plist +26 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/Debug.xcconfig +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/Release.xcconfig +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldb_helper.py +32 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Flutter/ephemeral/flutter_lldbinit +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Podfile +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/AppDelegate.h +26 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/AppDelegate.m +33 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Base.lproj/Main.storyboard +29 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Info.plist +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/Runner.entitlements +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner/main.m +29 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.pbxproj +612 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +90 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/lib/main.dart +565 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/CMakeLists.txt +128 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/CMakeLists.txt +88 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/generated_plugin_registrant.cc +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/generated_plugin_registrant.h +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/flutter/generated_plugins.cmake +24 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/CMakeLists.txt +26 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/main.cc +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/my_application.cc +130 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/linux/runner/my_application.h +18 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Flutter/Flutter-Debug.xcconfig +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Flutter/Flutter-Release.xcconfig +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Flutter/GeneratedPluginRegistrant.swift +14 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Podfile +47 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/AppDelegate.swift +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Base.lproj/MainMenu.xib +343 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/AppInfo.xcconfig +14 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/Debug.xcconfig +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/Release.xcconfig +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Configs/Warnings.xcconfig +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/DebugProfile.entitlements +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Info.plist +32 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/MainFlutterWindow.swift +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner/Release.entitlements +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcodeproj/project.pbxproj +800 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +99 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/macos/RunnerTests/RunnerTests.swift +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/AppScope/app.json5 +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/AppScope/resources/base/element/string.json +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/AppScope/resources/base/media/app_icon.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/build-profile.json5 +41 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/build-profile.json5 +34 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/hvigorfile.ts +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/oh-package.json5 +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/ets/pages/Index.ets +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/module.json5 +53 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/element/color.json +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/media/icon.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/en_US/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/main/resources/zh_CN/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/test/Ability.test.ets +50 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/test/List.test.ets +20 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/testability/TestAbility.ets +63 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/testability/pages/Index.ets +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts +64 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/module.json5 +51 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/element/color.json +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/element/string.json +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/media/icon.png +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/entry/src/ohosTest/resources/base/profile/test_pages.json +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/hvigor/hvigor-config.json5 +20 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/hvigorfile.ts +21 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/ohos/oh-package.json5 +21 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/pubspec.yaml +75 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/CMakeLists.txt +108 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/CMakeLists.txt +109 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/generated_plugin_registrant.cc +14 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/generated_plugin_registrant.h +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/flutter/generated_plugins.cmake +24 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/CMakeLists.txt +40 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/Runner.rc +121 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/flutter_window.cpp +71 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/flutter_window.h +33 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/main.cpp +43 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/resource.h +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/resources/app_icon.ico +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/runner.exe.manifest +14 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/utils.cpp +65 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/utils.h +19 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/win32_window.cpp +288 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/example/windows/runner/win32_window.h +102 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/lib/mmkv.dart +1052 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/mmkv.iml +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/pubspec.yaml +62 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/test/mmkv_test.dart +48 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/tool/fix_mmkv_plugin_name.rb +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv/tool/mmkvpodhelper.rb +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv.iml +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/CHANGELOG.md +48 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/README.md +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/build.gradle +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradle.properties +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradlew +160 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/gradlew.bat +90 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/settings.gradle +1 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/src/main/AndroidManifest.xml +1 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/android/src/main/java/com/tencent/mmkv/MMKVPlugin.java +82 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/lib/mmkv_android.dart +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_android/pubspec.yaml +40 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/.metadata +33 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/CHANGELOG.md +52 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/README.md +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/MMKVPlugin.h +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/MMKVPlugin.mm +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/flutter-bridge.h +32 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/Classes/flutter-bridge.mm +693 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/darwin/mmkv_ios.podspec +35 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/lib/mmkv_ios.dart +78 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ios/pubspec.yaml +44 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/.metadata +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/CHANGELOG.md +9 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/README.md +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/analysis_options.yaml +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/lib/mmkv_linux.dart +69 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/CMakeLists.txt +63 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/flutter-bridge.cpp +694 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/include/mmkv_linux/mmkv_linux_plugin.h +46 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/linux/mmkv_linux_plugin.cc +97 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_linux/pubspec.yaml +47 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/.metadata +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/CHANGELOG.md +42 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/README.md +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/analysis_options.yaml +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/lib/mmkv_ohos.dart +84 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/build-profile.json5 +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/hvigorfile.ts +2 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/index.ets +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/oh-package.json5 +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/src/main/ets/components/plugin/MMKVPlugin.ets +78 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/ohos/src/main/module.json5 +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_ohos/pubspec.yaml +50 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/CHANGELOG.md +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/README.md +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/lib/mmkv_platform_ffi.dart +363 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/lib/mmkv_platform_interface.dart +363 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_platform_interface/pubspec.yaml +23 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/.metadata +30 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/CHANGELOG.md +9 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/LICENSE +193 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/README.md +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/analysis_options.yaml +4 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/lib/mmkv_win32.dart +69 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/pubspec.yaml +47 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/CMakeLists.txt +71 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/flutter-bridge.cpp +721 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/include/mmkv_win32/mmkv_win32_plugin.h +43 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/flutter/mmkv_win32/windows/mmkv_win32_plugin.cpp +88 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/AutoCleanInfo.hpp +65 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/MMKV.h +552 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/MMKVHandler.h +60 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/Resources/Info.plist +24 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV/libMMKV.mm +1361 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/project.pbxproj +967 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKV For App Extension.xcscheme +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKV Static.xcscheme +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKV.xcscheme +76 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKV/MMKV.xcodeproj/xcshareddata/xcschemes/MMKVWatchExtension.xcscheme +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/Config.xcconfig +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/AppDelegate.h +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/AppDelegate.m +43 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Assets.xcassets/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Base.lproj/LaunchScreen.storyboard +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Base.lproj/Main.storyboard +42 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/Info.plist +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/MMKVCatalystDemo.entitlements +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/SceneDelegate.h +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/SceneDelegate.m +58 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/ViewController.h +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/ViewController.mm +85 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVCatalystDemo/main.m +19 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/AppDelegate.h +27 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/AppDelegate.m +135 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/DemoSwiftUsage.swift +82 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/MMKVDemo-Bridging-Header.h +22 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Base.lproj/LaunchScreen.storyboard +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Base.lproj/Main.storyboard +48 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/Info.plist +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/MMKVDemo.entitlements +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/testReadOnly +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/Resources/testReadOnly.crc +0 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/TestMMKVCpp.cpp +204 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/TestMMKVCpp.hpp +18 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController+TestCaseBad.h +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController+TestCaseBad.mm +200 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController.h +32 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/ViewController.mm +1245 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo/main.m +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.pbxproj +1944 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/MMKVDemo.xcscheme +88 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/MMKVMacDemo.xcscheme +78 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/MMKVTodayExtensionDemo.xcscheme +116 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/WatchApp (Notification).xcscheme +106 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme +102 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemo.xcodeproj/xcshareddata/xcschemes/kvdemo.xcscheme +78 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemoTests/Info.plist +22 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemoTests/MMKVDemoTests.mm +554 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVDemoTests/MMKVPerformanceTest.mm +118 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/AppDelegate.h +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/AppDelegate.m +27 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Assets.xcassets/AppIcon.appiconset/Contents.json +58 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Assets.xcassets/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Base.lproj/Main.storyboard +718 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/Info.plist +32 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/MMKVMacDemo.entitlements +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/ViewController.h +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/ViewController.mm +352 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVMacDemo/main.m +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/Base.lproj/MainInterface.storyboard +45 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/Info.plist +31 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/MMKVTodayExtensionDemo.entitlements +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/TodayViewController.h +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVTodayExtensionDemo/TodayViewController.m +106 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Content.imageset/Contents.json +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Back.solidimagestacklayer/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Contents.json +17 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Content.imageset/Contents.json +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Front.solidimagestacklayer/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Content.imageset/Contents.json +12 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/AppIcon.solidimagestack/Middle.solidimagestacklayer/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Assets.xcassets/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/ContentView.swift +71 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Info.plist +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/MMKVVisionDemoApp.swift +22 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/MMKVVisionDemo/Preview Content/Preview Assets.xcassets/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Assets.xcassets/AppIcon.appiconset/Contents.json +81 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Assets.xcassets/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Base.lproj/Interface.storyboard +47 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp/Info.plist +33 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Circular.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Contents.json +48 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Extra Large.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Bezel.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Circular.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Corner.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Graphic Large Rectangular.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Modular.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Complication.complicationset/Utilitarian.imageset/Contents.json +28 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Assets.xcassets/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/ExtensionDelegate.h +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/ExtensionDelegate.mm +135 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/Info.plist +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/InterfaceController.h +26 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/InterfaceController.m +50 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/NotificationController.h +26 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/NotificationController.m +60 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/WatchApp Extension/PushNotificationPayload.apns +20 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/AppDelegate.h +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/AppDelegate.m +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Assets.xcassets/Contents.json +6 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Base.lproj/LaunchScreen.storyboard +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Base.lproj/Main.storyboard +45 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/Info.plist +25 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/SceneDelegate.h +16 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/SceneDelegate.m +58 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/ViewController.h +15 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/ViewController.m +38 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/kvdemo.entitlements +10 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKV/iOS/MMKVDemo/kvdemo/main.m +19 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MMKVManagedBuffer.h +49 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MmkvCxx.cpp +152 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MmkvCxx.h +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MmkvHostObject.cpp +357 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MmkvHostObject.h +66 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MmkvLogger.h +52 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MmkvPlatformContext.cpp +37 -0
- package/harmony/reactNativeMMKV/src/main/cpp/MmkvPlatformContext.h +36 -0
- package/harmony/reactNativeMMKV/src/main/cpp/NativeMMKVComponentDescriptor.h +65 -0
- package/harmony/reactNativeMMKV/src/main/cpp/NativeMMKVJSIBinder.h +55 -0
- package/harmony/reactNativeMMKV/src/main/cpp/NativeMMKVPackage.h +67 -0
- package/harmony/reactNativeMMKV/src/main/cpp/Props.cpp +37 -0
- package/harmony/reactNativeMMKV/src/main/cpp/Props.h +42 -0
- package/harmony/reactNativeMMKV/src/main/cpp/ShadowNodes.cpp +39 -0
- package/harmony/reactNativeMMKV/src/main/cpp/ShadowNodes.h +41 -0
- package/harmony/reactNativeMMKV/src/main/cpp/States.cpp +40 -0
- package/harmony/reactNativeMMKV/src/main/cpp/States.h +45 -0
- package/harmony/reactNativeMMKV/src/main/ets/Logger.ts +65 -0
- package/harmony/reactNativeMMKV/src/main/ets/MmkvCxxPackage.ts +46 -0
- package/harmony/reactNativeMMKV/src/main/ets/MmkvCxxTurboModule.ts +60 -0
- package/harmony/reactNativeMMKV/src/main/ets/MmkvPlatformContextPackage.ts +46 -0
- package/harmony/reactNativeMMKV/src/main/ets/MmkvPlatformContextTurboModule.ts +48 -0
- package/harmony/reactNativeMMKV/src/main/module.json5 +7 -0
- package/harmony/reactNativeMMKV/src/main/resources/base/element/string.json +8 -0
- package/harmony/reactNativeMMKV/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/reactNativeMMKV/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/reactNativeMMKV/ts.ts +27 -0
- package/harmony/reactNativeMMKV.har +0 -0
- package/lib/commonjs/MMKV.js +124 -0
- package/lib/commonjs/MMKV.js.map +1 -0
- package/lib/commonjs/MemoryWarningListener.js +31 -0
- package/lib/commonjs/MemoryWarningListener.js.map +1 -0
- package/lib/commonjs/MemoryWarningListener.web.js +11 -0
- package/lib/commonjs/MemoryWarningListener.web.js.map +1 -0
- package/lib/commonjs/ModuleNotFoundError.js +75 -0
- package/lib/commonjs/ModuleNotFoundError.js.map +1 -0
- package/lib/commonjs/NativeMmkv.js +53 -0
- package/lib/commonjs/NativeMmkv.js.map +1 -0
- package/lib/commonjs/NativeMmkvPlatformContext.js +22 -0
- package/lib/commonjs/NativeMmkvPlatformContext.js.map +1 -0
- package/lib/commonjs/PlatformChecker.js +14 -0
- package/lib/commonjs/PlatformChecker.js.map +1 -0
- package/lib/commonjs/Types.js +32 -0
- package/lib/commonjs/Types.js.map +1 -0
- package/lib/commonjs/createMMKV.js +43 -0
- package/lib/commonjs/createMMKV.js.map +1 -0
- package/lib/commonjs/createMMKV.mock.js +43 -0
- package/lib/commonjs/createMMKV.mock.js.map +1 -0
- package/lib/commonjs/createMMKV.web.js +110 -0
- package/lib/commonjs/createMMKV.web.js.map +1 -0
- package/lib/commonjs/createTextEncoder.js +23 -0
- package/lib/commonjs/createTextEncoder.js.map +1 -0
- package/lib/commonjs/hooks.js +198 -0
- package/lib/commonjs/hooks.js.map +1 -0
- package/lib/commonjs/index.js +40 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/module/MMKV.js +119 -0
- package/lib/module/MMKV.js.map +1 -0
- package/lib/module/MemoryWarningListener.js +27 -0
- package/lib/module/MemoryWarningListener.js.map +1 -0
- package/lib/module/MemoryWarningListener.web.js +6 -0
- package/lib/module/MemoryWarningListener.web.js.map +1 -0
- package/lib/module/ModuleNotFoundError.js +70 -0
- package/lib/module/ModuleNotFoundError.js.map +1 -0
- package/lib/module/NativeMmkv.js +51 -0
- package/lib/module/NativeMmkv.js.map +1 -0
- package/lib/module/NativeMmkvPlatformContext.js +18 -0
- package/lib/module/NativeMmkvPlatformContext.js.map +1 -0
- package/lib/module/PlatformChecker.js +10 -0
- package/lib/module/PlatformChecker.js.map +1 -0
- package/lib/module/Types.js +31 -0
- package/lib/module/Types.js.map +1 -0
- package/lib/module/createMMKV.js +38 -0
- package/lib/module/createMMKV.js.map +1 -0
- package/lib/module/createMMKV.mock.js +38 -0
- package/lib/module/createMMKV.mock.js.map +1 -0
- package/lib/module/createMMKV.web.js +105 -0
- package/lib/module/createMMKV.web.js.map +1 -0
- package/lib/module/createTextEncoder.js +19 -0
- package/lib/module/createTextEncoder.js.map +1 -0
- package/lib/module/hooks.js +189 -0
- package/lib/module/hooks.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/src/MMKV.d.ts +34 -0
- package/lib/typescript/src/MMKV.d.ts.map +1 -0
- package/lib/typescript/src/MemoryWarningListener.d.ts +3 -0
- package/lib/typescript/src/MemoryWarningListener.d.ts.map +1 -0
- package/lib/typescript/src/MemoryWarningListener.web.d.ts +3 -0
- package/lib/typescript/src/MemoryWarningListener.web.d.ts.map +1 -0
- package/lib/typescript/src/ModuleNotFoundError.d.ts +7 -0
- package/lib/typescript/src/ModuleNotFoundError.d.ts.map +1 -0
- package/lib/typescript/src/NativeMmkv.d.ts +91 -0
- package/lib/typescript/src/NativeMmkv.d.ts.map +1 -0
- package/lib/typescript/src/NativeMmkvPlatformContext.d.ts +20 -0
- package/lib/typescript/src/NativeMmkvPlatformContext.d.ts.map +1 -0
- package/lib/typescript/src/PlatformChecker.d.ts +2 -0
- package/lib/typescript/src/PlatformChecker.d.ts.map +1 -0
- package/lib/typescript/src/Types.d.ts +172 -0
- package/lib/typescript/src/Types.d.ts.map +1 -0
- package/lib/typescript/src/__tests__/hooks.test.d.ts +2 -0
- package/lib/typescript/src/__tests__/hooks.test.d.ts.map +1 -0
- package/lib/typescript/src/createMMKV.d.ts +3 -0
- package/lib/typescript/src/createMMKV.d.ts.map +1 -0
- package/lib/typescript/src/createMMKV.mock.d.ts +3 -0
- package/lib/typescript/src/createMMKV.mock.d.ts.map +1 -0
- package/lib/typescript/src/createMMKV.web.d.ts +3 -0
- package/lib/typescript/src/createMMKV.web.d.ts.map +1 -0
- package/lib/typescript/src/createTextEncoder.d.ts +2 -0
- package/lib/typescript/src/createTextEncoder.d.ts.map +1 -0
- package/lib/typescript/src/hooks.d.ts +86 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +187 -0
- package/react-native-mmkv.podspec +38 -0
- package/react-native.config.js +20 -0
- package/src/MMKV.ts +142 -0
- package/src/MemoryWarningListener.ts +29 -0
- package/src/MemoryWarningListener.web.ts +5 -0
- package/src/ModuleNotFoundError.ts +95 -0
- package/src/NativeMmkv.ts +118 -0
- package/src/NativeMmkvPlatformContext.ts +38 -0
- package/src/PlatformChecker.ts +9 -0
- package/src/Types.ts +178 -0
- package/src/__tests__/hooks.test.tsx +89 -0
- package/src/createMMKV.mock.ts +38 -0
- package/src/createMMKV.ts +42 -0
- package/src/createMMKV.web.ts +127 -0
- package/src/createTextEncoder.ts +16 -0
- package/src/hooks.ts +247 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,2049 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* MMKV available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2020 THL A29 Limited, a Tencent company.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the BSD 3-Clause License (the "License"); you may not use
|
|
9
|
+
* this file except in compliance with the License. You may obtain a copy of
|
|
10
|
+
* the License at
|
|
11
|
+
*
|
|
12
|
+
* https://opensource.org/licenses/BSD-3-Clause
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#include "MMKV_IO.h"
|
|
22
|
+
#include "CodedInputData.h"
|
|
23
|
+
#include "CodedOutputData.h"
|
|
24
|
+
#include "InterProcessLock.h"
|
|
25
|
+
#include "MMBuffer.h"
|
|
26
|
+
#include "MMKVLog.h"
|
|
27
|
+
#include "MMKVMetaInfo.hpp"
|
|
28
|
+
#include "MemoryFile.h"
|
|
29
|
+
#include "MiniPBCoder.h"
|
|
30
|
+
#include "PBUtility.h"
|
|
31
|
+
#include "ScopedLock.hpp"
|
|
32
|
+
#include "ThreadLock.h"
|
|
33
|
+
#include "aes/AESCrypt.h"
|
|
34
|
+
#include "aes/openssl/openssl_aes.h"
|
|
35
|
+
#include "aes/openssl/openssl_md5.h"
|
|
36
|
+
#include "crc32/Checksum.h"
|
|
37
|
+
#include <algorithm>
|
|
38
|
+
#include <cassert>
|
|
39
|
+
#include <cstring>
|
|
40
|
+
#include <ctime>
|
|
41
|
+
|
|
42
|
+
#ifdef MMKV_IOS
|
|
43
|
+
# include "MMKV_OSX.h"
|
|
44
|
+
#endif
|
|
45
|
+
|
|
46
|
+
#ifdef MMKV_APPLE
|
|
47
|
+
# if __has_feature(objc_arc)
|
|
48
|
+
# error This file must be compiled with MRC. Use -fno-objc-arc flag.
|
|
49
|
+
# endif
|
|
50
|
+
#endif // MMKV_APPLE
|
|
51
|
+
|
|
52
|
+
#ifndef MMKV_WIN32
|
|
53
|
+
# include <unistd.h>
|
|
54
|
+
#endif
|
|
55
|
+
|
|
56
|
+
using namespace std;
|
|
57
|
+
using namespace mmkv;
|
|
58
|
+
using KVHolderRet_t = std::pair<bool, KeyValueHolder>;
|
|
59
|
+
extern ThreadLock *g_instanceLock;
|
|
60
|
+
extern unordered_map<string, MMKV *> *g_instanceDic;
|
|
61
|
+
|
|
62
|
+
MMKV_NAMESPACE_BEGIN
|
|
63
|
+
|
|
64
|
+
void MMKV::loadFromFile() {
|
|
65
|
+
loadMetaInfoAndCheck();
|
|
66
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
67
|
+
if (m_crypter) {
|
|
68
|
+
if (m_metaInfo->m_version >= MMKVVersionRandomIV) {
|
|
69
|
+
m_crypter->resetIV(m_metaInfo->m_vector, sizeof(m_metaInfo->m_vector));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#endif
|
|
73
|
+
if (!m_file->isFileValid()) {
|
|
74
|
+
m_file->reloadFromFile(m_expectedCapacity);
|
|
75
|
+
} else if (isMultiProcess()) {
|
|
76
|
+
// the file size may change by other process between instance creation and loadFromFile
|
|
77
|
+
// because we have lazy load
|
|
78
|
+
auto actualFileSize = m_file->getActualFileSize();
|
|
79
|
+
if (actualFileSize != m_file->getFileSize()) {
|
|
80
|
+
m_file->reloadFromFile(m_expectedCapacity);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (!m_file->isFileValid()) {
|
|
84
|
+
MMKVError("file [%s] not valid", m_path.c_str());
|
|
85
|
+
} else {
|
|
86
|
+
// error checking
|
|
87
|
+
bool loadFromFile = false, needFullWriteback = false;
|
|
88
|
+
checkDataValid(loadFromFile, needFullWriteback);
|
|
89
|
+
MMKVInfo("loading [%s] with %zu actual size, file size %zu, InterProcess %d, meta info "
|
|
90
|
+
"version:%u",
|
|
91
|
+
m_mmapID.c_str(), m_actualSize, m_file->getFileSize(), isMultiProcess(), m_metaInfo->m_version);
|
|
92
|
+
auto ptr = (uint8_t *) m_file->getMemory();
|
|
93
|
+
// loading
|
|
94
|
+
if (loadFromFile && m_actualSize > 0) {
|
|
95
|
+
MMKVInfo("loading [%s] with crc %u sequence %u version %u", m_mmapID.c_str(), m_metaInfo->m_crcDigest,
|
|
96
|
+
m_metaInfo->m_sequence, m_metaInfo->m_version);
|
|
97
|
+
MMBuffer inputBuffer(ptr + Fixed32Size, m_actualSize, MMBufferNoCopy);
|
|
98
|
+
if (m_crypter) {
|
|
99
|
+
clearDictionary(m_dicCrypt);
|
|
100
|
+
} else {
|
|
101
|
+
clearDictionary(m_dic);
|
|
102
|
+
}
|
|
103
|
+
if (needFullWriteback) {
|
|
104
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
105
|
+
if (m_crypter) {
|
|
106
|
+
MiniPBCoder::greedyDecodeMap(*m_dicCrypt, inputBuffer, m_crypter);
|
|
107
|
+
} else
|
|
108
|
+
#endif
|
|
109
|
+
{
|
|
110
|
+
MiniPBCoder::greedyDecodeMap(*m_dic, inputBuffer);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
114
|
+
if (m_crypter) {
|
|
115
|
+
MiniPBCoder::decodeMap(*m_dicCrypt, inputBuffer, m_crypter);
|
|
116
|
+
} else
|
|
117
|
+
#endif
|
|
118
|
+
{
|
|
119
|
+
MiniPBCoder::decodeMap(*m_dic, inputBuffer);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
|
|
123
|
+
m_output->seek(m_actualSize);
|
|
124
|
+
if (needFullWriteback && !isReadOnly()) {
|
|
125
|
+
fullWriteback();
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
// file not valid or empty, discard everything
|
|
129
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
130
|
+
|
|
131
|
+
m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
|
|
132
|
+
if (isReadOnly()) {
|
|
133
|
+
// do nothing
|
|
134
|
+
} else if (m_actualSize > 0) {
|
|
135
|
+
writeActualSize(0, 0, nullptr, IncreaseSequence);
|
|
136
|
+
sync(MMKV_SYNC);
|
|
137
|
+
} else {
|
|
138
|
+
writeActualSize(0, 0, nullptr, KeepSequence);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
auto count = m_crypter ? m_dicCrypt->size() : m_dic->size();
|
|
142
|
+
MMKVInfo("loaded [%s] with %zu key-values", m_mmapID.c_str(), count);
|
|
143
|
+
// auto keys = allKeys();
|
|
144
|
+
// for (size_t index = 0; index < count; index++) {
|
|
145
|
+
// MMKVInfo("key[%llu]: %s", index, keys[index].c_str());
|
|
146
|
+
// }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
m_needLoadFromFile = false;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// read from last m_position
|
|
153
|
+
void MMKV::partialLoadFromFile() {
|
|
154
|
+
if (!m_file->isFileValid()) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
m_metaInfo->read(m_metaFile->getMemory());
|
|
158
|
+
|
|
159
|
+
size_t oldActualSize = m_actualSize;
|
|
160
|
+
m_actualSize = readActualSize();
|
|
161
|
+
auto fileSize = m_file->getFileSize();
|
|
162
|
+
MMKVDebug("loading [%s] with file size %zu, oldActualSize %zu, newActualSize %zu", m_mmapID.c_str(), fileSize,
|
|
163
|
+
oldActualSize, m_actualSize);
|
|
164
|
+
|
|
165
|
+
if (m_actualSize > 0) {
|
|
166
|
+
if (m_actualSize < fileSize && m_actualSize + Fixed32Size <= fileSize) {
|
|
167
|
+
if (m_actualSize > oldActualSize) {
|
|
168
|
+
auto position = oldActualSize;
|
|
169
|
+
size_t addedSize = m_actualSize - position;
|
|
170
|
+
auto basePtr = (uint8_t *) m_file->getMemory() + Fixed32Size;
|
|
171
|
+
// incremental update crc digest
|
|
172
|
+
m_crcDigest = (uint32_t) CRC32(m_crcDigest, basePtr + position, (z_size_t) addedSize);
|
|
173
|
+
if (m_crcDigest == m_metaInfo->m_crcDigest) {
|
|
174
|
+
MMBuffer inputBuffer(basePtr, m_actualSize, MMBufferNoCopy);
|
|
175
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
176
|
+
if (m_crypter) {
|
|
177
|
+
MiniPBCoder::greedyDecodeMap(*m_dicCrypt, inputBuffer, m_crypter, position);
|
|
178
|
+
} else
|
|
179
|
+
#endif
|
|
180
|
+
{
|
|
181
|
+
MiniPBCoder::greedyDecodeMap(*m_dic, inputBuffer, position);
|
|
182
|
+
}
|
|
183
|
+
m_output->seek(addedSize);
|
|
184
|
+
m_hasFullWriteback = false;
|
|
185
|
+
|
|
186
|
+
[[maybe_unused]] auto count = m_crypter ? m_dicCrypt->size() : m_dic->size();
|
|
187
|
+
MMKVDebug("partial loaded [%s] with %zu values", m_mmapID.c_str(), count);
|
|
188
|
+
return;
|
|
189
|
+
} else {
|
|
190
|
+
MMKVError("m_crcDigest[%u] != m_metaInfo->m_crcDigest[%u]", m_crcDigest, m_metaInfo->m_crcDigest);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// something is wrong, do a full load
|
|
196
|
+
clearMemoryCache();
|
|
197
|
+
loadFromFile();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
//#if defined(MMKV_APPLE) || defined(MMKV_WIN32)
|
|
201
|
+
bool MMKV::checkFileHasDiskError() {
|
|
202
|
+
if (m_isSecondLoad) {
|
|
203
|
+
return false;
|
|
204
|
+
}
|
|
205
|
+
m_isSecondLoad = true;
|
|
206
|
+
|
|
207
|
+
bool needReportReadFail = false;
|
|
208
|
+
if (isDiskOfMMAPFileCorrupted(m_metaFile, needReportReadFail)) {
|
|
209
|
+
m_metaFile->clearMemoryCache();
|
|
210
|
+
deleteFile(m_metaFile->getPath());
|
|
211
|
+
m_metaFile->reloadFromFile();
|
|
212
|
+
}
|
|
213
|
+
if (isDiskOfMMAPFileCorrupted(m_file, needReportReadFail)) {
|
|
214
|
+
m_file->clearMemoryCache();
|
|
215
|
+
deleteFile(m_file->getPath());
|
|
216
|
+
m_file->reloadFromFile(m_expectedCapacity);
|
|
217
|
+
}
|
|
218
|
+
return needReportReadFail;
|
|
219
|
+
}
|
|
220
|
+
//#endif
|
|
221
|
+
|
|
222
|
+
void MMKV::loadMetaInfoAndCheck() {
|
|
223
|
+
if (!m_metaFile->isFileValid()) {
|
|
224
|
+
m_metaFile->reloadFromFile();
|
|
225
|
+
}
|
|
226
|
+
if (!m_metaFile->isFileValid()) {
|
|
227
|
+
MMKVError("file [%s] not valid", m_metaFile->getPath().c_str());
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (checkFileHasDiskError()) {
|
|
232
|
+
// let user know?
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
m_metaInfo->read(m_metaFile->getMemory());
|
|
236
|
+
|
|
237
|
+
if (isReadOnly()) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// the meta file is in specious status
|
|
242
|
+
if (m_metaInfo->m_version >= MMKVVersionHolder) {
|
|
243
|
+
MMKVWarning("meta file [%s] in specious state, version %u, flags 0x%llx", m_mmapID.c_str(),
|
|
244
|
+
m_metaInfo->m_version, m_metaInfo->m_flags);
|
|
245
|
+
|
|
246
|
+
// MMKVVersionActualSize is the last version we don't check meta file
|
|
247
|
+
m_metaInfo->m_version = MMKVVersionActualSize;
|
|
248
|
+
m_metaInfo->m_flags = 0;
|
|
249
|
+
m_metaInfo->write(m_metaFile->getMemory());
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (m_metaInfo->m_version >= MMKVVersionFlag) {
|
|
253
|
+
m_enableKeyExpire = m_metaInfo->hasFlag(MMKVMetaInfo::EnableKeyExipre);
|
|
254
|
+
if (m_enableKeyExpire && m_enableCompareBeforeSet) {
|
|
255
|
+
MMKVError("enableCompareBeforeSet will be invalid when Expiration is on");
|
|
256
|
+
m_enableCompareBeforeSet = false;
|
|
257
|
+
}
|
|
258
|
+
MMKVInfo("meta file [%s] has flag [%llu]", m_mmapID.c_str(), m_metaInfo->m_flags);
|
|
259
|
+
} else {
|
|
260
|
+
if (m_metaInfo->m_flags != 0) {
|
|
261
|
+
m_metaInfo->m_flags = 0;
|
|
262
|
+
m_metaInfo->write(m_metaFile->getMemory());
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
void MMKV::checkDataValid(bool &loadFromFile, bool &needFullWriteback) {
|
|
268
|
+
// try auto recover from last confirmed location
|
|
269
|
+
auto fileSize = m_file->getFileSize();
|
|
270
|
+
auto checkLastConfirmedInfo = [&] {
|
|
271
|
+
if (m_metaInfo->m_version >= MMKVVersionActualSize) {
|
|
272
|
+
// downgrade & upgrade support
|
|
273
|
+
uint32_t oldStyleActualSize = 0;
|
|
274
|
+
memcpy(&oldStyleActualSize, m_file->getMemory(), Fixed32Size);
|
|
275
|
+
if (oldStyleActualSize != m_actualSize) {
|
|
276
|
+
MMKVWarning("oldStyleActualSize %u not equal to meta actual size %lu", oldStyleActualSize,
|
|
277
|
+
m_actualSize);
|
|
278
|
+
if (oldStyleActualSize < fileSize && (oldStyleActualSize + Fixed32Size) <= fileSize) {
|
|
279
|
+
if (checkFileCRCValid(oldStyleActualSize, m_metaInfo->m_crcDigest)) {
|
|
280
|
+
MMKVInfo("looks like [%s] been downgrade & upgrade again", m_mmapID.c_str());
|
|
281
|
+
loadFromFile = true;
|
|
282
|
+
writeActualSize(oldStyleActualSize, m_metaInfo->m_crcDigest, nullptr, KeepSequence);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
MMKVWarning("oldStyleActualSize %u greater than file size %lu", oldStyleActualSize, fileSize);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
auto lastActualSize = m_metaInfo->m_lastConfirmedMetaInfo.lastActualSize;
|
|
291
|
+
if (lastActualSize < fileSize && (lastActualSize + Fixed32Size) <= fileSize) {
|
|
292
|
+
auto lastCRCDigest = m_metaInfo->m_lastConfirmedMetaInfo.lastCRCDigest;
|
|
293
|
+
if (checkFileCRCValid(lastActualSize, lastCRCDigest)) {
|
|
294
|
+
loadFromFile = true;
|
|
295
|
+
writeActualSize(lastActualSize, lastCRCDigest, nullptr, KeepSequence);
|
|
296
|
+
} else {
|
|
297
|
+
MMKVError("check [%s] error: lastActualSize %u, lastActualCRC %u", m_mmapID.c_str(), lastActualSize,
|
|
298
|
+
lastCRCDigest);
|
|
299
|
+
}
|
|
300
|
+
} else {
|
|
301
|
+
MMKVError("check [%s] error: lastActualSize %u, file size is %u", m_mmapID.c_str(), lastActualSize,
|
|
302
|
+
fileSize);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
m_actualSize = readActualSize();
|
|
308
|
+
|
|
309
|
+
if (m_actualSize < fileSize && (m_actualSize + Fixed32Size) <= fileSize) {
|
|
310
|
+
if (checkFileCRCValid(m_actualSize, m_metaInfo->m_crcDigest)) {
|
|
311
|
+
loadFromFile = true;
|
|
312
|
+
} else {
|
|
313
|
+
checkLastConfirmedInfo();
|
|
314
|
+
if (!loadFromFile) {
|
|
315
|
+
|
|
316
|
+
auto strategic = onMMKVCRCCheckFail(m_mmapID);
|
|
317
|
+
if (strategic == OnErrorRecover) {
|
|
318
|
+
loadFromFile = true;
|
|
319
|
+
needFullWriteback = true;
|
|
320
|
+
}
|
|
321
|
+
MMKVInfo("recover strategic for [%s] is %d", m_mmapID.c_str(), strategic);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
MMKVError("check [%s] error: %zu size in total, file size is %zu", m_mmapID.c_str(), m_actualSize, fileSize);
|
|
326
|
+
|
|
327
|
+
checkLastConfirmedInfo();
|
|
328
|
+
|
|
329
|
+
if (!loadFromFile) {
|
|
330
|
+
auto strategic = onMMKVFileLengthError(m_mmapID);
|
|
331
|
+
if (strategic == OnErrorRecover) {
|
|
332
|
+
// make sure we don't over read the file
|
|
333
|
+
m_actualSize = fileSize - Fixed32Size;
|
|
334
|
+
loadFromFile = true;
|
|
335
|
+
needFullWriteback = true;
|
|
336
|
+
}
|
|
337
|
+
MMKVInfo("recover strategic for [%s] is %d", m_mmapID.c_str(), strategic);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
void MMKV::checkLoadData() {
|
|
343
|
+
if (m_needLoadFromFile) {
|
|
344
|
+
SCOPED_LOCK(m_sharedProcessLock);
|
|
345
|
+
|
|
346
|
+
m_needLoadFromFile = false;
|
|
347
|
+
loadFromFile();
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (!isMultiProcess()) {
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
if (!m_metaFile->isFileValid()) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
SCOPED_LOCK(m_sharedProcessLock);
|
|
358
|
+
|
|
359
|
+
MMKVMetaInfo metaInfo;
|
|
360
|
+
metaInfo.read(m_metaFile->getMemory());
|
|
361
|
+
if (m_metaInfo->m_sequence != metaInfo.m_sequence) {
|
|
362
|
+
MMKVInfo("[%s] oldSeq %u, newSeq %u", m_mmapID.c_str(), m_metaInfo->m_sequence, metaInfo.m_sequence);
|
|
363
|
+
SCOPED_LOCK(m_sharedProcessLock);
|
|
364
|
+
|
|
365
|
+
clearMemoryCache();
|
|
366
|
+
loadFromFile();
|
|
367
|
+
notifyContentChanged();
|
|
368
|
+
} else if ((m_metaInfo->m_crcDigest != metaInfo.m_crcDigest) || (m_metaInfo->m_actualSize != metaInfo.m_actualSize)) {
|
|
369
|
+
MMKVDebug("[%s] crcDigest %u -> %u, actualSize %u -> %u", m_mmapID.c_str(), m_metaInfo->m_crcDigest,
|
|
370
|
+
metaInfo.m_crcDigest, m_metaInfo->m_actualSize, metaInfo.m_actualSize);
|
|
371
|
+
SCOPED_LOCK(m_sharedProcessLock);
|
|
372
|
+
|
|
373
|
+
// looks like this is no longer needed
|
|
374
|
+
// for we inc sequence on truncate()/trim()/expandAndWriteBack()/fullWriteBack() etc
|
|
375
|
+
/*size_t fileSize = m_file->getActualFileSize();
|
|
376
|
+
if (m_file->getFileSize() != fileSize) {
|
|
377
|
+
MMKVInfo("file size has changed [%s] from %zu to %zu", m_mmapID.c_str(), m_file->getFileSize(), fileSize);
|
|
378
|
+
clearMemoryCache();
|
|
379
|
+
loadFromFile();
|
|
380
|
+
} else*/ {
|
|
381
|
+
partialLoadFromFile();
|
|
382
|
+
}
|
|
383
|
+
notifyContentChanged();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
constexpr uint32_t ItemSizeHolderSize = 4;
|
|
388
|
+
|
|
389
|
+
static pair<MMBuffer, size_t> prepareEncode(const MMKVMap &dic) {
|
|
390
|
+
// make some room for placeholder
|
|
391
|
+
size_t totalSize = ItemSizeHolderSize;
|
|
392
|
+
for (auto &itr : dic) {
|
|
393
|
+
auto &kvHolder = itr.second;
|
|
394
|
+
totalSize += kvHolder.computedKVSize + kvHolder.valueSize;
|
|
395
|
+
}
|
|
396
|
+
return make_pair(MMBuffer(), totalSize);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
400
|
+
static pair<MMBuffer, size_t> prepareEncode(const MMKVMapCrypt &dic) {
|
|
401
|
+
MMKVVector vec;
|
|
402
|
+
size_t totalSize = 0;
|
|
403
|
+
// make some room for placeholder
|
|
404
|
+
uint32_t smallestOffet = 5 + 1; // 5 is the largest size needed to encode varint32
|
|
405
|
+
for (auto &itr : dic) {
|
|
406
|
+
auto &kvHolder = itr.second;
|
|
407
|
+
if (kvHolder.type == KeyValueHolderType_Offset) {
|
|
408
|
+
totalSize += kvHolder.pbKeyValueSize + kvHolder.keySize + kvHolder.valueSize;
|
|
409
|
+
smallestOffet = min(smallestOffet, kvHolder.offset);
|
|
410
|
+
} else {
|
|
411
|
+
vec.emplace_back(itr.first, kvHolder.toMMBuffer(nullptr, nullptr));
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (smallestOffet > 5) {
|
|
415
|
+
smallestOffet = ItemSizeHolderSize;
|
|
416
|
+
}
|
|
417
|
+
totalSize += smallestOffet;
|
|
418
|
+
if (vec.empty()) {
|
|
419
|
+
return make_pair(MMBuffer(), totalSize);
|
|
420
|
+
}
|
|
421
|
+
auto buffer = MiniPBCoder::encodeDataWithObject(vec);
|
|
422
|
+
// skip the pb size of buffer
|
|
423
|
+
auto sizeOfMap = CodedInputData(buffer.getPtr(), buffer.length()).readUInt32();
|
|
424
|
+
totalSize += sizeOfMap;
|
|
425
|
+
return make_pair(std::move(buffer), totalSize);
|
|
426
|
+
}
|
|
427
|
+
#endif
|
|
428
|
+
|
|
429
|
+
static pair<MMBuffer, size_t> prepareEncode(MMKVVector &&vec) {
|
|
430
|
+
// make some room for placeholder
|
|
431
|
+
size_t totalSize = ItemSizeHolderSize;
|
|
432
|
+
auto buffer = MiniPBCoder::encodeDataWithObject(vec);
|
|
433
|
+
// skip the pb size of buffer
|
|
434
|
+
auto sizeOfMap = CodedInputData(buffer.getPtr(), buffer.length()).readUInt32();
|
|
435
|
+
totalSize += sizeOfMap;
|
|
436
|
+
return make_pair(std::move(buffer), totalSize);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// since we use append mode, when -[setData: forKey:] many times, space may not be enough
|
|
440
|
+
// try a full rewrite to make space
|
|
441
|
+
bool MMKV::ensureMemorySize(size_t newSize) {
|
|
442
|
+
if (!isFileValid()) {
|
|
443
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
446
|
+
if (isReadOnly()) {
|
|
447
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
448
|
+
return false;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
if (newSize >= m_output->spaceLeft() || (m_crypter ? m_dicCrypt->empty() : m_dic->empty())) {
|
|
452
|
+
// remove expired keys
|
|
453
|
+
if (m_enableKeyExpire) {
|
|
454
|
+
filterExpiredKeys();
|
|
455
|
+
}
|
|
456
|
+
// try a full rewrite to make space
|
|
457
|
+
auto preparedData = m_crypter ? prepareEncode(*m_dicCrypt) : prepareEncode(*m_dic);
|
|
458
|
+
// dic.empty() means inserting key-value for the first time, no need to call msync()
|
|
459
|
+
return expandAndWriteBack(newSize, std::move(preparedData), m_crypter ? !m_dicCrypt->empty() : !m_dic->empty());
|
|
460
|
+
}
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// try a full rewrite to make space
|
|
465
|
+
bool MMKV::expandAndWriteBack(size_t newSize, std::pair<mmkv::MMBuffer, size_t> preparedData, bool needSync) {
|
|
466
|
+
auto fileSize = m_file->getFileSize();
|
|
467
|
+
auto sizeOfDic = preparedData.second;
|
|
468
|
+
size_t lenNeeded = sizeOfDic + Fixed32Size + newSize;
|
|
469
|
+
size_t nowDicCount = m_crypter ? m_dicCrypt->size() : m_dic->size();
|
|
470
|
+
size_t laterDicCount = std::max<size_t>(1, nowDicCount + 1);
|
|
471
|
+
// or use <cmath> ceil()
|
|
472
|
+
size_t avgItemSize = (lenNeeded + laterDicCount - 1) / laterDicCount;
|
|
473
|
+
size_t futureUsage = avgItemSize * std::max<size_t>(8, laterDicCount / 2);
|
|
474
|
+
// 1. no space for a full rewrite, double it
|
|
475
|
+
// 2. or space is not large enough for future usage, double it to avoid frequently full rewrite
|
|
476
|
+
if (lenNeeded >= fileSize || (needSync && (lenNeeded + futureUsage) >= fileSize)) {
|
|
477
|
+
size_t oldSize = fileSize;
|
|
478
|
+
do {
|
|
479
|
+
fileSize *= 2;
|
|
480
|
+
} while (lenNeeded + futureUsage >= fileSize);
|
|
481
|
+
MMKVInfo("extending [%s] file size from %zu to %zu, incoming size:%zu, future usage:%zu", m_mmapID.c_str(),
|
|
482
|
+
oldSize, fileSize, newSize, futureUsage);
|
|
483
|
+
|
|
484
|
+
// if we can't extend size, rollback to old state
|
|
485
|
+
// this is a good place to mock enlarging file failure
|
|
486
|
+
if (!m_file->truncate(fileSize)) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// check if we fail to make more space
|
|
491
|
+
if (!isFileValid()) {
|
|
492
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return doFullWriteBack(std::move(preparedData), nullptr, needSync);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
size_t MMKV::readActualSize() {
|
|
500
|
+
MMKV_ASSERT(m_file->getMemory());
|
|
501
|
+
MMKV_ASSERT(m_metaFile->isFileValid());
|
|
502
|
+
|
|
503
|
+
uint32_t actualSize = 0;
|
|
504
|
+
memcpy(&actualSize, m_file->getMemory(), Fixed32Size);
|
|
505
|
+
|
|
506
|
+
if (m_metaInfo->m_version >= MMKVVersionActualSize) {
|
|
507
|
+
if (m_metaInfo->m_actualSize != actualSize) {
|
|
508
|
+
MMKVWarning("[%s] actual size %u, meta actual size %u", m_mmapID.c_str(), actualSize,
|
|
509
|
+
m_metaInfo->m_actualSize);
|
|
510
|
+
}
|
|
511
|
+
return m_metaInfo->m_actualSize;
|
|
512
|
+
} else {
|
|
513
|
+
return actualSize;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
void MMKV::oldStyleWriteActualSize(size_t actualSize) {
|
|
518
|
+
MMKV_ASSERT(m_file->getMemory());
|
|
519
|
+
|
|
520
|
+
m_actualSize = actualSize;
|
|
521
|
+
memcpy(m_file->getMemory(), &actualSize, Fixed32Size);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
bool MMKV::writeActualSize(size_t size, uint32_t crcDigest, const void *iv, bool increaseSequence) {
|
|
525
|
+
if (isReadOnly()) {
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// backward compatibility
|
|
530
|
+
oldStyleWriteActualSize(size);
|
|
531
|
+
|
|
532
|
+
if (!m_metaFile->isFileValid()) {
|
|
533
|
+
return false;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
bool needsFullWrite = false;
|
|
537
|
+
m_actualSize = size;
|
|
538
|
+
m_metaInfo->m_actualSize = static_cast<uint32_t>(size);
|
|
539
|
+
m_crcDigest = crcDigest;
|
|
540
|
+
m_metaInfo->m_crcDigest = crcDigest;
|
|
541
|
+
if (m_metaInfo->m_version < MMKVVersionSequence) {
|
|
542
|
+
m_metaInfo->m_version = MMKVVersionSequence;
|
|
543
|
+
needsFullWrite = true;
|
|
544
|
+
}
|
|
545
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
546
|
+
if (mmkv_unlikely(iv)) {
|
|
547
|
+
memcpy(m_metaInfo->m_vector, iv, sizeof(m_metaInfo->m_vector));
|
|
548
|
+
if (m_metaInfo->m_version < MMKVVersionRandomIV) {
|
|
549
|
+
m_metaInfo->m_version = MMKVVersionRandomIV;
|
|
550
|
+
}
|
|
551
|
+
needsFullWrite = true;
|
|
552
|
+
}
|
|
553
|
+
#endif
|
|
554
|
+
if (mmkv_unlikely(increaseSequence)) {
|
|
555
|
+
m_metaInfo->m_sequence++;
|
|
556
|
+
m_metaInfo->m_lastConfirmedMetaInfo.lastActualSize = static_cast<uint32_t>(size);
|
|
557
|
+
m_metaInfo->m_lastConfirmedMetaInfo.lastCRCDigest = crcDigest;
|
|
558
|
+
if (m_metaInfo->m_version < MMKVVersionActualSize) {
|
|
559
|
+
m_metaInfo->m_version = MMKVVersionActualSize;
|
|
560
|
+
}
|
|
561
|
+
needsFullWrite = true;
|
|
562
|
+
MMKVInfo("[%s] increase sequence to %u, crc %u, actualSize %u", m_mmapID.c_str(), m_metaInfo->m_sequence,
|
|
563
|
+
m_metaInfo->m_crcDigest, m_metaInfo->m_actualSize);
|
|
564
|
+
}
|
|
565
|
+
if (m_metaInfo->m_version < MMKVVersionFlag) {
|
|
566
|
+
m_metaInfo->m_flags = 0;
|
|
567
|
+
m_metaInfo->m_version = MMKVVersionFlag;
|
|
568
|
+
needsFullWrite = true;
|
|
569
|
+
}
|
|
570
|
+
if (mmkv_unlikely(needsFullWrite)) {
|
|
571
|
+
m_metaInfo->write(m_metaFile->getMemory());
|
|
572
|
+
} else {
|
|
573
|
+
m_metaInfo->writeCRCAndActualSizeOnly(m_metaFile->getMemory());
|
|
574
|
+
}
|
|
575
|
+
return true;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
MMBuffer MMKV::getRawDataForKey(MMKVKey_t key) {
|
|
579
|
+
checkLoadData();
|
|
580
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
581
|
+
if (m_crypter) {
|
|
582
|
+
auto itr = m_dicCrypt->find(key);
|
|
583
|
+
if (itr != m_dicCrypt->end()) {
|
|
584
|
+
auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
|
|
585
|
+
return itr->second.toMMBuffer(basePtr, m_crypter);
|
|
586
|
+
}
|
|
587
|
+
} else
|
|
588
|
+
#endif
|
|
589
|
+
{
|
|
590
|
+
auto itr = m_dic->find(key);
|
|
591
|
+
if (itr != m_dic->end()) {
|
|
592
|
+
auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
|
|
593
|
+
return itr->second.toMMBuffer(basePtr);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
MMBuffer nan;
|
|
597
|
+
return nan;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
mmkv::MMBuffer MMKV::getDataForKey(MMKVKey_t key) {
|
|
601
|
+
if (mmkv_unlikely(m_enableKeyExpire)) {
|
|
602
|
+
return getDataWithoutMTimeForKey(key);
|
|
603
|
+
}
|
|
604
|
+
return getRawDataForKey(key);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
608
|
+
// for Apple watch simulator
|
|
609
|
+
# if defined(TARGET_OS_SIMULATOR) && defined(TARGET_CPU_X86)
|
|
610
|
+
static AESCryptStatus t_status;
|
|
611
|
+
# else
|
|
612
|
+
thread_local AESCryptStatus t_status;
|
|
613
|
+
# endif
|
|
614
|
+
#endif // MMKV_DISABLE_CRYPT
|
|
615
|
+
|
|
616
|
+
bool MMKV::setDataForKey(MMBuffer &&data, MMKVKey_t key, bool isDataHolder) {
|
|
617
|
+
if ((!isDataHolder && data.length() == 0) || isKeyEmpty(key)) {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
SCOPED_LOCK(m_lock);
|
|
621
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
622
|
+
checkLoadData();
|
|
623
|
+
|
|
624
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
625
|
+
if (m_crypter) {
|
|
626
|
+
if (isDataHolder) {
|
|
627
|
+
auto sizeNeededForData = pbRawVarint32Size((uint32_t) data.length()) + data.length();
|
|
628
|
+
if (!KeyValueHolderCrypt::isValueStoredAsOffset(sizeNeededForData)) {
|
|
629
|
+
data = MiniPBCoder::encodeDataWithObject(data);
|
|
630
|
+
isDataHolder = false;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
auto itr = m_dicCrypt->find(key);
|
|
634
|
+
if (itr != m_dicCrypt->end()) {
|
|
635
|
+
bool onlyOneKey = !isMultiProcess() && m_dicCrypt->size() == 1;
|
|
636
|
+
# ifdef MMKV_APPLE
|
|
637
|
+
KVHolderRet_t ret;
|
|
638
|
+
if (onlyOneKey) {
|
|
639
|
+
ret = overrideDataWithKey(data, key, itr->second, isDataHolder);
|
|
640
|
+
} else {
|
|
641
|
+
ret = appendDataWithKey(data, key, itr->second, isDataHolder);
|
|
642
|
+
}
|
|
643
|
+
# else
|
|
644
|
+
KVHolderRet_t ret;
|
|
645
|
+
if (onlyOneKey) {
|
|
646
|
+
ret = overrideDataWithKey(data, key, isDataHolder);
|
|
647
|
+
} else {
|
|
648
|
+
ret = appendDataWithKey(data, key, isDataHolder);
|
|
649
|
+
}
|
|
650
|
+
# endif
|
|
651
|
+
if (!ret.first) {
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
KeyValueHolderCrypt kvHolder;
|
|
655
|
+
if (KeyValueHolderCrypt::isValueStoredAsOffset(ret.second.valueSize)) {
|
|
656
|
+
kvHolder = KeyValueHolderCrypt(ret.second.keySize, ret.second.valueSize, ret.second.offset);
|
|
657
|
+
memcpy(&kvHolder.cryptStatus, &t_status, sizeof(t_status));
|
|
658
|
+
} else {
|
|
659
|
+
kvHolder = KeyValueHolderCrypt(std::move(data));
|
|
660
|
+
}
|
|
661
|
+
if (mmkv_likely(!m_enableKeyExpire)) {
|
|
662
|
+
itr->second = std::move(kvHolder);
|
|
663
|
+
} else {
|
|
664
|
+
itr = m_dicCrypt->find(key);
|
|
665
|
+
if (itr != m_dicCrypt->end()) {
|
|
666
|
+
itr->second = std::move(kvHolder);
|
|
667
|
+
} else {
|
|
668
|
+
// in case filterExpiredKeys() is triggered
|
|
669
|
+
m_dicCrypt->emplace(key, std::move(kvHolder));
|
|
670
|
+
mmkv_retain_key(key);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
} else {
|
|
674
|
+
bool needOverride = !isMultiProcess() && m_dicCrypt->empty() && m_actualSize > 0;
|
|
675
|
+
KVHolderRet_t ret;
|
|
676
|
+
if (needOverride) {
|
|
677
|
+
ret = overrideDataWithKey(data, key, isDataHolder);
|
|
678
|
+
} else {
|
|
679
|
+
ret = appendDataWithKey(data, key, isDataHolder);
|
|
680
|
+
}
|
|
681
|
+
if (!ret.first) {
|
|
682
|
+
return false;
|
|
683
|
+
}
|
|
684
|
+
if (KeyValueHolderCrypt::isValueStoredAsOffset(ret.second.valueSize)) {
|
|
685
|
+
auto r = m_dicCrypt->emplace(
|
|
686
|
+
key, KeyValueHolderCrypt(ret.second.keySize, ret.second.valueSize, ret.second.offset));
|
|
687
|
+
if (r.second) {
|
|
688
|
+
memcpy(&(r.first->second.cryptStatus), &t_status, sizeof(t_status));
|
|
689
|
+
}
|
|
690
|
+
} else {
|
|
691
|
+
m_dicCrypt->emplace(key, KeyValueHolderCrypt(std::move(data)));
|
|
692
|
+
}
|
|
693
|
+
mmkv_retain_key(key);
|
|
694
|
+
}
|
|
695
|
+
} else
|
|
696
|
+
#endif // MMKV_DISABLE_CRYPT
|
|
697
|
+
{
|
|
698
|
+
auto itr = m_dic->find(key);
|
|
699
|
+
if (itr != m_dic->end()) {
|
|
700
|
+
// compare data before appending to file
|
|
701
|
+
if (isCompareBeforeSetEnabled()) {
|
|
702
|
+
auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
|
|
703
|
+
MMBuffer oldValueData = itr->second.toMMBuffer(basePtr);
|
|
704
|
+
if (isDataHolder) {
|
|
705
|
+
CodedInputData inputData(oldValueData.getPtr(), oldValueData.length());
|
|
706
|
+
try {
|
|
707
|
+
// read extra holder header bytes and to real MMBuffer
|
|
708
|
+
oldValueData = CodedInputData::readRealData(oldValueData);
|
|
709
|
+
if (oldValueData == data) {
|
|
710
|
+
// MMKVInfo("[key] %s, set the same data", key.c_str());
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
} catch (std::exception &exception) {
|
|
714
|
+
MMKVWarning("compareBeforeSet exception: %s", exception.what());
|
|
715
|
+
} catch (...) {
|
|
716
|
+
MMKVWarning("compareBeforeSet fail");
|
|
717
|
+
}
|
|
718
|
+
} else {
|
|
719
|
+
if (oldValueData == data) {
|
|
720
|
+
// MMKVInfo("[key] %s, set the same data", key.c_str());
|
|
721
|
+
return true;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
bool onlyOneKey = !isMultiProcess() && m_dic->size() == 1;
|
|
727
|
+
if (mmkv_likely(!m_enableKeyExpire)) {
|
|
728
|
+
KVHolderRet_t ret;
|
|
729
|
+
if (onlyOneKey) {
|
|
730
|
+
ret = overrideDataWithKey(data, itr->second, isDataHolder);
|
|
731
|
+
} else {
|
|
732
|
+
ret = appendDataWithKey(data, itr->second, isDataHolder);
|
|
733
|
+
}
|
|
734
|
+
if (!ret.first) {
|
|
735
|
+
return false;
|
|
736
|
+
}
|
|
737
|
+
itr->second = std::move(ret.second);
|
|
738
|
+
} else {
|
|
739
|
+
KVHolderRet_t ret;
|
|
740
|
+
if (onlyOneKey) {
|
|
741
|
+
ret = overrideDataWithKey(data, key, isDataHolder);
|
|
742
|
+
} else {
|
|
743
|
+
ret = appendDataWithKey(data, key, isDataHolder);
|
|
744
|
+
}
|
|
745
|
+
if (!ret.first) {
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
itr = m_dic->find(key);
|
|
749
|
+
if (itr != m_dic->end()) {
|
|
750
|
+
itr->second = std::move(ret.second);
|
|
751
|
+
} else {
|
|
752
|
+
// in case filterExpiredKeys() is triggered
|
|
753
|
+
m_dic->emplace(key, std::move(ret.second));
|
|
754
|
+
mmkv_retain_key(key);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
} else {
|
|
758
|
+
bool needOverride = !isMultiProcess() && m_dic->empty() && m_actualSize > 0;
|
|
759
|
+
KVHolderRet_t ret;
|
|
760
|
+
if (needOverride) {
|
|
761
|
+
ret = overrideDataWithKey(data, key, isDataHolder);
|
|
762
|
+
} else {
|
|
763
|
+
ret = appendDataWithKey(data, key, isDataHolder);
|
|
764
|
+
}
|
|
765
|
+
if (!ret.first) {
|
|
766
|
+
return false;
|
|
767
|
+
}
|
|
768
|
+
m_dic->emplace(key, std::move(ret.second));
|
|
769
|
+
mmkv_retain_key(key);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
m_hasFullWriteback = false;
|
|
773
|
+
return true;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
template <typename T>
|
|
777
|
+
static void eraseHelper(T& container, std::string_view key) {
|
|
778
|
+
auto itr = container.find(key);
|
|
779
|
+
if (itr != container.end()) {
|
|
780
|
+
container.erase(itr);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
bool MMKV::removeDataForKey(MMKVKey_t key) {
|
|
785
|
+
if (isKeyEmpty(key)) {
|
|
786
|
+
return false;
|
|
787
|
+
}
|
|
788
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
789
|
+
if (m_crypter) {
|
|
790
|
+
auto itr = m_dicCrypt->find(key);
|
|
791
|
+
if (itr != m_dicCrypt->end()) {
|
|
792
|
+
m_hasFullWriteback = false;
|
|
793
|
+
static MMBuffer nan;
|
|
794
|
+
# ifdef MMKV_APPLE
|
|
795
|
+
auto ret = appendDataWithKey(nan, key, itr->second);
|
|
796
|
+
if (ret.first) {
|
|
797
|
+
if (mmkv_unlikely(m_enableKeyExpire)) {
|
|
798
|
+
// filterExpiredKeys() may invalid itr
|
|
799
|
+
itr = m_dicCrypt->find(key);
|
|
800
|
+
if (itr == m_dicCrypt->end()) {
|
|
801
|
+
return true;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
auto oldKey = itr->first;
|
|
805
|
+
m_dicCrypt->erase(itr);
|
|
806
|
+
[oldKey release];
|
|
807
|
+
}
|
|
808
|
+
# else
|
|
809
|
+
auto ret = appendDataWithKey(nan, key);
|
|
810
|
+
if (ret.first) {
|
|
811
|
+
if (mmkv_unlikely(m_enableKeyExpire)) {
|
|
812
|
+
eraseHelper(*m_dicCrypt, key);
|
|
813
|
+
} else {
|
|
814
|
+
m_dicCrypt->erase(itr);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
# endif
|
|
818
|
+
return ret.first;
|
|
819
|
+
}
|
|
820
|
+
} else
|
|
821
|
+
#endif // MMKV_DISABLE_CRYPT
|
|
822
|
+
{
|
|
823
|
+
auto itr = m_dic->find(key);
|
|
824
|
+
if (itr != m_dic->end()) {
|
|
825
|
+
m_hasFullWriteback = false;
|
|
826
|
+
static MMBuffer nan;
|
|
827
|
+
auto ret = mmkv_likely(!m_enableKeyExpire) ? appendDataWithKey(nan, itr->second) : appendDataWithKey(nan, key);
|
|
828
|
+
if (ret.first) {
|
|
829
|
+
#ifdef MMKV_APPLE
|
|
830
|
+
if (mmkv_unlikely(m_enableKeyExpire)) {
|
|
831
|
+
// filterExpiredKeys() may invalid itr
|
|
832
|
+
itr = m_dic->find(key);
|
|
833
|
+
if (itr == m_dic->end()) {
|
|
834
|
+
return true;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
auto oldKey = itr->first;
|
|
838
|
+
m_dic->erase(itr);
|
|
839
|
+
[oldKey release];
|
|
840
|
+
#else
|
|
841
|
+
if (mmkv_unlikely(m_enableKeyExpire)) {
|
|
842
|
+
// filterExpiredKeys() may invalid itr
|
|
843
|
+
eraseHelper(*m_dic, key);
|
|
844
|
+
} else {
|
|
845
|
+
m_dic->erase(itr);
|
|
846
|
+
}
|
|
847
|
+
#endif
|
|
848
|
+
}
|
|
849
|
+
return ret.first;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
KVHolderRet_t
|
|
857
|
+
MMKV::doAppendDataWithKey(const MMBuffer &data, const MMBuffer &keyData, bool isDataHolder, uint32_t originKeyLength) {
|
|
858
|
+
auto isKeyEncoded = (originKeyLength < keyData.length());
|
|
859
|
+
auto keyLength = static_cast<uint32_t>(keyData.length());
|
|
860
|
+
auto valueLength = static_cast<uint32_t>(data.length());
|
|
861
|
+
if (isDataHolder) {
|
|
862
|
+
valueLength += pbRawVarint32Size(valueLength);
|
|
863
|
+
}
|
|
864
|
+
// size needed to encode the key
|
|
865
|
+
size_t size = isKeyEncoded ? keyLength : (keyLength + pbRawVarint32Size(keyLength));
|
|
866
|
+
// size needed to encode the value
|
|
867
|
+
size += valueLength + pbRawVarint32Size(valueLength);
|
|
868
|
+
|
|
869
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
870
|
+
|
|
871
|
+
bool hasEnoughSize = ensureMemorySize(size);
|
|
872
|
+
if (!hasEnoughSize || !isFileValid()) {
|
|
873
|
+
return make_pair(false, KeyValueHolder());
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
877
|
+
if (m_crypter) {
|
|
878
|
+
if (KeyValueHolderCrypt::isValueStoredAsOffset(valueLength)) {
|
|
879
|
+
m_crypter->getCurStatus(t_status);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
#endif
|
|
883
|
+
try {
|
|
884
|
+
if (isKeyEncoded) {
|
|
885
|
+
m_output->writeRawData(keyData);
|
|
886
|
+
} else {
|
|
887
|
+
m_output->writeData(keyData);
|
|
888
|
+
}
|
|
889
|
+
if (isDataHolder) {
|
|
890
|
+
m_output->writeRawVarint32((int32_t) valueLength);
|
|
891
|
+
}
|
|
892
|
+
m_output->writeData(data); // note: write size of data
|
|
893
|
+
} catch (std::exception &e) {
|
|
894
|
+
MMKVError("%s", e.what());
|
|
895
|
+
return make_pair(false, KeyValueHolder());
|
|
896
|
+
} catch (...) {
|
|
897
|
+
MMKVError("append fail");
|
|
898
|
+
return make_pair(false, KeyValueHolder());
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
auto offset = static_cast<uint32_t>(m_actualSize);
|
|
902
|
+
auto ptr = (uint8_t *) m_file->getMemory() + Fixed32Size + m_actualSize;
|
|
903
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
904
|
+
if (m_crypter) {
|
|
905
|
+
m_crypter->encrypt(ptr, ptr, size);
|
|
906
|
+
}
|
|
907
|
+
#endif
|
|
908
|
+
m_actualSize += size;
|
|
909
|
+
updateCRCDigest(ptr, size);
|
|
910
|
+
|
|
911
|
+
return make_pair(true, KeyValueHolder(originKeyLength, valueLength, offset));
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
KVHolderRet_t MMKV::doOverrideDataWithKey(const MMBuffer &data,
|
|
915
|
+
const MMBuffer &keyData,
|
|
916
|
+
bool isDataHolder,
|
|
917
|
+
uint32_t originKeyLength) {
|
|
918
|
+
auto isKeyEncoded = (originKeyLength < keyData.length());
|
|
919
|
+
auto keyLength = static_cast<uint32_t>(keyData.length());
|
|
920
|
+
auto valueLength = static_cast<uint32_t>(data.length());
|
|
921
|
+
if (isDataHolder) {
|
|
922
|
+
valueLength += pbRawVarint32Size(valueLength);
|
|
923
|
+
}
|
|
924
|
+
// size needed to encode the key
|
|
925
|
+
size_t size = isKeyEncoded ? keyLength : (keyLength + pbRawVarint32Size(keyLength));
|
|
926
|
+
// size needed to encode the value
|
|
927
|
+
size += valueLength + pbRawVarint32Size(valueLength);
|
|
928
|
+
|
|
929
|
+
if (!checkSizeForOverride(size)) {
|
|
930
|
+
return doAppendDataWithKey(data, keyData, isDataHolder, originKeyLength);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// we don't not support override in multi-process mode
|
|
934
|
+
// SCOPED_LOCK(m_exclusiveProcessLock);
|
|
935
|
+
|
|
936
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
937
|
+
if (m_crypter) {
|
|
938
|
+
if (m_metaInfo->m_version >= MMKVVersionRandomIV) {
|
|
939
|
+
m_crypter->resetIV(m_metaInfo->m_vector, sizeof(m_metaInfo->m_vector));
|
|
940
|
+
} else {
|
|
941
|
+
m_crypter->resetIV();
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
#endif
|
|
945
|
+
try {
|
|
946
|
+
// write ItemSizeHolder
|
|
947
|
+
m_output->setPosition(0);
|
|
948
|
+
m_output->writeUInt32(AESCrypt::randomItemSizeHolder(ItemSizeHolderSize));
|
|
949
|
+
m_actualSize = ItemSizeHolderSize;
|
|
950
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
951
|
+
if (m_crypter) {
|
|
952
|
+
auto ptr = (uint8_t *) m_file->getMemory() + Fixed32Size;
|
|
953
|
+
m_crypter->encrypt(ptr, ptr, m_actualSize);
|
|
954
|
+
if (KeyValueHolderCrypt::isValueStoredAsOffset(valueLength)) {
|
|
955
|
+
m_crypter->getCurStatus(t_status);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
#endif
|
|
959
|
+
if (isKeyEncoded) {
|
|
960
|
+
m_output->writeRawData(keyData);
|
|
961
|
+
} else {
|
|
962
|
+
m_output->writeData(keyData);
|
|
963
|
+
}
|
|
964
|
+
if (isDataHolder) {
|
|
965
|
+
m_output->writeRawVarint32((int32_t) valueLength);
|
|
966
|
+
}
|
|
967
|
+
m_output->writeData(data); // note: write size of data
|
|
968
|
+
} catch (std::exception &e) {
|
|
969
|
+
MMKVError("%s", e.what());
|
|
970
|
+
return make_pair(false, KeyValueHolder());
|
|
971
|
+
} catch (...) {
|
|
972
|
+
MMKVError("append fail");
|
|
973
|
+
return make_pair(false, KeyValueHolder());
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
auto offset = static_cast<uint32_t>(m_actualSize);
|
|
977
|
+
m_actualSize += size;
|
|
978
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
979
|
+
if (m_crypter) {
|
|
980
|
+
auto ptr = (uint8_t *) m_file->getMemory() + Fixed32Size + offset;
|
|
981
|
+
m_crypter->encrypt(ptr, ptr, size);
|
|
982
|
+
}
|
|
983
|
+
#endif
|
|
984
|
+
recalculateCRCDigestOnly();
|
|
985
|
+
|
|
986
|
+
return make_pair(true, KeyValueHolder(originKeyLength, valueLength, offset));
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
bool MMKV::checkSizeForOverride(size_t size) {
|
|
990
|
+
if (!isFileValid()) {
|
|
991
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
992
|
+
return false;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
// only override if the file can hole it without ftruncate()
|
|
996
|
+
auto fileSize = m_file->getFileSize();
|
|
997
|
+
auto spaceNeededForOverride = size + Fixed32Size + ItemSizeHolderSize;
|
|
998
|
+
if (size > fileSize || spaceNeededForOverride > fileSize) {
|
|
999
|
+
return false;
|
|
1000
|
+
}
|
|
1001
|
+
return true;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
KVHolderRet_t MMKV::appendDataWithKey(const MMBuffer &data, MMKVKey_t key, bool isDataHolder) {
|
|
1005
|
+
#ifdef MMKV_APPLE
|
|
1006
|
+
auto oData = [key dataUsingEncoding:NSUTF8StringEncoding];
|
|
1007
|
+
auto keyData = MMBuffer(oData, MMBufferNoCopy);
|
|
1008
|
+
#else
|
|
1009
|
+
auto keyData = MMBuffer((void *) key.data(), key.size(), MMBufferNoCopy);
|
|
1010
|
+
#endif
|
|
1011
|
+
return doAppendDataWithKey(data, keyData, isDataHolder, static_cast<uint32_t>(keyData.length()));
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
KVHolderRet_t MMKV::overrideDataWithKey(const MMBuffer &data, MMKVKey_t key, bool isDataHolder) {
|
|
1015
|
+
#ifdef MMKV_APPLE
|
|
1016
|
+
auto oData = [key dataUsingEncoding:NSUTF8StringEncoding];
|
|
1017
|
+
auto keyData = MMBuffer(oData, MMBufferNoCopy);
|
|
1018
|
+
#else
|
|
1019
|
+
auto keyData = MMBuffer((void *) key.data(), key.size(), MMBufferNoCopy);
|
|
1020
|
+
#endif
|
|
1021
|
+
return doOverrideDataWithKey(data, keyData, isDataHolder, static_cast<uint32_t>(keyData.length()));
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
KVHolderRet_t MMKV::appendDataWithKey(const MMBuffer &data, const KeyValueHolder &kvHolder, bool isDataHolder) {
|
|
1025
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1026
|
+
|
|
1027
|
+
uint32_t keyLength = kvHolder.keySize;
|
|
1028
|
+
// size needed to encode the key
|
|
1029
|
+
size_t rawKeySize = keyLength + pbRawVarint32Size(keyLength);
|
|
1030
|
+
|
|
1031
|
+
// ensureMemorySize() might change kvHolder.offset, so have to do it early
|
|
1032
|
+
{
|
|
1033
|
+
auto valueLength = static_cast<uint32_t>(data.length());
|
|
1034
|
+
if (isDataHolder) {
|
|
1035
|
+
valueLength += pbRawVarint32Size(valueLength);
|
|
1036
|
+
}
|
|
1037
|
+
auto size = rawKeySize + valueLength + pbRawVarint32Size(valueLength);
|
|
1038
|
+
bool hasEnoughSize = ensureMemorySize(size);
|
|
1039
|
+
if (!hasEnoughSize) {
|
|
1040
|
+
return make_pair(false, KeyValueHolder());
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
auto basePtr = (uint8_t *) m_file->getMemory() + Fixed32Size;
|
|
1044
|
+
MMBuffer keyData(basePtr + kvHolder.offset, rawKeySize, MMBufferNoCopy);
|
|
1045
|
+
|
|
1046
|
+
return doAppendDataWithKey(data, keyData, isDataHolder, keyLength);
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// only one key in dict, do not append, just rewrite from beginning
|
|
1050
|
+
KVHolderRet_t MMKV::overrideDataWithKey(const MMBuffer &data, const KeyValueHolder &kvHolder, bool isDataHolder) {
|
|
1051
|
+
// we don't not support override in multi-process mode
|
|
1052
|
+
// SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1053
|
+
|
|
1054
|
+
uint32_t keyLength = kvHolder.keySize;
|
|
1055
|
+
// size needed to encode the key
|
|
1056
|
+
size_t rawKeySize = keyLength + pbRawVarint32Size(keyLength);
|
|
1057
|
+
|
|
1058
|
+
// ensureMemorySize() (inside doAppendDataWithKey() which be called from doOverrideDataWithKey())
|
|
1059
|
+
// might change kvHolder.offset, so have to do it early
|
|
1060
|
+
{
|
|
1061
|
+
auto valueLength = static_cast<uint32_t>(data.length());
|
|
1062
|
+
if (isDataHolder) {
|
|
1063
|
+
valueLength += pbRawVarint32Size(valueLength);
|
|
1064
|
+
}
|
|
1065
|
+
auto size = rawKeySize + valueLength + pbRawVarint32Size(valueLength);
|
|
1066
|
+
bool hasEnoughSize = checkSizeForOverride(size);
|
|
1067
|
+
if (!hasEnoughSize) {
|
|
1068
|
+
return appendDataWithKey(data, kvHolder, isDataHolder);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
auto basePtr = (uint8_t *) m_file->getMemory() + Fixed32Size;
|
|
1072
|
+
MMBuffer keyData;
|
|
1073
|
+
if (kvHolder.offset < ItemSizeHolderSize) {
|
|
1074
|
+
keyData = MMBuffer(basePtr + kvHolder.offset, rawKeySize, MMBufferCopy);
|
|
1075
|
+
} else {
|
|
1076
|
+
keyData = MMBuffer(basePtr + kvHolder.offset, rawKeySize, MMBufferNoCopy);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
return doOverrideDataWithKey(data, keyData, isDataHolder, keyLength);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
bool MMKV::fullWriteback(AESCrypt *newCrypter, bool onlyWhileExpire) {
|
|
1083
|
+
if (m_hasFullWriteback) {
|
|
1084
|
+
return true;
|
|
1085
|
+
}
|
|
1086
|
+
if (m_needLoadFromFile) {
|
|
1087
|
+
return true;
|
|
1088
|
+
}
|
|
1089
|
+
if (!isFileValid()) {
|
|
1090
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
1091
|
+
return false;
|
|
1092
|
+
}
|
|
1093
|
+
if (isReadOnly()) {
|
|
1094
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
if (mmkv_unlikely(m_enableKeyExpire)) {
|
|
1099
|
+
auto expiredCount = filterExpiredKeys();
|
|
1100
|
+
if (onlyWhileExpire && expiredCount == 0) {
|
|
1101
|
+
return true;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
auto isEmpty = m_crypter ? m_dicCrypt->empty() : m_dic->empty();
|
|
1106
|
+
if (isEmpty) {
|
|
1107
|
+
clearAll();
|
|
1108
|
+
return true;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1112
|
+
auto preparedData = m_crypter ? prepareEncode(*m_dicCrypt) : prepareEncode(*m_dic);
|
|
1113
|
+
auto sizeOfDic = preparedData.second;
|
|
1114
|
+
if (sizeOfDic > 0) {
|
|
1115
|
+
auto fileSize = m_file->getFileSize();
|
|
1116
|
+
if (sizeOfDic + Fixed32Size <= fileSize) {
|
|
1117
|
+
return doFullWriteBack(std::move(preparedData), newCrypter);
|
|
1118
|
+
} else {
|
|
1119
|
+
assert(0);
|
|
1120
|
+
assert(newCrypter == nullptr);
|
|
1121
|
+
// expandAndWriteBack() will extend file & full rewrite, no need to write back again
|
|
1122
|
+
auto newSize = sizeOfDic + Fixed32Size - fileSize;
|
|
1123
|
+
return expandAndWriteBack(newSize, std::move(preparedData));
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
return false;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// we don't need to really serialize the dictionary, just reuse what's already in the file
|
|
1130
|
+
static void
|
|
1131
|
+
memmoveDictionary(MMKVMap &dic, CodedOutputData *output, uint8_t *ptr, AESCrypt *encrypter, size_t totalSize) {
|
|
1132
|
+
auto originOutputPtr = output->curWritePointer();
|
|
1133
|
+
// make space to hold the fake size of dictionary's serialization result
|
|
1134
|
+
auto writePtr = originOutputPtr + ItemSizeHolderSize;
|
|
1135
|
+
// reuse what's already in the file
|
|
1136
|
+
if (!dic.empty()) {
|
|
1137
|
+
// sort by offset
|
|
1138
|
+
vector<KeyValueHolder *> vec;
|
|
1139
|
+
vec.reserve(dic.size());
|
|
1140
|
+
for (auto &itr : dic) {
|
|
1141
|
+
vec.push_back(&itr.second);
|
|
1142
|
+
}
|
|
1143
|
+
sort(vec.begin(), vec.end(), [](const auto &left, const auto &right) { return left->offset < right->offset; });
|
|
1144
|
+
|
|
1145
|
+
// merge nearby items to make memmove quicker
|
|
1146
|
+
vector<pair<uint32_t, uint32_t>> dataSections; // pair(offset, size)
|
|
1147
|
+
dataSections.emplace_back(vec.front()->offset, vec.front()->computedKVSize + vec.front()->valueSize);
|
|
1148
|
+
for (size_t index = 1, total = vec.size(); index < total; index++) {
|
|
1149
|
+
auto kvHolder = vec[index];
|
|
1150
|
+
auto &lastSection = dataSections.back();
|
|
1151
|
+
if (kvHolder->offset == lastSection.first + lastSection.second) {
|
|
1152
|
+
lastSection.second += kvHolder->computedKVSize + kvHolder->valueSize;
|
|
1153
|
+
} else {
|
|
1154
|
+
dataSections.emplace_back(kvHolder->offset, kvHolder->computedKVSize + kvHolder->valueSize);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
// do the move
|
|
1158
|
+
auto basePtr = ptr + Fixed32Size;
|
|
1159
|
+
for (auto §ion : dataSections) {
|
|
1160
|
+
// memmove() should handle this well: src == dst
|
|
1161
|
+
memmove(writePtr, basePtr + section.first, section.second);
|
|
1162
|
+
writePtr += section.second;
|
|
1163
|
+
}
|
|
1164
|
+
// update offset
|
|
1165
|
+
if (!encrypter) {
|
|
1166
|
+
auto offset = ItemSizeHolderSize;
|
|
1167
|
+
for (auto kvHolder : vec) {
|
|
1168
|
+
kvHolder->offset = offset;
|
|
1169
|
+
offset += kvHolder->computedKVSize + kvHolder->valueSize;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
// hold the fake size of dictionary's serialization result
|
|
1174
|
+
output->writeUInt32(AESCrypt::randomItemSizeHolder(ItemSizeHolderSize));
|
|
1175
|
+
auto writtenSize = static_cast<size_t>(writePtr - originOutputPtr);
|
|
1176
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1177
|
+
if (encrypter) {
|
|
1178
|
+
encrypter->encrypt(originOutputPtr, originOutputPtr, writtenSize);
|
|
1179
|
+
}
|
|
1180
|
+
#endif
|
|
1181
|
+
assert(writtenSize == totalSize);
|
|
1182
|
+
output->seek(writtenSize - ItemSizeHolderSize);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1186
|
+
|
|
1187
|
+
static void memmoveDictionary(MMKVMapCrypt &dic,
|
|
1188
|
+
CodedOutputData *output,
|
|
1189
|
+
uint8_t *ptr,
|
|
1190
|
+
AESCrypt *decrypter,
|
|
1191
|
+
AESCrypt *encrypter,
|
|
1192
|
+
pair<MMBuffer, size_t> &preparedData) {
|
|
1193
|
+
// reuse what's already in the file
|
|
1194
|
+
vector<KeyValueHolderCrypt *> vec;
|
|
1195
|
+
if (!dic.empty()) {
|
|
1196
|
+
// sort by offset
|
|
1197
|
+
vec.reserve(dic.size());
|
|
1198
|
+
for (auto &itr : dic) {
|
|
1199
|
+
if (itr.second.type == KeyValueHolderType_Offset) {
|
|
1200
|
+
vec.push_back(&itr.second);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
sort(vec.begin(), vec.end(), [](auto left, auto right) { return left->offset < right->offset; });
|
|
1204
|
+
}
|
|
1205
|
+
auto sizeHolderSize = ItemSizeHolderSize;
|
|
1206
|
+
auto sizeHolder = AESCrypt::randomItemSizeHolder(sizeHolderSize);
|
|
1207
|
+
if (!vec.empty()) {
|
|
1208
|
+
auto smallestOffset = vec.front()->offset;
|
|
1209
|
+
if (smallestOffset != ItemSizeHolderSize && smallestOffset <= 5) {
|
|
1210
|
+
sizeHolderSize = smallestOffset;
|
|
1211
|
+
assert(sizeHolderSize != 0);
|
|
1212
|
+
static const uint32_t ItemSizeHolders[] = {0, 0x0f, 0xff, 0xffff, 0xffffff, 0xffffffff};
|
|
1213
|
+
sizeHolder = AESCrypt::randomItemSizeHolder(sizeHolderSize);
|
|
1214
|
+
assert(sizeHolder >= ItemSizeHolders[sizeHolderSize] && sizeHolder <= ItemSizeHolders[sizeHolderSize]);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
output->writeRawVarint32(static_cast<int32_t>(sizeHolder));
|
|
1218
|
+
auto writePtr = output->curWritePointer();
|
|
1219
|
+
if (encrypter) {
|
|
1220
|
+
encrypter->encrypt(writePtr - sizeHolderSize, writePtr - sizeHolderSize, sizeHolderSize);
|
|
1221
|
+
}
|
|
1222
|
+
if (!vec.empty()) {
|
|
1223
|
+
// merge nearby items to make memmove quicker
|
|
1224
|
+
vector<tuple<uint32_t, uint32_t, AESCryptStatus *>> dataSections; // pair(offset, size)
|
|
1225
|
+
dataSections.push_back(vec.front()->toTuple());
|
|
1226
|
+
for (size_t index = 1, total = vec.size(); index < total; index++) {
|
|
1227
|
+
auto kvHolder = vec[index];
|
|
1228
|
+
auto &lastSection = dataSections.back();
|
|
1229
|
+
if (kvHolder->offset == get<0>(lastSection) + get<1>(lastSection)) {
|
|
1230
|
+
get<1>(lastSection) += kvHolder->pbKeyValueSize + kvHolder->keySize + kvHolder->valueSize;
|
|
1231
|
+
} else {
|
|
1232
|
+
dataSections.push_back(kvHolder->toTuple());
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
// do the move
|
|
1236
|
+
auto basePtr = ptr + Fixed32Size;
|
|
1237
|
+
for (auto §ion : dataSections) {
|
|
1238
|
+
auto crypter = decrypter->cloneWithStatus(*get<2>(section));
|
|
1239
|
+
crypter.decrypt(basePtr + get<0>(section), writePtr, get<1>(section));
|
|
1240
|
+
writePtr += get<1>(section);
|
|
1241
|
+
}
|
|
1242
|
+
// update offset & AESCryptStatus
|
|
1243
|
+
if (encrypter) {
|
|
1244
|
+
auto offset = sizeHolderSize;
|
|
1245
|
+
for (auto kvHolder : vec) {
|
|
1246
|
+
kvHolder->offset = offset;
|
|
1247
|
+
auto size = kvHolder->pbKeyValueSize + kvHolder->keySize + kvHolder->valueSize;
|
|
1248
|
+
encrypter->getCurStatus(kvHolder->cryptStatus);
|
|
1249
|
+
encrypter->encrypt(basePtr + offset, basePtr + offset, size);
|
|
1250
|
+
offset += size;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
auto &data = preparedData.first;
|
|
1255
|
+
if (data.length() > 0) {
|
|
1256
|
+
auto dataSize = CodedInputData(data.getPtr(), data.length()).readUInt32();
|
|
1257
|
+
if (dataSize > 0) {
|
|
1258
|
+
auto dataPtr = (uint8_t *) data.getPtr() + pbRawVarint32Size(dataSize);
|
|
1259
|
+
if (encrypter) {
|
|
1260
|
+
encrypter->encrypt(dataPtr, writePtr, dataSize);
|
|
1261
|
+
} else {
|
|
1262
|
+
memcpy(writePtr, dataPtr, dataSize);
|
|
1263
|
+
}
|
|
1264
|
+
writePtr += dataSize;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
auto writtenSize = static_cast<size_t>(writePtr - output->curWritePointer());
|
|
1268
|
+
assert(writtenSize + sizeHolderSize == preparedData.second);
|
|
1269
|
+
output->seek(writtenSize);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
# define InvalidCryptPtr ((AESCrypt *) (void *) (1))
|
|
1273
|
+
|
|
1274
|
+
#endif // MMKV_DISABLE_CRYPT
|
|
1275
|
+
|
|
1276
|
+
static void fullWriteBackWholeData(MMBuffer allData, size_t totalSize, CodedOutputData *output) {
|
|
1277
|
+
auto originOutputPtr = output->curWritePointer();
|
|
1278
|
+
output->writeUInt32(AESCrypt::randomItemSizeHolder(ItemSizeHolderSize));
|
|
1279
|
+
if (allData.length() > 0) {
|
|
1280
|
+
auto dataSize = CodedInputData(allData.getPtr(), allData.length()).readUInt32();
|
|
1281
|
+
if (dataSize > 0) {
|
|
1282
|
+
auto dataPtr = (uint8_t *) allData.getPtr() + pbRawVarint32Size(dataSize);
|
|
1283
|
+
memcpy(output->curWritePointer(), dataPtr, dataSize);
|
|
1284
|
+
output->seek(dataSize);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
[[maybe_unused]] auto writtenSize = (size_t)(output->curWritePointer() - originOutputPtr);
|
|
1288
|
+
assert(writtenSize == totalSize);
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1292
|
+
bool MMKV::doFullWriteBack(pair<MMBuffer, size_t> prepared, AESCrypt *newCrypter, bool needSync) {
|
|
1293
|
+
auto ptr = (uint8_t *) m_file->getMemory();
|
|
1294
|
+
auto totalSize = prepared.second;
|
|
1295
|
+
|
|
1296
|
+
uint8_t newIV[AES_IV_LEN];
|
|
1297
|
+
auto encrypter = (newCrypter == InvalidCryptPtr) ? nullptr : (newCrypter ? newCrypter : m_crypter);
|
|
1298
|
+
if (encrypter) {
|
|
1299
|
+
AESCrypt::fillRandomIV(newIV);
|
|
1300
|
+
encrypter->resetIV(newIV, sizeof(newIV));
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
delete m_output;
|
|
1304
|
+
m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
|
|
1305
|
+
if (m_crypter) {
|
|
1306
|
+
auto decrypter = m_crypter;
|
|
1307
|
+
memmoveDictionary(*m_dicCrypt, m_output, ptr, decrypter, encrypter, prepared);
|
|
1308
|
+
} else if (prepared.first.length() != 0) {
|
|
1309
|
+
auto &preparedData = prepared.first;
|
|
1310
|
+
fullWriteBackWholeData(std::move(preparedData), totalSize, m_output);
|
|
1311
|
+
if (encrypter) {
|
|
1312
|
+
encrypter->encrypt(ptr + Fixed32Size, ptr + Fixed32Size, totalSize);
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
memmoveDictionary(*m_dic, m_output, ptr, encrypter, totalSize);
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
m_actualSize = totalSize;
|
|
1319
|
+
if (encrypter) {
|
|
1320
|
+
recalculateCRCDigestWithIV(newIV);
|
|
1321
|
+
} else {
|
|
1322
|
+
recalculateCRCDigestWithIV(nullptr);
|
|
1323
|
+
}
|
|
1324
|
+
m_hasFullWriteback = true;
|
|
1325
|
+
// make sure lastConfirmedMetaInfo is saved if needed
|
|
1326
|
+
if (needSync) {
|
|
1327
|
+
sync(MMKV_SYNC);
|
|
1328
|
+
}
|
|
1329
|
+
return true;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
#else // MMKV_DISABLE_CRYPT
|
|
1333
|
+
|
|
1334
|
+
bool MMKV::doFullWriteBack(pair<MMBuffer, size_t> prepared, AESCrypt *, bool needSync) {
|
|
1335
|
+
auto ptr = (uint8_t *) m_file->getMemory();
|
|
1336
|
+
auto totalSize = prepared.second;
|
|
1337
|
+
|
|
1338
|
+
delete m_output;
|
|
1339
|
+
m_output = new CodedOutputData(ptr + Fixed32Size, m_file->getFileSize() - Fixed32Size);
|
|
1340
|
+
if (prepared.first.length() != 0) {
|
|
1341
|
+
auto &preparedData = prepared.first;
|
|
1342
|
+
fullWriteBackWholeData(std::move(preparedData), totalSize, m_output);
|
|
1343
|
+
} else {
|
|
1344
|
+
constexpr AESCrypt *encrypter = nullptr;
|
|
1345
|
+
memmoveDictionary(*m_dic, m_output, ptr, encrypter, totalSize);
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
m_actualSize = totalSize;
|
|
1349
|
+
recalculateCRCDigestWithIV(nullptr);
|
|
1350
|
+
m_hasFullWriteback = true;
|
|
1351
|
+
// make sure lastConfirmedMetaInfo is saved if needed
|
|
1352
|
+
if (needSync) {
|
|
1353
|
+
sync(MMKV_SYNC);
|
|
1354
|
+
}
|
|
1355
|
+
return true;
|
|
1356
|
+
}
|
|
1357
|
+
#endif // MMKV_DISABLE_CRYPT
|
|
1358
|
+
|
|
1359
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1360
|
+
bool MMKV::reKey(const string &cryptKey, bool aes256) {
|
|
1361
|
+
if (isReadOnly()) {
|
|
1362
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
1363
|
+
return false;
|
|
1364
|
+
}
|
|
1365
|
+
SCOPED_LOCK(m_lock);
|
|
1366
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1367
|
+
checkLoadData();
|
|
1368
|
+
if (!isFileValid()) {
|
|
1369
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
1370
|
+
return false;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
bool ret = false;
|
|
1374
|
+
if (m_crypter) {
|
|
1375
|
+
if (cryptKey.length() > 0) {
|
|
1376
|
+
string oldKey = this->cryptKey();
|
|
1377
|
+
if (cryptKey == oldKey) {
|
|
1378
|
+
return true;
|
|
1379
|
+
} else {
|
|
1380
|
+
// change encryption key
|
|
1381
|
+
MMKVInfo("reKey with new aes key");
|
|
1382
|
+
auto newCrypt = new AESCrypt(cryptKey.data(), cryptKey.length(), nullptr, 0, aes256);
|
|
1383
|
+
m_hasFullWriteback = false;
|
|
1384
|
+
ret = fullWriteback(newCrypt);
|
|
1385
|
+
if (ret) {
|
|
1386
|
+
delete m_crypter;
|
|
1387
|
+
m_crypter = newCrypt;
|
|
1388
|
+
} else {
|
|
1389
|
+
delete newCrypt;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
} else {
|
|
1393
|
+
// decryption to plain text
|
|
1394
|
+
MMKVInfo("reKey to no aes key");
|
|
1395
|
+
m_hasFullWriteback = false;
|
|
1396
|
+
ret = fullWriteback(InvalidCryptPtr);
|
|
1397
|
+
if (ret) {
|
|
1398
|
+
delete m_crypter;
|
|
1399
|
+
m_crypter = nullptr;
|
|
1400
|
+
if (!m_dic) {
|
|
1401
|
+
m_dic = new MMKVMap();
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
} else {
|
|
1406
|
+
if (cryptKey.length() > 0) {
|
|
1407
|
+
// transform plain text to encrypted text
|
|
1408
|
+
MMKVInfo("reKey to a aes key");
|
|
1409
|
+
m_hasFullWriteback = false;
|
|
1410
|
+
auto newCrypt = new AESCrypt(cryptKey.data(), cryptKey.length(), nullptr, 0, aes256);
|
|
1411
|
+
ret = fullWriteback(newCrypt);
|
|
1412
|
+
if (ret) {
|
|
1413
|
+
m_crypter = newCrypt;
|
|
1414
|
+
if (!m_dicCrypt) {
|
|
1415
|
+
m_dicCrypt = new MMKVMapCrypt();
|
|
1416
|
+
}
|
|
1417
|
+
} else {
|
|
1418
|
+
delete newCrypt;
|
|
1419
|
+
}
|
|
1420
|
+
} else {
|
|
1421
|
+
return true;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
// m_dic or m_dicCrypt is not valid after reKey
|
|
1425
|
+
if (ret) {
|
|
1426
|
+
clearMemoryCache();
|
|
1427
|
+
}
|
|
1428
|
+
return ret;
|
|
1429
|
+
}
|
|
1430
|
+
#endif
|
|
1431
|
+
|
|
1432
|
+
void MMKV::trim() {
|
|
1433
|
+
MMKVInfo("prepare to trim %s", m_mmapID.c_str());
|
|
1434
|
+
if (isReadOnly()) {
|
|
1435
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
SCOPED_LOCK(m_lock);
|
|
1439
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1440
|
+
checkLoadData();
|
|
1441
|
+
if (!isFileValid()) {
|
|
1442
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
1443
|
+
return;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
if (m_actualSize == 0) {
|
|
1447
|
+
clearAll();
|
|
1448
|
+
return;
|
|
1449
|
+
} else if (m_file->getFileSize() <= m_expectedCapacity) {
|
|
1450
|
+
return;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
fullWriteback();
|
|
1454
|
+
auto oldSize = m_file->getFileSize();
|
|
1455
|
+
auto fileSize = oldSize;
|
|
1456
|
+
while (fileSize > (m_actualSize + Fixed32Size) * 2) {
|
|
1457
|
+
fileSize /= 2;
|
|
1458
|
+
}
|
|
1459
|
+
fileSize = std::max<size_t>(fileSize, m_expectedCapacity);
|
|
1460
|
+
if (oldSize == fileSize) {
|
|
1461
|
+
MMKVInfo("there's no need to trim %s with size %zu, actualSize %zu", m_mmapID.c_str(), fileSize, m_actualSize);
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
MMKVInfo("trimming %s from %zu to %zu, actualSize %zu", m_mmapID.c_str(), oldSize, fileSize, m_actualSize);
|
|
1466
|
+
|
|
1467
|
+
if (!m_file->truncate(fileSize)) {
|
|
1468
|
+
return;
|
|
1469
|
+
}
|
|
1470
|
+
fileSize = m_file->getFileSize();
|
|
1471
|
+
auto ptr = (uint8_t *) m_file->getMemory();
|
|
1472
|
+
delete m_output;
|
|
1473
|
+
m_output = new CodedOutputData(ptr + pbFixed32Size(), fileSize - Fixed32Size);
|
|
1474
|
+
m_output->seek(m_actualSize);
|
|
1475
|
+
|
|
1476
|
+
MMKVInfo("finish trim %s from %zu to %zu", m_mmapID.c_str(), oldSize, fileSize);
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
void MMKV::clearAll(bool keepSpace) {
|
|
1480
|
+
MMKVInfo("cleaning all key-values from [%s]", m_mmapID.c_str());
|
|
1481
|
+
if (isReadOnly()) {
|
|
1482
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1485
|
+
SCOPED_LOCK(m_lock);
|
|
1486
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1487
|
+
checkLoadData();
|
|
1488
|
+
if (!isFileValid()) {
|
|
1489
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
if (m_file->getFileSize() == m_expectedCapacity && m_actualSize == 0) {
|
|
1494
|
+
MMKVInfo("nothing to clear for [%s]", m_mmapID.c_str());
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
if (!keepSpace) {
|
|
1499
|
+
m_file->truncate(m_expectedCapacity);
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1503
|
+
uint8_t newIV[AES_IV_LEN];
|
|
1504
|
+
AESCrypt::fillRandomIV(newIV);
|
|
1505
|
+
if (m_crypter) {
|
|
1506
|
+
m_crypter->resetIV(newIV, sizeof(newIV));
|
|
1507
|
+
}
|
|
1508
|
+
writeActualSize(0, 0, newIV, IncreaseSequence);
|
|
1509
|
+
#else
|
|
1510
|
+
writeActualSize(0, 0, nullptr, IncreaseSequence);
|
|
1511
|
+
#endif
|
|
1512
|
+
|
|
1513
|
+
m_metaFile->msync(MMKV_SYNC);
|
|
1514
|
+
|
|
1515
|
+
clearMemoryCache(keepSpace);
|
|
1516
|
+
loadFromFile();
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
size_t MMKV::importFrom(MMKV *src) {
|
|
1520
|
+
if (!src) {
|
|
1521
|
+
return 0;
|
|
1522
|
+
}
|
|
1523
|
+
MMKVInfo("importing from [%s] to [%s]", src->m_mmapID.c_str(), m_mmapID.c_str());
|
|
1524
|
+
if (isReadOnly()) {
|
|
1525
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
1526
|
+
return 0;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
SCOPED_LOCK(m_lock);
|
|
1530
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1531
|
+
SCOPED_LOCK(src->m_lock);
|
|
1532
|
+
SCOPED_LOCK(src->m_exclusiveProcessLock);
|
|
1533
|
+
|
|
1534
|
+
checkLoadData();
|
|
1535
|
+
src->checkLoadData();
|
|
1536
|
+
if (!isFileValid() || !src->isFileValid()) {
|
|
1537
|
+
MMKVWarning("[%s] or [%s] file not valid", m_mmapID.c_str(), src->m_mmapID.c_str());
|
|
1538
|
+
return 0;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
size_t count = 0;
|
|
1542
|
+
bool notAutoExpire = !m_enableKeyExpire;
|
|
1543
|
+
auto time = UInt32ToInt32((m_expiredInSeconds != ExpireNever) ? getCurrentTimeInSecond() + m_expiredInSeconds : ExpireNever);
|
|
1544
|
+
for (auto &key : src->allKeys(false)) {
|
|
1545
|
+
auto value = src->getDataForKey(key);
|
|
1546
|
+
if (value.length() > 0) {
|
|
1547
|
+
if (mmkv_likely(notAutoExpire)) {
|
|
1548
|
+
setDataForKey(std::move(value), key, false);
|
|
1549
|
+
} else {
|
|
1550
|
+
auto tmp = MMBuffer(value.length() + Fixed32Size);
|
|
1551
|
+
CodedOutputData output(tmp.getPtr(), tmp.length());
|
|
1552
|
+
// no need write size, it's already written in value
|
|
1553
|
+
output.writeRawData(value);
|
|
1554
|
+
output.writeRawLittleEndian32(time);
|
|
1555
|
+
setDataForKey(std::move(tmp), key, false);
|
|
1556
|
+
}
|
|
1557
|
+
count++;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
MMKVInfo("imported %llu from [%s] to [%s]", count, src->m_mmapID.c_str(), m_mmapID.c_str());
|
|
1562
|
+
return count;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
static std::pair<MMKVPath_t, MMKVPath_t> getStorage(const std::string &mmapID, const MMKVPath_t *relatePath, std::string& realID, std::string& mmapKey) {
|
|
1566
|
+
#ifdef MMKV_ANDROID
|
|
1567
|
+
auto migrateStatus = tryMigrateLegacyMMKVFile(mmapID, relatePath);
|
|
1568
|
+
if (migrateStatus == MigrateStatus::NoneExist) {
|
|
1569
|
+
MMKVWarning("file id [%s] not exist in path %s", mmapID.c_str(), relatePath ? relatePath->c_str() : "default");
|
|
1570
|
+
return {};
|
|
1571
|
+
} else if (migrateStatus == MigrateStatus::OldToNewMigrateFail) {
|
|
1572
|
+
realID = legacyMmapedKVKey(mmapID, relatePath);
|
|
1573
|
+
} else {
|
|
1574
|
+
realID = mmapID;
|
|
1575
|
+
}
|
|
1576
|
+
#else
|
|
1577
|
+
realID = mmapID;
|
|
1578
|
+
#endif
|
|
1579
|
+
mmapKey = mmapedKVKey(realID, relatePath);
|
|
1580
|
+
MMKVDebug("mmapKey %s, real ID %s", mmapKey.c_str(), realID.c_str());
|
|
1581
|
+
|
|
1582
|
+
MMKVPath_t kvPath = mappedKVPathWithID(realID, relatePath);
|
|
1583
|
+
MMKVPath_t crcPath = crcPathWithPath(kvPath);
|
|
1584
|
+
if (!isFileExist(kvPath)) {
|
|
1585
|
+
#ifdef MMKV_WIN32
|
|
1586
|
+
MMKVInfo("file not exist %ls", kvPath.c_str());
|
|
1587
|
+
#else
|
|
1588
|
+
MMKVInfo("file not exist %s", kvPath.c_str());
|
|
1589
|
+
#endif
|
|
1590
|
+
kvPath.resize(0);
|
|
1591
|
+
}
|
|
1592
|
+
if (!isFileExist(crcPath)) {
|
|
1593
|
+
#ifdef MMKV_WIN32
|
|
1594
|
+
MMKVInfo("crc file not exist %ls", crcPath.c_str());
|
|
1595
|
+
#else
|
|
1596
|
+
MMKVInfo("crc file not exist %s", crcPath.c_str());
|
|
1597
|
+
#endif // MMKV_WIN32
|
|
1598
|
+
crcPath.resize(0);
|
|
1599
|
+
}
|
|
1600
|
+
return {kvPath, crcPath};
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
bool MMKV::isFileValid(const string &mmapID, const MMKVPath_t *relatePath) {
|
|
1604
|
+
if (!g_instanceLock) {
|
|
1605
|
+
return false;
|
|
1606
|
+
}
|
|
1607
|
+
SCOPED_LOCK(g_instanceLock);
|
|
1608
|
+
|
|
1609
|
+
std::string realID, mmapKey;
|
|
1610
|
+
auto [kvPath, crcPath] = getStorage(mmapID, relatePath, realID, mmapKey);
|
|
1611
|
+
if (kvPath.empty()) {
|
|
1612
|
+
return true;
|
|
1613
|
+
}
|
|
1614
|
+
if (crcPath.empty()) {
|
|
1615
|
+
return false;
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
uint32_t crcFile = 0;
|
|
1619
|
+
MMBuffer *data = readWholeFile(crcPath);
|
|
1620
|
+
if (data) {
|
|
1621
|
+
if (data->getPtr()) {
|
|
1622
|
+
MMKVMetaInfo metaInfo;
|
|
1623
|
+
metaInfo.read(data->getPtr());
|
|
1624
|
+
crcFile = metaInfo.m_crcDigest;
|
|
1625
|
+
}
|
|
1626
|
+
delete data;
|
|
1627
|
+
} else {
|
|
1628
|
+
return false;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
uint32_t crcDigest = 0;
|
|
1632
|
+
MMBuffer *fileData = readWholeFile(kvPath);
|
|
1633
|
+
if (fileData) {
|
|
1634
|
+
if (fileData->getPtr() && (fileData->length() >= Fixed32Size)) {
|
|
1635
|
+
uint32_t actualSize = 0;
|
|
1636
|
+
memcpy(&actualSize, fileData->getPtr(), Fixed32Size);
|
|
1637
|
+
if (actualSize > (fileData->length() - Fixed32Size)) {
|
|
1638
|
+
delete fileData;
|
|
1639
|
+
return false;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
crcDigest = (uint32_t) CRC32(0, (const uint8_t *) fileData->getPtr() + Fixed32Size, (uint32_t) actualSize);
|
|
1643
|
+
}
|
|
1644
|
+
delete fileData;
|
|
1645
|
+
return crcFile == crcDigest;
|
|
1646
|
+
} else {
|
|
1647
|
+
return false;
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
bool MMKV::removeStorage(const std::string &mmapID, const MMKVPath_t *relatePath) {
|
|
1652
|
+
if (!g_instanceLock) {
|
|
1653
|
+
return false;
|
|
1654
|
+
}
|
|
1655
|
+
SCOPED_LOCK(g_instanceLock);
|
|
1656
|
+
|
|
1657
|
+
std::string realID, mmapKey;
|
|
1658
|
+
auto [kvPath, crcPath] = getStorage(mmapID, relatePath, realID, mmapKey);
|
|
1659
|
+
if (kvPath.empty() && crcPath.empty()) {
|
|
1660
|
+
return false;
|
|
1661
|
+
}
|
|
1662
|
+
MMKVInfo("remove storage [%s]", realID.c_str());
|
|
1663
|
+
|
|
1664
|
+
if (crcPath.empty()) {
|
|
1665
|
+
deleteFile(kvPath);
|
|
1666
|
+
return true;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
File crcFile(crcPath, OpenFlag::ReadOnly);
|
|
1670
|
+
if (!crcFile.isFileValid()) {
|
|
1671
|
+
deleteFile(kvPath);
|
|
1672
|
+
return true;
|
|
1673
|
+
}
|
|
1674
|
+
FileLock fileLock(crcFile.getFd());
|
|
1675
|
+
InterProcessLock lock(&fileLock, ExclusiveLockType);
|
|
1676
|
+
SCOPED_LOCK(&lock);
|
|
1677
|
+
|
|
1678
|
+
auto itr = g_instanceDic->find(mmapKey);
|
|
1679
|
+
if (itr != g_instanceDic->end()) {
|
|
1680
|
+
itr->second->close();
|
|
1681
|
+
// itr is not valid after this
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
deleteFile(kvPath);
|
|
1685
|
+
deleteFile(crcPath);
|
|
1686
|
+
|
|
1687
|
+
return true;
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
bool MMKV::checkExist(const std::string &mmapID, const MMKVPath_t *relatePath) {
|
|
1691
|
+
if (!g_instanceLock) {
|
|
1692
|
+
return false;
|
|
1693
|
+
}
|
|
1694
|
+
SCOPED_LOCK(g_instanceLock);
|
|
1695
|
+
|
|
1696
|
+
std::string realID, mmapKey;
|
|
1697
|
+
auto [kvPath, crcPath] = getStorage(mmapID, relatePath, realID, mmapKey);
|
|
1698
|
+
return (!kvPath.empty() && !crcPath.empty());
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
// ---- auto expire ----
|
|
1702
|
+
|
|
1703
|
+
uint32_t MMKV::getCurrentTimeInSecond() {
|
|
1704
|
+
auto time = ::time(nullptr);
|
|
1705
|
+
return static_cast<uint32_t>(time);
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
bool MMKV::doFullWriteBack(MMKVVector &&vec) {
|
|
1709
|
+
auto preparedData = prepareEncode(std::move(vec));
|
|
1710
|
+
|
|
1711
|
+
// must clean before write-back and after prepareEncode()
|
|
1712
|
+
if (m_crypter) {
|
|
1713
|
+
clearDictionary(m_dicCrypt);
|
|
1714
|
+
} else {
|
|
1715
|
+
clearDictionary(m_dic);
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
bool ret = false;
|
|
1719
|
+
auto sizeOfDic = preparedData.second;
|
|
1720
|
+
auto fileSize = m_file->getFileSize();
|
|
1721
|
+
if (sizeOfDic + Fixed32Size <= fileSize) {
|
|
1722
|
+
ret = doFullWriteBack(std::move(preparedData), nullptr);
|
|
1723
|
+
} else {
|
|
1724
|
+
// expandAndWriteBack() will extend file & full rewrite, no need to write back again
|
|
1725
|
+
auto newSize = sizeOfDic + Fixed32Size - fileSize;
|
|
1726
|
+
ret = expandAndWriteBack(newSize, std::move(preparedData));
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
clearMemoryCache();
|
|
1730
|
+
return ret;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
bool MMKV::enableAutoKeyExpire(uint32_t expiredInSeconds) {
|
|
1734
|
+
if (isReadOnly()) {
|
|
1735
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
1736
|
+
return false;
|
|
1737
|
+
}
|
|
1738
|
+
SCOPED_LOCK(m_lock);
|
|
1739
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1740
|
+
checkLoadData();
|
|
1741
|
+
if (!isFileValid() || !m_metaFile->isFileValid()) {
|
|
1742
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
1743
|
+
return false;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
if (m_enableCompareBeforeSet) {
|
|
1747
|
+
MMKVError("enableCompareBeforeSet will be invalid when Expiration is on");
|
|
1748
|
+
m_enableCompareBeforeSet = false;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
if (m_expiredInSeconds != expiredInSeconds) {
|
|
1752
|
+
MMKVInfo("expiredInSeconds: %u", expiredInSeconds);
|
|
1753
|
+
m_expiredInSeconds = expiredInSeconds;
|
|
1754
|
+
}
|
|
1755
|
+
m_enableKeyExpire = true;
|
|
1756
|
+
if (m_metaInfo->hasFlag(MMKVMetaInfo::EnableKeyExipre)) {
|
|
1757
|
+
return true;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
auto autoRecordExpireTime = (m_expiredInSeconds != 0);
|
|
1761
|
+
auto time = autoRecordExpireTime ? getCurrentTimeInSecond() + m_expiredInSeconds : 0;
|
|
1762
|
+
MMKVInfo("turn on recording expire date for all keys inside [%s] from now %u", m_mmapID.c_str(), time);
|
|
1763
|
+
m_metaInfo->setFlag(MMKVMetaInfo::EnableKeyExipre);
|
|
1764
|
+
m_metaInfo->m_version = MMKVVersionFlag;
|
|
1765
|
+
|
|
1766
|
+
if (m_file->getFileSize() == m_expectedCapacity && m_actualSize == 0) {
|
|
1767
|
+
MMKVInfo("file is new, don't need a full writeback [%s], just update meta file", m_mmapID.c_str());
|
|
1768
|
+
writeActualSize(0, 0, nullptr, IncreaseSequence);
|
|
1769
|
+
m_metaFile->msync(MMKV_SYNC);
|
|
1770
|
+
return true;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
MMKVVector vec;
|
|
1774
|
+
auto packKeyValue = [&](const auto &key, const MMBuffer &value) {
|
|
1775
|
+
MMBuffer data(value.length() + Fixed32Size);
|
|
1776
|
+
auto ptr = (uint8_t *) data.getPtr();
|
|
1777
|
+
memcpy(ptr, value.getPtr(), value.length());
|
|
1778
|
+
memcpy(ptr + value.length(), &time, Fixed32Size);
|
|
1779
|
+
vec.emplace_back(key, std::move(data));
|
|
1780
|
+
};
|
|
1781
|
+
|
|
1782
|
+
auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
|
|
1783
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1784
|
+
if (m_crypter) {
|
|
1785
|
+
for (auto &pair : *m_dicCrypt) {
|
|
1786
|
+
auto &key = pair.first;
|
|
1787
|
+
auto &value = pair.second;
|
|
1788
|
+
auto buffer = value.toMMBuffer(basePtr, m_crypter);
|
|
1789
|
+
packKeyValue(key, buffer);
|
|
1790
|
+
}
|
|
1791
|
+
} else
|
|
1792
|
+
#endif
|
|
1793
|
+
{
|
|
1794
|
+
for (auto &pair : *m_dic) {
|
|
1795
|
+
auto &key = pair.first;
|
|
1796
|
+
auto &value = pair.second;
|
|
1797
|
+
auto buffer = value.toMMBuffer(basePtr);
|
|
1798
|
+
packKeyValue(key, buffer);
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
return doFullWriteBack(std::move(vec));
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
bool MMKV::disableAutoKeyExpire() {
|
|
1806
|
+
if (isReadOnly()) {
|
|
1807
|
+
MMKVWarning("[%s] file readonly", m_mmapID.c_str());
|
|
1808
|
+
return false;
|
|
1809
|
+
}
|
|
1810
|
+
SCOPED_LOCK(m_lock);
|
|
1811
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
1812
|
+
checkLoadData();
|
|
1813
|
+
if (!isFileValid() || !m_metaFile->isFileValid()) {
|
|
1814
|
+
MMKVWarning("[%s] file not valid", m_mmapID.c_str());
|
|
1815
|
+
return false;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
m_expiredInSeconds = 0;
|
|
1819
|
+
m_enableKeyExpire = false;
|
|
1820
|
+
if (!m_metaInfo->hasFlag(MMKVMetaInfo::EnableKeyExipre)) {
|
|
1821
|
+
return true;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
MMKVInfo("erase previous recorded expire date for all keys inside [%s]", m_mmapID.c_str());
|
|
1825
|
+
m_metaInfo->unsetFlag(MMKVMetaInfo::EnableKeyExipre);
|
|
1826
|
+
m_metaInfo->m_version = MMKVVersionFlag;
|
|
1827
|
+
|
|
1828
|
+
if (m_file->getFileSize() == m_expectedCapacity && m_actualSize == 0) {
|
|
1829
|
+
MMKVInfo("file is new, don't need a full write-back [%s], just update meta file", m_mmapID.c_str());
|
|
1830
|
+
writeActualSize(0, 0, nullptr, IncreaseSequence);
|
|
1831
|
+
m_metaFile->msync(MMKV_SYNC);
|
|
1832
|
+
return true;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
MMKVVector vec;
|
|
1836
|
+
auto packKeyValue = [&](auto &key, const MMBuffer &value) {
|
|
1837
|
+
assert(value.length() >= Fixed32Size);
|
|
1838
|
+
if (value.length() < Fixed32Size) {
|
|
1839
|
+
#ifdef MMKV_APPLE
|
|
1840
|
+
MMKVWarning("key [%@] has invalid value size %u", key, value.length());
|
|
1841
|
+
#else
|
|
1842
|
+
MMKVWarning("key [%s] has invalid value size %u", key.data(), value.length());
|
|
1843
|
+
#endif
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
MMBuffer data(value.length() - Fixed32Size);
|
|
1847
|
+
auto ptr = (uint8_t *) data.getPtr();
|
|
1848
|
+
memcpy(ptr, value.getPtr(), value.length() - Fixed32Size);
|
|
1849
|
+
vec.emplace_back(key, std::move(data));
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
|
|
1853
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1854
|
+
if (m_crypter) {
|
|
1855
|
+
for (auto &pair : *m_dicCrypt) {
|
|
1856
|
+
auto &key = pair.first;
|
|
1857
|
+
auto &value = pair.second;
|
|
1858
|
+
auto buffer = value.toMMBuffer(basePtr, m_crypter);
|
|
1859
|
+
packKeyValue(key, buffer);
|
|
1860
|
+
}
|
|
1861
|
+
} else
|
|
1862
|
+
#endif
|
|
1863
|
+
{
|
|
1864
|
+
for (auto &pair : *m_dic) {
|
|
1865
|
+
auto &key = pair.first;
|
|
1866
|
+
auto &value = pair.second;
|
|
1867
|
+
auto buffer = value.toMMBuffer(basePtr);
|
|
1868
|
+
packKeyValue(key, buffer);
|
|
1869
|
+
}
|
|
1870
|
+
}
|
|
1871
|
+
|
|
1872
|
+
return doFullWriteBack(std::move(vec));
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
uint32_t MMKV::getExpireTimeForKey(MMKVKey_t key) {
|
|
1876
|
+
SCOPED_LOCK(m_lock);
|
|
1877
|
+
SCOPED_LOCK(m_sharedProcessLock);
|
|
1878
|
+
checkLoadData();
|
|
1879
|
+
|
|
1880
|
+
if (!m_enableKeyExpire || mmkv_key_length(key) == 0) {
|
|
1881
|
+
return 0;
|
|
1882
|
+
}
|
|
1883
|
+
auto raw = getRawDataForKey(key);
|
|
1884
|
+
assert(raw.length() == 0 || raw.length() >= Fixed32Size);
|
|
1885
|
+
if (raw.length() < Fixed32Size) {
|
|
1886
|
+
if (raw.length() != 0) {
|
|
1887
|
+
#ifdef MMKV_APPLE
|
|
1888
|
+
MMKVWarning("key [%@] has invalid value size %u", key, raw.length());
|
|
1889
|
+
#else
|
|
1890
|
+
MMKVWarning("key [%s] has invalid value size %u", key.data(), raw.length());
|
|
1891
|
+
#endif
|
|
1892
|
+
}
|
|
1893
|
+
return 0;
|
|
1894
|
+
}
|
|
1895
|
+
auto ptr = (const uint8_t *) raw.getPtr() + raw.length() - Fixed32Size;
|
|
1896
|
+
auto time = *(const uint32_t *) ptr;
|
|
1897
|
+
return time;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
mmkv::MMBuffer MMKV::getDataWithoutMTimeForKey(MMKVKey_t key) {
|
|
1901
|
+
SCOPED_LOCK(m_lock);
|
|
1902
|
+
SCOPED_LOCK(m_sharedProcessLock);
|
|
1903
|
+
checkLoadData();
|
|
1904
|
+
|
|
1905
|
+
auto raw = getRawDataForKey(key);
|
|
1906
|
+
assert(raw.length() == 0 || raw.length() >= Fixed32Size);
|
|
1907
|
+
if (raw.length() < Fixed32Size) {
|
|
1908
|
+
if (raw.length() != 0) {
|
|
1909
|
+
#ifdef MMKV_APPLE
|
|
1910
|
+
MMKVWarning("key [%@] has invalid value size %u", key, raw.length());
|
|
1911
|
+
#else
|
|
1912
|
+
MMKVWarning("key [%s] has invalid value size %u", key.data(), raw.length());
|
|
1913
|
+
#endif
|
|
1914
|
+
}
|
|
1915
|
+
return raw;
|
|
1916
|
+
}
|
|
1917
|
+
auto newLength = raw.length() - Fixed32Size;
|
|
1918
|
+
if (m_enableKeyExpire) {
|
|
1919
|
+
auto ptr = (const uint8_t *) raw.getPtr() + newLength;
|
|
1920
|
+
auto time = *(const uint32_t *) ptr;
|
|
1921
|
+
if (time != ExpireNever && time <= getCurrentTimeInSecond()) {
|
|
1922
|
+
#ifdef MMKV_APPLE
|
|
1923
|
+
MMKVInfo("deleting expired key [%@] in mmkv [%s], due date %u", key, m_mmapID.c_str(), time);
|
|
1924
|
+
#else
|
|
1925
|
+
MMKVInfo("deleting expired key [%s] in mmkv [%s], due date %u", key.data(), m_mmapID.c_str(), time);
|
|
1926
|
+
#endif
|
|
1927
|
+
removeValueForKey(key);
|
|
1928
|
+
return MMBuffer();
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
return MMBuffer(std::move(raw), newLength);
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
#define NOOP ((void) 0)
|
|
1935
|
+
|
|
1936
|
+
size_t MMKV::filterExpiredKeys() {
|
|
1937
|
+
if (!m_enableKeyExpire || (m_crypter ? m_dicCrypt->empty() : m_dic->empty())) {
|
|
1938
|
+
return 0;
|
|
1939
|
+
}
|
|
1940
|
+
SCOPED_LOCK(m_sharedProcessLock);
|
|
1941
|
+
|
|
1942
|
+
auto now = getCurrentTimeInSecond();
|
|
1943
|
+
MMKVInfo("filtering expired keys inside [%s] now: %u, m_expiredInSeconds: %u", m_mmapID.c_str(), now,
|
|
1944
|
+
m_expiredInSeconds);
|
|
1945
|
+
|
|
1946
|
+
size_t count = 0;
|
|
1947
|
+
auto basePtr = (uint8_t *) (m_file->getMemory()) + Fixed32Size;
|
|
1948
|
+
#ifndef MMKV_DISABLE_CRYPT
|
|
1949
|
+
if (m_crypter) {
|
|
1950
|
+
for (auto itr = m_dicCrypt->begin(); itr != m_dicCrypt->end(); NOOP) {
|
|
1951
|
+
auto &kvHolder = itr->second;
|
|
1952
|
+
assert(kvHolder.realValueSize() >= Fixed32Size);
|
|
1953
|
+
if (kvHolder.realValueSize() < Fixed32Size) {
|
|
1954
|
+
#ifdef MMKV_APPLE
|
|
1955
|
+
MMKVWarning("key [%@] has invalid value size %u", itr->first, kvHolder.realValueSize());
|
|
1956
|
+
#else
|
|
1957
|
+
MMKVWarning("key [%s] has invalid value size %u", itr->first.c_str(), kvHolder.realValueSize());
|
|
1958
|
+
#endif
|
|
1959
|
+
itr++;
|
|
1960
|
+
continue;
|
|
1961
|
+
}
|
|
1962
|
+
auto buffer = kvHolder.toMMBuffer(basePtr, m_crypter);
|
|
1963
|
+
auto ptr = (uint8_t *) buffer.getPtr();
|
|
1964
|
+
ptr += buffer.length() - Fixed32Size;
|
|
1965
|
+
auto time = *(const uint32_t *) ptr;
|
|
1966
|
+
if (time != ExpireNever && time <= now) {
|
|
1967
|
+
auto oldKey = itr->first;
|
|
1968
|
+
itr = m_dicCrypt->erase(itr);
|
|
1969
|
+
# ifdef MMKV_APPLE
|
|
1970
|
+
MMKVInfo("deleting expired key [%@], due date %u", oldKey, time);
|
|
1971
|
+
[oldKey release];
|
|
1972
|
+
# else
|
|
1973
|
+
MMKVInfo("deleting expired key [%s], due date %u", oldKey.c_str(), time);
|
|
1974
|
+
# endif
|
|
1975
|
+
count++;
|
|
1976
|
+
} else {
|
|
1977
|
+
itr++;
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
} else
|
|
1981
|
+
#endif // !MMKV_DISABLE_CRYPT
|
|
1982
|
+
{
|
|
1983
|
+
for (auto itr = m_dic->begin(); itr != m_dic->end(); NOOP) {
|
|
1984
|
+
auto &kvHolder = itr->second;
|
|
1985
|
+
assert(kvHolder.valueSize >= Fixed32Size);
|
|
1986
|
+
if (kvHolder.valueSize < Fixed32Size) {
|
|
1987
|
+
#ifdef MMKV_APPLE
|
|
1988
|
+
MMKVWarning("key [%@] has invalid value size %u", itr->first, kvHolder.valueSize);
|
|
1989
|
+
#else
|
|
1990
|
+
MMKVWarning("key [%s] has invalid value size %u", itr->first.c_str(), kvHolder.valueSize);
|
|
1991
|
+
#endif
|
|
1992
|
+
itr++;
|
|
1993
|
+
continue;
|
|
1994
|
+
}
|
|
1995
|
+
auto ptr = basePtr + kvHolder.offset + kvHolder.computedKVSize;
|
|
1996
|
+
ptr += kvHolder.valueSize - Fixed32Size;
|
|
1997
|
+
auto time = *(const uint32_t *) ptr;
|
|
1998
|
+
if (time != ExpireNever && time <= now) {
|
|
1999
|
+
auto oldKey = itr->first;
|
|
2000
|
+
itr = m_dic->erase(itr);
|
|
2001
|
+
#ifdef MMKV_APPLE
|
|
2002
|
+
MMKVInfo("deleting expired key [%@], due date %u", oldKey, time);
|
|
2003
|
+
[oldKey release];
|
|
2004
|
+
#else
|
|
2005
|
+
MMKVInfo("deleting expired key [%s], due date %u", oldKey.c_str(), time);
|
|
2006
|
+
#endif
|
|
2007
|
+
count++;
|
|
2008
|
+
} else {
|
|
2009
|
+
itr++;
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
if (count != 0) {
|
|
2014
|
+
MMKVInfo("deleted %zu expired keys inside [%s]", count, m_mmapID.c_str());
|
|
2015
|
+
}
|
|
2016
|
+
return count;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
bool MMKV::enableCompareBeforeSet() {
|
|
2020
|
+
MMKVInfo("enableCompareBeforeSet for [%s]", m_mmapID.c_str());
|
|
2021
|
+
SCOPED_LOCK(m_lock);
|
|
2022
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
2023
|
+
|
|
2024
|
+
assert(!m_enableKeyExpire && "enableCompareBeforeSet is invalid when Expiration is on");
|
|
2025
|
+
assert(!m_dicCrypt && "enableCompareBeforeSet is invalid when key encryption is on");
|
|
2026
|
+
if (m_enableKeyExpire || m_dicCrypt) {
|
|
2027
|
+
return false;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
m_enableCompareBeforeSet = true;
|
|
2031
|
+
return true;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
bool MMKV::disableCompareBeforeSet() {
|
|
2035
|
+
MMKVInfo("disableCompareBeforeSet for [%s]", m_mmapID.c_str());
|
|
2036
|
+
SCOPED_LOCK(m_lock);
|
|
2037
|
+
SCOPED_LOCK(m_exclusiveProcessLock);
|
|
2038
|
+
|
|
2039
|
+
assert(!m_enableKeyExpire && "disableCompareBeforeSet is invalid when Expiration is on");
|
|
2040
|
+
assert(!m_dicCrypt && "disableCompareBeforeSet is invalid when key encryption is on");
|
|
2041
|
+
if (m_enableKeyExpire || m_dicCrypt) {
|
|
2042
|
+
return false;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
m_enableCompareBeforeSet = false;
|
|
2046
|
+
return true;
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
MMKV_NAMESPACE_END
|