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

Relaying messages between workers

For the master to be able to relay messages between workers, it needs to be able to efficiently answer the following question: "given a destination ID, which partition does it belong to?"

This certainly sounds like a query that the Range type should be able to answer! To jog your memory, this is what the Range type definition from Chapter 10, Building, Packaging, and Deploying Software, looks like:

type Range struct {
    start       uuid.UUID
    rangeSplits []uuid.UUID
}

The start field keeps track of the range's start UUID while rangeSplits[p] tracks the end UUID value for the pth partition. Therefore, the UUID range for a partition p can be calculated as follows:

Before we examine how the UUID-to-partition number ...

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