thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Moreno <jwellington.mor...@gmail.com>
Subject Re: Data migration in Thrift / Possibilty to create message dynamically at runtime?
Date Mon, 09 Jun 2014 16:41:51 GMT
Have you considered having the structure contain a Map<String,SomeObject>
to achieve what you'd like? This way you can rely on Thrift for
serialization and RPC but still be able to interpret and compose the
dynamic structure at runtime,

Kind Regards,
Juan Wellington Moreno
*Software Engineer*
*Somewhere or Another*


On Tue, Jun 3, 2014 at 7:18 AM, Nevo Hed <nhed+thriftusr@aereo.com> wrote:

> Yes Klaus, it does contradict.  Jen's answer is consistent with the current
> design in large of thrift
>
> Look for the method "struct_fields", it is used when parsing the type
>
> My hack (just about over 200 lines of ruby) involves monkey-patching that,
> as well as read, write, handle_message as well as other methods to support
> on-the-fly addition of fields (I name them __annon_fld_XX, where XX is the
> field ID)
>
> I think that is as much as I can say without getting further clearance.  I
> have been trying to get said clearance but the forces that be are a bit
> tied up at the moment.
>
>
> This is ruby only
> I know its not available for the C++, Java side, I have never really looked
> at any of the other languages, but suspect that something similar may be
> possible in Python as well (*religious-indoctrination-on* but if you know
> this is doable in Ruby why would you ever touch Python?
> *religious-indoctrination-off*)
>
>
> On Tue, Jun 3, 2014 at 3:15 AM, Klaus Kraft <kl.kraft85@gmail.com> wrote:
>
> > Hi Nevo,
> >
> > your answer somehow seems to contradict the answer from Jens - or am I
> > mistaken? If you are allowed to do some, can you elaborate on this more
> > concretely please? So far I could not see any possibility to use
> reflection
> > mechanisms of Thrift. As I already wrote in my initial post, I did
> > something like this for Protobuf to create dynamic messages at runtime.
> >
> > Greetings
> > Klaus
> >
> >
> > 2014-05-30 20:02 GMT+02:00 Nevo Hed <nhed+thriftusr@aereo.com>:
> >
> > > You could do something with reflection ... I have played with (by
> > > monkey-patching in ruby) deserializing fields in structs that I didn't
> > know
> > > about and then re-serializing it.  I do not at this time have
> > authorization
> > > to share this, but it is doable.
> > >
> > >
> > > On Sat, May 24, 2014 at 11:49 AM, Klaus Kraft <kl.kraft85@gmail.com>
> > > wrote:
> > >
> > > > Hi all,
> > > >
> > > > so far I gained some experiences with Apache Avro and Google
> ProtoBuf.
> > > Now
> > > > I wanted to play around with Thrift a bit.
> > > > One of the thrings I'm mainly interested in is data migration. Lets
> > say I
> > > > have defined certain structs.
> > > > I know that thrift can deal with additions, deletions and renamings.
> > > >
> > > > But can I also deal with more complex migration scenarios, e.g.,
> when I
> > > > move a field of a struct
> > > > into another struct? Or splitting a field of a struct into two fields
> > (of
> > > > the same struct)?
> > > > The crucial point here is to be able to write migration classes or so
> > > which
> > > > prevent me from
> > > > loosing data.
> > > >
> > > > In ProtoBuf, I could write a message dynamically. This allowed me to
> > > create
> > > > a message with
> > > > certain content at runtime. This was based on some reflection
> > mechanisms.
> > > > Is something like this
> > > > also possible in Thrift? Can I write a message dynamically at runtime
> > > > without using the
> > > > classes generated out of the .thrift file?
> > > >
> > > > Thanks in advance.
> > > >
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message