From bd45d6f0bf191b9f48592ba5ce988d29c7086db2 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 28 Jun 2018 10:35:23 +0200 Subject: [PATCH 1/7] Revert "Use object store" This reverts commit 965e997d8e4a4b83ab271842c6d5ed7490257111. --- src/js_realm.hpp | 3 ++- src/object-store | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js_realm.hpp b/src/js_realm.hpp index 4f41994c..3870f7ce 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -1183,7 +1183,8 @@ void RealmClass::compute_size(ContextType ctx, ObjectType this_object, Argume args.validate_maximum(0); SharedRealm realm = *get_internal>(this_object); - return_value.set(Value::from_number(ctx, realm->compute_size())); + auto size = realm->read_group().compute_aggregated_byte_size(); + return_value.set(Value::from_number(ctx, size)); } } // js diff --git a/src/object-store b/src/object-store index c12c750e..0bcb9643 160000 --- a/src/object-store +++ b/src/object-store @@ -1 +1 @@ -Subproject commit c12c750ecef2ba198d20ff073df05dfa2f750102 +Subproject commit 0bcb9643b8fb14323df697999b79c4a5341a8a21 From 8435068cbf1d69dc9770b05cea549ce6576a8a8b Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 28 Jun 2018 10:35:38 +0200 Subject: [PATCH 2/7] Revert "Added a TypeScript definition for computeSize" This reverts commit 367133c53e80153e2ab0fede394b7be9eab53bf8. --- lib/index.d.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index b0f7de6c..920fd2b7 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -318,7 +318,7 @@ declare namespace Realm.Sync { static requestPasswordReset(server: string, email: string): Promise; static completePasswordReset(server:string, reset_token:string, new_password:string): Promise; - + static requestEmailConfirmation(server:string, email:string): Promise; static confirmEmail(server:string, confirmation_token:string): Promise; @@ -733,14 +733,6 @@ declare class Realm { */ compact(): boolean; - /** - * Computes the aggregated size of all objects and their history in the Realm. - * - * Note that this will traverse the Realm and might be expensive for large Realms. - * @returns {number} the computed size in bytes. - */ - computeSize(): number; - /** * Write a copy to destination path * @param path destination path From 6aefa482d2a87f5488287e5b0a566593fee2d445 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 28 Jun 2018 10:36:37 +0200 Subject: [PATCH 3/7] Revert "Added a note in the changelog" This reverts commit a01553ef258734c99c9db56cac8a743cdf194b83. --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3eb602c5..defc6b06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ X.Y.Z Release notes * None. ### Enhancements -* Added a method `Realm.computeSize()` that computes the aggregated size of all objects and their history (#1881). * Improved performance for devices which can support large address spaces. * [Sync] Exposed custom HTTP headers in `Realm.Configuration` (#1897). @@ -193,7 +192,7 @@ X.Y.Z Release notes The feature known as Partial synchronization has been renamed to Query-based synchronization and is now the default mode for synchronized Realms. This has impacted a number of APIs. See below for the details. ### Deprecated -* [Sync] `Realm.Configuration.SyncConfiguration.partial` has been deprecated in favor of `Realm.Configuration.SyncConfiguration.fullSynchronization`. +* [Sync] `Realm.Configuration.SyncConfiguration.partial` has been deprecated in favor of `Realm.Configuration.SyncConfiguration.fullSynchronization`. * [Sync] `Realm.automaticSyncConfiguration()` has been deprecated in favor of `Realm.Sync.User.createConfiguration()`. ### Breaking changes From f907ebc3671d4854f9273095395c9e08fe4e0b79 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 28 Jun 2018 10:36:55 +0200 Subject: [PATCH 4/7] Revert "Exposed the computeSize method to the debugger" This reverts commit 3ee3d3e39ca8f52a1981b34f3c7102c377dd30b1. --- lib/browser/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/browser/index.js b/lib/browser/index.js index 705a43b1..6ad8643a 100644 --- a/lib/browser/index.js +++ b/lib/browser/index.js @@ -130,7 +130,6 @@ util.createMethods(Realm.prototype, objectTypes.REALM, [ 'removeListener', 'removeAllListeners', 'close', - 'computeSize', '_waitForDownload', '_objectForObjectId', ]); From 3b101af16b4b63f4a307dfe85d76e77fe4a78a09 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 28 Jun 2018 10:37:10 +0200 Subject: [PATCH 5/7] Revert "Adding documentation" This reverts commit b4955b816d09627124de9b12ebebfd17ab6fb696. --- docs/realm.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/realm.js b/docs/realm.js index 8b677bb1..4530d551 100644 --- a/docs/realm.js +++ b/docs/realm.js @@ -285,14 +285,6 @@ class Realm { */ compact() {} - /** - * Computes the aggregated size of all objects and their history in the Realm. - * - * Note that this will traverse the Realm and might be expensive for large Realms. - * @returns {number} the computed size in bytes. - */ - computeSize() {} - /** * Writes a compacted copy of the Realm to the given path. * @@ -464,3 +456,4 @@ class Realm { * any object of this type from inside the same Realm, and will always be _optional_ * (meaning it may also be assigned `null` or `undefined`). */ + From 12b8e9030a45b2792a9a172751f4cd1a5ff8f4a8 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 28 Jun 2018 10:37:25 +0200 Subject: [PATCH 6/7] Revert "Adding a test of the computeSize method" This reverts commit f16feec112a28ca888c974d73d67f36b3e59b37c. --- tests/js/compute-size-tests.js | 54 ---------------------------------- tests/js/index.js | 1 - 2 files changed, 55 deletions(-) delete mode 100644 tests/js/compute-size-tests.js diff --git a/tests/js/compute-size-tests.js b/tests/js/compute-size-tests.js deleted file mode 100644 index 09834e88..00000000 --- a/tests/js/compute-size-tests.js +++ /dev/null @@ -1,54 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -'use strict'; - -const Realm = require('realm'); -const TestCase = require('./asserts'); -const schemas = require('./schemas'); - -module.exports = { - testComputeSizeExistsAndIncreases: function() { - const realm = new Realm({schema: [ - { name: 'Something', properties: { numbers: 'int[]' } } - ]}); - - TestCase.assertEqual(typeof realm.computeSize, 'function'); - - const sizeInitially = realm.computeSize(); - TestCase.assertEqual(typeof sizeInitially, 'number'); - TestCase.assertTrue(sizeInitially > 0); - - // Compact the Realm first - realm.compact(); - - const sizeCompacted = realm.computeSize(); - TestCase.assertEqual(typeof sizeCompacted, 'number'); - TestCase.assertTrue(sizeCompacted <= sizeInitially); - TestCase.assertTrue(sizeCompacted > 0); - - // Add an object - realm.write(() => { - realm.create('Something', {}); - }); - - const sizeAfter = realm.computeSize(); - TestCase.assertEqual(typeof sizeAfter, 'number'); - TestCase.assertTrue(sizeAfter > sizeCompacted); - }, -}; diff --git a/tests/js/index.js b/tests/js/index.js index 79318c3e..0e059c2a 100644 --- a/tests/js/index.js +++ b/tests/js/index.js @@ -50,7 +50,6 @@ var TESTS = { EncryptionTests: require('./encryption-tests'), ObjectIDTests: require('./object-id-tests'), // Garbagecollectiontests: require('./garbage-collection'), - ComputeSizeTests: require('./compute-size-tests'), }; // If sync is enabled, run the sync tests From 9fcf3f20ee0d0377e239ffaa022cf2085c9568b7 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Thu, 28 Jun 2018 10:37:39 +0200 Subject: [PATCH 7/7] Revert "Exposing a Realms groups compute_aggregated_byte_size via `computeSize`" This reverts commit 10c127542beba5c4b8757396210dfcd26d7749c8. --- src/js_realm.hpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/js_realm.hpp b/src/js_realm.hpp index 3870f7ce..33fde2b9 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -237,7 +237,6 @@ public: static void delete_model(ContextType, ObjectType, Arguments, ReturnValue &); static void object_for_object_id(ContextType, ObjectType, Arguments, ReturnValue&); static void privileges(ContextType, ObjectType, Arguments, ReturnValue&); - static void compute_size(ContextType, ObjectType, Arguments, ReturnValue&); // properties static void get_empty(ContextType, ObjectType, ReturnValue &); @@ -296,7 +295,6 @@ public: {"writeCopyTo", wrap}, {"deleteModel", wrap}, {"privileges", wrap}, - {"computeSize", wrap}, {"_objectForObjectId", wrap}, #if REALM_ENABLE_SYNC {"_waitForDownload", wrap}, @@ -1178,14 +1176,5 @@ void RealmClass::privileges(ContextType ctx, ObjectType this_object, Argument return_value.set(object); } -template -void RealmClass::compute_size(ContextType ctx, ObjectType this_object, Arguments args, ReturnValue &return_value) { - args.validate_maximum(0); - - SharedRealm realm = *get_internal>(this_object); - auto size = realm->read_group().compute_aggregated_byte_size(); - return_value.set(Value::from_number(ctx, size)); -} - } // js } // realm