Skip to content

Commit ce3c56e

Browse files
unexport listener functions
1 parent d16ee77 commit ce3c56e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

internal/interface/grpc/handlers/broker.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (l *listener[T]) includesAny(topics []string) bool {
4545
return false
4646
}
4747

48-
func (l *listener[T]) AddTopics(topics []string) {
48+
func (l *listener[T]) addTopics(topics []string) {
4949
l.lock.Lock()
5050
defer l.lock.Unlock()
5151
if l.topics == nil {
@@ -56,7 +56,7 @@ func (l *listener[T]) AddTopics(topics []string) {
5656
}
5757
}
5858

59-
func (l *listener[T]) RemoveTopics(topics []string) {
59+
func (l *listener[T]) removeTopics(topics []string) {
6060
l.lock.Lock()
6161
defer l.lock.Unlock()
6262
if l.topics == nil {
@@ -67,7 +67,7 @@ func (l *listener[T]) RemoveTopics(topics []string) {
6767
}
6868
}
6969

70-
func (l *listener[T]) OverwriteTopics(topics []string) {
70+
func (l *listener[T]) overwriteTopics(topics []string) {
7171
l.lock.Lock()
7272
defer l.lock.Unlock()
7373
newTopics := make(map[string]struct{}, len(topics))
@@ -77,7 +77,7 @@ func (l *listener[T]) OverwriteTopics(topics []string) {
7777
l.topics = newTopics
7878
}
7979

80-
func (l *listener[T]) GetTopics() []string {
80+
func (l *listener[T]) getTopics() []string {
8181
l.lock.RLock()
8282
defer l.lock.RUnlock()
8383
out := make([]string, 0, len(l.topics))
@@ -87,7 +87,7 @@ func (l *listener[T]) GetTopics() []string {
8787
return out
8888
}
8989

90-
func (l *listener[T]) Channel() chan T {
90+
func (l *listener[T]) channel() chan T {
9191
// no strong reason to lock here, but keep RLock to be safe if ch could be replaced
9292
l.lock.RLock()
9393
defer l.lock.RUnlock()
@@ -137,7 +137,7 @@ func (h *broker[T]) getListenerChannel(id string) (chan T, error) {
137137
if !ok {
138138
return nil, fmt.Errorf("subscription %s not found", id)
139139
}
140-
return listener.Channel(), nil
140+
return listener.channel(), nil
141141
}
142142

143143
func (h *broker[T]) getTopics(id string) []string {
@@ -147,7 +147,7 @@ func (h *broker[T]) getTopics(id string) []string {
147147
if !ok {
148148
return nil
149149
}
150-
return listener.GetTopics()
150+
return listener.getTopics()
151151
}
152152

153153
func (h *broker[T]) addTopics(id string, topics []string) error {
@@ -157,7 +157,7 @@ func (h *broker[T]) addTopics(id string, topics []string) error {
157157
if !ok {
158158
return fmt.Errorf("subscription %s not found", id)
159159
}
160-
listener.AddTopics(topics)
160+
listener.addTopics(topics)
161161
return nil
162162
}
163163

@@ -168,7 +168,7 @@ func (h *broker[T]) removeTopics(id string, topics []string) error {
168168
if !ok {
169169
return fmt.Errorf("subscription %s not found", id)
170170
}
171-
listener.RemoveTopics(topics)
171+
listener.removeTopics(topics)
172172
return nil
173173
}
174174

@@ -179,7 +179,7 @@ func (h *broker[T]) removeAllTopics(id string) error {
179179
if !ok {
180180
return fmt.Errorf("subscription %s not found", id)
181181
}
182-
listener.OverwriteTopics([]string{})
182+
listener.overwriteTopics([]string{})
183183
return nil
184184
}
185185

@@ -190,7 +190,7 @@ func (h *broker[T]) overwriteTopics(id string, topics []string) error {
190190
if !ok {
191191
return fmt.Errorf("subscription %s not found", id)
192192
}
193-
listener.OverwriteTopics(topics)
193+
listener.overwriteTopics(topics)
194194
return nil
195195
}
196196

0 commit comments

Comments
 (0)