在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"
  }]
});

相关问答

更多

构建我的猫鼬模式的最佳方式:嵌入式数组,填充,子文档?(Best way to structure my mongoose schema: embedded array , populate, subdocument?)

Mongodb本身不支持连接。 所以,猫鼬填充是对外部参考分辨率的尝试。 与mongodb的事情是,你需要设计你的数据,以便: 大多数查询不需要引用多个集合。 从查询中获取数据后,您不需要将其转换太多。 考虑所涉及的实体及其关系: 品牌就是品牌。 不依赖于其他任何东西。 每个产品都属于一个品牌。 每个产品都与样式相关联。 每个帖子都与一个产品相关联。 间接地,每个帖子都通过产品与品牌和风格相关联。 现在介绍一下用例: 请参阅:如果您正在通过ID查找一个实体,那么提取1-2个相关实体并不是很大的开销...

数据没有填充在猫鼬中(Data not populating in mongoose)

你不能在mongoose中填充嵌入字段,但你可以使用一些解决方法 1)将您的相关数据保存在其他字段中 var employee = { grd: {type: mongoose.Schema.ObjectId, ref: 'grade'}, grdData: { grade: [], effFrom: {type: Date, default: Date.now}, effTo: {type: Date} } }; 2)使用...

猫鼬 - this.find()不存在(Mongoose - this.find() does not exist)

您需要为静态函数使用正常函数声明,而不是使用胖箭头语法,以便在函数中保留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 f...

在mongodb中,schema方法不适用于find方法(schema methods doesn't work with find method in mongodb)

这个问题肯定需要更多的细节,但如果我们假设显示的findOne代码有效,但未显示的find代码没有,那么这可能是由于返回值没有正确地用于find代码。 缺少find代码的假设: Member.find().exec((err, member) => { res.json(member.toAuthJSON()) }); 同样,如果这个假设是正确的,那么它就是对find返回值的误解。 findOne将返回单个文档, find返回文档数组 。 因此,假定的代码需要更新以迭代返回的数组,调用每个文...

在现有的猫鼬藏品中查找(Find in existing mongoose collection)

您正在运行错误的过滤器来查找文档。 {'a': '1', 'b' : '2', 'c': '3'} 问题出在你的模型对象中,你将b定义为key1的其他属性的属性, c定义为key1.key2.c属性,以及与x相同的属性。 { a: req.body.a, key1:{ b: req.body.b, key2: { c:...

从Mongoose find方法中的其他集合中获取数据(fetching data from other collections inside Mongoose find method)

从本质上讲,问题不在于猫鼬而是mongo。 你要做的是基本上在非关系数据库中拉关系数据。 根据经验,我建议不要这样做。 如果你无法避免,请使用postgres。 Postgres支持json数据。 在mongoose中,您可以使用.populate方法加载第一级关系(用户 - >帖子)。 如果你想引入二级关系(用户 - >帖子 - >回复),那么你最终需要在代码中手动创建联接。 因此,如果用户有多本书,您可以像这样设置您的模式。 User = new mongoose.Schema({ ...

没有架构的猫鼬(Mongoose without 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...

Mongoose - 创建数据并将数据插入到新集合中(Mongoose - Create and Insert data to new collection)

我做了这些更改来解决问题: 我没有在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 ...

无法使用mongoose插入数据(can't insert data using mongoose)

var contactdetails1 = new db.Schema({ name:req.body.name, email:req.body.email, password:'', number:req.body.number }); 你应该保存一个模型,而不是模式。 你在这里完成的是将一个对象传递给模式。 文档是模型的实例,而不是模式。 模式只是一个对象定义。 而不是你在这里所做的,你为什么不做 var ContactModel = mongoose.model('Cont...

相关文章

更多

Hadoop源码分析之RPC(Remote Procedure Call Protocol)

理解这个RPC是不是的先去理解哈动态代理 好多invoke,还有Socket网络编程 先来张eclip ...

Hadoop源码分析之二(RPC机制之Call处理)

上一篇介绍整个RPC Server端的处理机制。http://www.linuxidc.com/Lin ...

mybatis 调用 mysql 存储过程 返回结果集

存储过程: create procedure sp_uList(uname varchar(11)) ...

Hadoop中RPC机制

RPC(Remote Procedure Call Protocol)远程过程调用协议,它是一种通过网 ...

源码级强力分析Hadoop的RPC机制

言: 这些天一直奔波于长沙和武汉之间,忙着腾讯的笔试、面试,以至于对Hadoop RPC(Remot ...

hibernate 调用存储过程的问题

问题如下 public Account queryByaccount1(String account ...

java 调用oracle的存储过程返回记录集

从oracle存储过程返回记录集 转自:http://www.cnblogs.com/SunJav ...

java 调用oracle的存储过程返回记录集

从oracle存储过程返回记录集 转自:http://www.cnblogs.com/jinan ...

Twitter Storm - DRPC

https://github.com/nathanmarz/storm/wiki/Distribute ...

最新问答

更多

您如何使用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?)

将diff文件复制到存储库的根目录,然后执行以下操作: git apply yourcoworkers.diff 有关apply命令的更多信息, apply 见其手册页 。 顺便说一下:一个更好的方法是通过文件交换整个提交文件是发送者上的命令git format-patch ,然后在接收器上加上git am ,因为它也传送作者信息和提交信息。 如果修补程序应用程序失败,并且生成diff的提交实际上在您的备份中,则可以使用尝试在更改中合并的apply程序的-3选项。 它还适用于Unix管道,如下

将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)

尝试将第二行更改为snprintf(buf1, sizeof buf1, "%.2f", balance1); 。 另外,为什么要声明用该特定表达式分配缓冲区的存储量? EDIT @LưuVĩnhPhúc在下面的评论中提到我的原始答案中的格式说明符将舍入而不是截断,因此根据如何在不使用C舍入的情况下截断小数,您可以执行以下操作: float balance = 200.56866; int tmp = balance1 * 100; float balance1 = tmp / 100.0; c

OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)

这是简单的解决方案 在你需要写的控制器中 BackendMenu::setContext('Archetypics.Team', 'website', 'team'); 请参阅https://octobercms.com/docs/backend/controllers-views-ajax#navigation-context BackendMenu::setContext('Author.Plugin name', 'Menu code', 'Sub menu code'); 你需要在r

页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)

每当发出请求时ASP都会创建一个新的Page对象,并且一旦它将响应发送回用户就不会保留对该Page对象的引用,因此只要你找不到某种方法来保持生命自己引用该Page对象后,一旦发送响应, Page和只能通过该页面访问的所有对象才有资格进行垃圾回收。 ASP creates a new Page object whenever a request is made, and it does not hold onto the reference to that Page object once it

codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)

要在生产服务器中调试这个,你可以临时放 error_reporting(E_ALL); 并查看有哪些其他错误阻止正确的重定向。 您还应该检查生产服务器发送的响应标头。 它是否具有“缓存”,是否需要重新验证标头等 to debug this in production server, you can temporary put error_reporting(E_ALL); and see what other errors are there that prevents the proper

在计算机拍照在哪里进入

打开娥的电脑.在下面找到视频设备点击进去就可以了...

使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)

你是对的。 第一次输入后,换行符将保留在输入缓冲区中。 第一次读取后尝试插入: cin.ignore(); // to ignore the newline character 或者更好的是: //discards all input in the standard input stream up to and including the first newline. cin.ignore(numeric_limits::max(), '\n'); 您必须为#inc

No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)

for (int k = 0; k > 10; k++) { System.out.println(k); } k不大于10,所以循环将永远不会执行。 我想要什么是k<10 ,不是吗? for (int k = 0; k < 10; k++) { System.out.println(k); } for (int k = 0; k > 10; k++) { System.out.println(k); } k is not greater than 10, so loop

单页应用程序:页面重新加载(Single Page Application: page reload)

优点是不注销会避免惹恼用户,以至于他们会想要杀死你:-)。 说真的,如果每次刷新页面时应用程序都会将我注销(或者在新选项卡中打开一个链接),我再也不会使用该应用程序了。 好吧,不要这样做。 确保身份验证令牌存储在刷新后的某个位置,即不在某些JS变量中,而是存储在cookie或本地存储中。 The advantage is that not logging off will avoid pissing off your users so much that they'll want to kill

在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)

EXECUTE IMMEDIATE 'SELECT '||field_val_temp ||' FROM tableb WHERE function_id = :func_val AND rec_key = :rec_key' INTO field_val USING 'STDCUSAC' , yu.rec_key; 和, EXECUTE IMMEDIATE 'UPDATE tablec SET field_val_'||i||' = :field_val' USI