Commit Graph

863 Commits

Author SHA1 Message Date
Thomas Goyne feed7c3479 Update moves when there is another move to exactly the previous move target 2016-05-11 16:08:30 -07:00
Thomas Goyne 0a3158ce74 Fix marking deletions when chaining move_last_over() 2016-05-11 16:08:30 -07:00
Thomas Goyne 1289c4806c Fix handling of move_last_over() on the second-to-last row 2016-05-11 16:08:30 -07:00
Thomas Goyne edc0d1fc4a Improve and expand the changeset calculation tests 2016-05-11 16:08:30 -07:00
Thomas Goyne dc7ddfae84 Treat Results from LinkViews as if they were sorted for diff calculations 2016-05-11 16:08:30 -07:00
Thomas Goyne 71911ee221 Add support for wrapping a LinkView in a Results 2016-05-11 16:08:30 -07:00
Thomas Goyne 1b48c71932 Speed up transaction log parsing for queries 2016-05-11 16:08:30 -07:00
Thomas Goyne 5d5f504543 Greatly speed up sorted changeset calculations 2016-05-11 16:08:30 -07:00
Thomas Goyne 88a3b6ed00 Speed up the IndexSet combining operations 2016-05-11 16:08:30 -07:00
Thomas Goyne fdeb80f970 Speed up IndexSet::count() a bit 2016-05-11 16:08:30 -07:00
Thomas Goyne 059f907a4a Make sorted move calculations a bit less gross 2016-05-11 16:08:30 -07:00
Thomas Goyne 1a8a56d10a Use binary search in IndexSet::find() 2016-05-11 16:08:30 -07:00
Thomas Goyne f1f0327146 Speed up unsorted changeset calculations by eliminating most calls to count() 2016-05-11 16:08:30 -07:00
Thomas Goyne c6def6b814 Don't parse the transaction logs on the background thread if no change info is needed 2016-05-11 16:08:30 -07:00
Thomas Goyne 9503a3fc03 Always send an empty changeset to the first call of a Results notification callback 2016-05-11 16:08:30 -07:00
Thomas Goyne b5bd00005c Skip collecting change information when it isn't needed 2016-05-11 16:08:30 -07:00
Thomas Goyne e65ad4d413 Discard moves which are turned into no-ops when merging 2016-05-11 16:08:30 -07:00
Thomas Goyne cfb9f0635c Fix calculation of moves for unsorted queries 2016-05-11 16:08:30 -07:00
Thomas Goyne d22c65f28a Partially split out the code for calculating changesets from the struct for delivering them 2016-05-11 16:08:30 -07:00
Thomas Goyne a4298dd92c Remove an unused function 2016-05-11 16:08:30 -07:00
Thomas Goyne b920f62ca5 Comment and clean up the Notifiers/BackgroundCollection 2016-05-11 16:08:30 -07:00
Thomas Goyne 4ec1090c05 Rename AsyncQuery to ResultsNotifier 2016-05-11 16:08:30 -07:00
Thomas Goyne 424f4e829f Prioritize modified rows when calculating changes for sorted results 2016-05-11 16:08:30 -07:00
Thomas Goyne a428f813d5 Skip calling callbacks if two commits cancel each other out when merged 2016-05-11 16:08:30 -07:00
Thomas Goyne a16cd7d42d Add async_query.hpp to the project 2016-05-11 16:08:30 -07:00
Thomas Goyne 9a0ec0eb28 Actually report deletions for table clears 2016-05-11 16:08:30 -07:00
Thomas Goyne e25e4c2dcd Rework handling of mixed move_last_over() and modifications to actually work 2016-05-11 16:08:30 -07:00
Thomas Goyne d46f2c65ba Refactor the transaction log parsers to eliminate some duplication 2016-05-11 16:08:30 -07:00
Thomas Goyne f4aaa7c9de Add fine-grained notifications for Results 2016-05-11 16:08:30 -07:00
Thomas Goyne 6609bcaed7 Add fine-grained notifications for List 2016-05-11 16:08:30 -07:00
Thomas Goyne 6380335fc3 Extract out the parts of AsyncQuery not directly related to query running 2016-05-11 16:08:30 -07:00
Nabil Hachicha 895c6a3056 Copying embedded Realm files using AssetManager from JNI 2016-05-11 19:56:59 +01:00
Thomas Goyne deea1e8f5f Merge pull request #67 from realm/tg/tvos-ech
Watch changes for tvOS without named pipes
2016-05-11 09:58:16 -07:00
Thomas Goyne 8d115ad42d Merge pull request #68 from realm/tg/schema-validation-error
Split SchemaValidationException into SchemaValidationException and SchemaMismatchException
2016-05-11 09:58:06 -07:00
Ari Lazier cf4fd74f52 pr fixes for build script 2016-05-10 14:01:27 -07:00
Thomas Goyne c07fb9c963 Merge pull request #64 from realm/tg/leak
Fix the initial ref count for WeakRealmNotifier
2016-05-10 11:55:06 -07:00
kishikawa katsumi 23d9c1c6e8 Split SchemaValidationException into SchemaValidationException and SchemaMismatchException
Because SchemaValidationException is thrown both case that a schema definition is incorrect and case that two schema definitions are mismatched.
In the former case, the migration does not solve the problem. But the exception message shows "Migration is required..."

Therefore the latter as MismatchException, to distinguish between the two cases.
2016-05-10 11:53:58 -07:00
kishikawa katsumi 8e24d4331f Watch changes for tvOS without named pipes 2016-05-10 11:47:37 -07:00
Scott Kyle 26d2c169a9 Support ES6 class inheritance from Realm.Object
Unfortunately, this was broken because our native Realm.Object constructor was not presenting itself as a function in JS. This fixes that and adds tests.
2016-05-09 16:49:05 -07:00
Scott Kyle 651449108e Improve usage of js::PropertyAttributes 2016-05-09 16:08:04 -07:00
Ari Lazier a960d88893 add project for building/debugging node 2016-05-09 15:16:37 -07:00
Ari Lazier e71fb3766b convert old date columns 2016-05-09 13:12:48 -07:00
Ari Lazier 9c7b01091f convert old date columns 2016-05-09 13:12:48 -07:00
Scott Kyle 40855f789c Prevent accidental leak of RealmDelegate
If a binding context already exists, we make sure it's a js::RealmDelegate for the same JS context. If not, then we throw an exception because this could lead to serious trouble.

Also, we update the defaults and constructors only if new ones were provided.
2016-05-06 15:40:35 -07:00
Ari Lazier 477f7b1f33 add hook for detecting file format upgrade 2016-05-05 19:39:50 -07:00
Ari Lazier 87c9dda321 add hook for detecting file format upgrade 2016-05-05 19:39:50 -07:00
Ari Lazier 28a7efcd1b add test for current date 2016-05-05 17:36:48 -07:00
Ari Lazier 7b3fa3bc42 fix leaking realm 2016-05-05 17:10:56 -07:00
Ari Lazier 76c2d3cd54 fix leaking realm 2016-05-05 17:10:56 -07:00
Ari Lazier 3b24a4270e fix for object link nullification 2016-05-05 14:08:58 -07:00
Ari Lazier 7a6141e066 fix for object link nullification 2016-05-05 14:08:58 -07:00
Ari Lazier 4daa1ff5a1 upgrade to latest core and object store 2016-05-05 13:09:07 -07:00
Ari Lazier 54fede2715 upgrade to latest core and object store 2016-05-05 13:09:07 -07:00
Thomas Goyne 56def7daa0 Merge pull request #65 from realm/tg/timestamp
Update to core 0.100.0
2016-05-05 10:25:06 -07:00
Thomas Goyne 507882d663 Update to core 0.100.1 2016-05-05 10:19:48 -07:00
Thomas Goyne 25d245deda Use erase-remove_if in RealmCoordinator::unregister_realm() 2016-05-04 10:21:44 -07:00
Scott Kyle 24dab1e8d7 Heed v8 warning in Node v6 from v8::Template::Set 2016-05-04 02:14:50 -07:00
Ari Lazier 513c0fee77 Merge pull request #416 from realm/al-ignored
Allow setting of non-persisted properties
2016-05-03 13:47:44 -07:00
Ari Lazier d26924e2f9 allow setting of non-persisted properties 2016-05-03 13:05:48 -07:00
Scott Kyle c8e7ddc3af [0.12.0-rc] Bump version 2016-05-03 12:06:15 -07:00
Scott Kyle 18a4d66903 Explicitly stop the RPCWorker in RPCServer destructor 2016-05-03 12:06:15 -07:00
Scott Kyle 32219cf0a3 Clear protected value maps in RPCServer destructor 2016-05-03 11:42:37 -07:00
Scott Kyle 741db2037f Merge pull request #407 from realm/sk-chrome-migration
All tests now pass in Chrome debug mode (including migration)
2016-05-02 16:19:09 -07:00
Ari Lazier 6e4a7f1019 remove extraneous quote 2016-05-02 12:57:15 -07:00
Ari Lazier 8eef37a46f remove extraneous quote 2016-05-02 12:57:15 -07:00
Ari Lazier bf488274a3 improve error message when specifying invalid schema 2016-05-02 12:45:42 -07:00
Ari Lazier 0d1b22b10d improve error message when specifying invalid schema 2016-05-02 12:45:42 -07:00
Scott Kyle e8cd20d7bb Use RPC callback mechanism for writes and listeners
The callbacks are stored by their id in the RPCServer so they are properly uniqued. This prevents the same callback from being added multiple times as a change listener.
2016-05-02 12:41:53 -07:00
Scott Kyle 889b762566 Allow protected values to be empty
This makes them much more friendly to being put inside of STL containers, like maps.
2016-05-02 12:33:20 -07:00
Scott Kyle dd23c66e69 Address some PR feedback with more comments 2016-05-01 14:35:18 -07:00
Scott Kyle 32a8a2ed72 Make migration tests work in Chrome debug mode
All realm operations for the RPC are now done in their own thread so it can be allowed to block on waiting for callback results. The recursive and multi-threaded nature of this makes it pretty tricky, but it works!
2016-04-29 13:55:49 -07:00
Ari Lazier 2b6b0b97f4 Merge pull request #406 from realm/al-workspace
Add workspace and clean up xcproject layout
2016-04-29 13:53:26 -07:00
Ari Lazier 5a9e24cb06 tab to space 2016-04-29 13:11:19 -07:00
Ari Lazier 0c05259558 remove old umbrella header 2016-04-29 12:58:25 -07:00
Ari Lazier c493a8070b add workspace and clean up xcproject layout 2016-04-29 12:00:40 -07:00
Scott Kyle 85919dc66f Fix realm.schema property in Chrome debug mode 2016-04-29 11:16:10 -07:00
Ari Lazier 2b35360117 add readOnly property 2016-04-28 15:50:43 -07:00
Ari Lazier b9b3812c86 support for read-only realms 2016-04-28 15:42:28 -07:00
Ari Lazier a2ed550dde Merge pull request #383 from realm/al-migration
Basic data migrations
2016-04-28 15:40:27 -07:00
Ari Lazier 2c85f032d9 compare non-existent properties to undefined 2016-04-28 13:21:30 -07:00
Ari Lazier af9b54074e pr feedback 2016-04-28 13:03:38 -07:00
Ari Lazier 79446f957a test and bug fixes 2016-04-28 12:44:48 -07:00
Ari Lazier cff099a4af tests and bugfixes 2016-04-28 12:16:16 -07:00
Scott Kyle 850e3a4090 Add validate_read() check to Results::set_live()
If the Results is detached, then this can cause a crash.
2016-04-28 09:39:53 -07:00
Scott Kyle 041530ee72 Add validate_read() check to Results::set_live()
If the Results is detached, then this can cause a crash.
2016-04-28 09:39:53 -07:00
Scott Kyle cf5112467c Fix InvalidSchemaVersionException message 2016-04-27 14:00:34 -07:00
Scott Kyle 0c4dfcb914 Fix InvalidSchemaVersionException message 2016-04-27 14:00:34 -07:00
Scott Kyle d4d5e28d26 Improve error message for non-object ObjectSchema 2016-04-27 14:00:14 -07:00
Scott Kyle ca87f5a3e0 Fix Node crash from calling function with empty this 2016-04-27 10:42:42 -07:00
Ari Lazier 8602787fc9 add schema getters 2016-04-27 08:31:05 -07:00
Ari Lazier fea0b69865 add support for non-memmber functions 2016-04-27 08:30:59 -07:00
Ari Lazier 17e5946af4 support for data migrations 2016-04-27 08:30:59 -07:00
Ari Lazier 588bbc327a remove un-needed usings 2016-04-26 17:40:56 -07:00
Ari Lazier 6e93d85420 pr fixes 2016-04-26 16:59:03 -07:00
Ari Lazier 27d973151f pr fixes 2016-04-26 16:59:03 -07:00
Ari Lazier cec8667e35 create RealmObject class and make isValid a member 2016-04-26 16:30:04 -07:00
Ari Lazier b59784670b create RealmObject class and make isValid a member 2016-04-26 16:30:04 -07:00
Ari Lazier 988f723f49 remove unnecessary catch block 2016-04-21 13:38:10 -07:00
Thomas Goyne 273db05605 Fix the initial ref count for WeakRealmNotifier
Adding the run loop source to the run loop retains it, so the initial refcount
should be 0, not 1.
2016-04-20 15:41:05 -07:00
Ari Lazier 75d8f5b759 bugfix for empty results, fix for realm.isValid 2016-04-19 17:29:34 -07:00
Ari Lazier 4d8d1d96e4 api to check if object has been deleted 2016-04-19 17:29:34 -07:00
Ari Lazier 3509caedd5 bugfix for empty results, fix for realm.isValid 2016-04-19 17:29:34 -07:00
Ari Lazier 6072061463 api to check if object has been deleted 2016-04-19 17:29:34 -07:00
Scott Kyle 2a58862070 Add test script for Node 2016-04-19 14:10:10 -07:00
Scott Kyle 8e5afeccc9 Fix another crash involving protected values 2016-04-19 03:58:23 -07:00
Scott Kyle 541791fd85 Fix crash by properly protecting JSC values
The previous implementation was lazy and ended up unprotecting values due to the move constructor being defaulted.
2016-04-19 03:18:02 -07:00
Scott Kyle 8ff23b5411 Fix build issues on Android
GCC was more strict with how we handled some types.
2016-04-18 18:30:55 -07:00
Scott Kyle fc49470b3c Fix for failing nested transaction test 2016-04-18 15:11:56 -07:00
Scott Kyle a0424c6600 Fix some styling of exception handling in JS wrappers 2016-04-18 15:11:36 -07:00
Scott Kyle 4731610a58 Merge branch 'master' into sk-node
* master:
  add keypath tests
  pr feedback, changelog
  typo
  bug fix
  tests
  support keypath comparisons for types that support it
  support for null queries
  don't require optional or link properties when creating objects
  [0.11.1] Bump version
  Update CHANGELOG with 0.11.1 fixes
  Update changelog script
  Remove changes_available implementation that asserts
  Get correct path to adb from Android Studio
  add some simple tests for Realm.write
  Update apps to use React Native 0.22
2016-04-18 14:19:06 -07:00
Scott Kyle 1ca5a43982 Revert TValue to ValueType, etc. 2016-04-18 12:18:13 -07:00
Scott Kyle 49e2b54151 Convert some more camelCase in js_realm.hpp 2016-04-18 12:17:45 -07:00
Scott Kyle 5c56a99403 Split up JS abstractions into type-specific files 2016-04-18 01:15:54 -07:00
Scott Kyle d57483c675 Rename js_object.hpp -> js_realm_object.hpp 2016-04-18 01:14:48 -07:00
Scott Kyle 10f08747e7 Rename remained camelCase to snake_case
And fix some minor build warnings along the way.
2016-04-18 01:01:04 -07:00
Scott Kyle 60a3cd4399 Remove unused js_schema.cpp 2016-04-17 22:33:18 -07:00
Scott Kyle a5bf9ed8dd Define most of jsc::ObjectWrap separately 2016-04-17 22:12:23 -07:00
Scott Kyle 5ed2c3cf25 Define most of node::ObjectWrap separately 2016-04-17 22:00:06 -07:00
Scott Kyle 7c97a1752e Remove need for BaseClassDefinition 2016-04-16 16:46:16 -07:00
Scott Kyle 999900ff00 Fix script that copies query-tests.json 2016-04-16 16:30:02 -07:00
Scott Kyle 2641e5a2a1 Move JSC object accessor code into header 2016-04-15 16:10:25 -07:00
Scott Kyle 133289ad85 All tests now pass on Node 2016-04-15 16:06:44 -07:00
Ari Lazier bd4088ce91 key templates off explicitly defined classes rather than the internal type 2016-04-15 13:47:01 -07:00
Ari Lazier 760126f0d7 public before private 2016-04-15 11:59:10 -07:00
Ari Lazier e8ca5ff92e ObjectClass -> ClassDefinition 2016-04-15 10:50:15 -07:00
Ari Lazier c817ac7eac create -> create_instance 2016-04-14 11:19:01 -07:00
Ari Lazier 84559316d8 compact property getter/setter types 2016-04-14 11:06:17 -07:00
Ari Lazier 0b2a75bdc3 use different naming convention for extracted template types 2016-04-14 10:54:43 -07:00
Scott Kyle c0c65ad620 Make all JSC tests pass again 2016-04-13 03:21:18 -07:00
Scott Kyle 05c432deb1 WIP Node support
The JS engine details are mostly abstracted away. This breaks JSC support until the rest of the pieces are in place. The Node version builds and runs, but crashes when creating a Realm object.
2016-04-12 11:53:30 -07:00
Ari Lazier 4aed9135b8 add keypath tests 2016-04-12 11:01:33 -07:00
Ari Lazier 3e34d2355f pr feedback, changelog 2016-04-12 08:13:29 -07:00
Ari Lazier 1afa844aa4 pr feedback, changelog 2016-04-12 08:13:29 -07:00
Ari Lazier c874c15e75 typo 2016-04-11 16:37:18 -07:00
Ari Lazier 9f4b9410a5 typo 2016-04-11 16:37:18 -07:00
Ari Lazier e26b044fbe bug fix 2016-04-11 16:03:36 -07:00
Ari Lazier 321ddc39e1 bug fix 2016-04-11 16:03:36 -07:00
Ari Lazier 0c1ade2b8e tests 2016-04-11 16:01:51 -07:00
Ari Lazier b542fe8c7b tests 2016-04-11 16:01:51 -07:00
Ari Lazier adc4a970fd support keypath comparisons for types that support it 2016-04-11 15:03:47 -07:00
Ari Lazier 3a174161d7 support keypath comparisons for types that support it 2016-04-11 15:03:47 -07:00
Ari Lazier 6a05db6aed support for null queries 2016-04-11 13:58:52 -07:00
Ari Lazier 8a77099685 support for null queries 2016-04-11 13:58:52 -07:00
Ari Lazier 805fdc63a7 don't require optional or link properties when creating objects 2016-04-01 11:00:53 -07:00
Ari Lazier 4ac022ecc9 don't require optional or link properties when creating objects 2016-04-01 11:00:53 -07:00
Ari Lazier f80bcd882d convert schema parsing 2016-03-30 16:14:48 -07:00
Ari Lazier 61685dee83 use string wrapper, finish realm constructor conversion 2016-03-30 14:56:33 -07:00
Ari Lazier 29213f1d87 wrap list properties 2016-03-30 14:18:44 -07:00
Ari Lazier c249eea505 wrap realm properties 2016-03-30 13:48:24 -07:00
Ari Lazier 2baec5bec6 move static methods and constructor 2016-03-30 13:09:05 -07:00
Ari Lazier 0282e98232 move exception handling to method wrapper 2016-03-30 11:55:13 -07:00
Ari Lazier 58d50bb3c5 refactor realm 2016-03-30 10:23:15 -07:00
Ari Lazier 016d723731 tmp 2016-03-30 09:16:38 -07:00
Ari Lazier 5b2a59d5c6 converted BindingContext 2016-03-29 16:17:57 -07:00
Scott Kyle 2c0d8f8cef [0.11.1] Bump version 2016-03-29 15:30:39 -07:00
Ari Lazier e7d954a727 wrap all types in a single type and use static class methods 2016-03-29 14:12:27 -07:00
Ari Lazier b4990fbbff convert more of Realm 2016-03-29 13:36:01 -07:00
Scott Kyle 0f9f450062 Remove changes_available implementation that asserts
This gets called when a Realm changes on another thread, but is called on the correct thread on iOS. It doesn't look like it will be called on Android, so we can unofficially support iOS accessing Realms from multiple bindings for now.

Fixes #352
2016-03-29 12:59:06 -07:00
Ari Lazier 9626842f8e start refactoring realm 2016-03-28 13:21:36 -07:00
Ari Lazier 20bac8e2c7 refactor list 2016-03-25 12:13:49 -07:00
Scott Kyle daa2948028 Move RealmJS.xcodeproj to be under src/ios 2016-03-23 13:39:12 -07:00
Scott Kyle 0e74362e4c Merge pull request #340 from realm/sk-collection
Make List and Results inherit from Collection
2016-03-21 15:27:18 -07:00
Ari Lazier 4b2e47a861 support encrypted realm when getting schemaVersion 2016-03-21 13:34:12 -07:00
Ari Lazier 836cfc1c6b add chrome debugging, use -1 for not versioned 2016-03-21 13:34:12 -07:00
Ari Lazier 324c3d702b support getting the schema version from unopened realms 2016-03-21 13:34:11 -07:00
Ari Lazier c32dff40a2 case insensitive searches 2016-03-21 13:32:03 -07:00
Ari Lazier 8b986f031c case insensitive searches 2016-03-21 13:32:03 -07:00
Scott Kyle b5ce02c0ce Make List and Results inherit from Collection
This will allow for easier type checking, documentation, etc.
2016-03-20 11:51:16 -07:00
Ari Lazier 7ef25e9e14 its a struct 2016-03-18 20:04:30 -07:00
Ari Lazier 693df136d5 its a struct 2016-03-18 20:04:30 -07:00
Ari Lazier f186c3d1b7 android fixes for latests object store 2016-03-18 19:58:45 -07:00
Ari Lazier 67f2f40297 android fixes for latests object store 2016-03-18 19:58:45 -07:00
Ari Lazier b2e4d93732 support for indexed properties 2016-03-18 16:50:55 -07:00
Ari Lazier 7fe2f69b8c latest object store 2016-03-18 16:14:11 -07:00
Ari Lazier b02f64e727 latest object store 2016-03-18 16:14:11 -07:00
Thomas Goyne aaccb8992f Merge pull request #51 from realm/tg/indexable
Bool and NSDate properties can be indexed.
2016-03-18 15:33:56 -07:00
Scott Kyle 301214dd39 Fix List splice method to be spec compatible
If the second argument is omitted, then all objects after the provided index should be removed. This is the same behavior as Array.prototype.splice.
2016-03-17 14:48:39 -07:00
Scott Kyle 5d872d6233 Remove accidentally included files in npm package
The 0.11.0-rc was bloated by lots of unnecessary build products and other miscellaneous files.
2016-03-16 16:48:04 -07:00
Scott Kyle 7feadb27b2 Fix ARM hook into JSGlobalContextCreateInGroup
We were loading into the program counter, which is not good in THUMB mode, so we now instead load into R3, since it's a temp register not used by this function (it only takes two arguments). Also, when building this module in THUMB mode itself, we needed to clear the ARM instruction cache, which wasn't needed when switching from THUMB to ARM mode.
2016-03-15 13:57:09 -07:00
Nabil Hachicha 53c28dca16 fixes gcc optimisation causing RealmCoordinator to use a empty/default path
fix indentation
2016-03-14 16:42:52 -07:00
Nabil Hachicha 48d8b6a2e7 fixes #329 2016-03-14 16:09:22 -07:00
Nabil Hachicha 92f3314a0b fixes #329 2016-03-14 16:09:22 -07:00
Ari Lazier 991c25865a fix for reload in example 2016-03-13 10:09:53 -07:00
Ari Lazier e459194bfd fix for reload in example 2016-03-13 10:09:53 -07:00
Ari Lazier aa08d25ed0 Merge pull request #305 from realm/al-object-store
Latest object store changes and core
2016-03-10 16:03:12 -08:00
Thomas Goyne c65d536573 Remove Realm::m_in_transaction and use the value from the SharedGroup
There were a bunch of places where m_in_transaction was not being updated
correctly when exceptions were thrown, and this eliminates that as a possible
problem entirely.
2016-03-07 13:18:20 -08:00
Thomas Goyne b7283be7d1 Merge pull request #52 from realm/tg/core-0.97.0
Update to core 0.97.0
2016-03-07 13:13:59 -08:00
Thomas Goyne af0db71187 Strip all trailing whitespace from files 2016-03-07 12:47:02 -08:00
Thomas Goyne c94770be81 Update to core 0.97.0 2016-03-07 12:46:36 -08:00
Scott Kyle 1a127b425b Merge pull request #289 from realm/sk-accept-constructor
Accept constructor in create() and objects() methods
2016-03-07 12:23:26 -08:00
Ari Lazier 6b523bab09 forward declare property 2016-03-04 07:28:10 -08:00
Ari Lazier 21a4e2543e forward declare property 2016-03-04 07:28:10 -08:00
Ari Lazier f7927f189c use core to_string 2016-03-04 07:09:49 -08:00
Ari Lazier 42cb078a8c use core to_string 2016-03-04 07:09:49 -08:00
Ari Lazier eb7f213c93 pr fixes 2016-03-03 16:49:06 -08:00
Ari Lazier 987978fd4e pr fixes 2016-03-03 16:49:06 -08:00
Ari Lazier d07f82b3ec fixes for android 2016-03-03 14:56:18 -08:00
Ari Lazier 641eb37b2c fixes for android 2016-03-03 14:56:18 -08:00
Scott Kyle 17eb6bcbb5 submodule fixes 2016-03-03 14:48:41 -08:00
Ari Lazier 4923d7d953 object store fixes for js binding 2016-03-03 14:45:44 -08:00
Ari Lazier 548d700ffe object store fixes for js binding 2016-03-03 14:45:44 -08:00
Ari Lazier 7802a9e976 merge latest object store 2016-03-03 14:15:54 -08:00
Ari Lazier 05429a8163 merge latest object store 2016-03-03 14:15:54 -08:00
Ari Lazier 5f61fd970c support relative paths when opening realms 2016-03-03 13:33:49 -08:00
Scott Kyle 42cdf9daad Disallow non-constructors to have schema property
Non-constructor functions (e.g. arrow functions and native functions) as well as regular objects should not be allowed as valid schema hosts. Neither of these cases were ever actually tested or used anywhere.
2016-03-03 02:52:15 -08:00
Scott Kyle 85832f0f02 Rename some functions according to PR feedback 2016-03-03 02:49:37 -08:00
kishikawa katsumi 9045d79453 Bool and NSDate properties can be indexed.
Core supports indexing Bool and NSDate properties.
realm-java also supports indexing Bool and NSDate properties.
It is better to align the specification with realm-java.
2016-03-02 13:20:29 -08:00
Scott Kyle 4a81b091cb Accept constructor in create() and objects() methods
This will help the linter prevent spelling mistakes and make some code more easily readable.

