incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cr...@apache.org
Subject [09/30] git commit: Changing the api to allow for different table configurations for size and filters.
Date Thu, 07 Nov 2013 02:41:32 GMT
Changing the api to allow for different table configurations for size and filters.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/1c3a4a11
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/1c3a4a11
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/1c3a4a11

Branch: refs/heads/blur-console-v2
Commit: 1c3a4a11472194e03b92f937f39fe572b32ce4b6
Parents: 32ba117
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Sun Oct 20 21:41:53 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Sun Oct 20 21:42:11 2013 -0400

----------------------------------------------------------------------
 .../apache/blur/store/BlockCacheDirectoryFactoryV2.java | 10 +++++-----
 .../org/apache/blur/store/blockcache_v2/BaseCache.java  | 10 +++++-----
 .../apache/blur/store/blockcache_v2/CacheDirectory.java | 12 ++++++++++++
 .../apache/blur/store/blockcache_v2/FileNameFilter.java |  2 +-
 .../java/org/apache/blur/store/blockcache_v2/Quiet.java |  2 +-
 .../java/org/apache/blur/store/blockcache_v2/Size.java  |  2 +-
 .../org/apache/blur/store/CacheDirectoryTestSuite.java  | 10 +++++-----
 .../blur/store/blockcache_v2/CacheDirectoryTest.java    | 10 +++++-----
 8 files changed, 35 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
