You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Roger Meier (JIRA)" <ji...@apache.org> on 2010/07/14 00:34:50 UTC

[jira] Created: (THRIFT-819) add Enumeration for protocol, transport and server types

add Enumeration for protocol, transport and server types
--------------------------------------------------------

                 Key: THRIFT-819
                 URL: https://issues.apache.org/jira/browse/THRIFT-819
             Project: Thrift
          Issue Type: Improvement
          Components: Library (C++)
            Reporter: Roger Meier
         Attachments: THRIFT-819.patch

I would like to have Enumeration's for protocol, transport and server types.

I'm doing some testing stuff, and using types for the different parameter's would make it much more comfortable to work with, e.g.

{code}
  // Dispatcher
  shared_ptr<TProtocolFactory> protocolFactory;
  if (protocol_type == PROTOCOL_JSON) {
    shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
    protocolFactory = jsonProtocolFactory;
  } else
  {
    shared_ptr<TProtocolFactory> binaryProtocolFactory(new TBinaryProtocolFactory());
    protocolFactory = binaryProtocolFactory;
  }

{code}

aligning these enums across all languages might be another benefit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-819) add Enumeration for protocol, transport and server types

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier updated THRIFT-819:
-------------------------------

    Attachment: THRIFT-819.patch

> add Enumeration for protocol, transport and server types
> --------------------------------------------------------
>
>                 Key: THRIFT-819
>                 URL: https://issues.apache.org/jira/browse/THRIFT-819
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Library (C++)
>            Reporter: Roger Meier
>         Attachments: THRIFT-819.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I would like to have Enumeration's for protocol, transport and server types.
> I'm doing some testing stuff, and using types for the different parameter's would make it much more comfortable to work with, e.g.
> {code}
>   // Dispatcher
>   shared_ptr<TProtocolFactory> protocolFactory;
>   if (protocol_type == PROTOCOL_JSON) {
>     shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
>     protocolFactory = jsonProtocolFactory;
>   } else
>   {
>     shared_ptr<TProtocolFactory> binaryProtocolFactory(new TBinaryProtocolFactory());
>     protocolFactory = binaryProtocolFactory;
>   }
> {code}
> aligning these enums across all languages might be another benefit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (THRIFT-819) add Enumeration for protocol, transport and server types

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier updated THRIFT-819:
-------------------------------

    Priority: Minor  (was: Major)

> add Enumeration for protocol, transport and server types
> --------------------------------------------------------
>
>                 Key: THRIFT-819
>                 URL: https://issues.apache.org/jira/browse/THRIFT-819
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Library (C++)
>            Reporter: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-819.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I would like to have Enumeration's for protocol, transport and server types.
> I'm doing some testing stuff, and using types for the different parameter's would make it much more comfortable to work with, e.g.
> {code}
>   // Dispatcher
>   shared_ptr<TProtocolFactory> protocolFactory;
>   if (protocol_type == PROTOCOL_JSON) {
>     shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
>     protocolFactory = jsonProtocolFactory;
>   } else
>   {
>     shared_ptr<TProtocolFactory> binaryProtocolFactory(new TBinaryProtocolFactory());
>     protocolFactory = binaryProtocolFactory;
>   }
> {code}
> aligning these enums across all languages might be another benefit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-819) add Enumeration for protocol, transport and server types

Posted by "Mark Slee (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898393#action_12898393 ] 

Mark Slee commented on THRIFT-819:
----------------------------------

I tend to agree with David here. One of the main ideas in Thrift is that the transports/protocols are just interfaces, and there may be any number of implementations of them, people can write whatever types they want, etc.

Rather than statically defining the available types as constants, maybe there'd be some value in having something like a TProtocolRegistry or TTransportRegistry. When a protocol or transport is defined/declared, it could statically register itself with one of these Registries with some kind of unique identifier.

This would enable iteration over the available types, or symbolic access to a type (via whatever unique key it uses, probably just strings?)

