4层应用程序架构 - 服务器端API的NoSQL [英] 4-tier Application architecture - server side API with noSQL

查看:144
本文介绍了4层应用程序架构 - 服务器端API的NoSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图建筑师运行使用NoSQL数据库的服务器端API。我是新来的应用程序架构,所以我想就如何我试图分离层一些反馈。我想,什么扔我是使用的NoSQL数据库,去除了有一个定义的数据模型提前,而在同一时间,需要对数据的非规范化程序,以确保数据可以查询,快速的约束的重要组成部分。

I've been attempting to architect a server side API that runs using a noSQL database. I'm new to application architecture so I would like some feedback on how I have attempted to separate layers. I think a major part of whats throwing me is the use of a noSQL database which removes the constraint of having to have a defined data model beforehand while at the same time requiring denormalization routines on the data to ensure that data can be queries for quickly.

我使用的是4层:


  • 数据层


  • 键入接受对象

  • 从关键
  • 提供对象
  • 提供对象的列表从查询

  • 提供对象的列表,从按键的名单

  • 接受键控对象列表

  • 从关键
  • 删除对象
  • 根据模型定义器具的非规范化例程(很多时候,一些对象的部分拷贝给他人,以加快查询速度,因为联接不可能的NOSQL)

  • Accepts keyed objects
  • Provides objects from a key
  • Provides lists of objects from queries
  • Provides lists of objects from lists of keys
  • Accepts lists of keyed objects
  • Deletes objects from a key
  • Implements denormalization routines based on definitions in model (many times, parts of some objects are copies to others in order to speed up queries since joins are not possible with noSQL)

业务层


  • 提供业务逻辑

  • 强制执行的权限

模型层


  • 定义已知对象

  • Definies非规范化(哪些对象的部分被复制到其他地方)

  • Definies权限(哪些用户可以访问在什么情况下什么对象)

presentation层(REST的API)


  • 提供的所有资源/服务的宁静API,包括

    • 访问和修改对象

    • 置备新的用户帐户

    • 登录到帐户

    • 还有其他的API需要做

    我对如何我有这个设置了几个问题:

    I have a few questions about how I have this set up:

    1)我认为,信息非规范化定义(如何当一些ojects的副本是由其他对象提供)是模型的definiteion的一部分,所以我有提供模型信息的程序。但是,实际上有做到这一点的是数据层的层,特别是被保存的信息的时候,所以我把程序实施在数据层模型中发现的非规范化定义。这是正确的?

    1) I believe that information defining denormalization (how and when copies of some ojects are made available in other objects) is part of the definiteion of the model, so I have the routines that provide this information in the model. However, the layer that actually has to do this is the Datalayer, specifically when information is being saved, so I put the routines for implementing the denormalization definitions found in the model in the data layer. Is this correct?

    2)同样,我有权限的定义(谁可以在模型访问哪些信息以及在什么curcumstances)为好。但是,业务层将负责提供这些信息的REST API,所以这是我执行权限层。我没有数据层强制执行权限,因为尽管一些用户可能没有某些数据的直接访问,即数据可被间接通过其他动作,该用户执行修改(例如,简单的日志对子级更新该用户的last_login_time属性虽然用户将永远无法修改随意的信息),这是正确的?

    2) Similarly, I have the definitions for Permissions (who can access what information and under what curcumstances) in the model as well. But the business layer will be responsible for delivering this information to the REST API, so this is the layer that I have enforcing permissions. I do not have the data layer enforcing permissions because although some users may not have direct access to some data, that data may be modified indirectly through other actions that the user performs (for example, simple logging in whould update that user's "last_login_time" property although the user would never be able to modify that information at will) Is this correct?

    3)还有什么在这里,我有不正确的,在一般什么,我应该注意或其他任何东西,我应该知道吗?

    3) Is there anything else here that I have incorrect, anything in general that I should watch out for or anything else I should know?

    4)我使用谷歌应用程序引擎对于这一点,在Java低级API的任何蟒蛇。是否有一个框架,我应该使用已经处理一些这方面,特别是与非规范化的权限?

    4) I'm using google app engine for this, either python of the Java low-level api. Is there a framework I should be using that already handles some of this, specifically the denormalization and the permissions?

    谢谢!

    推荐答案

    不知道你的数据的复杂程度,为什么数据层从模型分开?我倾向于将功能添加到我的谷歌应用程序引擎的模型做任何他们需要的,以接受来自数据和获取数据到业务层。

    Without knowing how complicated your data is, why have the data layer separate from the model? I tend to add functionality to my Google App Engine models to do whatever they need to in order to accept data from and get data to the business layer.

    此外,为什么你计划使用低级别的API,而不是持久性的帮手这使得持久性一样容易倒下的?

    Also, why are you planning on using the low-level api instead of the persistence helpers which make persistence as easy as falling down?

    我想你应该采取一对夫妇的步骤回来,定义你正在试图解决这个问题,看看谷歌应用程序引擎已经建立了解决。我需要了解你试图告诉你该怎么做之前要完成什么样的信息。

    I think you should take a couple steps back, define the problem you're trying to solve, and see what Google App Engine has built in to solve it. I'd need information about what you're trying to accomplish before telling you how to do it.

    这篇关于4层应用程序架构 - 服务器端API的NoSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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