List will list all the objects in this store.
(opts ...ListObjectsOpt)
| 1166 | |
| 1167 | // List will list all the objects in this store. |
| 1168 | func (obs *obs) List(opts ...ListObjectsOpt) ([]*ObjectInfo, error) { |
| 1169 | var o listObjectOpts |
| 1170 | for _, opt := range opts { |
| 1171 | if opt != nil { |
| 1172 | if err := opt.configureListObjects(&o); err != nil { |
| 1173 | return nil, err |
| 1174 | } |
| 1175 | } |
| 1176 | } |
| 1177 | watchOpts := make([]WatchOpt, 0) |
| 1178 | if !o.showDeleted { |
| 1179 | watchOpts = append(watchOpts, IgnoreDeletes()) |
| 1180 | } |
| 1181 | watcher, err := obs.Watch(watchOpts...) |
| 1182 | if err != nil { |
| 1183 | return nil, err |
| 1184 | } |
| 1185 | defer watcher.Stop() |
| 1186 | if o.ctx == nil { |
| 1187 | o.ctx = context.Background() |
| 1188 | } |
| 1189 | |
| 1190 | var objs []*ObjectInfo |
| 1191 | updates := watcher.Updates() |
| 1192 | Updates: |
| 1193 | for { |
| 1194 | select { |
| 1195 | case entry := <-updates: |
| 1196 | if entry == nil { |
| 1197 | break Updates |
| 1198 | } |
| 1199 | objs = append(objs, entry) |
| 1200 | case <-o.ctx.Done(): |
| 1201 | return nil, o.ctx.Err() |
| 1202 | } |
| 1203 | } |
| 1204 | if len(objs) == 0 { |
| 1205 | return nil, ErrNoObjectsFound |
| 1206 | } |
| 1207 | return objs, nil |
| 1208 | } |
| 1209 | |
| 1210 | // ObjectBucketStatus represents status of a Bucket, implements ObjectStoreStatus |
| 1211 | type ObjectBucketStatus struct { |
nothing calls this directly
no test coverage detected