> add Enumeration for protocol, transport and server types
> --------------------------------------------------------
>
>                 Key: THRIFT-819
>                 URL: https://issues.apache.org/jira/browse/THRIFT-819
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Library (C++)
>            Reporter: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-819.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I would like to have Enumeration's for protocol, transport and server types.
> I'm doing some testing stuff, and using types for the different parameter's would make it much more comfortable to work with, e.g.
> {code}
>   // Dispatcher
>   shared_ptr<TProtocolFactory> protocolFactory;
>   if (protocol_type == PROTOCOL_JSON) {
>     shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
>     protocolFactory = jsonProtocolFactory;
>   } else
>   {
>     shared_ptr<TProtocolFactory> binaryProtocolFactory(new TBinaryProtocolFactory());
>     protocolFactory = binaryProtocolFactory;
>   }
> {code}
> aligning these enums across all languages might be another benefit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (THRIFT-819) add Enumeration for protocol, transport and server types

Posted by "David Reiss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898383#action_12898383 ] 

David Reiss commented on THRIFT-819:
------------------------------------

I think it wold be better to just put these enums in your test code.  It is possible (easy, in fact) to have protocol, transport, and server types defined outside of Thrift, so trying to catalogue them all within Thrift would be an uphill battle.  Synchronizing between languages is also tricky because not all types exist in all languages.  For example, Erlang has no nonblocking server because blocking I/O is implemented efficiently in Erlang.  It does, however, have a disklog transport that uses a format provided by the Erlang standard library.  Java has no buffered transport because it is preferable to just wrap a buffered stream around a socket.

> add Enumeration for protocol, transport and server types
> --------------------------------------------------------
>
>                 Key: THRIFT-819
>                 URL: https://issues.apache.org/jira/browse/THRIFT-819
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Library (C++)
>            Reporter: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-819.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I would like to have Enumeration's for protocol, transport and server types.
> I'm doing some testing stuff, and using types for the different parameter's would make it much more comfortable to work with, e.g.
> {code}
>   // Dispatcher
>   shared_ptr<TProtocolFactory> protocolFactory;
>   if (protocol_type == PROTOCOL_JSON) {
>     shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
>     protocolFactory = jsonProtocolFactory;
>   } else
>   {
>     shared_ptr<TProtocolFactory> binaryProtocolFactory(new TBinaryProtocolFactory());
>     protocolFactory = binaryProtocolFactory;
>   }
> {code}
> aligning these enums across all languages might be another benefit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (THRIFT-819) add Enumeration for protocol, transport and server types

Posted by "Roger Meier (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roger Meier closed THRIFT-819.
------------------------------

    Resolution: Not A Problem

I agree, it isn't realistic to align such enumerations across all languages.

The proposed registry approach seems to be a good way to go.

> add Enumeration for protocol, transport and server types
> --------------------------------------------------------
>
>                 Key: THRIFT-819
>                 URL: https://issues.apache.org/jira/browse/THRIFT-819
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Library (C++)
>            Reporter: Roger Meier
>            Priority: Minor
>         Attachments: THRIFT-819.patch
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> I would like to have Enumeration's for protocol, transport and server types.
> I'm doing some testing stuff, and using types for the different parameter's would make it much more comfortable to work with, e.g.
> {code}
>   // Dispatcher
>   shared_ptr<TProtocolFactory> protocolFactory;
>   if (protocol_type == PROTOCOL_JSON) {
>     shared_ptr<TProtocolFactory> jsonProtocolFactory(new TJSONProtocolFactory());
>     protocolFactory = jsonProtocolFactory;
>   } else
>   {
>     shared_ptr<TProtocolFactory> binaryProtocolFactory(new TBinaryProtocolFactory());
>     protocolFactory = binaryProtocolFactory;
>   }
> {code}
> aligning these enums across all languages might be another benefit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.