[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16097390#comment-16097390
 ] 

ASF GitHub Bot commented on THRIFT-4236:


Github user asfgit closed the pull request at:

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


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16094403#comment-16094403
 ] 

ASF GitHub Bot commented on THRIFT-4236:


GitHub user taozle reopened a pull request:

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

Use build tags to support context.

As the comment in https://issues.apache.org/jira/browse/THRIFT-4236, this 
PR use build tags to support context in go1.7 above.

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

$ git pull https://github.com/taozle/thrift context

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

https://github.com/apache/thrift/pull/1309.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 #1309


commit 0df5965eb2a35793f19de1b2696e3c4afb6b5132
Author: taozle 
Date:   2017-07-17T16:40:42Z

Use build tags to support context.

commit e610d07370f55314fa674810cee4574006a15238
Author: taozle 
Date:   2017-07-19T15:47:35Z

Use x/net/context to support go<1.7.

commit 3d4eb9a967317cca7ea6f9e668e80fd06e0651ac
Author: taozle 
Date:   2017-07-19T16:13:59Z

Add legacy_context in go generator.

commit fdee27a80401107fc96c7aee7c2f8e14adaa425a
Author: taozle 
Date:   2017-07-19T16:37:29Z

Fix go test dependency.

commit 88d2fc00c2d8c0a3b6f48fbfea42b02fb7c6080c
Author: taozle 
Date:   2017-07-19T17:13:39Z

Fix GOPATH not set.

commit 8d052a6a97b295021277da29dbc87cf73deb3009
Author: taozle 
Date:   2017-07-20T02:51:11Z

Get x/net/context in lib/go.

commit acf418d6f6c0c75afd8ddaa6263f30e1987a6bfc
Author: taozle 
Date:   2017-07-20T06:13:26Z

Fix go tests.

commit 6451d1419747fb5bc011391872d1afdb6d1f3b1e
Author: taozle 
Date:   2017-07-20T08:39:36Z

Fix go tests in /lib/go/test/tests.




> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-20 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16094402#comment-16094402
 ] 

ASF GitHub Bot commented on THRIFT-4236:


Github user taozle closed the pull request at:

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


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-17 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16090063#comment-16090063
 ] 

ASF GitHub Bot commented on THRIFT-4236:


GitHub user taozle opened a pull request:

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

Use build tags to support context.

As the comment in https://issues.apache.org/jira/browse/THRIFT-4236, this 
PR use build tags to support context in go1.7 above.

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

$ git pull https://github.com/taozle/thrift context

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

https://github.com/apache/thrift/pull/1309.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 #1309


commit 0df5965eb2a35793f19de1b2696e3c4afb6b5132
Author: taozle 
Date:   2017-07-17T16:40:42Z

Use build tags to support context.




> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-12 Thread taozle (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16084196#comment-16084196
 ] 

taozle commented on THRIFT-4236:


Maybe i can work on this this weekend or next week if it was not too late, and 
when will the 0.11 be released? i really hope this feature will be released 
with 0.11

> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-12 Thread Jens Geyer (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16084085#comment-16084085
 ] 

Jens Geyer commented on THRIFT-4236:


We have more than once decided to focus on newer versions, so I did the same 
here. of course that's not to say that we should break compatibilty 
intentionally if there is a better way to do it, and sometimes we also decided 
pro compatibility, whatever makes the most sense. I'd still not call it a 
mistake, you are always free to use older Thrift versions if you need to 
support older target language versions.

So if you have a better idea, please do!




> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-12 Thread Can Celasun (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16084098#comment-16084098
 ] 

Can Celasun commented on THRIFT-4236:
-

{quote}So if you have a better idea, please do!{quote}

I _could_ work on adding building tags around go1.7, but it would depend on the 
release date for 0.11. If it's too close, I might not have time to do it before 
that.

> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-11 Thread Can Celasun (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16083445#comment-16083445
 ] 

Can Celasun commented on THRIFT-4236:
-

I realize I'm a bit late to notice this PR since it's already merged, but I 
think introducing a hard dependency on Go 1.7+ is the wrong way to go about 
this, and so is making it default.

