Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

TChannel Node: Implement getThriftCodec on HyperbahnClient #1337

Open
Raynos opened this issue Sep 17, 2015 · 5 comments
Open

TChannel Node: Implement getThriftCodec on HyperbahnClient #1337

Raynos opened this issue Sep 17, 2015 · 5 comments
Labels

Comments

@Raynos
Copy link
Contributor

Raynos commented Sep 17, 2015

var tchannelThrift = hyperbahnClient.getThriftCodec({
    serviceName: 'steve'
    thriftFile: path.join(__dirname, 'thrift', 'steve.thrift'),
    timeout: 500 /* optional better default timeout for steve */
});

The idea is to hide the sub channel behind the thrift codec interface so that people dont have to know about sub channels.

This allows application developers to make requests like:

tchannelThrift.request({
    parent: inReq /* noParent: true */
}).send('Steve::doSomething', null, {
    /* body arguments */
}, function onResponse(err, response) {
    /* handle response */
});
@Raynos
Copy link
Contributor Author

Raynos commented Sep 17, 2015

cc @jcorbin @rf @kriskowal ^

cc @jeloi for the initial idea :)

@jcorbin
Copy link
Contributor

jcorbin commented Sep 17, 2015

sgtm

@rf
Copy link
Contributor

rf commented Sep 17, 2015

I like it, but how about getThriftService? codec is really generic

@kriskowal
Copy link
Contributor

Maybe getThriftChannel. What you’re getting has the shape of a channel. Code/Decode is the same as Read/Write and you’re not getting a ThriftRW.

Is this the best way to hide sub-channels? Should we hide sub-channels? The way to hide sub-channels is to present SubChannel as the Channel constructor folks use, which in turn constructs the topChannel on your behalf.

@Raynos
Copy link
Contributor Author

Raynos commented Sep 18, 2015

This suggestion is not really about "hiding sub channels". The sub channel implementation detail is just hidden from the user with this method.

This method is all about simplifying the step from "I have a hyperbahn client" to "I make a thrift RPC call".

@Raynos Raynos added the node label Sep 22, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants