Gossip Digest Merge

easy · distributed-systems, membership, gossip

Gossip Digest Merge

Two nodes exchange digests: per-node version counters indicating the latest updates seen. Given local and remote digests, decide:

  • Which nodes the local node should send updates for (local is ahead).
  • Which nodes the local node should request updates for (remote is ahead).

For each index i:

  • if local[i] > remote[i] -> send update for i
  • if local[i] < remote[i] -> request update for i
  • equal -> no action

Return two slices of indices in ascending order.

Function signature

func GossipDigestDelta(local, remote []int) (send []int, request []int)

Example

local  = [2,1,0]
remote = [1,1,3]

send    = [0]
request = [2]

Constraints

  • 0 <= len(local) <= 100000
  • 0 <= local[i], remote[i]

Notes

  • If lengths differ, missing entries are treated as 0.
Run tests to see results
No issues detected