The correct way of handling these situations is to use [build 
tags|https://golang.org/pkg/go/build/#hdr-Build_Constraints]. So, any file that 
uses "context" directly should have a "go1.7" build tag and a "_go17" suffix in 
the filename. The default file should either not import context at all, or do 
so using "golang.org/x/net/context".

I believe it would be a mistake to release 0.11 without the above changes, so 
it should either be fixed before then or just reverted for 0.11.

[~taozle] [~jensg] thoughts?

> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-02 Thread taozle (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16071878#comment-16071878
 ] 

taozle commented on THRIFT-4236:


Awesome! I am considering making this the default behavior in 1.0, any advise? 
if this make sense, should i work for it now or after 0.11.0 released?

> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>Assignee: taozle
> Fix For: 0.11.0
>
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16071294#comment-16071294
 ] 

ASF GitHub Bot commented on THRIFT-4236:


Github user asfgit closed the pull request at:

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


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-07-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16071260#comment-16071260
 ] 

ASF GitHub Bot commented on THRIFT-4236:


Github user Jens-G commented on the issue:

https://github.com/apache/thrift/pull/1298
  
I look at it.


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16070292#comment-16070292
 ] 

ASF GitHub Bot commented on THRIFT-4236:


GitHub user taozle reopened a pull request:

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

THRIFT-4236: Add context support for go server.

This commit add the context support for thrift server side in go.
for compatibility, added a use_context option in go's generator option
to tell compiler whether generated code should support context.
Added TProcessor2, TProcessorFactory2, TServer2, TMultiplexedProcessor2
to support ctx as first param.

See: https://issues.apache.org/jira/browse/THRIFT-4236

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

$ git pull https://github.com/taozle/thrift context

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

https://github.com/apache/thrift/pull/1298.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 #1298


commit 9e0591ec03a3a90e9b6a202da47d4edb38fbed30
Author: taozle 
Date:   2017-06-27T10:27:40Z

THRIFT-4236: Add context support for go server.

This commit add the context support for thrift server side in go.
for compatibility, added a use_context option in go's generator option
to tell compiler whether generated code should support context.
Added TProcessor2, TProcessorFactory2, TServer2, TMultiplexedProcessor2
to support ctx as first param.

commit a42ad13cf265b0d7ccd26ef65bf923fea1b4268f
Author: taozle 
Date:   2017-06-27T16:12:48Z

use golang.org/x/net/context for compatibility.

commit e79e6178a8eea2e8ce6368294238af6f3a8a641c
Author: taozle 
Date:   2017-06-29T03:33:31Z

use official context.

this feature requires golang >=1.7.

commit 61e24e6fe7efab36c032f149151648336edc9967
Author: taozle 
Date:   2017-06-30T11:23:36Z

check go version >= 1.7.




> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-30 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16070291#comment-16070291
 ] 

ASF GitHub Bot commented on THRIFT-4236:


Github user taozle closed the pull request at:

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


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-30 Thread taozle (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16069956#comment-16069956
 ] 

taozle commented on THRIFT-4236:


{quote}Could you adjust the build scripts version checks accordingly?{quote}
Updated.

> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-29 Thread Jens Geyer (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16067982#comment-16067982
 ] 

Jens Geyer commented on THRIFT-4236:


{quote}
 or should we just simple require go >= 1.7?
{quote}

I think that should be ok.


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-27 Thread taozle (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16065827#comment-16065827
 ] 

taozle commented on THRIFT-4236:


Hi, [~jensg], I fired a pull request for adding context support in thrift 
golang server side but it failed tests due to the lack of thirdparty dependency 
{{golang.org/x/net/context}}, is thirdparty package not allowed in thrift-go? 
or should we just simple require go >= 1.7?

> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16064944#comment-16064944
 ] 

ASF GitHub Bot commented on THRIFT-4236:


GitHub user taozle reopened a pull request:

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

THRIFT-4236: Add context support for go server.

This commit add the context support for thrift server side in go.
for compatibility, added a use_context option in go's generator option
to tell compiler whether generated code should support context.
Added TProcessor2, TProcessorFactory2, TServer2, TMultiplexedProcessor2
to support ctx as first param.

See: https://issues.apache.org/jira/browse/THRIFT-4236

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

$ git pull https://github.com/taozle/thrift context

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

https://github.com/apache/thrift/pull/1298.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 #1298


