GetDocStorageReadBucket gets a storage.ReadBucket that just contains the documentation file(s). This is needed for i.e. using RootToExcludes in NewWorkspaceForBucket.
(ctx context.Context, bucket storage.ReadBucket)
| 229 | // |
| 230 | // This is needed for i.e. using RootToExcludes in NewWorkspaceForBucket. |
| 231 | func GetDocStorageReadBucket(ctx context.Context, bucket storage.ReadBucket) (storage.ReadBucket, error) { |
| 232 | // Store the documentation file in a new memory bucket for performance reasons. |
| 233 | docFilePath := getDocFilePathForStorageReadBucket(ctx, bucket) |
| 234 | if docFilePath == "" { |
| 235 | return storage.MultiReadBucket(), nil // nop bucket |
| 236 | } |
| 237 | content, err := storage.ReadPath(ctx, bucket, docFilePath) |
| 238 | if err != nil { |
| 239 | return nil, err |
| 240 | } |
| 241 | return storagemem.NewReadBucket( |
| 242 | map[string][]byte{ |
| 243 | docFilePath: content, |
| 244 | }, |
| 245 | ) |
| 246 | } |
| 247 | |
| 248 | // GetLicenseStorageReadBucket gets a storage.ReadBucket that just contains the license file(s). |
| 249 | // |
no test coverage detected
searching dependent graphs…