Dmytro Shteflyuk created THRIFT-6150:
----------------------------------------
Summary: Separate Ruby endpoint and layered transport roles
Key: THRIFT-6150
URL: https://issues.apache.org/jira/browse/THRIFT-6150
Project: Thrift
Issue Type: New Feature
Components: Ruby - Library
Reporter: Dmytro Shteflyuk
Assignee: Dmytro Shteflyuk
h3. Problem
The Ruby library represents endpoint transports and transport wrappers with the
same {{Thrift::BaseTransport}} inheritance role. These transport categories
have different responsibilities: endpoint transports perform physical or
in-memory I/O, while layered transports wrap another transport and may buffer,
frame, transform, or otherwise reinterpret its bytes.
Without an explicit distinction, wrapper behavior and delegation are repeated
across transport classes. Cross-layer features such as configuration
propagation and message-size accounting also cannot identify the endpoint
boundary structurally.
The .NET library already models this distinction with {{TEndpointTransport}}
and {{TLayeredTransport}} beneath {{TTransport}}. Endpoint transports own
endpoint state, while layered transports hold and delegate to an underlying
transport.
This issue is related to THRIFT-5938, which introduces the Ruby configuration
API that will use this transport structure.
h3. Client impact
The Ruby hierarchy does not currently communicate whether a transport is an
endpoint or a wrapper. Custom transports and future transport-wide behavior
must infer that distinction from concrete classes or duplicated implementation
details.
The proposed hierarchy change is intended to be behavior-neutral. Existing
transport construction and I/O behavior should remain compatible.
h3. Proposed solution
Introduce public {{Thrift::EndpointTransport}} and {{Thrift::LayeredTransport}}
base classes beneath {{Thrift::BaseTransport}}.
The target client transport hierarchy is:
{noformat}
Thrift::BaseTransport
├── Thrift::EndpointTransport
│ ├── Thrift::MemoryBufferTransport
│ ├── Thrift::IOStreamTransport
│ ├── Thrift::HTTPClientTransport
│ └── Thrift::Socket
│ ├── Thrift::SSLSocket
│ └── Thrift::UNIXSocket
└── Thrift::LayeredTransport
├── Thrift::BufferedTransport
├── Thrift::FramedTransport
└── Thrift::HeaderTransport
{noformat}
The existing server transport hierarchy remains separate and unchanged:
{noformat}
Thrift::BaseServerTransport
├── Thrift::ServerSocket
│ └── Thrift::SSLServerSocket
└── Thrift::UNIXServerSocket
{noformat}
{{LayeredTransport}} should expose its wrapped transport through a public
reader and centralize common lifecycle delegation. This issue should not add
configuration or message-size enforcement; those changes remain independently
reviewable.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)