Last active
July 7, 2022 23:58
-
-
Save pravinchandar/296e17e036b3a5c118288f4c971ee341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Evaluate is an RPC proxy. It proxies the request to the main process and | |
| // writes the response to o. | |
| func (j JqServer) Evaluate(i *SomeInput, o *SomeOutput) error { | |
| // setup the conduit | |
| reqChan := make(chan RequestResponse) | |
| req := RequestResponse{Req: i} | |
| // send the request to the main process | |
| j.process.ReqRespChan <- reqChan | |
| reqChan <- req | |
| // receive response from the main process | |
| if res := <-reqChan; res.Error != nil { | |
| return res.Error | |
| } | |
| o = res.Response | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment