-
Notifications
You must be signed in to change notification settings - Fork 2
/
group_coordinator.go
55 lines (47 loc) · 1.04 KB
/
group_coordinator.go
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
package kop
import (
"sync"
)
type Group struct {
groupId string
partitionedTopic []string
groupStatus GroupStatus
supportedProtocol string
groupProtocols map[string]string
protocolType string
leader string
members map[string]*memberMetadata
canRebalance bool
generationId int
groupLock sync.RWMutex
groupStatusLock sync.RWMutex
groupMemberLock sync.RWMutex
groupNewMemberLock sync.RWMutex
sessionTimeoutMs int
}
type memberMetadata struct {
clientId string
memberId string
metadata string
assignment []byte
protocolType string
protocols map[string]string
joinGenerationId int
syncGenerationId int
}
type GroupStatus int
const (
PreparingRebalance GroupStatus = 1 + iota
CompletingRebalance
Stable
Dead
Empty
)
type GroupCoordinatorType string
const (
GroupCoordinatorTypeMemory GroupCoordinatorType = "memory"
GroupCoordinatorTypeRedis GroupCoordinatorType = "redis"
)
const (
EmptyMemberId = ""
)