ObjectStoreNames is used to retrieve a list of bucket names
(opts ...ObjectOpt)
| 1350 | |
| 1351 | // ObjectStoreNames is used to retrieve a list of bucket names |
| 1352 | func (js *js) ObjectStoreNames(opts ...ObjectOpt) <-chan string { |
| 1353 | var o objOpts |
| 1354 | for _, opt := range opts { |
| 1355 | if opt != nil { |
| 1356 | if err := opt.configureObject(&o); err != nil { |
| 1357 | return nil |
| 1358 | } |
| 1359 | } |
| 1360 | } |
| 1361 | ch := make(chan string) |
| 1362 | var cancel context.CancelFunc |
| 1363 | if o.ctx == nil { |
| 1364 | o.ctx, cancel = context.WithTimeout(context.Background(), defaultRequestWait) |
| 1365 | } |
| 1366 | l := &streamLister{js: js} |
| 1367 | l.js.opts.streamListSubject = fmt.Sprintf(objAllChunksPreTmpl, "*") |
| 1368 | l.js.opts.ctx = o.ctx |
| 1369 | go func() { |
| 1370 | if cancel != nil { |
| 1371 | defer cancel() |
| 1372 | } |
| 1373 | defer close(ch) |
| 1374 | for l.Next() { |
| 1375 | for _, info := range l.Page() { |
| 1376 | if !strings.HasPrefix(info.Config.Name, "OBJ_") { |
| 1377 | continue |
| 1378 | } |
| 1379 | select { |
| 1380 | case ch <- info.Config.Name: |
| 1381 | case <-o.ctx.Done(): |
| 1382 | return |
| 1383 | } |
| 1384 | } |
| 1385 | } |
| 1386 | }() |
| 1387 | |
| 1388 | return ch |
| 1389 | } |
| 1390 | |
| 1391 | // ObjectStores is used to retrieve a list of bucket statuses |
| 1392 | func (js *js) ObjectStores(opts ...ObjectOpt) <-chan ObjectStoreStatus { |
nothing calls this directly
no test coverage detected