January 2020
Intermediate to advanced
640 pages
16h 56m
English
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 ...