{"action":"created","issue":{"url":"https://api.github.com/repos/yarpc/yarpc-node/issues/1","labels_url":"https://api.github.com/repos/yarpc/yarpc-node/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/yarpc/yarpc-node/issues/1/comments","events_url":"https://api.github.com/repos/yarpc/yarpc-node/issues/1/events","html_url":"https://github.com/yarpc/yarpc-node/pull/1","id":129050872,"number":1,"title":"Factor out Local, Remote, and Template","user":{"login":"kriskowal","id":60294,"avatar_url":"https://avatars.githubusercontent.com/u/60294?v=3","gravatar_id":"","url":"https://api.github.com/users/kriskowal","html_url":"https://github.com/kriskowal","followers_url":"https://api.github.com/users/kriskowal/followers","following_url":"https://api.github.com/users/kriskowal/following{/other_user}","gists_url":"https://api.github.com/users/kriskowal/gists{/gist_id}","starred_url":"https://api.github.com/users/kriskowal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriskowal/subscriptions","organizations_url":"https://api.github.com/users/kriskowal/orgs","repos_url":"https://api.github.com/users/kriskowal/repos","events_url":"https://api.github.com/users/kriskowal/events{/privacy}","received_events_url":"https://api.github.com/users/kriskowal/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-27T06:50:42Z","updated_at":"2016-01-28T15:23:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/yarpc/yarpc-node/pulls/1","html_url":"https://github.com/yarpc/yarpc-node/pull/1","diff_url":"https://github.com/yarpc/yarpc-node/pull/1.diff","patch_url":"https://github.com/yarpc/yarpc-node/pull/1.patch"},"body":"This request factors the request handler router and request call router into separate modules, both implementing the {call, onResponse} interface. The interface of the RPC instance remains the same, delegating to the underlying {local, remote} handlers: handle forwarding to local.call and call forwarding to remote.call.\r\n\r\nThis also introduces a `template` function that returns a template object, implementing the {call} interface but routing to a specific procedure on an outbound service. This gives us an API cut-point for optimizing the outbound serialization for combinations of transport/encoding in the future.\r\n\r\nI intend to create another commit that moves the logic for serializing and deserializing, using the scheme property of the request context, out of the local/remote call implementations and into the transport layer, so that it can decide whether to use scheme {toBuffer,fromBuffer}, {writeFrom,byteLength,readInto}, or {read/write} directly to a stream. Each of these approaches makes sense performance-wise for different combinations of encoding/transport. Particularly, the {writeFrom,byteLength} combination does not make sense for JSON, since it would duplicate a JSON.stringify call. The {toBuffer,fromBuffer} approach is wasteful for Thrift, generating an unnecessary Buffer allocation. {read,write} makes sense for reading and writing directly to a stream, but not for writing to a transport frame.\r\n\r\nr @yarpc/yarpc @yarpc/node"},"comment":{"url":"https://api.github.com/repos/yarpc/yarpc-node/issues/comments/176234078","html_url":"https://github.com/yarpc/yarpc-node/pull/1#issuecomment-176234078","issue_url":"https://api.github.com/repos/yarpc/yarpc-node/issues/1","id":176234078,"user":{"login":"breerly","id":263587,"avatar_url":"https://avatars.githubusercontent.com/u/263587?v=3","gravatar_id":"","url":"https://api.github.com/users/breerly","html_url":"https://github.com/breerly","followers_url":"https://api.github.com/users/breerly/followers","following_url":"https://api.github.com/users/breerly/following{/other_user}","gists_url":"https://api.github.com/users/breerly/gists{/gist_id}","starred_url":"https://api.github.com/users/breerly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/breerly/subscriptions","organizations_url":"https://api.github.com/users/breerly/orgs","repos_url":"https://api.github.com/users/breerly/repos","events_url":"https://api.github.com/users/breerly/events{/privacy}","received_events_url":"https://api.github.com/users/breerly/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T15:23:22Z","updated_at":"2016-01-28T15:23:22Z","body":"This allows the transport to make decisions based on the scheme? For example, would this allow the TChannel transport to decide not to envelope a Thrift scheme's body?"}}