This file contains hidden or 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
var zetta = require('zetta-client'); | |
var server = zetta().connect('http://localhost:3003'); | |
var allQuery = server | |
.from() | |
.where('where type is not missing'); | |
server.observe(allQuery, function(device) { | |
var hubName = device._data.links |
This file contains hidden or 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
var zetta = require('zetta'); | |
var Photocell = require('zetta-photocell-mock-driver'); | |
zetta() | |
.use(Photocell) | |
.use(function(runtime) { | |
// Create an array to store sockets associated | |
// with PeerClient instances. | |
var peerClientSockets = []; |
This file contains hidden or 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
var zetta = require('zetta'); | |
var Photocell = require('zetta-photocell-mock-driver'); | |
zetta() | |
.use(Photocell) | |
.link('http://localhost:3000') | |
.use(function(runtime) { | |
var argo = runtime.httpServer.cloud; | |
var serverName = runtime.httpServer.zetta.id; |
This file contains hidden or 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
var zetta = require('zetta'); | |
var Photocell = require('zetta-photocell-mock-driver'); | |
zetta() | |
.use(Photocell) | |
.use(function(runtime) { | |
var httpServer = runtime.httpServer.server; | |
var listener = httpServer.listeners('upgrade')[0]; | |
httpServer.removeListener('upgrade', listener); |
This file contains hidden or 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
var caql = require('caql'); | |
var CaqlDecompiler = require('caql-decompiler'); | |
function checkExpression(expr) { | |
if (expr.type === 'Conjunction' && !expr.isNegated) { | |
return checkExpression(expr.left) || checkExpression(expr.right); | |
} | |
return expr.type === 'ComparisonPredicate' | |
&& expr.field === 'type' |
This file contains hidden or 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
module.exports = function(server) { | |
server.pubsub.subscribe('_peer/connect', function(ev, socket) { | |
if (!socket.peer.ws) { | |
return; // only use for initiating peer requests | |
} | |
var s = socket.peer.ws.socket; | |
var oldWrite = s.write; | |
s.write = function(data, encoding, callback) { |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"golang.org/x/net/context" | |
) | |
// Example of processing multiple sequential pipelines in parallel | |
func main() { | |
done := make(chan struct{}) |
This file contains hidden or 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
var assert = require('assert'); | |
function maybeCallback(callback) { | |
setTimeout(function() { | |
callback(); | |
}, 5000); | |
}; | |
describe('maybeCallback', function() { | |
it('should execute without a callback function', function(done) { |
This file contains hidden or 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
var assert = require('assert'); | |
var siren = require('siren'); | |
var ROOT_URL = 'http://45.55.169.202:3000/'; | |
describe('Zetta API', function() { | |
describe('root', function() { | |
it('contains a class named "root"', function(done) { | |
siren() | |
.load(ROOT_URL) |
This file contains hidden or 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
{ | |
"class": [ "order" ], | |
"properties": { | |
"orderNumber": 42, | |
"itemCount": 3, | |
"status": "pending" | |
}, | |
"entities": [ | |
{ | |
"class": [ "items", "collection" ], |