List implements backend.Reader
(ctx context.Context, keypath backend.KeyPath)
| 169 | |
| 170 | // List implements backend.Reader |
| 171 | func (rw *Azure) List(ctx context.Context, keypath backend.KeyPath) ([]string, error) { |
| 172 | keypath = backend.KeyPathWithPrefix(keypath, rw.cfg.Prefix) |
| 173 | |
| 174 | prefix := path.Join(keypath...) |
| 175 | |
| 176 | if len(prefix) > 0 { |
| 177 | prefix += dir |
| 178 | } |
| 179 | |
| 180 | pager := rw.containerClient.NewListBlobsHierarchyPager(dir, &container.ListBlobsHierarchyOptions{ |
| 181 | Include: container.ListBlobsInclude{}, |
| 182 | Prefix: &prefix, |
| 183 | }) |
| 184 | |
| 185 | objects := make([]string, 0) |
| 186 | for pager.More() { |
| 187 | page, err := pager.NextPage(ctx) |
| 188 | if err != nil { |
| 189 | return objects, fmt.Errorf("iterating tenants: %w", err) |
| 190 | } |
| 191 | |
| 192 | for _, b := range page.Segment.BlobPrefixes { |
| 193 | if b.Name == nil { |
| 194 | return objects, fmt.Errorf("unexpected empty blob name when listing %s: %w", prefix, err) |
| 195 | } |
| 196 | objects = append(objects, strings.TrimPrefix(strings.TrimSuffix(*b.Name, dir), prefix)) |
| 197 | } |
| 198 | } |
| 199 | return objects, nil |
| 200 | } |
| 201 | |
| 202 | // ListBlocks implements backend.Reader |
| 203 | func (rw *Azure) ListBlocks(ctx context.Context, tenant string) ([]uuid.UUID, []uuid.UUID, error) { |
nothing calls this directly
no test coverage detected