Disk cache refactoring #7
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed in Dresden in December 2018, we've been working on a N5 backend for the
DiskCachedCellImg. To prepare for that, I have refactored theDiskCachedCellImgFactoryandDiskCachedCellImgOptionsto allow for better extensibility and reuse. Their external interface remains (nearly) unchanged.The two main (internal) changes are:
AbstractReadWriteCachedCellImgFactoryandAbstractReadWriteCachedCellImgOptionsthat hold the code that can be shared by different read-write-cache implementations. Concrete subclasses must implement abstract methods that encapsulate backend-specific things like CellCache creation.DiskCachedCellImgOptions extends AbstractReadWriteCachedCellImgOptions extends ReadOnlyCachedCellImgOptionsAPI change:
DiskCachedCellImgOptions.valuesis now private, use the new methodvalues()instead to get access to the values.CacheTypehas moved fromDiskCachedCellImgOptionstoReadOnlyCachedCellImgOptionsbecause that is its first usage in the inheritance hierarchy.Notes:
imglib2-cache-examplesto verify that the caches still work as expected.n5-imglibprovides aN5CellLoaderthat we reuse instead of reimplementing it, butn5-imglibat the same time depends onimglib2-cache. To prevent cyclic dependencies, I have put theN5CachedCellImginto its own maven project.IoSyncinstance across multiple caches. I did not add an interface for this yet.Flushableversion of theGuardedStrongRefLoaderRemoverCacheto be able to trigger writing of all in-memory cache blocks to disk. This is not handled in this PR orimglib2-cache-n5yet.