Refactored events to be camel case.

This commit is contained in:
Adin Schmahmann 2019-08-02 12:25:57 -04:00
parent 48c9847240
commit 57f2c1efdd
3 changed files with 13 additions and 13 deletions

View File

@ -1116,7 +1116,7 @@ func TestSubscriptionJoinNotification(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if event.Type == PEER_JOIN {
if event.Type == PeerJoin {
peersFound[event.Peer] = struct{}{}
}
}
@ -1170,7 +1170,7 @@ func TestSubscriptionLeaveNotification(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if event.Type == PEER_JOIN {
if event.Type == PeerJoin {
peersFound[event.Peer] = struct{}{}
}
}
@ -1195,7 +1195,7 @@ func TestSubscriptionLeaveNotification(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if event.Type == PEER_LEAVE {
if event.Type == PeerLeave {
leavingPeers[event.Peer] = struct{}{}
}
}
@ -1252,7 +1252,7 @@ func TestSubscriptionNotificationOverflowSimple(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if event.Type == PEER_JOIN {
if event.Type == PeerJoin {
peersFound[event.Peer] = struct{}{}
}
}
@ -1286,8 +1286,8 @@ func TestSubscriptionNotificationOverflowSimple(t *testing.T) {
}
for _, e := range peerState {
if e != PEER_JOIN {
t.Fatal("non JOIN event occurred")
if e != PeerJoin {
t.Fatal("non Join event occurred")
}
}
@ -1308,8 +1308,8 @@ func TestSubscriptionNotificationOverflowSimple(t *testing.T) {
}
for _, e := range peerState {
if e != PEER_LEAVE {
t.Fatal("non LEAVE event occurred")
if e != PeerLeave {
t.Fatal("non Leave event occurred")
}
}
}

View File

@ -456,7 +456,7 @@ func (p *PubSub) handleAddSubscription(req *addSubReq) {
tmap := p.topics[sub.topic]
for p := range tmap {
sub.evtBacklog[p] = PEER_JOIN
sub.evtBacklog[p] = PeerJoin
}
sub.cancelCh = p.cancelCh
@ -573,7 +573,7 @@ func (p *PubSub) subscribedToMsg(msg *pb.Message) bool {
func (p *PubSub) notifyLeave(topic string, pid peer.ID) {
if subs, ok := p.myTopics[topic]; ok {
for s := range subs {
s.sendNotification(PeerEvent{PEER_LEAVE, pid})
s.sendNotification(PeerEvent{PeerLeave, pid})
}
}
}
@ -593,7 +593,7 @@ func (p *PubSub) handleIncomingRPC(rpc *RPC) {
if subs, ok := p.myTopics[t]; ok {
peer := rpc.from
for s := range subs {
s.sendNotification(PeerEvent{PEER_JOIN, peer})
s.sendNotification(PeerEvent{PeerJoin, peer})
}
}
}

View File

@ -9,8 +9,8 @@ import (
type EventType int
const (
PEER_JOIN EventType = iota
PEER_LEAVE
PeerJoin EventType = iota
PeerLeave
)
type Subscription struct {