如何设计一个流星智能封装到应用程序透明地分成不同的实例? [英] How to design a meteor smart package to transparently separate an app into different instances?

查看:137
本文介绍了如何设计一个流星智能封装到应用程序透明地分成不同的实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个问题,对于那些谁是非常熟悉的流星的架构。

This is a question for those who are very familiar with Meteor's architecture.

我试图设计一种智能软件包,可以透明地运行几个流星应用的副本。也就是说,给定现有的流星应用程序,和几个predefined用户组,可以在包半自动地隔离的应用程序 - 在为每组用户的一种方式运行它,似乎只有这些用户正在使用的应用

I am trying to design a smart package that can transparently run several "copies" of a Meteor app. That is, given an existing Meteor app, and several predefined groups of users, the package can semi-automagically "segregate" the app - run it in a way that for each group of users, it appears that only those users are using the app.

据我了解,这个功能可以定制设计的任何应用程序。不过,我正在寻找一个聪明的包装最直接的方式,提供在任何现有应用程序之上此功能,考虑到使用流星的收藏和所有。因此,它应当或多或少满足下列关系:

I understand that this functionality could be custom designed for any application. However, I'm looking for the most straightforward way for a smart package to provide this functionality on top of any existing app, taking into account the use of Meteor's Collections and all. Hence, it should more or less satisfy the following:


  • 这应该只是作为一个普通流星应用的高效性能。

  • 将现有应用程序流星使用这个系统应该需要最少code修改。

  • 包装不应有修改或覆盖流星和相对面向未来。

这里有一些方法和相应的缺点,对于这个问题我想过:

Here are some approaches and corresponding drawbacks I've thought about for this problem:


  • 使用常规流星应用的所有集合,以及一个额外的ID重新$ P $标记每个文件psenting用户在该组中。这些出版物/为每个用户订阅只拉文件具有相同组ID

  • 覆盖 Meteor.Collection (或实现相同的接口)的方式,使得它知道这些不同的群体,而从客户角度来看,它的行为就好像当前用户组是整个应用程序。

  • Use all the collections of the regular Meteor app, and tag each document with an additional id representing the group that the user is in. The publications/subscriptions for each user only pull the documents with the same group id.
  • Override Meteor.Collection (or implement an identical interface) in a way that makes it aware of these different groups, and from the client perspective it behaves as if the current user's group is the entire app.

我要找的人谁真正知道流星的系统在这里好主意。我怎么能在某种程度上设计这个功能,绝大多数流星的应用程序可以很容易地转换与它的工作(即避免疯狂的黑客是非常脆弱),但很简单,高效的流星之上实现?

I'm looking for good ideas here from someone who really knows Meteor's system. How can I design this functionality in a way that the vast majority of Meteor apps can be easily converted to work with it (i.e. avoid crazy hacks that are very brittle) yet is straightforward and efficient to implement on top of Meteor?

(如果你是在纽约地区的流星大师,我会很乐意带你出去吃晚饭讨论这个!)

(If you are a Meteor guru in the NYC area, I would be happy to take you out to dinner to discuss this!)

推荐答案

我已经采取了在这个问题上我的工作,并把它伸到流星智能包。它满足了我在我的问题提到的所有要求。有关详细信息,请参阅文档和说明。

I've taken my work on this problem and pulled it out into a Meteor smart package. It satisfies all the requirements I noted in my question. For more details, see the documentation and instructions.

<一个href=\"https://github.com/mizzao/meteor-partitioner\">https://github.com/mizzao/meteor-partitioner

由于我在实践中使用这种不已,code是pretty稳定,具有良好的一组测试。意见和建议,都欢迎。

Because I've been using this in practice already, the code is pretty stable and has a good set of tests. Comments and contributions are welcome.

使用此一包的一个例子是以下

An example of a package that uses this is the following:

<一个href=\"https://github.com/HarvardEconCS/turkserver-meteor\">https://github.com/HarvardEconCS/turkserver-meteor

这篇关于如何设计一个流星智能封装到应用程序透明地分成不同的实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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