incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: Adding the TableContext to the shard route interface so that the command has enough information about the table.
Date Tue, 23 Sep 2014 13:25:59 GMT
Repository: incubator-blur
Updated Branches:
  refs/heads/master 86f30c9aa -> c08882f31


Adding the TableContext to the shard route interface so that the command has enough information
about the table.


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

Branch: refs/heads/master
Commit: c08882f31014e79d8e013559e24e87a8dc11fa00
Parents: 86f30c9
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue Sep 23 09:25:55 2014 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue Sep 23 09:25:55 2014 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/blur/command/BaseCommandManager.java   | 5 +++--
 .../java/org/apache/blur/command/ControllerClusterContext.java  | 4 ++--
 .../main/java/org/apache/blur/command/ShardCommandManager.java  | 2 +-
 blur-core/src/main/java/org/apache/blur/command/ShardRoute.java | 4 +++-
 4 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c08882f3/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
index 7169077..b9c713c 100644
--- a/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/BaseCommandManager.java
@@ -38,6 +38,7 @@ import org.apache.blur.command.annotation.RequiredArguments;
 import org.apache.blur.concurrent.Executors;
 import org.apache.blur.log.Log;
 import org.apache.blur.log.LogFactory;
+import org.apache.blur.server.TableContextFactory;
 import org.apache.commons.io.IOUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
@@ -354,12 +355,12 @@ public class BaseCommandManager implements Closeable {
     return _commandNameLookup.get(clazz);
   }
 
-  protected Map<String, Set<Shard>> getShards(Command command, final Args args,
Set<String> tables) throws IOException {
+  protected Map<String, Set<Shard>> getShards(TableContextFactory tableContextFactory,
Command command, final Args args, Set<String> tables) throws IOException {
     Map<String, Set<Shard>> shardMap = new TreeMap<String, Set<Shard>>();
     if (command instanceof ShardRoute) {
       ShardRoute shardRoute = (ShardRoute) command;
       for (String table : tables) {
-        shardMap.put(table, shardRoute.resolveShards(table, args));
+        shardMap.put(table, shardRoute.resolveShards(tableContextFactory.getTableContext(table),
args));
       }
     } else {
       if (tables.size() > 1) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c08882f3/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
b/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
index bcb8e74..30bbbed 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ControllerClusterContext.java
@@ -119,7 +119,7 @@ public class ControllerClusterContext extends ClusterContext implements
Closeabl
     Command command = _manager.getCommandObject(commandName);
     Map<Shard, Future<T>> futureMap = new HashMap<Shard, Future<T>>();
     Set<String> tables = _manager.getTables(command, args);
-    Map<String, Set<Shard>> shards = _manager.getShards(command, args, tables);
+    Map<String, Set<Shard>> shards = _manager.getShards(_tableContextFactory,
command, args, tables);
     Map<Server, Client> clientMap = getClientMap(command, args, tables, shards);
 
     for (Entry<Server, Client> e : clientMap.entrySet()) {
@@ -209,7 +209,7 @@ public class ControllerClusterContext extends ClusterContext implements
Closeabl
     Command command = _manager.getCommandObject(commandName);
     Map<Server, Future<T>> futureMap = new HashMap<Server, Future<T>>();
     Set<String> tables = _manager.getTables(command, args);
-    Map<String, Set<Shard>> shards = _manager.getShards(command, args, tables);
+    Map<String, Set<Shard>> shards = _manager.getShards(_tableContextFactory,
command, args, tables);
     Map<Server, Client> clientMap = getClientMap(command, args, tables, shards);
     for (Entry<Server, Client> e : clientMap.entrySet()) {
       Server server = e.getKey();

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c08882f3/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
index 562f0c9..92909fe 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ShardCommandManager.java
@@ -111,7 +111,7 @@ public class ShardCommandManager extends BaseCommandManager {
     if (tables.isEmpty()) {
       throw new IOException("At least one table needs to specified.");
     }
-    Map<String, Set<Shard>> shardMap = getShards(command, args, tables);
+    Map<String, Set<Shard>> shardMap = getShards(tableContextFactory, command,
args, tables);
 
     Map<Shard, Future<?>> futureMap = new HashMap<Shard, Future<?>>();
     for (String table : tables) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c08882f3/blur-core/src/main/java/org/apache/blur/command/ShardRoute.java
----------------------------------------------------------------------
diff --git a/blur-core/src/main/java/org/apache/blur/command/ShardRoute.java b/blur-core/src/main/java/org/apache/blur/command/ShardRoute.java
index ce38b59..7f59857 100644
--- a/blur-core/src/main/java/org/apache/blur/command/ShardRoute.java
+++ b/blur-core/src/main/java/org/apache/blur/command/ShardRoute.java
@@ -2,6 +2,8 @@ package org.apache.blur.command;
 
 import java.util.Set;
 
+import org.apache.blur.server.TableContext;
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements. See the NOTICE file distributed with this
@@ -21,6 +23,6 @@ import java.util.Set;
 
 public interface ShardRoute {
 
-  Set<Shard> resolveShards(String table, Args args);
+  Set<Shard> resolveShards(TableContext tableContext, Args args);
 
 }


Mime
View raw message