2017-10-07 129 views
0

我计划使用Apache Thrift来监视对本地更改的任何更改并将该数据推送到客户端(更改后的数据)。apache节俭监视器hdfs文件

当我检查了勤俭节约的文档林看到多个传输层,但不明白我应该使用哪一个传输层

http://thrift-tutorial.readthedocs.io/en/latest/thrift-stack.html

Tranport Layer 
The transport layer is responsible for reading from and writing to the wire. Thrift supports the following: 

TSocket - Uses blocking socket I/O for transport. 
TFramedTransport - Sends data in frames, where each frame is preceded by a length. This transport is required when using a non-blocking server. 
TFileTransport - This transport writes to a file. While this transport is not included with the Java implementation, it should be simple enough to implement. 
TMemoryTransport - Uses memory for I/O. The Java implementation uses a simple ByteArrayOutputStream internally. 
TZlibTransport - Performs compression using zlib. Used in conjunction with another transport. Not available in the Java implementation. 

回答

0

有两种传输方式:

  • 终点运输
  • 分层运输

前者是您需要(其中之一)来写入和读取数据的线路。例如,这可能是一个TSocket。

后者用于另外,在某些情况下,它们甚至组合。例如,TFramedTransport为数据添加一个特殊层,以使内存分配和I/O更高效。 zlib传输可用于压缩数据。

一个例子是:

+------------------------------------+ 
| Application code     | 
+------------------------------------+ 
| TBinaryProtocol     | 
+------------------------------------+ 
| TZLibTransport     | 
+------------------------------------+ 
| TFramedTransport     | 
+------------------------------------+ 
| TSocket transport     | 
+------------------------------------+ 

另外一个没有分层传输的所有:

+------------------------------------+ 
| Application code     | 
+------------------------------------+ 
| TBinaryProtocol     | 
+------------------------------------+ 
| TSocket transport     | 
+------------------------------------+ 

PS:你挂的不是官方文件,这是由一些三阶成立第三方人员和Apache Thrift项目对该网站的质量没有影响。

强烈推荐the forthcoming Manning book from Randy Abernethy。他是节俭承诺者,书中提供了宝贵的见解。不,我没有得到任何推荐它的东西。

+0

这本书会带来很大的变化,非常感谢。 – user1050619

+0

你可以把我推荐给官方文档吗?我是 – user1050619

+0

http://thrift.apache.org – JensG