nvclock_cmp() compares two vector clocks: returning NVC_LT, NVC_EQ, NVC_GT, NVC_DIV depending on whether the first argument is less than, equal to, greater than the second, or if the two clocks diverged and therefore neither is an ancestor of the other.
nvclock_cmp_total() returns -1, 0, +1 if the first arg is less than, equal to, or greater than the second. If the two vector clocks have diverged (nvclock_cmp() would return NVC_DIV), then nvclock_cmp_total() returns either -1 or +1 (but is consisent!). This provides a total ordering of vector clocks. This is useful as a comparator callback for avl_create() etc.
We already need these functions.
nvclock_cmp()
compares two vector clocks: returningNVC_LT
,NVC_EQ
,NVC_GT
,NVC_DIV
depending on whether the first argument is less than, equal to, greater than the second, or if the two clocks diverged and therefore neither is an ancestor of the other.nvclock_cmp_total()
returns -1, 0, +1 if the first arg is less than, equal to, or greater than the second. If the two vector clocks have diverged (nvclock_cmp()
would returnNVC_DIV
), thennvclock_cmp_total()
returns either -1 or +1 (but is consisent!). This provides a total ordering of vector clocks. This is useful as a comparator callback foravl_create()
etc.