在NETCONF中使用远程过程调用(use of remote procedure call in NETCONF)
我正在阅读有关netconf的RFC6241,其中有关于RPC作为协议的消息传递机制的说法。 但是,规范定义了用于传输RPC消息的XML,所以我不太明白为什么这仍然被称为RPC? 我曾经认为在ONC RPC中描述了RPC ,即应该定义一个存根函数(由Unix上的rpcgen完成)等等,但NETCONF所说的并不严格遵循这个范例,而是定义了一种传输机制电线参数。
也许,我误解了RPC作为一个概念。 有人可以为我澄清netconf中的RPC吗? 谢谢,
I was reading RFC6241 about netconf, where it's said about RPC as a messaging mechanism of the protocol. However, the spec defines XML for transmitting RPC messages, so I don't quite understand why this is still called RPC? I used to think of RPC as described in ONC RPC, i.e. there should be a stub function defined (as done by rpcgen on Unix) and so on, but what NETCONF says does not strictly follow this paradigm, rather it defines a mechanism to transmit parameters over wire.
Perhaps, I misunderstand RPC as a concept. Could anybody clarify RPC in netconf for me? Thanks,
原文:https://stackoverflow.com/questions/34276899
满意答案
教师发现功能将被异步调用,所以JavaScript代码将继续之前,你有该猫鼬查询的结果。
您需要在回调中添加课程的保存。 可能看起来像这样:
if (!req.body) return console.log("No data sent"); dbs.collection('instructors').find({ name: req.body.iname }).toArray((err, instructors) => { if (!err) { if (!instructors) { var newcourse = new clist({ // new data also from instructors }); newcourse.save(function(err) { if (err) { res.status(400); res.send(err); } else { res.status(200); res.redirect('/course'); } }); } else { res.status(400); res.send("Could not find instructor"); } } else { res.status(400); res.send(err); } });
但请注意,通过这种方式,您可以获得具有给定名称的所有教师,并且您必须从该阵列中选择一个。 如果您想要将更多课程保存到教师中,则必须更改模式:例如
var courseSchema = mongoose.Schema({ // Schema variables ... }); var courseModel = mongoose.model("Course", courseSchema); var instructorlist = mongoose.Schema({ name: { type: String, required: true }, ... courses: [{ type: ObjectId, ref: "Course" }] });
The instructors find function will be called asynchronously so the javascript code will go on before you have the results of that mongoose query.
You need to add the saving of the course inside the callback. Could look like this:
if (!req.body) return console.log("No data sent"); dbs.collection('instructors').find({ name: req.body.iname }).toArray((err, instructors) => { if (!err) { if (!instructors) { var newcourse = new clist({ // new data also from instructors }); newcourse.save(function(err) { if (err) { res.status(400); res.send(err); } else { res.status(200); res.redirect('/course'); } }); } else { res.status(400); res.send("Could not find instructor"); } } else { res.status(400); res.send(err); } });
But be aware that with this you get all instructors with the given name and you have to select one from that array. If you want to save more courses to a instructor you have to change the schema: e.g.
var courseSchema = mongoose.Schema({ // Schema variables ... }); var courseModel = mongoose.model("Course", courseSchema); var instructorlist = mongoose.Schema({ name: { type: String, required: true }, ... courses: [{ type: ObjectId, ref: "Course" }] });
相关问答
更多LINUX 如何查看JPG文件
构建我的猫鼬模式的最佳方式:嵌入式数组,填充,子文档?(Best way to structure my mongoose schema: embedded array , populate, subdocument?)
数据没有填充在猫鼬中(Data not populating in mongoose)
猫鼬 - this.find()不存在(Mongoose - this.find() does not exist)
在mongodb中,schema方法不适用于find方法(schema methods doesn't work with find method in mongodb)
在现有的猫鼬藏品中查找(Find in existing mongoose collection)
从Mongoose find方法中的其他集合中获取数据(fetching data from other collections inside Mongoose find method)
没有架构的猫鼬(Mongoose without schema)
Mongoose - 创建数据并将数据插入到新集合中(Mongoose - Create and Insert data to new collection)
无法使用mongoose插入数据(can't insert data using mongoose)
相关文章
更多Hadoop源码分析之RPC(Remote Procedure Call Protocol)
RFC2848--The PINT Service Protocol: Extensions to SIP and SDP for IP Access to Telephone Call Services
Hadoop源码分析之二(RPC机制之Call处理)
mybatis 调用 mysql 存储过程 返回结果集
Hadoop中RPC机制
源码级强力分析Hadoop的RPC机制
hibernate 调用存储过程的问题
java 调用oracle的存储过程返回记录集
java 调用oracle的存储过程返回记录集
Twitter Storm - DRPC
最新问答
更多您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
在计算机拍照在哪里进入
使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
单页应用程序:页面重新加载(Single Page Application: page reload)
在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!