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

查看:39
本文介绍了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.

对于100万左右的用户群(只有1万左右的活跃用户)对pouchDB的用户访问控制有什么建议吗?

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.

用户的设备将拥有自己的数据库+/- 任何共享数据库.那些百万用户设备上的应用程序只需要关注它们自己的内容(也就是硬盘空间)的可扩展性.该应用程序将直接复制到云"端用户数据库以进行备份、网络使用等.

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天全站免登陆