K - The key typepublic class SimpleRegionFactory<K extends IKey<K>> extends java.lang.Object implements IRegionFactory<K>
IRegionFactory.| Modifier and Type | Class and Description |
|---|---|
static interface |
SimpleRegionFactory.RegionExistsPredicate<K extends IKey<K>> |
static interface |
SimpleRegionFactory.RegionFactory<K extends IKey<K>> |
| Constructor and Description |
|---|
SimpleRegionFactory(IKeyProvider<K> keyProvider,
java.nio.file.Path directory,
SimpleRegionFactory.RegionFactory<K> regionBuilder,
SimpleRegionFactory.RegionExistsPredicate<K> regionExists) |
| Modifier and Type | Method and Description |
|---|---|
java.util.stream.Stream<RegionKey> |
allRegions()
Gets a
Stream over the keys of all the existing regions. |
static <K extends IKey<K>> |
createDefault(IKeyProvider<K> keyProvider,
java.nio.file.Path directory,
int sectorSize) |
java.util.Optional<IRegion<K>> |
getExistingRegion(RegionKey key)
Opens an existing
IRegion at a given region key. |
IKeyProvider<K> |
getKeyProvider() |
IRegion<K> |
getRegion(RegionKey key)
Opens an
IRegion at a given region key, creating a new one if none exists. |
public SimpleRegionFactory(IKeyProvider<K> keyProvider, java.nio.file.Path directory, SimpleRegionFactory.RegionFactory<K> regionBuilder, SimpleRegionFactory.RegionExistsPredicate<K> regionExists)
public static <K extends IKey<K>> SimpleRegionFactory<K> createDefault(IKeyProvider<K> keyProvider, java.nio.file.Path directory, int sectorSize)
public IKeyProvider<K> getKeyProvider()
getKeyProvider in interface IRegionFactory<K extends IKey<K>>IKeyProvider used by this factorypublic IRegion<K> getRegion(RegionKey key) throws java.io.IOException
IRegionFactoryIRegion at a given region key, creating a new one if none exists.public java.util.Optional<IRegion<K>> getExistingRegion(RegionKey key) throws java.io.IOException
IRegionFactoryIRegion at a given region key.getExistingRegion in interface IRegionFactory<K extends IKey<K>>key - the key for the IRegionIRegion at the given key, or an empty Optional if none existsjava.io.IOExceptionpublic java.util.stream.Stream<RegionKey> allRegions() throws java.io.IOException
IRegionFactoryStream over the keys of all the existing regions.
All regions that had been created at the time of this method invocation are guaranteed to be present in the returned Stream, no guarantees
are made for regions created during iteration.
Note that the returned Stream must be closed (using BaseStream.close()) once no longer needed.
allRegions in interface IRegionFactory<K extends IKey<K>>Stream over the keys of all the existing regionsjava.io.IOException