github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/cluster/messages.go (about) 1 package cluster 2 3 import ( 4 "google.golang.org/protobuf/proto" 5 ) 6 7 // Used to query the GossipActor about a given key status 8 type GetGossipStateRequest struct { 9 Key string 10 } 11 12 // Create a new GetGossipStateRequest value and return it back 13 func NewGetGossipStateRequest(key string) GetGossipStateRequest { 14 request := GetGossipStateRequest{Key: key} 15 return request 16 } 17 18 // Used by the GossipActor to send back the status value of a given key 19 type GetGossipStateResponse struct { 20 State map[string]*GossipKeyValue 21 } 22 23 func NewGetGossipStateResponse(state map[string]*GossipKeyValue) GetGossipStateResponse { 24 value := GetGossipStateResponse{ 25 State: state, 26 } 27 return value 28 } 29 30 // Used to setup Gossip Status Keys in the GossipActor 31 type SetGossipStateKey struct { 32 Key string 33 Value proto.Message 34 } 35 36 // Create a new SetGossipStateKey value with the given data and return it back 37 func NewGossipStateKey(key string, value proto.Message) SetGossipStateKey { 38 statusKey := SetGossipStateKey{ 39 Key: key, 40 Value: value, 41 } 42 return statusKey 43 } 44 45 type SendGossipStateRequest struct{} 46 47 type SendGossipStateResponse struct{} 48 49 // Used by the GossipActor to respond SetGossipStatus requests 50 type SetGossipStateResponse struct{} 51 52 type AddConsensusCheck struct { 53 ID string 54 Check *ConsensusCheck 55 } 56 57 // Mimic .NET ReenterAfterCancellation on GossipActor 58 type RemoveConsensusCheck struct { 59 ID string 60 } 61 62 func NewAddConsensusCheck(id string, check *ConsensusCheck) AddConsensusCheck { 63 value := AddConsensusCheck{ 64 ID: id, 65 Check: check, 66 } 67 return value 68 } 69 70 func NewRemoveConsensusCheck(id string) RemoveConsensusCheck { 71 value := RemoveConsensusCheck{ 72 ID: id, 73 } 74 return value 75 }