Package org.openrewrite.maven.cache
Class RocksdbMavenPomCache
java.lang.Object
org.openrewrite.maven.cache.RocksdbMavenPomCache
- All Implemented Interfaces:
MavenPomCache
Implementation of the maven cache that leverages Rocksdb. The keys and values are serialized to/from byte arrays
using jackson. Things to know about this cache implementation:
It will create a rocks db in the workspace directory passed to it.
If two caches are pointed to the same workspace folder, they will "share" the same underlying rocks database,
it is thread-safe.
Because multiple caches can share the same database, the close on this cache implementation does nothing.
The database is closed via a system shutdown hook registered by this class. Any unexpected process termination
is non-fatal, any non-flushed data is lost, but the database will not be corrupted.
The database is configured to auto-flush when the in-memory size reaches 1MB.
Rocksdb's write ahead log has been disabled because we are using this as a cache and do not need to recover any
"lost" data.
Rocksdb computes checksums for all of its files, normally it checks those on startup, this has been disabled as
well.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable Optional<MavenMetadata>
getMavenMetadata
(URI repo, GroupArtifactVersion gav) @Nullable Optional<MavenRepository>
getNormalizedRepository
(MavenRepository repository) @Nullable ResolvedPom
getResolvedDependencyPom
(ResolvedGroupArtifactVersion dependency) void
putMavenMetadata
(URI repo, GroupArtifactVersion gav, @Nullable MavenMetadata metadata) void
putNormalizedRepository
(MavenRepository repository, MavenRepository normalized) void
putPom
(ResolvedGroupArtifactVersion gav, Pom pom) void
putResolvedDependencyPom
(ResolvedGroupArtifactVersion dependency, ResolvedPom resolved)
-
Constructor Details
-
RocksdbMavenPomCache
-
-
Method Details
-
getResolvedDependencyPom
@Nullable public @Nullable ResolvedPom getResolvedDependencyPom(ResolvedGroupArtifactVersion dependency) - Specified by:
getResolvedDependencyPom
in interfaceMavenPomCache
-
putResolvedDependencyPom
- Specified by:
putResolvedDependencyPom
in interfaceMavenPomCache
-
getMavenMetadata
@Nullable public @Nullable Optional<MavenMetadata> getMavenMetadata(URI repo, GroupArtifactVersion gav) - Specified by:
getMavenMetadata
in interfaceMavenPomCache
-
putMavenMetadata
public void putMavenMetadata(URI repo, GroupArtifactVersion gav, @Nullable @Nullable MavenMetadata metadata) - Specified by:
putMavenMetadata
in interfaceMavenPomCache
-
getPom
- Specified by:
getPom
in interfaceMavenPomCache
- Throws:
MavenDownloadingException
-
putPom
- Specified by:
putPom
in interfaceMavenPomCache
-
getNormalizedRepository
@Nullable public @Nullable Optional<MavenRepository> getNormalizedRepository(MavenRepository repository) - Specified by:
getNormalizedRepository
in interfaceMavenPomCache
-
putNormalizedRepository
- Specified by:
putNormalizedRepository
in interfaceMavenPomCache
-