Tendermint源码阅读(六)

关注点:protobuf 3

一、Tendermint中的proto3

我们先来看看tendermint中有多少个proto3源文件

[vagrant@vagrant tendermint]$ find . -type f|grep proto$
./abci/types/types.proto
./benchmarks/proto/test.proto
./libs/common/types.proto
./libs/db/remotedb/proto/defs.proto
./rpc/grpc/types.proto
./types/proto3/block.proto

总共有6个源文件,那我们再来看看每个文件有多少行源码

[vagrant@vagrant tendermint]$ wc -l `find . -type f|grep proto$`
  312 ./abci/types/types.proto
   29 ./benchmarks/proto/test.proto
   28 ./libs/common/types.proto
   71 ./libs/db/remotedb/proto/defs.proto
   45 ./rpc/grpc/types.proto
   50 ./types/proto3/block.proto
  535 总用量

加上注释和空白,proto3的源码有500行的规模。这个规模算是已经是不小了,对比一下谷歌公司的数据就知道了。

Google内部有超过40000多个数据结构是通过protobuf来进行的定义

未完待续....

你可能感兴趣的:(Tendermint源码阅读(六))