Find implements backend.Reader
(ctx context.Context, keypath backend.KeyPath, f backend.FindFunc)
| 263 | |
| 264 | // Find implements backend.Reader |
| 265 | func (rw *Azure) Find(ctx context.Context, keypath backend.KeyPath, f backend.FindFunc) (err error) { |
| 266 | keypath = backend.KeyPathWithPrefix(keypath, rw.cfg.Prefix) |
| 267 | |
| 268 | prefix := path.Join(keypath...) |
| 269 | if len(prefix) > 0 { |
| 270 | prefix += dir |
| 271 | } |
| 272 | |
| 273 | pager := rw.containerClient.NewListBlobsFlatPager(&container.ListBlobsFlatOptions{ |
| 274 | Prefix: &prefix, |
| 275 | }) |
| 276 | |
| 277 | var o string |
| 278 | for pager.More() { |
| 279 | page, err := pager.NextPage(ctx) |
| 280 | if err != nil { |
| 281 | return fmt.Errorf("iterating objects: %w", err) |
| 282 | } |
| 283 | |
| 284 | for _, b := range page.Segment.BlobItems { |
| 285 | if b == nil || b.Name == nil { |
| 286 | continue |
| 287 | } |
| 288 | |
| 289 | o = strings.TrimSuffix(*b.Name, dir) |
| 290 | opts := backend.FindMatch{ |
| 291 | Key: strings.TrimPrefix(o, rw.cfg.Prefix), |
| 292 | Modified: *b.Properties.LastModified, |
| 293 | } |
| 294 | f(opts) |
| 295 | } |
| 296 | |
| 297 | } |
| 298 | |
| 299 | return |
| 300 | } |
| 301 | |
| 302 | // Read implements backend.Reader |
| 303 | func (rw *Azure) Read(ctx context.Context, name string, keypath backend.KeyPath, _ *backend.CacheInfo) (io.ReadCloser, int64, error) { |
nothing calls this directly
no test coverage detected