简体   繁体   English

ArangoDB:Foxx服务中的事务限制

[英]ArangoDB: Transaction restrictions within Foxx service

I'm trying to find documentation describing restrictions on what can be safely accessed from within a transaction running within a javascript Foxx micro-service. 我正在尝试查找描述对可以在JavaScript Foxx微服务中运行的事务中安全访问的内容进行限制的文档。 I had read somewhere (can't find it now) that you can't access anything except what is passed via the transaction parameters array, and you must re-import all node modules that are used within the transaction. 我已经读到某个地方(现在找不到),除了通过事务参数数组传递的内容之外,您无法访问其他任何东西,并且您必须重新导入事务中使用的所有节点模块。 I'm curious what I can safely pass into a transaction - such as the ArangoDB database object itself (instead or re-importing it), why these restrictions exist, and what the performance implications are (object marshaling?). 我很好奇我可以安全地传递给事务的内容-例如ArangoDB数据库对象本身(而不是导入或重新导入),为什么存在这些限制以及对性能的影响(对象编组?)。 In my testing on a single-node server, it seems that accessing externally defined variables does work, so I assume these restrictions have to do with more complex configurations of the database server/cluster. 在单节点服务器上的测试中,似乎可以访问外部定义的变量,因此,我认为这些限制与数据库服务器/集群的更复杂配置有关。

Thanks! 谢谢!

I had read somewhere (can't find it now) that you can't access anything except what is passed via the transaction parameters array 我读过某处(现在找不到),除了通过事务参数数组传递的内容外,您无法访问其他任何内容

This applies to UDFs (user-defined functions), not Foxx micro-services. 这适用于UDF(用户定义的函数),不适用于Foxx微服务。

I believe that all the cautions about Foxx are in the manual: 我相信有关Foxx的所有注意事项都在手册中:

https://docs.arangodb.com/3.3/Manual/Foxx/ https://docs.arangodb.com/3.3/Manual/Foxx/

In particular: 尤其是:

  • "you should not rely on server-side state (other than the database itself) between different requests as there is no way of making sure consecutive requests will be handled in the same context." “您不应该依赖不同请求之间的服务器端状态(数据库本身除外),因为无法确保连续请求将在同一上下文中处理。”

  • "Because the JavaScript code is running inside the database ... all Foxx and ArangoDB APIs are purely synchronous and should be considered blocking." “由于JavaScript代码正在数据库中运行,因此,所有Foxx和ArangoDB API都是纯同步的,应视为阻塞。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM