public class MemoryRegionDatabase extends Object implements RegionDatabase
HashSet.
This implementation is thread-safe. Difference saves are not supported.
| Constructor and Description |
|---|
MemoryRegionDatabase() |
| Modifier and Type | Method and Description |
|---|---|
String |
getName()
Get a displayable name for this store.
|
Set<ProtectedRegion> |
loadAll()
Load all regions from storage and place them into the passed map.
|
void |
saveAll(Set<ProtectedRegion> regions)
Replace all the data in the store with the given collection of regions.
|
void |
saveChanges(RegionDifference difference)
Perform a partial save that only commits changes, rather than the
entire region index.
|
public String getName()
RegionDatabasegetName in interface RegionDatabasepublic Set<ProtectedRegion> loadAll()
RegionDatabaseThe 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() and put() calls in order to maximize performance.
loadAll in interface RegionDatabasepublic void saveAll(Set<ProtectedRegion> regions)
RegionDatabasesaveAll in interface RegionDatabaseregions - a set of regionspublic void saveChanges(RegionDifference difference) throws DifferenceSaveException
RegionDatabasesaveChanges in interface RegionDatabasedifference - the differenceDifferenceSaveException - thrown if partial saves are not supportedCopyright © 2015. All Rights Reserved.