diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..5389a334 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,55 @@ +Copyright (c) 2015 Mark Nadal + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +--- + +Copyright (c) 2015 Mark Nadal + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgement in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +--- + +Copyright 2015 Mark Nadal + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md index 3faa71be..c6a532e8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ GUN is a realtime, decentralized, embedded, graph database engine. ## Getting Started -For the browser, try out this [tutorial](https://dl.dropboxusercontent.com/u/4374976/gun/web/think.html). This README is for GUN servers. +For the browser, try out this [tutorial](http://gun.js.org/web/think.html). This README is for GUN servers. If you do not have [node](http://nodejs.org/) or [npm](https://www.npmjs.com/), read [this](https://github.com/amark/gun/blob/master/examples/install.sh) first. Then in your terminal, run: @@ -42,12 +42,12 @@ Using S3 is recommended for deployment, and using a file is recommended for loca The examples included in this repo are online [here](http://gunjs.herokuapp.com/), you can run them locally by: ```bash -sudo npm install gun +npm install gun cd node_modules/gun node examples/http.js 8080 ``` -Then visit [http://localhost:8080](http://localhost:8080) in your browser. If that did not work it is probably because npm installed to a global directory, to fix this try `mkdir node_modules` in your desired directory and re-run the above commands. +Then visit [http://localhost:8080](http://localhost:8080) in your browser. If that did not work it is probably because npm installed it to a global directory. To fix that try `mkdir node_modules` in your desired directory and re-run the above commands. You also might have to add `sudo` in front of the commands. *** ## WARNINGS @@ -62,7 +62,7 @@ GUN is not stable, and therefore should not be trusted in a production environme Below is a really basic overview of how the gun API works. For a more detailed explanation with many more examples, [check out the wiki](https://github.com/amark/gun/wiki). -## Setting Data +## Putting Data In gun, it can be helpful to think of everything as field/value pairs. For example, let's say we have a `user` object that looks like this: @@ -138,17 +138,25 @@ We need help on the following roadmap. ## Ahead - ~~Realtime push to the browser~~ - ~~Persistence in the browser~~ +- Efficient storage engine - Authorization callbacks +- Security or ACLs +- Schema Validation +- Point of Entry Encryption - ~~Graph manipulation~~ - Server to server communication - Test more +- WebRTC Transport +- LRU or some Expiry (so RAM doesn't asplode) - Bug fixes - Data Structures: - ~~Sets~~ (Table/Collections, Unordered Lists) - CRDTs - OT + - Locking / Strong Consistency (sacrifices Availability) - Query: - SQL - MongoDB Query Documents - Neo4j Cypher + - LINQ - Gremlin Query Language diff --git a/examples/express.js b/examples/express.js index e311d5e1..e7b83641 100644 --- a/examples/express.js +++ b/examples/express.js @@ -1,4 +1,4 @@ -console.log("If modules not found, run `npm install` in /example folder!"); // git subtree push -P examples heroku master +console.log("If modules not found, run `npm install` in /example folder!"); // git subtree push -P examples heroku master // OR // git subtree split -P examples master && git push heroku [['HASH']]:master --force var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 80; var express = require('express'); diff --git a/examples/package.json b/examples/package.json index 8baedb08..98c46f2a 100644 --- a/examples/package.json +++ b/examples/package.json @@ -1,17 +1,17 @@ { "name": "examples", - "main": "express.js", + "main": "http.js", "description": "Example gun apps" -, "version": "0.0.1" +, "version": "0.0.2" , "engines": { "node": "~>0.10.x" } , "dependencies": { "express": "~>4.9.0", - "gun": "file:../" + "gun": "~>0.2.0-alpha-2" } , "scripts": { - "start": "node express.js", + "start": "node http.js", "test": "mocha" } } diff --git a/index.html b/index.html index 6f22b360..d21118ef 100644 --- a/index.html +++ b/index.html @@ -468,7 +468,7 @@ html, body {
var gun = Gun('https://gunjs.herokuapp.com/gun');
-gun.set({hello: "world"}).key('example/tutorial');
+gun.put({hello: "world"}).key('example/tutorial');
var ref = gun.load('example/tutorial'); +var ref = gun.get('example/tutorial'); ref.on(function(data){ $('body').text(JSON.stringify(data)); });
@@ -564,12 +564,12 @@ ref.on(function(data){@@ -596,7 +596,7 @@ ref.on(function(data){ $(".step1").find('button').on('click', function(e){ if(gun){ return } gun = Gun('https://gunjs.herokuapp.com/gun'); - gun.set({hello: "world"}).key(key); + gun.put({hello: "world"}).key(key); }); $(".step2").find('button').on('click', function(e){ $(".browser").find("iframe").attr("src", "./web/tabs.html?key=" + key); @@ -604,7 +604,7 @@ ref.on(function(data){ $(".step3").find('form').on('submit', function(e){ var val = $("#try-sync").val() || null; var path = $("#try-path").val(); - gun.load(key).path(path).set(val); + gun.get(key).path(path).put(val); }); }) diff --git a/lib/wsp.js b/lib/wsp.js index ea347bf5..73275156 100644 --- a/lib/wsp.js +++ b/lib/wsp.js @@ -117,7 +117,7 @@ console.log("tran.get", key); gun.get(key, function(err, graph){ //tran.sub.scribe(req.tab, graph._[Gun._.soul]); - console.log("tran.get", key, "<---", err, graph); + //console.log("tran.get", key, "<---", err, graph); if(err || !graph){ return cb({headers: reply.headers, body: (err? (err.err? err : {err: err || "Unknown error."}) : null)}); } diff --git a/package.json b/package.json index 0547facb..63eb2169 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gun", - "version": "0.2.0-alpha-1", + "version": "0.2.0-alpha-2", "description": "Graph engine", "main": "index.js", "scripts": { diff --git a/web/tabs.html b/web/tabs.html index 3d4be6a9..b1988606 100644 --- a/web/tabs.html +++ b/web/tabs.html @@ -11,7 +11,7 @@ var key = decodeURIComponent((location.search.match(/key\=(.*?)(\&|$)/i)||[])[1]||'') || alert("Please provide a key in a query parameter, such as `?key=example/tutorial`."); var gun = Gun('https://gunjs.herokuapp.com/gun'); - var ref = gun.load(key); + var ref = gun.get(key); ref.on(function(data){ delete data._; $('body').text(JSON.stringify(data,0,2)); diff --git a/web/try.html b/web/try.html index 52013400..697d70ad 100644 --- a/web/try.html +++ b/web/try.html @@ -87,7 +87,7 @@-ref.path('').set("");+ref.path('').put("");Let's update the "hello" field with a different value. - We can path into any field, and set it directly. + We can path into any field, and update it directly.var gun = Gun('https://gunjs.herokuapp.com/gun'); -gun.set({hello: "world"}).key('example/tutorial');
+gun.put({hello: "world"}).key('example/tutorial');@@ -101,7 +101,7 @@ gun.set({hello: "world"}).key('example/tutorial');-var ref = gun.load('example/tutorial'); +var ref = gun.get('example/tutorial'); ref.on(function(data){ $('body').text(JSON.stringify(data)); });
@@ -183,12 +183,12 @@ ref.on(function(data){@@ -215,7 +215,7 @@ ref.on(function(data){ $(".step1").find('button').on('click', function(e){ if(gun){ return } gun = Gun('https://gunjs.herokuapp.com/gun'); - gun.set({hello: "world"}).key(key); + gun.put({hello: "world"}).key(key); }); $(".step2").find('button').on('click', function(e){ $(".browser").find("iframe").attr("src", "./tabs.html?key=" + key); @@ -223,7 +223,7 @@ ref.on(function(data){ $(".step3").find('form').on('submit', function(e){ var val = $("#try-sync").val() || null; var path = $("#try-path").val(); - gun.load(key).path(path).set(val); + gun.get(key).path(path).put(val); }); })-ref.path('').set("");+ref.path('').put("");Let's update the "hello" field with a different value. - We can path into any field, and set it directly. + We can path into any field, and update it directly.