Make Mmapper a struct, and existing impls storages #1345
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.
We make Mmapper a struct instead of trait. It will be solely responsible for transitioning the map states.
Existing implementations, including
ByteMapMmapper
andTwoLevelMmapper
, become the storage backends ofMmapper
, namelyByteMapStateStorage
andTwoLevelStateStorage
. They are only responsible for maintaining the (one-level or two-level) array ofAtomic<MapState>
, and provide high-level functions for bulk-setting and bulk-transitioning map states.Methods of
MapState
are moved toMmapper
. All bulk-setting operations can callmmap
ormprotect
on contiguous range of chunks instead of one chunk at a time, regardless whether usingByteMapStateStorage
orTwoLevelStateStorage
.DRAFT: This is a very aggressive refactoring over the existing
Mmapper
framework. We need toByteMapMmapper
andTwoLevelMmapper
. This may involve a level ofdyn
somewhere. Make sure the performance is OK. It should be because it is supposed to be much cheaper thanmmap
andmprotect
system calls.