2017-10-07 117 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