MCPcopy Create free account
hub / github.com/bufbuild/buf / newModuleDataProvider

Function newModuleDataProvider

private/buf/bufcli/cache.go:244–280  ·  view source on GitHub ↗
(
	container appext.Container,
	moduleClientProvider bufregistryapimodule.ClientProvider,
	ownerClientProvider bufregistryapiowner.ClientProvider,
)

Source from the content-addressed store, hash-verified

242}
243
244func newModuleDataProvider(
245 container appext.Container,
246 moduleClientProvider bufregistryapimodule.ClientProvider,
247 ownerClientProvider bufregistryapiowner.ClientProvider,
248) (bufmodule.ModuleDataProvider, error) {
249 if err := createCacheDir(container.CacheDirPath(), v3CacheModuleRelDirPath); err != nil {
250 return nil, err
251 }
252 fullCacheDirPath := normalpath.Join(container.CacheDirPath(), v3CacheModuleRelDirPath)
253 delegateModuleDataProvider := bufmoduleapi.NewModuleDataProvider(
254 container.Logger(),
255 moduleClientProvider,
256 newGraphProvider(container, moduleClientProvider, ownerClientProvider),
257 )
258 // No symlinks.
259 storageosProvider := storageos.NewProvider()
260 cacheBucket, err := storageosProvider.NewReadWriteBucket(fullCacheDirPath)
261 if err != nil {
262 return nil, err
263 }
264 if err := createCacheDir(container.CacheDirPath(), v3CacheModuleLockRelDirPath); err != nil {
265 return nil, err
266 }
267 filelocker, err := filelock.NewLocker(normalpath.Join(container.CacheDirPath(), v3CacheModuleLockRelDirPath))
268 if err != nil {
269 return nil, err
270 }
271 return bufmodulecache.NewModuleDataProvider(
272 container.Logger(),
273 delegateModuleDataProvider,
274 bufmodulestore.NewModuleDataStore(
275 container.Logger(),
276 cacheBucket,
277 filelocker,
278 ),
279 ), nil
280}
281
282func newCommitProvider(
283 container appext.Container,

Callers 2

NewModuleDataProviderFunction · 0.70
NewControllerFunction · 0.70

Calls 9

NewReadWriteBucketMethod · 0.95
JoinFunction · 0.92
NewModuleDataProviderFunction · 0.92
NewProviderFunction · 0.92
NewLockerFunction · 0.92
NewModuleDataProviderFunction · 0.92
NewModuleDataStoreFunction · 0.92
createCacheDirFunction · 0.85
newGraphProviderFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…