use of org.gradle.internal.resource.cached.TwoStageExternalResourceFileStore in project gradle by gradle.
the class DependencyManagementBuildScopeServices method createFileStoreAndIndexProvider.
FileStoreAndIndexProvider createFileStoreAndIndexProvider(BuildCommencedTimeProvider timeProvider, ArtifactCachesProvider artifactCaches, DefaultExternalResourceFileStore.Factory defaultExternalResourceFileStoreFactory, DefaultArtifactIdentifierFileStore.Factory defaultArtifactIdentifierFileStoreFactory) {
ExternalResourceFileStore writableFileStore = defaultExternalResourceFileStoreFactory.create(artifactCaches.getWritableCacheMetadata());
ExternalResourceFileStore externalResourceFileStore = artifactCaches.withReadOnlyCache((md, manager) -> (ExternalResourceFileStore) new TwoStageExternalResourceFileStore(defaultExternalResourceFileStoreFactory.create(md), writableFileStore)).orElse(writableFileStore);
CachedExternalResourceIndex<String> writableByUrlCachedExternalResourceIndex = prepareArtifactUrlCachedResolutionIndex(timeProvider, artifactCaches.getWritableCacheLockingManager(), externalResourceFileStore, artifactCaches.getWritableCacheMetadata());
ArtifactIdentifierFileStore writableArtifactIdentifierFileStore = artifactCaches.withWritableCache((md, manager) -> defaultArtifactIdentifierFileStoreFactory.create(md));
ArtifactIdentifierFileStore artifactIdentifierFileStore = artifactCaches.withReadOnlyCache((md, manager) -> (ArtifactIdentifierFileStore) new TwoStageArtifactIdentifierFileStore(defaultArtifactIdentifierFileStoreFactory.create(md), writableArtifactIdentifierFileStore)).orElse(writableArtifactIdentifierFileStore);
return new FileStoreAndIndexProvider(artifactCaches.withReadOnlyCache((md, manager) -> (CachedExternalResourceIndex<String>) new TwoStageByUrlCachedExternalResourceIndex(md.getCacheDir().toPath(), prepareArtifactUrlCachedResolutionIndex(timeProvider, manager, externalResourceFileStore, md), writableByUrlCachedExternalResourceIndex)).orElse(writableByUrlCachedExternalResourceIndex), externalResourceFileStore, artifactIdentifierFileStore);
}
Aggregations