-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from DavidVujic/windows_support
Windows support
- Loading branch information
Showing
17 changed files
with
478 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
build | ||
node_modules | ||
npm-debug.log | ||
.idea | ||
*.tgz | ||
deps/zookeeper* | ||
.DS_Store | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
#!/usr/bin/env node | ||
var ZooKeeper = require ("./"); | ||
var zk = new ZooKeeper({ | ||
connect: "localhost:2181" | ||
,timeout: 200000 | ||
,debug_level: ZooKeeper.ZOO_LOG_LEVEL_WARNING | ||
,host_order_deterministic: false | ||
}); | ||
zk.connect(function (err) { | ||
if(err) throw err; | ||
console.log ("zk session established, id=%s", zk.client_id); | ||
zk.a_create ("/node.js1", "some value", ZooKeeper.ZOO_SEQUENCE | ZooKeeper.ZOO_EPHEMERAL, function (rc, error, path) { | ||
if (rc != 0) { | ||
console.log ("zk node create result: %d, error: '%s', path=%s", rc, error, path); | ||
} else { | ||
console.log ("created zk node %s", path); | ||
process.nextTick(function () { | ||
zk.close (); | ||
}); | ||
} | ||
}); | ||
const ZooKeeper = require('./lib/zookeeper'); | ||
|
||
function onCreate(client, rc, error, path) { | ||
if (rc !== 0) { | ||
console.log(`zk node create result: ${rc}, error: '${error}', path=${path}`); | ||
} else { | ||
console.log(`created zk node ${path}`); | ||
|
||
process.nextTick(() => { | ||
client.close(); | ||
}); | ||
} | ||
} | ||
|
||
function onConnect(client, err) { | ||
if (err) { | ||
throw err; | ||
} | ||
|
||
console.log(`zk session established, id=${client.client_id}`); | ||
client.a_create('/node.js1', 'some value', ZooKeeper.ZOO_SEQUENCE | ZooKeeper.ZOO_EPHEMERAL, onCreate.bind(null, client)); | ||
} | ||
|
||
const zk = new ZooKeeper({ | ||
connect: '127.0.0.1:2181', | ||
timeout: 200000, | ||
debug_level: ZooKeeper.ZOO_LOG_LEVEL_DEBUG, | ||
host_order_deterministic: false, | ||
}); | ||
|
||
zk.setLogger(console.log); | ||
|
||
try { | ||
zk.connect(onConnect.bind(null, zk)); | ||
} catch (e) { | ||
console.error(e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,48 @@ | ||
{ | ||
"name": "zookeeper" | ||
,"description": "apache zookeeper client (zookeeper async API >= 3.4.0)" | ||
,"version": "3.4.9-4" | ||
,"author": "Yuri Finkelstein <[email protected]>" | ||
,"contributors": [ | ||
"Yuri Finkelstein <[email protected]>" | ||
,"Woody Anderson <[email protected]>" | ||
,"Mark Cavage <[email protected]>" | ||
,"Dave Dopson <[email protected]>" | ||
,"David Trejo <[email protected]>" | ||
,"Pooya Karimian <[email protected]>" | ||
,"Jakub Lekstan <[email protected]>" | ||
,"Matt Lavin <[email protected]>" | ||
,"Roy Cheng <[email protected]>" | ||
] | ||
,"repository": { | ||
"type": "git" | ||
,"url": "https://github.com/yfinkelstein/node-zookeeper" | ||
"name": "zookeeper", | ||
"description": "apache zookeeper client (zookeeper async API >= 3.4.0)", | ||
"version": "4.0.0", | ||
"author": "Yuri Finkelstein <[email protected]>", | ||
"contributors": [ | ||
"Yuri Finkelstein <[email protected]>", | ||
"Woody Anderson <[email protected]>", | ||
"Mark Cavage <[email protected]>", | ||
"Dave Dopson <[email protected]>", | ||
"David Trejo <[email protected]>", | ||
"Pooya Karimian <[email protected]>", | ||
"Jakub Lekstan <[email protected]>", | ||
"Matt Lavin <[email protected]>", | ||
"Roy Cheng <[email protected]>", | ||
"David Vujic github.com/DavidVujic" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/yfinkelstein/node-zookeeper" | ||
}, | ||
"keywords": [ | ||
"apache", | ||
"zookeeper", | ||
"client" | ||
], | ||
"dependencies": { | ||
"async": "2.6.x", | ||
"decompress": "4.2.x", | ||
"decompress-targz": "4.1.x", | ||
"lodash": "4.x", | ||
"nan": "2.x", | ||
"shelljs": "0.8.x" | ||
}, | ||
"devDependencies": { | ||
"log4js": "4.x", | ||
"webworker": "0.x" | ||
}, | ||
"main": "lib/index", | ||
"scripts": { | ||
"build": "node-gyp configure build", | ||
"install": "node ./scripts/prepublish.js && npm run build", | ||
"test": "pushd test; ./test; popd" | ||
}, | ||
"engines": { | ||
"node": ">=8.9.4" | ||
} | ||
,"keywords": ["apache", "zookeeper", "client"] | ||
,"dependencies": { | ||
"async": "~2.6.1" | ||
,"nan": "~2.11.0" | ||
,"lodash": "~4.17.11" | ||
} | ||
,"devDependencies": { | ||
"log4js": "~3.0.5" | ||
,"webworker": ">=0.8.4" | ||
} | ||
,"main": "lib/index" | ||
,"scripts" : { | ||
"build" : "node-gyp configure build" | ||
,"test" : "pushd test; ./test; popd" | ||
,"prepublish" : "./scripts/prepublish.sh" | ||
} | ||
,"engines": { "node": ">=0.10" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const shell = require('shelljs'); | ||
const env = require('./env.js'); | ||
const { exec } = require('./helper.js'); | ||
|
||
function handleSunOS() { | ||
const uname = shell.exec('uname -v'); | ||
|
||
if (uname.match('joyent_.*')) { | ||
const res = shell.exec(`pkgin list | grep zookeeper-client-${env.zookeeperVersion}`); | ||
|
||
if (res.code !== 0) { | ||
shell.echo('You must install zookeeper before installing this module. Try:'); | ||
shell.echo(`pkgin install zookeeper-client-${env.zookeeperVersion}`); | ||
} | ||
} | ||
} | ||
|
||
if (env.isSunOs) { | ||
handleSunOS(); | ||
return; | ||
} | ||
|
||
if (env.isAlreadyBuilt) { | ||
shell.echo('Zookeeper has already been built'); | ||
shell.exit(0); | ||
return; | ||
} | ||
|
||
shell.config.fatal = true; | ||
shell.config.verbose = true; | ||
|
||
shell.cd(`${env.sourceFolder}/src/c`); | ||
|
||
if (env.isWindows) { | ||
exec(`cmake -DWANT_SYNCAPI=OFF -DCMAKE_GENERATOR_PLATFORM=${process.arch} .`); | ||
exec('cmake --build .'); | ||
} else { | ||
exec('./configure --without-syncapi --disable-shared --with-pic'); | ||
exec('make'); | ||
} | ||
|
||
shell.cd(env.rootFolder); | ||
|
||
|
||
|
Oops, something went wrong.