Resolves #233
2016-03-01 00:46:03 -08:00
Scott Kyle 3858ede7c7 Rename RJSObjectSetProperty to RJSValidatedSetProperty 2016-02-29 12:37:28 -08:00
Scott Kyle 5a9ad4f2b9 Rename InvalidConstructor to UncallableConstructor 2016-02-29 12:35:12 -08:00
Scott Kyle 44a29d8dd4 Expose List and Results constructors into JS 2016-02-29 03:24:58 -08:00
Scott Kyle 154422a3d1 Make realm instances pass instanceof check 2016-02-29 03:24:58 -08:00
Ari Lazier e495cc4685 add encryption support 2016-02-26 11:08:59 -08:00
Thomas Goyne b7b2822082 Make it possible to disable the commit notifier background worker
This makes it much easier to write tests which test the work done on the
background thread.
2016-02-25 11:19:00 -08:00
Thomas Goyne cfc88b6fd5 Rename CachedRealm to WeakRealmNotfier 2016-02-24 16:58:11 -08:00
Thomas Goyne 143cc3b696 Fix compilation with GCC 4.9
4.9 does not correctly implement C++14 aggregate initialization.
2016-02-24 16:58:11 -08:00
Thomas Goyne 99037a7c72 Add an AtomicSharedPtr implementation for gcc 4.9 2016-02-24 16:58:11 -08:00
Thomas Goyne 1e35324d97 Avoid holding locks while calling transaction::advance()
It can call user code due to change notifications, which leads to
deadlocks if that code then tries to add async queries (and advancing is
a potentially expensive operation, so doing it while holding a lock
inhibits parallelism anyway).
2016-02-24 16:58:11 -08:00
Thomas Goyne 8284340729 Remove redundant check in RealmCoordinator::advance_helper_shared_group_to_latest() 2016-02-24 16:58:11 -08:00
Thomas Goyne 4e18a99dfd Update some out-of-date comments 2016-02-24 16:58:10 -08:00
Thomas Goyne aa67216574 Write a much better comment about thread stuff for AsyncQuery 2016-02-24 16:58:10 -08:00
Thomas Goyne ad46e307a2 Update the comments for Realm::Internal 2016-02-24 16:58:10 -08:00
Thomas Goyne 1430fcf474 Rename AsyncFriend to Interal 2016-02-24 16:58:10 -08:00
Thomas Goyne c46a2a34de Fix typos and minor errors in comments 2016-02-24 16:58:10 -08:00
Thomas Goyne db7d6fa2a8 Don't hold onto the tableview between runs of async queries
Updating the table view in advance_read() can be very expensive, and the
updated data is never actually used.
2016-02-24 16:58:10 -08:00
Thomas Goyne a95eb50915 Don't create background queries for Results on threads without runloops 2016-02-24 16:58:09 -08:00
Thomas Goyne 3e90c30571 Add more tests and fix bugs 2016-02-24 16:58:09 -08:00
Thomas Goyne 8c4f2a4f30 Reduce the scope of class friendships 2016-02-24 16:58:09 -08:00
Thomas Goyne 13e1054553 Don't continue to run queries in the background if the result is unused 2016-02-24 16:58:09 -08:00
Thomas Goyne 934263f76a Automatically create the async query when converting to a TableView 2016-02-24 16:58:09 -08:00
Thomas Goyne 8f668fdf09 Use a single AsyncQuery per Results regardless of number of callbacks added 2016-02-24 16:58:08 -08:00
Thomas Goyne d165458601 Add support for running queries asynchronously 2016-02-24 16:58:08 -08:00
Thomas Goyne bceec93a69 Update to core 0.96.2 2016-02-23 15:01:35 -08:00
Tim Anglade 7cc2f69736 Merge pull request #264 from realm/km-js-fixlicense
License update
2016-02-21 18:56:59 -08:00
Nabil Hachicha 9bcebfaf29 PR feedback 2016-02-19 22:50:30 +00:00
Nabil Hachicha 76981229ab start debug server only on when using chrome debug 2016-02-19 19:05:07 +00:00
Thomas Goyne ae9d41f9ce Remove an incorrect std::move() 2016-02-18 19:05:02 -08:00
Scott Kyle 2e3a3b5db8 Merge pull request #257 from realm/sk-schema-prop
The schema property should be directly on constructor
2016-02-18 16:27:47 -08:00
Karson Miller 5e9333b699 no message 2016-02-18 15:30:44 -08:00
Scott Kyle a661350e59 Merge branch 'sk-sorted-results'
* sk-sorted-results:
  Add sorted() method to List
  Further improve argument checking for sorted()
  Improve error message in sorted() method
  Change sortedBy API as discussed
  Allow sortedBy to accept array of properties
  Change sortByProperty to return new Results
