Reduce code duplication by proposing to split up the mongo package
SimonSimCity opened this issue · comments
I've now dived quite much through the code-base and got the understanding that the following files also could be used as they are in the codebase of the meteor/mongo
package:
- mongo/lib/observeChanges.js
- mongo/lib/ObserveMultiplex.js
- mongo/lib/PollingObserverDriver.js
All these lines could be taken straight from the meteor-developed package. I think we should propose something to Meteor here:
We should implement a way to allow other classes to replace the OplogObserveDriver
internally available in meteor/mongo
and force the canUseOplog
even if self._oplogHandle
isn't set in https://github.com/meteor/meteor/blob/24865b28a0689de8b4949fb69ea1f95da647cd7a/packages/mongo/mongo_driver.js
This might require to put files like polling_observe_driver.js
and oplog_observe_driver.js
into their own packages, but it would also make this package a first-class-citizen - and not a dirty hook with a lot of copying of files.
E.g. we didn't get the benefit of meteor/meteor@86dba2b even if we could easily have had it in here.
Here's a specific list of code-changes this package has missed out on until now:
- meteor/meteor@b8cbe5a#diff-a9d0b23557a439d95f0ceea868fb961b
- meteor/meteor@fd63390#diff-75240636a2190af4439bf71a576e3649
- meteor/meteor@ecf726e#diff-75240636a2190af4439bf71a576e3649
- meteor/meteor@86dba2b#diff-75240636a2190af4439bf71a576e3649
And you've added something to https://github.com/cult-of-coders/redis-oplog/commits/master/lib/mongo/ObserveMultiplex.js whereby I don't know if this was to fix something or rather for convenience ...