-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgossip.thrift
78 lines (68 loc) · 1.6 KB
/
gossip.thrift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#
# Gossip messages and state.
# These are mostly based off of Cassandra's implementaiton
# http://wiki.apache.org/cassandra/ArchitectureGossip
# which is based on the paper
# http://www.cs.cornell.edu/home/rvr/papers/flowgossip.pdf
#
namespace cpp polyp.gossip
namespace java polyp.gossip
namespace py polyp.gossip
include "polyp.thrift"
struct HeartBeatState
{
1: required i64 generation
2: required i64 version
}
const i64 FIRST_GEN = 0;
struct ApplicationState
{
1: required string key
2: required string value
3: required i64 generation
4: required i64 version
}
struct EndpointState
{
1: required polyp.Endpoint endpoint
2: required HeartBeatState heartbeat
3: required map<string,ApplicationState> info
}
struct EndpointDigest
{
1: polyp.Endpoint endpoint
2: i64 generation
3: i64 version
}
# Clients use NewStateMessage to update server state
struct NewStateMessage
{
1: required string key
2: required string value
}
struct GetStateMessage
{
1: required list<polyp.Endpoint> endpoints
}
struct ReturnStateMessage
{
1: required list<EndpointState> states
}
# Massive hand waving over the actual algorithm:
# Gossiper A sends SynMessage to Gossiper B with it's known states
# B sends A the states B has a higher version for and requests from A
# the states it has a lower version for
# A then send B back the versions B requested
struct GossipSynMessage
{
1: required list<EndpointDigest> digests
}
struct GossipAckMessage
{
1: required list<EndpointDigest> requested
2: required list<EndpointState> known
}
struct GossipAckBackMessage
{
1: required list<EndpointState> known
}