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 individual workers

The workerStepBarrier type encapsulates the required logic for enabling a worker to enter the barrier for a particular graph execution step and to wait until the master notifies the worker that it can now exit the barrier.

The workerStepBarrier type is defined as follows:

type workerStepBarrier struct {    ctx context.Context    stream *remoteMasterStream    waitCh map[proto.Step_Type]chan *proto.Step}

To understand how these fields are initialized, let's take a look at the constructor for a new barrier instance:

func newWorkerStepBarrier(ctx context.Context, stream *remoteMasterStream) *workerStepBarrier {    waitCh := make(map[proto.Step_Type]chan *proto.Step) for stepType := range proto.Step_Type_name ...
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