Skip to content

Commit

Permalink
Make Meteor._WriteFence available on the client as well as the server…
Browse files Browse the repository at this point in the history
…. Keep

Meteor._CurrentWriteFence on server only.
  • Loading branch information
glasser committed Nov 9, 2012
1 parent e6a9ad6 commit 0092a56
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/livedata/livedata_server.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ _.extend(Meteor._LivedataSession.prototype, {
} }
}); });


// The current write fence. When there is a current write fence, code
// that writes to databases should register their writes with it using
// beginWrite().
Meteor._CurrentWriteFence = new Meteor.EnvironmentVariable;


/******************************************************************************/ /******************************************************************************/
/* LivedataSubscription */ /* LivedataSubscription */
/******************************************************************************/ /******************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion packages/livedata/package.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Package.on_use(function (api) {
// manage the current set of subscriptions. // manage the current set of subscriptions.
api.use('minimongo', ['client', 'server']); api.use('minimongo', ['client', 'server']);


api.add_files('writefence.js', 'server'); api.add_files('writefence.js', ['client', 'server']);
api.add_files('crossbar.js', 'server'); api.add_files('crossbar.js', 'server');


api.add_files('livedata_common.js', ['client', 'server']); api.add_files('livedata_common.js', ['client', 'server']);
Expand Down
6 changes: 1 addition & 5 deletions packages/livedata/writefence.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ Meteor._WriteFence = function () {
self.completion_callbacks = []; self.completion_callbacks = [];
}; };


// The current write fence. When there is a current write fence, code
// that writes to databases should register their writes with it using
// beginWrite().
Meteor._CurrentWriteFence = new Meteor.EnvironmentVariable;

_.extend(Meteor._WriteFence.prototype, { _.extend(Meteor._WriteFence.prototype, {
// Start tracking a write, and return an object to represent it. The // Start tracking a write, and return an object to represent it. The
// object has a single method, committed(). This method should be // object has a single method, committed(). This method should be
Expand Down Expand Up @@ -62,6 +57,7 @@ _.extend(Meteor._WriteFence.prototype, {
}, },


// Convenience function. Arms the fence, then blocks until it fires. // Convenience function. Arms the fence, then blocks until it fires.
// Only can be called on the server.
armAndWait: function () { armAndWait: function () {
var self = this; var self = this;
var future = new Future; var future = new Future;
Expand Down

0 comments on commit 0092a56

Please sign in to comment.