Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Remote master stream

Next, we will move to the worker side and examine the equivalent stream helper for handling a connection to the master node. The definition of the remoteMasterStream type is pretty much the same as remoteWorkerStream, given as follows:

type remoteMasterStream struct {    stream proto.JobQueue_JobStreamClient    recvMsgCh chan *proto.MasterPayload    sendMsgCh chan *proto.WorkerPayload    ctx context.Context    cancelFn func()    mu sync.Mutex    onDisconnectFn func()    disconnected bool}

Once the worker connects to the master node and receives a job assignment, it will invoke the newRemoteMasterStream function to wrap the obtained stream connection with a remoteMasterStream instance:

func newRemoteMasterStream(stream proto.JobQueue_JobStreamClient) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content