每个文档对PouchDB / CouchDB的用户访问控制 [英] Per document user access control for PouchDB / CouchDB

查看:105
本文介绍了每个文档对PouchDB / CouchDB的用户访问控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用PouchDB-CouchDB来保存Web应用程序的用户数据,但是找不到控制每个用户访问权限的方法。我的数据库仅由使用用户ID作为键的文档组成。我知道有一些解决方案:

I wish to use PouchDB - CouchDB for saving user data for my web application, but cannot find a way to control the access per user basis. My DB would simply consists of documents using user id as the key. I know there are some solutions:


  1. 每个用户一个数据库-但是它需要监视新用户何时要保存数据为了创建一个新的数据库,并可能创建许多数据库;

  1. One database per user - however it requires to monitor whenever a new user wants to save data in order to create a new DB, and may create a lot of DBs;

客户端和CouchDB之间的代理-但是我不希望PouchDB同步更改对于整个数据库,包括在_all_docs,_revs_diff请求中的其他用户的文档。

Proxy between client and CouchDB - however I don't want PouchDB to sync changes for the whole DB including documents of other users in those _all_docs, _revs_diff request.

对用户访问是否有任何建议控制pouchDB的用户群约为100万(活动用户仅约1万人)?

Is there any suggestion for user access control for pouchDB for a user base of around 1 million (active users around 10 thousand only)?

推荐答案

一百万个或更多数据库。结论是,这取决于您的操作系统如何处理这么多文件。当请求时,CouchDB只是访问 .couch 文件的一部分。性能与其能否快速找到,打开,访问和关闭该文件有关。

The topic of a million or more databases has come up on the mailing list in the past. The conclusion was that it depends on how your operating system deals with that many files. CouchDB is just accessing parts of the .couch file when requested. Performance is related to how quickly it can find, open, access, and close that file.

某些文件系统有一些技巧,例如放置 / 数据库名称中的分隔符-这将导致CouchDB将它们存储在匹配的目录结构中,例如 groupA / userA.couch 或使用电子邮件样式数据库名称 com / bigbluehat / byoung.couch (或类似名称)。

There are tricks for some file systems like putting / delimiters in the database name--which will cause CouchDB to store them in matching directory structures such as groupA/userA.couch or using email-style database names com/bigbluehat/byoung.couch (or some similar).

如果这还不够,请使用Apache CouchDB 2.0引入了 BigCouch 代码(其中 IBM Cloudant 使用)来提供完全自动分片的CouchDB。尚未完成,但是它将使用Amazon Dynamo样式分片系统提供跨多个节点的可伸缩性。

If that's not sufficient, Apache CouchDB 2.0 brings in BigCouch code (which IBM Cloudant uses) to provide a fully auto-sharded CouchDB. It's not done yet, but it will provide scalability across multiple nodes using an Amazon Dynamo style sharding system.

另一种选择是在多个CouchDB之间进行基于用户名的分区服务器或使用IBM Cloudant(已针对此级别的规模构建)。

Another option is to do your own username-based partitioning between multiple CouchDB servers or use IBM Cloudant (which is built for this level of scale).

所有这些选项都提供相同的Apache CouchDB复制协议,并且可以与坐在PouchDB上的服务器一起使用用户的计算机,电话或平板电脑。

All these options provide the same Apache CouchDB replication protocol and will work just fine with PouchDB sitting on the user's computer, phone, or tablet.

用户的设备将拥有自己的数据库 +/-任何共享数据库。数百万用户设备上的应用程序仅具有其自身内容(即硬盘空间)的可伸缩性,值得关注。该应用程序将直接复制到云端的用户数据库中,以进行备份,Web使用等。

The user's device would then have their own database +/- any share databases. The apps on those million user devices would only have the scalability of their own content (aka hard drive space) to be concerned about. The app would replicate directly to the "cloud"-side user database for backup, web use, etc.

希望其中听起来有些许希望。 :)

Hopefully something in there sounds promising. :)

这篇关于每个文档对PouchDB / CouchDB的用户访问控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