You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Torben Brodt (JIRA)" <ji...@apache.org> on 2011/03/19 13:38:29 UTC

[jira] Created: (THRIFT-1099) TPhpString: serialization/deserialization from string

TPhpString: serialization/deserialization from string
-----------------------------------------------------

                 Key: THRIFT-1099
                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
             Project: Thrift
          Issue Type: New Feature
          Components: PHP - Library
            Reporter: Torben Brodt


I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...

Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
I added additional getters to easy convert in both directions: from string to instance, from instance to string.
I provided the class as a patch and hope that it will be integrated, see the examples below:

write example:
$vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
$body = TPhpString::getStringFromInstance($vector);
file_put_contents('/tmp/apache', $body);

read example:
$body = file_get_contents('/tmp/apache');
$vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
print_r($vector);

I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1099) TPhpString: serialization/deserialization from string

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

Thomas Kho commented on THRIFT-1099:
------------------------------------

Torben, check out lib/php/src/protocol/TBinarySerializer.php

> TPhpString: serialization/deserialization from string
> -----------------------------------------------------
>
>                 Key: THRIFT-1099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>            Reporter: Torben Brodt
>              Labels: TPhpString, TTransport, php, string
>         Attachments: patch.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...
> Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
> I added additional getters to easy convert in both directions: from string to instance, from instance to string.
> I provided the class as a patch and hope that it will be integrated, see the examples below:
> write example:
> $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
> $body = TPhpString::getStringFromInstance($vector);
> file_put_contents('/tmp/apache', $body);
> read example:
> $body = file_get_contents('/tmp/apache');
> $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
> print_r($vector);
> I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1099) TPhpString: serialization/deserialization from string

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

Torben Brodt commented on THRIFT-1099:
--------------------------------------

JSON is another dataformat. Why should i convert my data in another data format ;)

TPhpString just allows me to write and read the thrift binary data.
I can directly transfer the binary data over network with Flume.
And I don't need to do any conversion.

> TPhpString: serialization/deserialization from string
> -----------------------------------------------------
>
>                 Key: THRIFT-1099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>            Reporter: Torben Brodt
>              Labels: TPhpString, TTransport, php, string
>         Attachments: patch.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...
> Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
> I added additional getters to easy convert in both directions: from string to instance, from instance to string.
> I provided the class as a patch and hope that it will be integrated, see the examples below:
> write example:
> $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
> $body = TPhpString::getStringFromInstance($vector);
> file_put_contents('/tmp/apache', $body);
> read example:
> $body = file_get_contents('/tmp/apache');
> $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
> print_r($vector);
> I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (THRIFT-1099) TPhpString: serialization/deserialization from string

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

Torben Brodt closed THRIFT-1099.
--------------------------------

    Resolution: Invalid
      Assignee: Torben Brodt

Hi Thomas, TBinarySerializer looks like the right place!
I can see some bugs within these lines, i will provide a patch and add a new ticket for it.

My TPhpString should not be included. Ticket closed :)

> TPhpString: serialization/deserialization from string
> -----------------------------------------------------
>
>                 Key: THRIFT-1099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>            Reporter: Torben Brodt
>            Assignee: Torben Brodt
>              Labels: TPhpString, TTransport, php, string
>         Attachments: patch.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...
> Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
> I added additional getters to easy convert in both directions: from string to instance, from instance to string.
> I provided the class as a patch and hope that it will be integrated, see the examples below:
> write example:
> $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
> $body = TPhpString::getStringFromInstance($vector);
> file_put_contents('/tmp/apache', $body);
> read example:
> $body = file_get_contents('/tmp/apache');
> $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
> print_r($vector);
> I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1099) TPhpString: serialization/deserialization from string

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

Rowan Kerr commented on THRIFT-1099:
------------------------------------

Why a new transport instead of implementing TJSONProtocol for PHP?

> TPhpString: serialization/deserialization from string
> -----------------------------------------------------
>
>                 Key: THRIFT-1099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>            Reporter: Torben Brodt
>              Labels: TPhpString, TTransport, php, string
>         Attachments: patch.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...
> Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
> I added additional getters to easy convert in both directions: from string to instance, from instance to string.
> I provided the class as a patch and hope that it will be integrated, see the examples below:
> write example:
> $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
> $body = TPhpString::getStringFromInstance($vector);
> file_put_contents('/tmp/apache', $body);
> read example:
> $body = file_get_contents('/tmp/apache');
> $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
> print_r($vector);
> I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1099) TPhpString: serialization/deserialization from string

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

David Reiss commented on THRIFT-1099:
-------------------------------------

How is this different from TMemoryBuffer?

> TPhpString: serialization/deserialization from string
> -----------------------------------------------------
>
>                 Key: THRIFT-1099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>            Reporter: Torben Brodt
>              Labels: TPhpString, TTransport, php, string
>         Attachments: patch.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...
> Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
> I added additional getters to easy convert in both directions: from string to instance, from instance to string.
> I provided the class as a patch and hope that it will be integrated, see the examples below:
> write example:
> $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
> $body = TPhpString::getStringFromInstance($vector);
> file_put_contents('/tmp/apache', $body);
> read example:
> $body = file_get_contents('/tmp/apache');
> $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
> print_r($vector);
> I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] Updated: (THRIFT-1099) TPhpString: serialization/deserialization from string

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

Torben Brodt updated THRIFT-1099:
---------------------------------

    Attachment: patch.diff

> TPhpString: serialization/deserialization from string
> -----------------------------------------------------
>
>                 Key: THRIFT-1099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>            Reporter: Torben Brodt
>              Labels: TPhpString, TTransport, php, string
>         Attachments: patch.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...
> Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
> I added additional getters to easy convert in both directions: from string to instance, from instance to string.
> I provided the class as a patch and hope that it will be integrated, see the examples below:
> write example:
> $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
> $body = TPhpString::getStringFromInstance($vector);
> file_put_contents('/tmp/apache', $body);
> read example:
> $body = file_get_contents('/tmp/apache');
> $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
> print_r($vector);
> I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1099) TPhpString: serialization/deserialization from string

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

Torben Brodt commented on THRIFT-1099:
--------------------------------------

You are right. I am sorry, when i started with thrift, i didn't get TMemoryBuffer running. Now it works :(

Then my only suggestion would be to add the public static methods for a really conversion between string and object.
Should i patch this in TMemoryBuffer? Or should we leave out these conversion methods from "core" ?

> TPhpString: serialization/deserialization from string
> -----------------------------------------------------
>
>                 Key: THRIFT-1099
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1099
>             Project: Thrift
>          Issue Type: New Feature
>          Components: PHP - Library
>            Reporter: Torben Brodt
>              Labels: TPhpString, TTransport, php, string
>         Attachments: patch.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I want to serialize thrift instances to save them to disk, serialize them in session, transfer them them to elephant bird, ...
> Therefore i build a class named TPhpString which extends TTransport and can be accessed like other TTransports.
> I added additional getters to easy convert in both directions: from string to instance, from instance to string.
> I provided the class as a patch and hope that it will be integrated, see the examples below:
> write example:
> $vector = new VectorSequence(array('query' => 'easy coding thrift server example'));
> $body = TPhpString::getStringFromInstance($vector);
> file_put_contents('/tmp/apache', $body);
> read example:
> $body = file_get_contents('/tmp/apache');
> $vector = TPhpString::getInstanceFromString('VectorSequence', $evt->body);
> print_r($vector);
> I build a tutorial in german about it: http://www.easy-coding.de/wiki/php/thrift-php-server.html

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira