MCPcopy Index your code
hub / github.com/totaljs/framework / clusterlock

Function clusterlock

nosql.js:90–107  ·  view source on GitHub ↗
(db, method)

Source from the content-addressed store, hash-verified

88var FORKCALLBACKS;
89
90function clusterlock(db, method) {
91 Fs.open(db.filenameLock, 'wx', function(err, fd) {
92
93 if (err) {
94 setTimeout(clusterlock, 100, db, method);
95 return;
96 }
97
98 Fs.write(fd, F.id.toString(), function(err) {
99 err && F.error('NoSQLStream.lock.write()', err);
100 Fs.close(fd, function(err) {
101 err && F.error('NoSQLStream.lock.close()', err);
102 db.locked = true;
103 db[method]();
104 });
105 });
106 });
107}
108
109function clusterunlock(db) {
110 if (db.locked) {

Callers 2

nosql.jsFile · 0.85
CounterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected