You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by cjmay <gi...@git.apache.org> on 2016/01/24 21:15:13 UTC

[GitHub] thrift pull request: THRIFT-2980 Accept external buffer in thrift_...

GitHub user cjmay opened a pull request:

    https://github.com/apache/thrift/pull/821

    THRIFT-2980 Accept external buffer in thrift_memory_buffer constructor

    Here's a pass at letting thrift_memory_buffer take its buffer as a constructor argument:
    
    Add buf (GByteArray pointer) and owner (gboolean) to constructor-only properties.  Create buf (object member) during construction if buf (constructor-only property) is NULL, the default.  Unref buf during finalize if buf is non-NULL and owner is TRUE.
    
    Also change semantics of buf_size slightly: default is now zero, max is G_MAXUINT32, and zero is interpreted as no limit.  (My thrift objects are often very large; setting no limit as the default seems to simplify the usage in my opinion, and I believe raising the maximum is harmless.)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cjmay/thrift THRIFT-2980

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/821.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #821
    
----
commit 939f66c638f68eb811bf22e4cb1a1a13fc2871cd
Author: Chandler May <cj...@gmail.com>
Date:   2016-01-24T03:27:27Z

    THRIFT-2980 Accept external buffer in thrift_memory_buffer constructor

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: THRIFT-2980 Accept external buffer in thrift_...

Posted by cjmay <gi...@git.apache.org>.
Github user cjmay commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/821#discussion_r55930384
  
    --- Diff: lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c ---
    @@ -209,16 +242,39 @@ thrift_memory_buffer_class_init (ThriftMemoryBufferClass *cls)
     
       param_spec = g_param_spec_uint ("buf_size",
                                       "buffer size (construct)",
    -                                  "Set the read buffer size",
    +                                  "Set the read/write buffer size limit"
    +                                  " (0 for unlimited)",
                                       0, /* min */
    --- End diff --
    
    That was my original intent, but now that you mention it I realize there's not actually an improvement over the size type (currently uint32) max.  Fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: THRIFT-2980 Accept external buffer in thrift_...

Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/821#discussion_r55930188
  
    --- Diff: lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c ---
    @@ -209,16 +242,39 @@ thrift_memory_buffer_class_init (ThriftMemoryBufferClass *cls)
     
       param_spec = g_param_spec_uint ("buf_size",
                                       "buffer size (construct)",
    -                                  "Set the read buffer size",
    +                                  "Set the read/write buffer size limit"
    +                                  " (0 for unlimited)",
                                       0, /* min */
    -                                  1048576, /* max, 1024*1024 */
    -                                  512, /* default value */
    +                                  G_MAXUINT32, /* max, 1024*1024 */
    --- End diff --
    
    nit: could you update or remove outdated part of the comment ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: THRIFT-2980 Accept external buffer in thrift_...

Posted by nsuke <gi...@git.apache.org>.
Github user nsuke commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/821#discussion_r55930217
  
    --- Diff: lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c ---
    @@ -209,16 +242,39 @@ thrift_memory_buffer_class_init (ThriftMemoryBufferClass *cls)
     
       param_spec = g_param_spec_uint ("buf_size",
                                       "buffer size (construct)",
    -                                  "Set the read buffer size",
    +                                  "Set the read/write buffer size limit"
    +                                  " (0 for unlimited)",
                                       0, /* min */
    --- End diff --
    
    ` " (0 for unlimited)",  0, /* min */` is confusing. Is the minimum actually unlimited ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: THRIFT-2980 Accept external buffer in thrift_...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/thrift/pull/821


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] thrift pull request: THRIFT-2980 Accept external buffer in thrift_...

Posted by cjmay <gi...@git.apache.org>.
Github user cjmay commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/821#discussion_r55930387
  
    --- Diff: lib/c_glib/src/thrift/c_glib/transport/thrift_memory_buffer.c ---
    @@ -209,16 +242,39 @@ thrift_memory_buffer_class_init (ThriftMemoryBufferClass *cls)
     
       param_spec = g_param_spec_uint ("buf_size",
                                       "buffer size (construct)",
    -                                  "Set the read buffer size",
    +                                  "Set the read/write buffer size limit"
    +                                  " (0 for unlimited)",
                                       0, /* min */
    -                                  1048576, /* max, 1024*1024 */
    -                                  512, /* default value */
    +                                  G_MAXUINT32, /* max, 1024*1024 */
    --- End diff --
    
    Sorry about that, fixed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---