commit 9e0591ec03a3a90e9b6a202da47d4edb38fbed30
Author: taozle 
Date:   2017-06-27T10:27:40Z

THRIFT-4236: Add context support for go server.

This commit add the context support for thrift server side in go.
for compatibility, added a use_context option in go's generator option
to tell compiler whether generated code should support context.
Added TProcessor2, TProcessorFactory2, TServer2, TMultiplexedProcessor2
to support ctx as first param.




> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16064943#comment-16064943
 ] 

ASF GitHub Bot commented on THRIFT-4236:


Github user taozle closed the pull request at:

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


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16064407#comment-16064407
 ] 

ASF GitHub Bot commented on THRIFT-4236:


GitHub user taozle opened a pull request:

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

THRIFT-4236: Add context support for go server.

This commit add the context support for thrift server side in go.
for compatibility, added a use_context option in go's generator option
to tell compiler whether generated code should support context.
Added TProcessor2, TProcessorFactory2, TServer2, TMultiplexedProcessor2
to support ctx as first param.

See: https://issues.apache.org/jira/browse/THRIFT-4236

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

$ git pull https://github.com/taozle/thrift context

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

https://github.com/apache/thrift/pull/1298.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 #1298


commit cf9cdd53a26c71547998714459e1eb89e17476c9
Author: taozle 
Date:   2017-06-27T05:46:53Z

THRIFT-4236: Add context support for go server.

This commit add the context support for thrift server side in go.
for compatibility, added a use_context option in go's generator option
to tell compiler whether generated code should support context.
Added TProcessor2, TProcessorFactory2, TServer2, TMultiplexedProcessor2
to support ctx as first param.




> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-26 Thread Jens Geyer (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16063806#comment-16063806
 ] 

Jens Geyer commented on THRIFT-4236:


{quote}
> other framework like grpc will pass a context for the first param, so the 
> expected output for above definition may looks like:
{quote}

Not yet. However, Thift is Open Source, which means it lives by contributions 
from its users. Hence, if you feel like [contributing some add-on functionally 
to the Thrift Go lib, we appreciate your pull 
request|https://thrift.apache.org/docs/HowToContribute]. 


> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-26 Thread taozle (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16062841#comment-16062841
 ] 

taozle commented on THRIFT-4236:


I don't think the {{THeaderTransport}} is what i want.

The {{context}} that i mentioned above is the library {{context}} officially 
accepted in go1.7 which previously located at {{golang.org/x/net/context}}.
Currently, the thrift definition:
{code:java}
service HelloService {
string ping()
}
{code}
will generate code like this:
{code:java}
type HelloService interface {
  Ping() (r string, err error)
}
{code}
other framework like grpc will pass a {{context}} for the first param, so the 
expected output for above definition may looks like:
{code:java}
type HelloService interface {
  Ping(ctx Context) (r string, err error)
}
{code}
Adding the {{context}} we can return immediately if current request is already 
expired:
{code:java}
func (h *HelloHandler) Ping(ctx Context) {
f, cancer := CreateLongTask()
rv = make(chan string)
go f(rv) // long task

select {
case <-ctx.Done():
cancer()
return // Timeout!
case <-rv:
// Another heavy work.
}
}
{code}
or carry extra info like zipkin span for framework level usage.

> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (THRIFT-4236) Support context in go generated code.

2017-06-26 Thread Jens Geyer (JIRA)

[ 
https://issues.apache.org/jira/browse/THRIFT-4236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16062790#comment-16062790
 ] 

Jens Geyer commented on THRIFT-4236:


There is {{THeaderTransport}}, currently only implemented for C++. 

If you want to [contribute a functionally identical version for the Go lib, 
please do|https://thrift.apache.org/docs/HowToContribute]. 
If that is not what you mean by "context", please explain.




> Support context in go generated code.
> -
>
> Key: THRIFT-4236
> URL: https://issues.apache.org/jira/browse/THRIFT-4236
> Project: Thrift
>  Issue Type: Improvement
>  Components: Go - Compiler, Go - Library
>Reporter: taozle
>
> Since context is widely used in go's community, and there is lots of 
> advantage to use context such as control timeout, carry extra info in one 
> request etc, so is there any plan for this? i just searched the issues but 
> didn't find anything about this.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)