使用protobuf作为文本配置文件 [英] using protobuf as a textual configuraton file

查看:385
本文介绍了使用protobuf作为文本配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了一个非常重要的任务关键项目,其中所有配置
文件都是使用文本protobuf定义来定义的。配置文件本应是人类可读和可编辑的

I recently encountered a very large mission-critical project where all the configuration files were defined using textual protobuf definitions. The configuration files are meant to be human readable and editable.

例如

message ServerSettings {
  required int32 port = 3022;
  optional string name = "mywebserver";
}

我个人觉得这很幽默。
但这实际上是否是一种合理的保持简单技术,或者显然是谐音的?!

Personally I found this humorous. But is it in fact a reasonable keep-it-simple technique, or clearly moronic ?!

换句话说,这是否存在真正的,实际的问题?

In other words, are there REAL, ACTUAL problems with this ?

推荐答案

如果这是文本proto if格式,那么...无论如何,我想。如果可行,那么它与任何其他序列化格式一样合理。

If that is the text proto if format, then... Whatever, I guess. If it works, then it is as reasonable as any other serialization format.

如果这是原始模式,那么它是非法的(=后的值是

If that is meant to be proto schema, then it is illegal (the value after the = is meant to be the field number).

Json或XML可能更典型,但只要有效,就不会太傻了。因此,最终的问题是:它起作用吗?

Json or XML might be more typical, but as long as it works it isn't "moronic". So the ultimate question is: does it work?

这篇关于使用protobuf作为文本配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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