You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Torsten Curdt <tc...@apache.org> on 2008/09/29 14:33:27 UTC
object creations
Hey
I am trying to understand the thrift API here:
final TDeserializer deserializer = new TDeserializer(new
TBinaryProtocol.Factory());
deserializer.deserialize(object, bytes);
It seems like object instantiation is not part of thrift.
Essentially it means that I need to know the object beforehand and do
the creation myself. Also looking at the TStruct implementation I
would expect that to carry the information about the object to create.
But apparently that's a NOP in the current binary protocol.
What am I missing here? How do people here handle different TBase
objects in the same stream?
cheers
--
Torsten
Re: object creations
Posted by Torsten Curdt <tc...@apache.org>.
Thanks for the answer, David
cheers
--
Torsten
On Sep 29, 2008, at 22:26, David Reiss wrote:
> That is correct. The code deserializing an object must know what
> type of object to expect. The only place where we use this type
> of polymorphism at Facebook is in our user actions log, which we
> represent as a sequence of method calls, rather than a sequence
> of structures.
>
> --David
>
> Torsten Curdt wrote:
>> Hey
>>
>> I am trying to understand the thrift API here:
>>
>> final TDeserializer deserializer = new TDeserializer(new
>> TBinaryProtocol.Factory());
>> deserializer.deserialize(object, bytes);
>>
>> It seems like object instantiation is not part of thrift.
>>
>> Essentially it means that I need to know the object beforehand and do
>> the creation myself. Also looking at the TStruct implementation I
>> would expect that to carry the information about the object to
>> create.
>> But apparently that's a NOP in the current binary protocol.
>>
>> What am I missing here? How do people here handle different TBase
>> objects in the same stream?
>>
>> cheers
>> --
>> Torsten
>>
Re: object creations
Posted by David Reiss <dr...@facebook.com>.
That is correct. The code deserializing an object must know what
type of object to expect. The only place where we use this type
of polymorphism at Facebook is in our user actions log, which we
represent as a sequence of method calls, rather than a sequence
of structures.
--David
Torsten Curdt wrote:
> Hey
>
> I am trying to understand the thrift API here:
>
> final TDeserializer deserializer = new TDeserializer(new
> TBinaryProtocol.Factory());
> deserializer.deserialize(object, bytes);
>
> It seems like object instantiation is not part of thrift.
>
> Essentially it means that I need to know the object beforehand and do
> the creation myself. Also looking at the TStruct implementation I
> would expect that to carry the information about the object to create.
> But apparently that's a NOP in the current binary protocol.
>
> What am I missing here? How do people here handle different TBase
> objects in the same stream?
>
> cheers
> --
> Torsten
>