Class GridLocalConfigManager
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.GridLocalConfigManager
-
public class GridLocalConfigManager extends Object
Responsible for restoring local cache configurations (both from static configuration and persistence). Keep stop sequence of caches and caches which were presented on node before node join.
-
-
Constructor Summary
Constructors Constructor Description GridLocalConfigManager(GridCacheProcessor cacheProcessor, GridKernalContext kernalCtx)
-
Method Summary
-
-
-
Constructor Detail
-
GridLocalConfigManager
public GridLocalConfigManager(GridCacheProcessor cacheProcessor, GridKernalContext kernalCtx) throws IgniteCheckedException
- Parameters:
cacheProcessor- Cache processor.kernalCtx- Kernal context.- Throws:
IgniteCheckedException
-
-
Method Detail
-
readConfigurationFiles
public void readConfigurationFiles(List<CacheConfiguration<?,?>> ccfgs, BiConsumer<CacheConfiguration<?,?>,File> ccfgCons)
- Parameters:
ccfgs- List of cache configurations to process.ccfgCons- Consumer which accepts found configurations files.
-
readCacheConfigurations
public Map<String,StoredCacheData> readCacheConfigurations() throws IgniteCheckedException
- Returns:
- Saved cache configurations.
- Throws:
IgniteCheckedException- If failed.
-
readCacheData
public StoredCacheData readCacheData(File conf) throws IgniteCheckedException
- Parameters:
conf- File with stored cache data.- Returns:
- Cache data.
- Throws:
IgniteCheckedException- If failed.
-
readCacheData
public static StoredCacheData readCacheData(File conf, @Nullable @Nullable Marshaller marshaller, @Nullable @Nullable IgniteConfiguration cfg) throws IgniteCheckedException
- Parameters:
conf- File with stored cache data.marshaller- Marshaller.cfg- Ignite configuration.- Returns:
- Cache data.
- Throws:
IgniteCheckedException- If failed.
-
readCachesData
public static Map<File,StoredCacheData> readCachesData(File dbDir, @Nullable @Nullable Marshaller marshaller, @Nullable @Nullable IgniteConfiguration cfg)
- Parameters:
dbDir- Root directory for all cache datas.marshaller- Marshaller.cfg- Ignite configuration.- Returns:
- Collection of cache data files and actual cache data.
-
writeCacheData
public void writeCacheData(StoredCacheData cacheData, File conf) throws IgniteCheckedException
- Parameters:
conf- File to store cache data.cacheData- Cache data file.- Throws:
IgniteCheckedException- If failed.
-
saveCacheConfiguration
public void saveCacheConfiguration(StoredCacheData cacheData, boolean overwrite) throws IgniteCheckedException
Save cache configuration to persistent store if necessary.- Parameters:
cacheData- Stored cache data.overwrite- Overwrite existing.- Throws:
IgniteCheckedException
-
removeCacheData
public void removeCacheData(StoredCacheData cacheData) throws IgniteCheckedException
Remove cache configuration from persistent store.- Parameters:
cacheData- Stored cache data.- Throws:
IgniteCheckedException
-
stopSequence
public Collection<String> stopSequence()
-
localCachesOnStart
public Set<String> localCachesOnStart()
- Returns:
- Caches to be started when this node starts.
-
restoreCacheConfigurations
public CacheJoinNodeDiscoveryData restoreCacheConfigurations() throws IgniteCheckedException
- Throws:
IgniteCheckedException- If failed.
-
addConfigurationChangeListener
public void addConfigurationChangeListener(BiConsumer<String,File> lsnr)
- Parameters:
lsnr- Instance of listener to add.
-
removeConfigurationChangeListener
public void removeConfigurationChangeListener(BiConsumer<String,File> lsnr)
- Parameters:
lsnr- Instance of listener to remove.
-
removeCacheGroupConfigurationData
public void removeCacheGroupConfigurationData(CacheGroupContext ctx) throws IgniteCheckedException
Delete caches' configuration data files of cache group.- Parameters:
ctx- Cache group context.- Throws:
IgniteCheckedException- If fails.
-
readCacheConfigurations
public void readCacheConfigurations(File dir, Map<String,StoredCacheData> ccfgs) throws IgniteCheckedException
- Parameters:
dir- Cache (group) directory.ccfgs- Cache configurations.- Throws:
IgniteCheckedException- If failed.
-
cacheConfigurationFile
public File cacheConfigurationFile(CacheConfiguration<?,?> ccfg)
- Parameters:
ccfg- Cache configuration.- Returns:
- Cache configuration file with respect to
CacheConfiguration.getGroupName()value.
-
cacheDataFilename
public static String cacheDataFilename(CacheConfiguration<?,?> ccfg)
- Returns:
- Name of cache data filename.
-
cacheWorkDir
public File cacheWorkDir(CacheConfiguration<?,?> ccfg)
- Parameters:
ccfg- Cache configuration.- Returns:
- Store dir for given cache.
-
cacheWorkDir
public File cacheWorkDir(boolean isSharedGroup, String cacheOrGroupName)
- Parameters:
isSharedGroup-Trueif cache is sharing the same `underlying` cache.cacheOrGroupName- Cache name.- Returns:
- Store directory for given cache.
-
validateIncomingConfiguration
@Nullable public static @Nullable String validateIncomingConfiguration(Collection<CacheConfiguration<?,?>> cacheConfigs, CacheConfiguration<?,?> cfg)
Validates already processed cache configuration instead a newly defined.- Parameters:
cacheConfigs- Already processed caches.cfg- Currently processed cache config.- Returns:
- Error message, if supplied configuration is incorrect.
- Throws:
IgniteException- If misconfigured.
-
-