diff --git a/README.md b/README.md index bb532fb..2f031a2 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,18 @@ npm install Key-Value store example: ``` -node examples/keyvalue.js -node examples/keyvalueReader.js +node examples/keyvalue.js +node examples/keyvalueReader.js ``` Event log example (run several in separate shells): ``` -node examples/reader.js +node examples/reader.js +``` + +Benchmark writes: +``` +node examples/benchmark.js ; ``` ## API diff --git a/examples/keyvalue.js b/examples/keyvalue.js index 5e821dc..666c9f6 100644 --- a/examples/keyvalue.js +++ b/examples/keyvalue.js @@ -5,8 +5,10 @@ const await = require('asyncawait/await'); const OrbitClient = require('../src/OrbitClient'); const Timer = require('./Timer'); +// usage: keyvalue.js + // orbit-server -const host = 'localhost'; +const host = process.argv[2] ? process.argv[2] : 'localhost' const port = 3333; const username = process.argv[3] ? process.argv[3] : 'LambOfGod'; @@ -15,14 +17,14 @@ const password = ''; let run = (async(() => { try { const orbit = OrbitClient.connect(host, port, username, password); - const channel = process.argv[2] ? process.argv[2] : 'testing123'; + const channel = process.argv[4] ? process.argv[4] : 'testing123'; const db = orbit.channel(channel); let count = 1; while(true) { - const key = process.argv[4] ? process.argv[4] : 'greeting'; - const value = process.argv[5] ? process.argv[5] : 'Hello world'; + const key = process.argv[5] ? process.argv[5] : 'greeting'; + const value = process.argv[6] ? process.argv65] : 'Hello world'; const timer = new Timer(true); db.put(key, value + " " + count); const result = db.get(key); diff --git a/examples/keyvalueReader.js b/examples/keyvalueReader.js index 5b3d188..73cf13b 100644 --- a/examples/keyvalueReader.js +++ b/examples/keyvalueReader.js @@ -5,8 +5,10 @@ const await = require('asyncawait/await'); const OrbitClient = require('../src/OrbitClient'); const Timer = require('./Timer'); +// usage: keyvalueReader.js + // orbit-server -const host = 'localhost'; +const host = process.argv[2] ? process.argv[2] : 'localhost' const port = 3333; const username = process.argv[3] ? process.argv[3] : 'LambOfGod'; @@ -15,13 +17,13 @@ const password = ''; let run = (async(() => { try { const orbit = OrbitClient.connect(host, port, username, password); - const channel = process.argv[2] ? process.argv[2] : 'testing123'; + const channel = process.argv[4] ? process.argv[4] : 'testing123'; const db = orbit.channel(channel); let count = 1; setInterval(async(() => { - const key = process.argv[4] ? process.argv[4] : 'greeting'; + const key = process.argv[5] ? process.argv[5] : 'greeting'; let timer = new Timer(true); const result = db.get(key); diff --git a/examples/reader.js b/examples/reader.js index 0a3d40e..a7a19e4 100644 --- a/examples/reader.js +++ b/examples/reader.js @@ -5,7 +5,7 @@ const await = require('asyncawait/await'); const OrbitClient = require('../src/OrbitClient'); const Timer = require('./Timer'); -// usage: reader.js +// usage: reader.js // orbit-server const host = process.argv[2] ? process.argv[2] : 'localhost'