2016-02-18 15:21:35 -08:00
Scott Kyle 5b2e7b37af Add script to update version in package.json and iOS
This uses agvtool to update the CURRENT_PROJECT_VERSION and DYLIB_CURRENT_VERSION project variables. The Info.plist files have been updated to propagate this value.
2016-02-18 13:58:12 -08:00
Scott Kyle 5332131c14 Add sorted() method to List 2016-02-18 13:41:11 -08:00
Scott Kyle d847fbceb1 Further improve argument checking for sorted() 2016-02-18 12:55:54 -08:00
Scott Kyle bd766297ef Improve error message in sorted() method 2016-02-18 12:50:44 -08:00
Scott Kyle 05d84b23a2 Change sortedBy API as discussed
If provided an array, then each member can optionally be an array of [propName, reverse]
2016-02-18 12:47:18 -08:00
Scott Kyle 76865d0da4 Allow sortedBy to accept array of properties
It now optionally accepts an array of properties for both parameters and the tests have been updated to reflect new capabilities.
2016-02-18 11:58:39 -08:00
Scott Kyle 249bcd8f3f Change sortByProperty to return new Results
The method name changed to sortedBy to reflect that it returns a new Results object and to be more succinct. Also, the second optional argument instead reflects descending (or rather, reverse) since it's an anti-pattern to have an optional argument default to true in JS, and this also follows precedences set by other JS libraries and by Python's sorted function.
2016-02-18 11:58:39 -08:00
Scott Kyle b34e52b290 The schema property should be directly on constructor
The constructor is now also called with `this` set as the constructed object.

Fixes #232
2016-02-18 11:10:02 -08:00
Ari Lazier b3486c0d0e final fixes 2016-02-17 20:51:03 -08:00
Ari Lazier 1d01a1db73 don't copy query unnecessarily 2016-02-17 20:48:27 -08:00
Ari Lazier e578b05058 pr feedback 2016-02-17 20:39:29 -08:00
Ari Lazier 6d02614eaa add List.filtered 2016-02-17 20:24:08 -08:00
Ari Lazier e91ef42ebb add filtered method 2016-02-17 20:06:42 -08:00
Ari Lazier 98951f52ac Merge pull request #244 from realm/al-benchmarks
Benchmarks
2016-02-17 13:15:47 -08:00
Thomas Goyne 87655793b7 Merge pull request #40 from realm/tg/list
Wrap more of LinkView in List
2016-02-16 17:35:58 -08:00
Thomas Goyne 7c350031d6 Merge pull request #37 from realm/tg/index-set-tests
Add IndexSet tests
2016-02-16 10:07:11 -08:00
Thomas Goyne f5ae1bdf80 Merge pull request #39 from realm/tg/validate-schema-changes
Handle allowed schema changes in the transaction log observer
2016-02-16 10:07:01 -08:00
Scott Kyle 3e1889d342 Merge branch 'master' into sk-listview-merge
* master: (207 commits)
  Convert to using new React Native MainActivity template
  Create RealmReactPackage for our Android plugin
  Fix doc for Android
  NPM ignore react-native/android folder
  Skip building Android module under Xcode
  Skip building Android module for iOS tests
  gitignore Android downloads folder
  Update README with instructions to run on Android
  Use un-patched RN for Android by installing hook into JSC
  cleanup build system
  Use Realm in node_modules for ReactTests on Android
  Change Demo => ReactTests
  adding a 'publishAndroid' task to generate the AAR with prebuilt .so files
  Adjust POM_NAME
  Use consistent package naming
  Remove old Demo files
  Add copyright to JNI file
  Cleanup platform.hpp
  Make our Android module buildable as a dependency
  Add `npm test` command
  ...
2016-02-15 14:49:31 -08:00
Ari Lazier 01f92ed72f start of benchmarks
fixes

enumeration test and test setup

add async store api tests

Log benchmark test errors and some other minor edits

Only delete .realm* files for tests

sql lite tests

run all the tests

worthless

Make SQLite benchmarks work

Make Realm insertion benchmark work like SQLite

run each test in release multiple times

Open each database once per benchmark test

Use same AppDelegate for benchmarks as the example

This will load the non-dev JS from the packager.

Make the benchmarks actually match their labels

Delete benchmark databases during setup phase

Some minor code style updates to benchmarks

query tests

make query test mostly work

bug fix and improved logging

remove double insertions

improved logging and bugfix

better logging

batch insersions

more reasonable counts

