gunshot

0.1.3 • Public • Published

Gunshot

A graph cache engine using Amazon S3 as the persistence layer.

'use strict';

var PromiseA = require('bluebird').Promise
  , Gun = require('./shotgun')
  , gun
  ;

gun = require('./shotgun').create({
  storage: require('./shotgun-s3').create({
    key: 'XXXXXXXXXXXXXXXXXXXX' // AWS Access Key
  , secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' // AWS Secret Token
  , bucket: 'XXX' // The bucket you want to save into
  , idKey: Gun._sym.id
  })
});

gun.load('blob/data').then(function (data) {
  var obj = { foo: 'bar', bar: 'baz', awesome: { sauce: 'x11', catsup: { ketchup: 'sauce' } } }
    ;

  if (data) {
    console.log('AWESOME!!!');
    console.log(data);
    return;
  }

  if (!data) {
    return gun.put(obj).then(function (root) {
      gun.key('blob/data', root).then(function (node) {
        console.log('SUCCESS: created key for root node (and saved all subnodes)');
      });
    });
  }
});

Readme

Keywords

none

Package Sidebar

Install

npm i gunshot

Weekly Downloads

4

Version

0.1.3

License

none

Last publish

Collaborators

  • coolaj86