寻找一种简单、简约的方式在云端存储小数据包

发布于 2024-10-04 10:46:16 字数 947 浏览 1 评论 0原文

我正在寻找一个非常简单且免费的小数据包云存储。

基本上,我想编写一个 Greasemonkey 脚本,用户可以在具有共享数据集的多台计算机上运行该脚本。数据主要只是一个数字,每个用户八个字节就足够了。

这一切都归结为以下要求:

  • 开发简单(这是一个有趣的项目,需要几个小时,我不想在同步上投入两倍)
  • 每个用户存储八个字节(或者可能更多一点,但是它真的很小)
  • 理想情况下,用户不必注册(他们只需获得一个可以在所有计算机上输入的随机密钥)
  • 我不需要注册(这都是 Greasemonkey,所以没有办法隐藏秘密,就像开发人员密钥)
  • 值中没有私有数据,因此另一个用户通过猜测随机密钥来访问该信息没什么大不了的,
  • 信息很容易重新创建(在云中共享它只是为了方便),所以另一个用户接管“密钥”也很容易修复。

第一个想法:

  • 以表单作为前端存储在 Google Docs 上。当然,这有点难看,每个用户都需要重新设置。
  • 我可以设置一个 Google App Engine 实例,允许将数字存储到键并通过键检索数字。这并不难,但对于我的需要来说,这听起来仍然有些过分。
  • 我可以创建一个 Firefox 插件而不是 Greasemonkey 脚本,并使用 Mozilla Weave/Sync,不幸的是,它还不支持存储 HTML5 本地存储,因此 GM 还不够。当然,我必须为 Opera 和 Chrome 实现相同的功能(假设它们有类似的服务),而不是仅仅重用用户脚本。

有人有我不知道的聪明想法或服务​​吗?


对于那些好奇的人的更新:我最终选择了 GAE 路线(大约半页 Python 代码)。我后来才发现OpenKeyval(见下文)。优点是用户可以很容易地在所有机器上连接(只需一个 Google 帐户登录,无需其他密钥从机器 A 转移到机器 B),缺点是每个人都需要一个 Google 帐户。

I'm looking for a very simple and free cloud store for small packets of data.

Basically, I want to write a Greasemonkey script that a user can run on multiple machines with a shared data set. The data is primarily just a single number, eight byte per user should be enough.

It all boils down to the following requirements:

  • simple to develop for (it's a fun project for a few hours, I don't want to invest twice as much in the sync)
  • store eight bytes per user (or maybe a bit more, but it's really tiny)
  • ideally, users don't have to sign up (they just get a random key they can enter on all their machines)
  • I don't need to sign up (it's all Greasemonkey, so there's no way to hide a secret, like a developer key)
  • there is no private data in the values, so another user getting access to that information by guessing the random key is no big deal
  • the information is easily recreated (sharing it in the cloud is just for convenience), so another user taking over the 'key' is easily fixed as well

First ideas:

  • Store on Google Docs with a form as the frontend. Of course, that's kinda ugly and every user needs to set it up again.
  • I could set up a Google App Engine instance that allows storing a number to a key and retrieving the number by key. It wouldn't be hard, but it still sounds overkill for what I need.
  • I could create a Firefox add-on instead of a Greasemonkey script and use Mozilla Weave/Sync—which unfortunately doesn't support storing HTML5 local storage yet, so GM isn't enough. Of course I'd have to implement the same for Opera and Chrome then (assuming there are similar services for them), instead of just reusing the user script.

Anybody got a clever idea or a service I'm not aware of?


Update for those who are curious: I ended up going the GAE route (about half a page of Python code). I only discovered OpenKeyval afterwards (see below). The advantage is that it's pretty easy for users to connect on all their machines (just a Google account login, no other key to transfer from machine A to machine B), the disadvantage is that everybody needs a Google account.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

提笔落墨 2024-10-11 10:46:16

OpenKeyval 正是我一直在寻找的东西。

OpenKeyval 正是我一直在寻找的东西,但有显然已经被关闭了。

OpenKeyval is pretty much what I was looking for.

OpenKeyval was what I was looking for but has apparently been shut down.

眸中客 2024-10-11 10:46:16

我认为GAE会是不错的选择。根据您对存储大小的要求,您永远不会获得免费的 500 MB GAE 存储空间。由于服务的 REST 性质,跨浏览器移植脚本将很容易;)

I think GAE will be nice choice. With your requirements for storage size you will never pass free 500 mb of GAE's store. And it will be easy to port your script across browsers because of REST nature of your service;)

偏爱自由 2024-10-11 10:46:16

我被要求分享我的 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()

I was asked to share my GAE key/value store solution, so here it comes. Note that this code hasn't run for years, so it might be wrong and/or very outdated GAE code:

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()
浮光之海 2024-10-11 10:46:16

我见过的最接近的是亚马逊的简单队列服务。
http://aws.amazon.com/sqs/

我自己没有使用过它,所以我'我不确定开发人员关键方面是如何工作的,但他们每月为您提供 100,000 次免费查询。

The closest thing I've seen is Amazon's Simple Queue Service.
http://aws.amazon.com/sqs/

I've not used it myself so I'm not sure how the developer key aspect works, but they give you 100,000 free queries a month.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文