Class MemoryRegionDatabase
java.lang.Object
com.sk89q.worldguard.protection.managers.storage.MemoryRegionDatabase
- All Implemented Interfaces:
RegionDatabase
A region database that saves the memory to an in-memory
HashSet.
This implementation is thread-safe. Difference saves are not supported.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Get a displayable name for this store.loadAll(FlagRegistry flagRegistry)Load all regions from storage and place them into the passed map.voidsaveAll(Set<ProtectedRegion> regions)Replace all the data in the store with the given collection of regions.voidsaveChanges(RegionDifference difference)Perform a partial save that only commits changes, rather than the entire region index.
-
Constructor Details
-
MemoryRegionDatabase
public MemoryRegionDatabase()
-
-
Method Details
-
getName
Description copied from interface:RegionDatabaseGet a displayable name for this store.- Specified by:
getNamein interfaceRegionDatabase
-
loadAll
Description copied from interface:RegionDatabaseLoad all regions from storage and place them into the passed map.The map will only be modified from one thread. The keys of each map entry will be in respect to the ID of the region but transformed to be lowercase. Until this method returns, the map may not be modified by any other thread simultaneously. If an exception is thrown, then the state in which the map is left is undefined.
The provided map should have reasonably efficient
get()andput()calls in order to maximize performance.- Specified by:
loadAllin interfaceRegionDatabase- Parameters:
flagRegistry- a flag registry- Returns:
- a set of loaded regions
-
saveAll
Description copied from interface:RegionDatabaseReplace all the data in the store with the given collection of regions.- Specified by:
saveAllin interfaceRegionDatabase- Parameters:
regions- a set of regions
-
saveChanges
Description copied from interface:RegionDatabasePerform a partial save that only commits changes, rather than the entire region index.- Specified by:
saveChangesin interfaceRegionDatabase- Parameters:
difference- the difference- Throws:
DifferenceSaveException- thrown if partial saves are not supported
-