首页 \ 问答 \ 在NETCONF中使用远程过程调用(use of remote procedure call in NETCONF)

在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
更新时间:2023-03-20 22:03

最满意答案

教师发现功能将被异步调用,所以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"
  }]
});

相关问答

更多
  • find
  • Mongodb本身不支持连接。 所以,猫鼬填充是对外部参考分辨率的尝试。 与mongodb的事情是,你需要设计你的数据,以便: 大多数查询不需要引用多个集合。 从查询中获取数据后,您不需要将其转换太多。 考虑所涉及的实体及其关系: 品牌就是品牌。 不依赖于其他任何东西。 每个产品都属于一个品牌。 每个产品都与样式相关联。 每个帖子都与一个产品相关联。 间接地,每个帖子都通过产品与品牌和风格相关联。 现在介绍一下用例: 请参阅:如果您正在通过ID查找一个实体,那么提取1-2个相关实体并不是很大的开销。 列表: ...
  • 你不能在mongoose中填充嵌入字段,但你可以使用一些解决方法 1)将您的相关数据保存在其他字段中 var employee = { grd: {type: mongoose.Schema.ObjectId, ref: 'grade'}, grdData: { grade: [], effFrom: {type: Date, default: Date.now}, effTo: {type: Date} } }; 2)使用像mong ...
  • 您需要为静态函数使用正常函数声明,而不是使用胖箭头语法,以便在函数中保留Mongoose的含义: schema.statics.getUserByToken = function(token, cb) { return this.find({ examplefield: token }, cb); }; You need to use a normal function declaration for your static function instead of using the fat-ar ...
  • 这个问题肯定需要更多的细节,但如果我们假设显示的findOne代码有效,但未显示的find代码没有,那么这可能是由于返回值没有正确地用于find代码。 缺少find代码的假设: Member.find().exec((err, member) => { res.json(member.toAuthJSON()) }); 同样,如果这个假设是正确的,那么它就是对find返回值的误解。 findOne将返回单个文档, find返回文档数组 。 因此,假定的代码需要更新以迭代返回的数组,调用每个文档的自定义 ...
  • 您正在运行错误的过滤器来查找文档。 {'a': '1', 'b' : '2', 'c': '3'} 问题出在你的模型对象中,你将b定义为key1的其他属性的属性, c定义为key1.key2.c属性,以及与x相同的属性。 { a: req.body.a, key1:{ b: req.body.b, key2: { c: req. ...
  • 从本质上讲,问题不在于猫鼬而是mongo。 你要做的是基本上在非关系数据库中拉关系数据。 根据经验,我建议不要这样做。 如果你无法避免,请使用postgres。 Postgres支持json数据。 在mongoose中,您可以使用.populate方法加载第一级关系(用户 - >帖子)。 如果你想引入二级关系(用户 - >帖子 - >回复),那么你最终需要在代码中手动创建联接。 因此,如果用户有多本书,您可以像这样设置您的模式。 User = new mongoose.Schema({ // ...
  • Mongoose说您可以使用Mixed模式来定义无模式类型。 权衡的是,如果在调用save之前修改了Mixed Schema值,则必须告诉mongoose。 除此之外,您应该能够在“架构”中定义任何您想要的内容。 文档 - http://mongoosejs.com/docs/schematypes.html#mixed Mongoose says that you can use a Mixed schema to define a schema-less type. The trade off is t ...
  • 我做了这些更改来解决问题: 我没有在mongo shell中创建集合,而是将以下代码放在module.factory.js this.Person = mongoose.model('Person',PersonSchema); this.Person.db.collection("user", { .... } ); I did these changes to solve the issue: Instead of creating collection in mongo shell, I put t ...
  • var contactdetails1 = new db.Schema({ name:req.body.name, email:req.body.email, password:'', number:req.body.number }); 你应该保存一个模型,而不是模式。 你在这里完成的是将一个对象传递给模式。 文档是模型的实例,而不是模式。 模式只是一个对象定义。 而不是你在这里所做的,你为什么不做 var ContactModel = mongoose.model('Contactde ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。