使用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?