You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Chandranshu ." <ch...@gmail.com> on 2008/12/07 20:37:46 UTC

Patch for Ruby

Hi,

I was working to get another facebook framework named Scribe to work
with Ruby. As it uses Thrift, I had to set it up. I'm not aware of the
procedure of creating issues and submitting patches. So, I'm putting
the code here itself.

The sample code for Scribe used TBinaryProtocol in Python whose
equivalent is Thrift::BinaryProtocol in Ruby. The method
read_message_begin is quite old as compared to its python counterpart.
I have changed it to be similar to the Python version as listed below.
Please note that this code does not check for a strict read condition
that was used by Python to restrict the actions in the else clause.

def read_message_begin
   version = read_i32
   if(version <0)
     if (version & VERSION_MASK != VERSION_1)
       raise ProtocolException.new(ProtocolException::BAD_VERSION,
'Missing version identifier')
    end
    type = version & 0×000000ff
    name = read_string
    seqid = read_i32
  else
    name = trans.readAll(version)
    type = read_byte
    seqid = read_i32
  end
  [name, type, seqid]
end

Please review and commit it to the codebase.

Regards
Chandranshu

Re: Patch for Ruby

Posted by "Chandranshu ." <ch...@gmail.com>.
Hi Kevin,

I created the issue at https://issues.apache.org/jira/browse/THRIFT-228.
However, I did not find any place to check the box giving rights to ASF.
Could you please bear with me and point out where to find that.

Thanks in advance,
Chandranshu


On Mon, Dec 8, 2008 at 1:15 AM, Kevin Clark <ke...@gmail.com> wrote:
>
> Hi Chandranshu,
> Would you mind posting this to
> https://issues.apache.org/jira/browse/THRIFT ? You may need to create
> an account in JIRA. It's the standard way of accepting patches, and it
> lets you check the box giving rights to the ASF, which we need in
> order to push. We can discuss your patch there.
>
> Thanks!
>
>
> On Sun, Dec 7, 2008 at 11:37 AM, Chandranshu . <ch...@gmail.com>
wrote:
> > Hi,
> >
> > I was working to get another facebook framework named Scribe to work
> > with Ruby. As it uses Thrift, I had to set it up. I'm not aware of the
> > procedure of creating issues and submitting patches. So, I'm putting
> > the code here itself.
> >
> > The sample code for Scribe used TBinaryProtocol in Python whose
> > equivalent is Thrift::BinaryProtocol in Ruby. The method
> > read_message_begin is quite old as compared to its python counterpart.
> > I have changed it to be similar to the Python version as listed below.
> > Please note that this code does not check for a strict read condition
> > that was used by Python to restrict the actions in the else clause.
> >
> > def read_message_begin
> >   version = read_i32
> >   if(version <0)
> >     if (version & VERSION_MASK != VERSION_1)
> >       raise ProtocolException.new(ProtocolException::BAD_VERSION,
> > 'Missing version identifier')
> >    end
> >    type = version & 0×000000ff
> >    name = read_string
> >    seqid = read_i32
> >  else
> >    name = trans.readAll(version)
> >    type = read_byte
> >    seqid = read_i32
> >  end
> >  [name, type, seqid]
> > end
> >
> > Please review and commit it to the codebase.
> >
> > Regards
> > Chandranshu
> >
>
>
>
> --
> Kevin Clark
> http://glu.ttono.us

Re: Patch for Ruby

Posted by Kevin Clark <ke...@gmail.com>.
Hi Chandranshu,
Would you mind posting this to
https://issues.apache.org/jira/browse/THRIFT ? You may need to create
an account in JIRA. It's the standard way of accepting patches, and it
lets you check the box giving rights to the ASF, which we need in
order to push. We can discuss your patch there.

Thanks!


On Sun, Dec 7, 2008 at 11:37 AM, Chandranshu . <ch...@gmail.com> wrote:
> Hi,
>
> I was working to get another facebook framework named Scribe to work
> with Ruby. As it uses Thrift, I had to set it up. I'm not aware of the
> procedure of creating issues and submitting patches. So, I'm putting
> the code here itself.
>
> The sample code for Scribe used TBinaryProtocol in Python whose
> equivalent is Thrift::BinaryProtocol in Ruby. The method
> read_message_begin is quite old as compared to its python counterpart.
> I have changed it to be similar to the Python version as listed below.
> Please note that this code does not check for a strict read condition
> that was used by Python to restrict the actions in the else clause.
>
> def read_message_begin
>   version = read_i32
>   if(version <0)
>     if (version & VERSION_MASK != VERSION_1)
>       raise ProtocolException.new(ProtocolException::BAD_VERSION,
> 'Missing version identifier')
>    end
>    type = version & 0×000000ff
>    name = read_string
>    seqid = read_i32
>  else
>    name = trans.readAll(version)
>    type = read_byte
>    seqid = read_i32
>  end
>  [name, type, seqid]
> end
>
> Please review and commit it to the codebase.
>
> Regards
> Chandranshu
>



-- 
Kevin Clark
http://glu.ttono.us