android
2016-02-15 13:02:25 -08:00
Thomas Goyne a99cbb7b84 Merge pull request #41 from realm/tg/index_of
Remove the Query version of Results::index_of()
2016-02-12 17:37:24 -08:00
Scott Kyle 6e4b2440ba Create RealmReactPackage for our Android plugin
Also renamed RealmReactAndroid to RealmReactModule to match the convention used by everyone else.
2016-02-12 09:49:11 -08:00
Scott Kyle 415b45be51 Use un-patched RN for Android by installing hook into JSC
This works by installing some assembly into JSGlobalContextCreateInGroup() that will immediately jump out into our own wrapper function so we always can inject the Realm constructor into the context.
2016-02-11 11:14:09 -08:00
Thomas Goyne 5f5510e170 Remove the Query version of Results::index_of()
It didn't work for queries based on a LinkView because for those the arguments
to count() are indexes in the LinkView rather than table rows, and there's
currently no way to check if a query is based on a LinkView.
2016-02-10 10:52:33 -08:00
Scott Kyle 5f02dc9f6d Add copyright to JNI file 2016-02-08 15:56:08 -08:00
Scott Kyle 8e80733409 Cleanup platform.hpp 2016-02-08 15:55:52 -08:00
Thomas Goyne 638b4ec35e Actually update the coordinator's copy of the schema 2016-02-08 14:46:42 -08:00
Thomas Goyne a3dab7e4b1 Add wrappers for platform-specific headers and normalize include paths
Building the objectstore code now only requires adding the root `src` directory
to the include paths.
2016-02-08 14:46:42 -08:00
Nabil Hachicha 49a74e5646 Refactor & formatting code 2016-02-04 18:30:26 +00:00
Thomas Goyne 74eb195e7f Add wrappers for a bunch more LinkView methods 2016-02-03 18:05:56 -08:00
Thomas Goyne fdc67777bb Make List default constructable 2016-02-03 18:05:56 -08:00
Thomas Goyne 4c5389dbac Return RowExpr from List::get() 2016-02-03 18:05:55 -08:00
Thomas Goyne 8e58fc693c Call verify_attached() from verify_in_transaction() 2016-02-03 18:05:55 -08:00
Thomas Goyne 27acf3f109 Fix spelling of verify_in_transaction 2016-02-03 18:05:55 -08:00
Thomas Goyne 9152198962 Change List::realm() to List::get_realm() for consistency 2016-02-03 18:05:55 -08:00
Thomas Goyne 6276266d67 Make List const-correct 2016-02-03 18:05:55 -08:00
Thomas Goyne 1cbbf1958f Check the thread in all of List's methods 2016-02-03 18:05:55 -08:00
Thomas Goyne 243ae32187 Fix incorrect error message 2016-02-03 18:05:55 -08:00
Thomas Goyne 0819f72b1b Remove call to sync_if_needed() on a LinkView 2016-02-03 18:05:55 -08:00
Thomas Goyne 62d573c1d9 Remove std:: from size_t in list.* 2016-02-03 18:05:55 -08:00
Thomas Goyne 356c17ba11 Remove list.hpp's dependency on shared_realm.hpp 2016-02-03 18:05:54 -08:00
Thomas Goyne 07c40b4517 Reformat list.{hpp,cpp} to match core style 2016-02-03 18:05:44 -08:00
Nabil Hachicha e5ee6d8e9c fixes #209 download core in gradle task 2016-01-30 18:26:27 +00:00
Nabil Hachicha b92a281b5e add missing refactored files 2016-01-28 15:11:33 +00:00
Nabil Hachicha 1e4c905cdc Change package name fixes #204 2016-01-28 15:09:36 +00:00
Thomas Goyne ad5db72767 Destroy all notifiers before closing realms in clear_cache() 2016-01-25 17:46:40 -08:00
Thomas Goyne e557babaad Fix the generic implementation of ExternalCommitHelper 2016-01-25 17:46:39 -08:00
Thomas Goyne 4eb49ce6dc Add a not-very-useful generic CachedRealm implementation 2016-01-25 17:46:39 -08:00
Thomas Goyne 112c778d8e Extract the non-Apple specific parts of CachedRealm to a base class 2016-01-25 17:46:39 -08:00
Thomas Goyne 178c562f2c Add an untested non-Apple ExternalCommitHelper implementation 2016-01-25 17:46:39 -08:00
Thomas Goyne 4c195c92e0 Remove some unused cruft from ExternalCommitHelper 2016-01-25 17:46:39 -08:00
Thomas Goyne 513b3d770c Add a short explanation of CachedRealm 2016-01-25 17:46:39 -08:00
Thomas Goyne 89bd55a535 Actually remove the Realm from the cache when close() is called 2016-01-25 17:46:38 -08:00
Thomas Goyne 9b8a0d5346 Log uncaught exceptions in the notifier thread
By default the thread just silently goes away.
2016-01-25 17:46:38 -08:00
Thomas Goyne ebfca16d00 Eliminate a config copy when opening Realms 2016-01-25 17:46:38 -08:00
Thomas Goyne e30e2ff278 Simplify RealmCoordinator::get_coordinator() 2016-01-25 17:46:38 -08:00
Thomas Goyne 7a0c83929f Use an unordered map for the Realm coordinator cache 2016-01-25 17:46:38 -08:00
Thomas Goyne d6daa052e8 Decouple Realm instance tracking from interprocess notifications 2016-01-25 17:46:38 -08:00
Thomas Goyne 2ed90e6d79 Check for invalid schema changes even when KVO is not used 2016-01-25 10:58:30 -08:00
Thomas Goyne d5e00c9315 Handle allowed schema changes in the transaction log observer 2016-01-25 10:56:06 -08:00
Thomas Goyne f3397d48c0 Add IndexSet tests
And fix a bug that resulted in ranges not being merged.
2016-01-25 10:36:54 -08:00