# version vector
https://www.youtube.com/watch?v=x-D8iFU1d-o&ab_channel=MartinKleppmann


### lamport clock

* each node have it own time T
* each event on each node(receiving/send) update T=T+1
* send message with this T
* when get message from other's node, update the local T = max(local T, message T)

only rule out b happen before a,
the situation might be
1. a happen before b
2. a and b concurrent

### lamport example

a send with t=2
b receive get t=2+1=3
b send message with t++(t=4) to c
c receive message with t=t+1
lamport timestamp with node can assgin particular event
ex. A(2) as send message to B
B(4) send message to C
C(5) receive message from b

* N(a) N(b) ordering the nodes priority, seems nothing to do with Lamport clock....
* given L(a)<L(b), we cant judge a->b or a||b(concurrent)
---
### vector clock
lamport clock cant diff 1. a,b concurrent 2. a/b has casuality.



---
### vector clock example

strict equal for 3rd: there must be one time diff
4th: incomparable

sets of events
vector clock A here correspond to (the set of events of A) plus (all of the events that happened before A)
and vertor clock B correspond (the set events of B) plus (all of the events that happened before B)
the less than recall relationship correspond to subset relationship on those two sets of event
given a nice way of reasoning about what the vectors actually mean

vector clock given a bidirectional relationship
3rd: the vector clock are concurrent, the vector is incomparable.