Permalink
Browse files

misc:change hard and fix cmd

  • Loading branch information...
1 parent 6ddd066 commit 2ac3b433235a016812dea7ba43e5f44aa55fd9a3 yaopiaohai committed Oct 8, 2012
View
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>data-sync</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
- </natures>
-</projectDescription>
View
@@ -31,10 +31,10 @@ var updateUser = function(dbclient,val) {
var dbclient = {};//db connection etc;
var id = 10001;
var optKey = 'updateUser';
-var path = {optKey:updateUer}; //key function mapping
-opt.write = path;
+var mapping = {optKey:updateUer}; //key function mapping
+opt.mapping = mapping;
opt.client = dbclient;
-opt.interval = opts.interval || 60 * 1000;
+opt.interval = 2000;
var sync = new DBsync(options) ;
sync.exec(optKey,id,{name:'hello'});
@@ -66,7 +66,7 @@ return false;
##Notice
-system default sync time is 1000 * 60 * 3,
+system default sync time is 1000 * 60,
if you use mysql or redis sync,you should set options.client,the file sync is default but it doesn't load in current.
Mysql OR mapping in this modules do not support,user should realize it self.
View
0 index.js 100755 → 100644
No changes.
View
0 lib/commands/hash.js 100755 → 100644
No changes.
View
0 lib/commands/index.js 100755 → 100644
No changes.
View
0 lib/commands/keys.js 100755 → 100644
No changes.
View
0 lib/commands/list.js 100755 → 100644
No changes.
View
11 lib/commands/mapping.js 100755 → 100644
@@ -10,26 +10,25 @@ var path = require('path');
*/
exports.load = function(mappingPath) {
var mapping = {};
- var cwd = process.cwd();
- mappingPath += '/';
var logger = this.log;
- logger.info('[ data sync compoment ] load mapping file ' + mappingPath);
+ mappingPath+='/';
+ logger.info('[data sync compoment] load mapping file ' + mappingPath);
fs.readdirSync(mappingPath).forEach(function(filename){
if (!/\.js$/.test(filename)) {return;}
var name = path.basename(filename, '.js'),key,pro;
- var fullPath = cwd +'/' + mappingPath + name;
+ var fullPath = mappingPath + name;
logger.info('loading ' + fullPath);
pro = require(fullPath);
for (key in pro){
var fullKey = name+'.'+key;
if (mapping[fullKey]){
- logger.error('[sync component] exist duplicated key map function ' + key + ' ignore it now.');
+ logger.error('[data sync component] exist duplicated key map function ' + key + ' ignore it now.');
} else {
mapping[fullKey] = pro[key];
}
}
});
- logger.info('[ data sync component ] load mapping file done.' );
+ logger.info('[data sync component] load mapping file done.' );
return mapping;
};
View
0 lib/commands/server.js 100755 → 100644
No changes.
View
0 lib/commands/string.js 100755 → 100644
No changes.
View
0 lib/dbsync.js 100755 → 100644
No changes.
View
0 lib/rewriter/filerewriter.js 100755 → 100644
No changes.
View
0 lib/rewriter/rewriter.js 100755 → 100644
No changes.
View
0 lib/timer/synctimer.js 100755 → 100644
No changes.
View
0 lib/utils/constant.js 100755 → 100644
No changes.
View
0 lib/utils/queue.js 100755 → 100644
No changes.
View
0 lib/utils/utils.js 100755 → 100644
No changes.
View
2 package.json 100755 → 100644
@@ -1,6 +1,6 @@
{
"name": "data-sync",
- "version": "0.0.12",
+ "version": "0.0.13",
"dependencies": {
}
}
View
0 test/bench.js 100755 → 100644
No changes.
View
0 test/mapping/bag.js 100755 → 100644
No changes.
View
0 test/mapping/player.js 100755 → 100644
No changes.
View
0 test/mysql.js 100755 → 100644
No changes.
View
2 test/synctest.js 100755 → 100644
@@ -4,7 +4,7 @@ var dbclient = require('./mysql').client;
var opt = {};
-opt.mappingPath = 'test/mapping';
+opt.mappingPath = __dirname+ '/mapping';
opt.client = dbclient;
opt.interval = 5000;
opt.aof = false;

0 comments on commit 2ac3b43

Please sign in to comment.