Preference List

As you might read here JustinDB replicates its data on multiple hosts in order to achieve high availability and durability. Each data is replicated at N host (this term is also called Replication Factor). Each key is assigned to a coordinator node (a node handling a read or write operation). The coordinator is in charge of the replication of the data items that fall within its range. In addition to locally storing each key within its range, the coordinator replicates these keys at the N-1 clockwise successor nodes in the Ring.

The list of nodes that is responsible for storing a particular value is called a preference list.

This is the way JustinDB represents preference list from code perspective. 👍

case class PreferenceList(primaryNodeId: NodeId, replicasNodeId: List[NodeId]) {
  def size: Int = all.size
  def all: List[NodeId] = primaryNodeId :: replicasNodeId
}

PrimaryNodeId is an Id of a coordinator node

If you are interested more about code you can start exploring here. 💪