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

Defining the Vertex and Edge types

The Vertex type encapsulates the state of each vertex that is part of a Graph instance:

type Vertex struct {
    id       string
    value    interface{}
    active   bool
    msgQueue [2]message.Queue
    edges    []*Edge
}

An interesting tidbit about the Vertex type definition is that we actually need to maintain two message.Queue instances. Any messages produced by compute function invocations while executing a super-step must be buffered so that they can be delivered to the intended recipient in the following super-step. To this end, our implementation will employ a double-buffering scheme. We will use one queue to hold the messages for the current super-step and another queue to buffer the messages for the next super-step. At the end ...

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