b/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
index aff5823..6135266 100644
--- a/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
+++ b/blur-store/src/main/java/org/apache/blur/store/BlockCacheDirectoryFactoryV2.java
@@ -42,21 +42,21 @@ public class BlockCacheDirectoryFactoryV2 extends BlockCacheDirectoryFactory
{
 
     Size fileBufferSize = new Size() {
       @Override
-      public int getSize(String directoryName, String fileName) {
+      public int getSize(CacheDirectory directory, String fileName) {
         return fileBufferSizeInt;
       }
     };
 
     Size cacheBlockSize = new Size() {
       @Override
-      public int getSize(String directoryName, String fileName) {
+      public int getSize(CacheDirectory directory, String fileName) {
         return cacheBlockSizeInt;
       }
     };
 
     FileNameFilter readFilter = new FileNameFilter() {
       @Override
-      public boolean accept(String directoryName, String fileName) {
+      public boolean accept(CacheDirectory directory, String fileName) {
         if (fileName.endsWith(".fdt") || fileName.endsWith(".fdx")) {
           return false;
         }
@@ -66,7 +66,7 @@ public class BlockCacheDirectoryFactoryV2 extends BlockCacheDirectoryFactory
{
 
     FileNameFilter writeFilter = new FileNameFilter() {
       @Override
-      public boolean accept(String directoryName, String fileName) {
+      public boolean accept(CacheDirectory directory, String fileName) {
         if (fileName.endsWith(".fdt") || fileName.endsWith(".fdx")) {
           return false;
         }
@@ -76,7 +76,7 @@ public class BlockCacheDirectoryFactoryV2 extends BlockCacheDirectoryFactory
{
 
     Quiet quiet = new Quiet() {
       @Override
-      public boolean shouldBeQuiet(String directoryName, String fileName) {
+      public boolean shouldBeQuiet(CacheDirectory directory, String fileName) {
         Thread thread = Thread.currentThread();
         String name = thread.getName();
         if (name.startsWith(SHARED_MERGE_SCHEDULER)) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
index 6d80797..1c69e5e 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/BaseCache.java
@@ -170,7 +170,7 @@ public class BaseCache extends Cache implements Closeable {
 
   @Override
   public boolean shouldBeQuiet(CacheDirectory directory, String fileName) {
-    return _quiet.shouldBeQuiet(directory.getDirectoryName(), fileName);
+    return _quiet.shouldBeQuiet(directory, fileName);
   }
 
   @Override
@@ -210,22 +210,22 @@ public class BaseCache extends Cache implements Closeable {
 
   @Override
   public int getCacheBlockSize(CacheDirectory directory, String fileName) {
-    return _cacheBlockSize.getSize(directory.getDirectoryName(), fileName);
+    return _cacheBlockSize.getSize(directory, fileName);
   }
 
   @Override
   public int getFileBufferSize(CacheDirectory directory, String fileName) {
-    return _fileBufferSize.getSize(directory.getDirectoryName(), fileName);
+    return _fileBufferSize.getSize(directory, fileName);
   }
 
   @Override
   public boolean cacheFileForReading(CacheDirectory directory, String fileName, IOContext
context) {
-    return _readFilter.accept(directory.getDirectoryName(), fileName);
+    return _readFilter.accept(directory, fileName);
   }
 
   @Override
   public boolean cacheFileForWriting(CacheDirectory directory, String fileName, IOContext
context) {
-    return _writeFilter.accept(directory.getDirectoryName(), fileName);
+    return _writeFilter.accept(directory, fileName);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheDirectory.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheDirectory.java
b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheDirectory.java
index 341c409..8d71912 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheDirectory.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/CacheDirectory.java
@@ -34,17 +34,29 @@ public class CacheDirectory extends Directory implements DirectoryDecorator,
Las
   private final Directory _internal;
   private final String _directoryName;
   private final Cache _cache;
+  private final String _shard;
+  private final String _table;
 
   public CacheDirectory(String table, String shard, Directory directory, Cache cache) {
     if (!(directory instanceof LastModified)) {
       throw new RuntimeException("Directory [" + directory + "] does not implement '" + LastModified.class.toString()
           + "'");
     }
+    _table = table;
+    _shard = shard;
     _directoryName = notNull(table + "_" + shard);
     _internal = notNull(directory);
     _cache = notNull(cache);
   }
 
+  public String getShard() {
+    return _shard;
+  }
+
+  public String getTable() {
+    return _table;
+  }
+
   @Override
   protected void finalize() throws Throwable {
     _cache.releaseDirectory(getDirectoryName());

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/FileNameFilter.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/FileNameFilter.java
b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/FileNameFilter.java
index 03a969c..d9f6f9f 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/FileNameFilter.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/FileNameFilter.java
@@ -19,6 +19,6 @@ package org.apache.blur.store.blockcache_v2;
 
 public interface FileNameFilter {
 
-  boolean accept(String directoryName, String fileName);
+  boolean accept(CacheDirectory directory, String fileName);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Quiet.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Quiet.java b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Quiet.java
index e7c9fb7..8cbd49f 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Quiet.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Quiet.java
@@ -17,5 +17,5 @@
 package org.apache.blur.store.blockcache_v2;
 
 public interface Quiet {
-  boolean shouldBeQuiet(String directoryName, String fileName);
+  boolean shouldBeQuiet(CacheDirectory directory, String fileName);
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Size.java
----------------------------------------------------------------------
diff --git a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Size.java b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Size.java
index c392a06..fa3ac1f 100644
--- a/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Size.java
+++ b/blur-store/src/main/java/org/apache/blur/store/blockcache_v2/Size.java
@@ -18,5 +18,5 @@
 package org.apache.blur.store.blockcache_v2;
 
 public interface Size {
-  int getSize(String directoryName, String fileName);
+  int getSize(CacheDirectory directory, String fileName);
 }

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
----------------------------------------------------------------------
diff --git a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
index 38e448f..87fcaad 100644
--- a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
+++ b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java
@@ -41,33 +41,33 @@ public abstract class CacheDirectoryTestSuite extends BaseDirectoryTestSuite
{
 
     Size fileBufferSize = new Size() {
       @Override
-      public int getSize(String directoryName, String fileName) {
+      public int getSize(CacheDirectory directory, String fileName) {
         return fileBufferSizeInt;
       }
     };
 
     Size cacheBlockSize = new Size() {
       @Override
-      public int getSize(String directoryName, String fileName) {
+      public int getSize(CacheDirectory directory, String fileName) {
         return cacheBlockSizeInt;
       }
     };
 
     FileNameFilter writeFilter = new FileNameFilter() {
       @Override
-      public boolean accept(String directoryName, String fileName) {
+      public boolean accept(CacheDirectory directory, String fileName) {
         return true;
       }
     };
     FileNameFilter readFilter = new FileNameFilter() {
       @Override
-      public boolean accept(String directoryName, String fileName) {
+      public boolean accept(CacheDirectory directory, String fileName) {
         return true;
       }
     };
     Quiet quiet = new Quiet() {
       @Override
-      public boolean shouldBeQuiet(String directoryName, String fileName) {
+      public boolean shouldBeQuiet(CacheDirectory directory, String fileName) {
         return false;
       }
     };

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c3a4a11/blur-store/src/test/java/org/apache/blur/store/blockcache_v2/CacheDirectoryTest.java
----------------------------------------------------------------------
diff --git a/blur-store/src/test/java/org/apache/blur/store/blockcache_v2/CacheDirectoryTest.java
b/blur-store/src/test/java/org/apache/blur/store/blockcache_v2/CacheDirectoryTest.java
index b351fcf..b6b615a 100644
--- a/blur-store/src/test/java/org/apache/blur/store/blockcache_v2/CacheDirectoryTest.java
+++ b/blur-store/src/test/java/org/apache/blur/store/blockcache_v2/CacheDirectoryTest.java
@@ -59,31 +59,31 @@ public class CacheDirectoryTest {
     final int cacheBlockSizeInt = 131;
     Size fileBufferSize = new Size() {
       @Override
-      public int getSize(String directoryName, String fileName) {
+      public int getSize(CacheDirectory directory, String fileName) {
         return fileBufferSizeInt;
       }
     };
     Size cacheBlockSize = new Size() {
       @Override
-      public int getSize(String directoryName, String fileName) {
+      public int getSize(CacheDirectory directory, String fileName) {
         return cacheBlockSizeInt;
       }
     };
     FileNameFilter writeFilter = new FileNameFilter() {
       @Override
-      public boolean accept(String directoryName, String fileName) {
+      public boolean accept(CacheDirectory directory, String fileName) {
         return true;
       }
     };
     FileNameFilter readFilter = new FileNameFilter() {
       @Override
-      public boolean accept(String directoryName, String fileName) {
+      public boolean accept(CacheDirectory directory, String fileName) {
         return true;
       }
     };
     Quiet quiet = new Quiet() {
       @Override
-      public boolean shouldBeQuiet(String directoryName, String fileName) {
+      public boolean shouldBeQuiet(CacheDirectory directory, String fileName) {
         return false;
       }
     };


Mime
View raw message