Skip to content

Commit

Permalink
# IGNITE-226: WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
vozerov-gridgain committed Feb 13, 2015
1 parent f9facce commit d096d13
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 80 deletions.
Expand Up @@ -25,7 +25,7 @@
/**
* GGFS eviction filter which will not evict blocks of particular files.
*/
public class CacheIgniteFsEvictionFilter implements CacheEvictionFilter {
public class CacheIgfsEvictionFilter implements CacheEvictionFilter {
/** {@inheritDoc} */
@Override public boolean evictAllowed(Cache.Entry entry) {
Object key = entry.getKey();
Expand Down
Expand Up @@ -33,8 +33,8 @@
/**
* GGFS eviction policy which evicts particular blocks.
*/
public class CacheIgniteFsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<IgfsBlockKey, byte[]>,
CacheIgniteFsPerBlockLruEvictionPolicyMXBean {
public class CacheIgfsPerBlockLruEvictionPolicy implements CacheEvictionPolicy<IgfsBlockKey, byte[]>,
CacheIgfsPerBlockLruEvictionPolicyMXBean {
/** Maximum size. When reached, eviction begins. */
private volatile long maxSize;

Expand All @@ -60,7 +60,7 @@ public class CacheIgniteFsPerBlockLruEvictionPolicy implements CacheEvictionPoli
/**
* Default constructor.
*/
public CacheIgniteFsPerBlockLruEvictionPolicy() {
public CacheIgfsPerBlockLruEvictionPolicy() {
// No-op.
}

Expand All @@ -70,7 +70,7 @@ public CacheIgniteFsPerBlockLruEvictionPolicy() {
* @param maxSize Maximum size. When reached, eviction begins.
* @param maxBlocks Maximum amount of blocks. When reached, eviction begins.
*/
public CacheIgniteFsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks) {
public CacheIgfsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks) {
this(maxSize, maxBlocks, null);
}

Expand All @@ -81,7 +81,7 @@ public CacheIgniteFsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks) {
* @param maxBlocks Maximum amount of blocks. When reached, eviction begins.
* @param excludePaths Collection of regex for path which must not be evicted.
*/
public CacheIgniteFsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks,
public CacheIgfsPerBlockLruEvictionPolicy(long maxSize, int maxBlocks,
@Nullable Collection<String> excludePaths) {
this.maxSize = maxSize;
this.maxBlocks = maxBlocks;
Expand Down
Expand Up @@ -26,7 +26,7 @@
* MBean for {@code GGFS per-block LRU} eviction policy.
*/
@MXBeanDescription("MBean for GGFS per-block LRU cache eviction policy.")
public interface CacheIgniteFsPerBlockLruEvictionPolicyMXBean {
public interface CacheIgfsPerBlockLruEvictionPolicyMXBean {
/**
* Gets maximum allowed size of all blocks in bytes.
*
Expand Down
Expand Up @@ -30,18 +30,18 @@ public class IgfsHelperImpl implements IgfsHelper {
@Override public void preProcessCacheConfiguration(CacheConfiguration cfg) {
CacheEvictionPolicy evictPlc = cfg.getEvictionPolicy();

if (evictPlc instanceof CacheIgniteFsPerBlockLruEvictionPolicy && cfg.getEvictionFilter() == null)
cfg.setEvictionFilter(new CacheIgniteFsEvictionFilter());
if (evictPlc instanceof CacheIgfsPerBlockLruEvictionPolicy && cfg.getEvictionFilter() == null)
cfg.setEvictionFilter(new CacheIgfsEvictionFilter());
}

/** {@inheritDoc} */
@Override public void validateCacheConfiguration(CacheConfiguration cfg) throws IgniteCheckedException {
CacheEvictionPolicy evictPlc = cfg.getEvictionPolicy();

if (evictPlc != null && evictPlc instanceof CacheIgniteFsPerBlockLruEvictionPolicy) {
if (evictPlc != null && evictPlc instanceof CacheIgfsPerBlockLruEvictionPolicy) {
CacheEvictionFilter evictFilter = cfg.getEvictionFilter();

if (evictFilter != null && !(evictFilter instanceof CacheIgniteFsEvictionFilter))
if (evictFilter != null && !(evictFilter instanceof CacheIgfsEvictionFilter))
throw new IgniteCheckedException("Eviction filter cannot be set explicitly when using " +
"CacheGgfsPerBlockLruEvictionPolicy:" + cfg.getName());
}
Expand Down
Expand Up @@ -116,7 +116,7 @@ public final class IgfsImpl implements IgfsEx {
private Object topic;

/** Eviction policy (if set). */
private CacheIgniteFsPerBlockLruEvictionPolicy evictPlc;
private CacheIgfsPerBlockLruEvictionPolicy evictPlc;

/**
* Creates GGFS instance with given context.
Expand Down Expand Up @@ -200,8 +200,8 @@ public final class IgfsImpl implements IgfsEx {
if (F.eq(dataCacheName, cacheCfg.getName())) {
CacheEvictionPolicy evictPlc = cacheCfg.getEvictionPolicy();

if (evictPlc != null & evictPlc instanceof CacheIgniteFsPerBlockLruEvictionPolicy)
this.evictPlc = (CacheIgniteFsPerBlockLruEvictionPolicy)evictPlc;
if (evictPlc != null & evictPlc instanceof CacheIgfsPerBlockLruEvictionPolicy)
this.evictPlc = (CacheIgfsPerBlockLruEvictionPolicy)evictPlc;

break;
}
Expand Down
Expand Up @@ -71,7 +71,7 @@ public class GridCacheIgfsPerBlockLruEvictionPolicySelfTest extends IgfsCommonAb
private static GridCacheAdapter<IgfsBlockKey, byte[]> dataCache;

/** Eviction policy */
private static CacheIgniteFsPerBlockLruEvictionPolicy evictPlc;
private static CacheIgfsPerBlockLruEvictionPolicy evictPlc;

/**
* Start a grid with the primary file system.
Expand Down Expand Up @@ -104,7 +104,7 @@ private void startPrimary() throws Exception {
dataCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);

evictPlc = new CacheIgniteFsPerBlockLruEvictionPolicy();
evictPlc = new CacheIgfsPerBlockLruEvictionPolicy();

dataCacheCfg.setEvictionPolicy(evictPlc);
dataCacheCfg.setAffinityMapper(new IgfsGroupDataBlocksKeyMapper(128));
Expand Down
Expand Up @@ -28,7 +28,7 @@
* Test suite for Hadoop file system over Ignite cache.
* Contains platform independent tests only.
*/
public class IgniteFsTestSuite extends TestSuite {
public class IgniteIgfsTestSuite extends TestSuite {
/**
* @return Test suite.
* @throws Exception Thrown in case of the failure.
Expand Down

This file was deleted.

0 comments on commit d096d13

Please sign in to comment.