( container appext.Container, policyClientProvider bufregistryapipolicy.ClientProvider, )
| 341 | } |
| 342 | |
| 343 | func newPolicyDataProvider( |
| 344 | container appext.Container, |
| 345 | policyClientProvider bufregistryapipolicy.ClientProvider, |
| 346 | ) (bufpolicy.PolicyDataProvider, error) { |
| 347 | if err := createCacheDir(container.CacheDirPath(), v3CachePolicyRelDirPath); err != nil { |
| 348 | return nil, err |
| 349 | } |
| 350 | fullCacheDirPath := normalpath.Join(container.CacheDirPath(), v3CachePolicyRelDirPath) |
| 351 | storageosProvider := storageos.NewProvider() // No symlinks. |
| 352 | cacheBucket, err := storageosProvider.NewReadWriteBucket(fullCacheDirPath) |
| 353 | if err != nil { |
| 354 | return nil, err |
| 355 | } |
| 356 | delegateModuleDataProvider := bufpolicyapi.NewPolicyDataProvider( |
| 357 | container.Logger(), |
| 358 | policyClientProvider, |
| 359 | ) |
| 360 | return bufpolicycache.NewPolicyDataProvider( |
| 361 | container.Logger(), |
| 362 | delegateModuleDataProvider, |
| 363 | bufpolicystore.NewPolicyDataStore( |
| 364 | container.Logger(), |
| 365 | cacheBucket, |
| 366 | ), |
| 367 | ), nil |
| 368 | } |
| 369 | |
| 370 | func createCacheDir(baseCacheDirPath string, relDirPath string) error { |
| 371 | baseCacheDirPath = normalpath.Unnormalize(baseCacheDirPath) |
no test coverage detected
searching dependent graphs…