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

Implementing a step barrier for the master

Now, let's take a look at the other half of the barrier implementation logic that runs on the master node. The masterStepBarrier type, the definition of which is given as follows, is admittedly more interesting as it contains the actual barrier synchronization logic:

type masterStepBarrier struct {    ctx context.Context    numWorkers int    waitCh map[proto.Step_Type]chan *proto.Step    notifyCh map[proto.Step_Type]chan *proto.Step}

One key difference is that the masterStepBarrier type defines two types of channels:

  • Wait channel: It is a channel for which the barrier monitors for incoming Step messages from workers.
  • Notify channel: It is a channel where remote worker streams will block waiting for a Step ...
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