MCPcopy Index your code
hub / github.com/minio/mc / Join

Method Join

cmd/watch.go:115–154  ·  view source on GitHub ↗

Join the watcher with client

(ctx context.Context, client Client, recursive bool)

Source from the content-addressed store, hash-verified

113
114// Join the watcher with client
115func (w *Watcher) Join(ctx context.Context, client Client, recursive bool) *probe.Error {
116 wo, err := client.Watch(ctx, WatchOptions{
117 Recursive: recursive,
118 Events: []string{"put", "delete", "bucket-creation", "bucket-removal"},
119 })
120 if err != nil {
121 return err
122 }
123
124 w.o = append(w.o, wo)
125
126 // join monitoring waitgroup
127 w.wg.Add(1)
128
129 // wait for events and errors of individual client watchers
130 // and sent then to eventsChan and errorsChan
131 go func() {
132 defer w.wg.Done()
133
134 for {
135 select {
136 case <-wo.DoneChan:
137 return
138 case events, ok := <-wo.Events():
139 if !ok {
140 return
141 }
142 w.EventInfoChan <- events
143 case err, ok := <-wo.Errors():
144 if !ok {
145 return
146 }
147
148 w.ErrorChan <- err
149 }
150 }
151 }()
152
153 return nil
154}

Callers 15

StringMethod · 0.80
doCopyFunction · 0.80
StringMethod · 0.80
trimSuffixAtMaxDepthFunction · 0.80
getUserAgentFunction · 0.80
StringMethod · 0.80
mainSupportInspectFunction · 0.80
migrateShareFunction · 0.80
StringMethod · 0.80
StringMethod · 0.80
mainAdminConfigGetFunction · 0.80
mainSubnetHealthFunction · 0.80

Calls 4

WatchMethod · 0.65
AddMethod · 0.65
EventsMethod · 0.45
ErrorsMethod · 0.45

Tested by 12

TestGetMcConfigPathMethod · 0.64
RunMCFunction · 0.64
RunCommandFunction · 0.64
TestListMethod · 0.64
TestPutBucketMethod · 0.64
TestStatBucketMethod · 0.64
TestBucketACLFailsMethod · 0.64
TestPutMethod · 0.64
TestGetMethod · 0.64
TestGetRangeMethod · 0.64
TestStatObjectMethod · 0.64
TestCopyMethod · 0.64