Looking for a simple and minimalist way to store small data packets in the cloud

I am looking for a very simple and free cloud storage for small data packets.

Basically, I want to write a Greasemonkey script that a user can run on multiple computers with a common dataset. The data is basically just one number, eight bytes per user should be enough.

All this boils down to the following requirements:

  • Simple development (this is a fun project in a few hours, I don’t want to invest twice as much in synchronization)
  • store eight bytes per user (or maybe a little more, but it's really tiny)
  • Ideally, users do not need to register (they just get a random key that they can enter on all their machines).
  • I don’t need to register (this is all Greasemonkey, so there is no way to hide the secret like a developer key)
  • there is no private data in the values, so another user accessing this information by guessing a random key does not really matter.
  • information is easily recreated (sharing it in the cloud is just for convenience), so another user using the “key” is also easily recorded.

First ideas:

  • Store in Google Docs using a form as an interface. Of course, this is ugly, and each user must configure it again.
  • I can configure an instance of Google App Engine that allows me to store the key number and get the number for the key. It would not be difficult, but it still sounds redundant for what I need.
  • Firefox Greasemonkey script Mozilla Weave/Sync, , , HTML5, GM . , Opera Chrome ( , ), script.

- , ?


, : GAE ( Python). OpenKeyval (. ). , ( Google, ), , Google.

+3
4

OpenKeyval - , .

OpenKeyval , , , -, .

+4

, GAE . 500 GAE. script - REST ;)

+1

/ GAE, . , , / GAE:

app.yaml

application: myapp
version: 1
runtime: python
api_version: 1

handlers:
- url: /
  script: keyvaluestore.py

keyvaluestore.py

from google.appengine.api import users
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

class KeyValue(db.Model):
    v = db.StringProperty(required=True)

class KeyValueStore(webapp.RequestHandler):
    def _do_auth(self):
        user = users.get_current_user()
        if user:
            return user
        else:
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('login_needed|'+users.create_login_url(self.request.get('uri')))

    def get(self):
        user = self._do_auth()
        callback = self.request.get('jsonp_callback')
        if user:
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write(self._read_value(user.user_id()))

    def post(self):
        user = self._do_auth()
        if user:
            self._store_value(user.user_id(), self.request.body)

    def _read_value(self, key):
        result = db.get(db.Key.from_path("KeyValue", key))
        return result.v if result else 'none'

    def _store_value(self, k, v):
        kv = KeyValue(key_name = k, v = v)
        kv.put()

application = webapp.WSGIApplication([('/', KeyValueStore)],
                                     debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
+1

, , Amazon Simple Queue Service.
http://aws.amazon.com/sqs/

, , , 100 000 .

0

Source: https://habr.com/ru/post/1776972/


All Articles