Reputation: 55
I thought the reason for dividing the transport layer of Apache Thrift is because the low-level transport just uses/wrap some basic Java function like socket. And the transport wrapper is only preparing the data for example with zlib-transport or framed-transport and use some other transport to send it to the network. But the HttpClient is also a transport wrapper and didn´t use another transport for sending.
So what is the reason that Apache Thrift divided the transport layer into low-level transport and transport wrapper?
Source: https://thrift.apache.org/docs/Languages
Upvotes: 1
Views: 302
Reputation: 13411
In recent years, the terms "layered transport" and "endpoint transport" have been coined for these, and they describe it fairly well.
The idea is that
you always need an (endpoint) transport to write/read the data from/off the wire or whatever the physical equivalent of it might be.
you may want to add additional layers of capabilities on top of the endpoint transport, such as compressing data, optimizing transport via buffers or "framed" transport, adding encryption or whatever else comes to mind.
While part 1 is mandatory, the second part is not. Furthermore, you may stack more than one layered transport on top of each other:
Among some other goals, Thrift is designed to offer great flexibility and modularity, essentially getting flexibility by means of modularity. When you look at the core base of what a TTransport/TServerTransport or a TProtocol is, you will find that it is not really a large amount of code that one needs to implement when a customized transport or protocol is needed.
And since things like encryption or buffering have no hard dependencies to any transport or protocol being used, it is just natural to keep them independent by design. That is what makes the Thrift protocol/transport stack easy to use and easy to extend. It lets you build great apps without getting in the way.
PS: A better read might be: https://thrift.apache.org/docs/concepts
Upvotes: 1