cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eev...@apache.org
Subject svn commit: r991650 - in /cassandra/trunk: interface/cassandra.genavro src/java/org/apache/cassandra/avro/CassandraServer.java
Date Wed, 01 Sep 2010 18:57:26 GMT
Author: eevans
Date: Wed Sep  1 18:57:26 2010
New Revision: 991650

URL: http://svn.apache.org/viewvc?rev=991650&view=rev
Log:
avro: describe_splits implementation

Patch by Jeremy Hanna; reviewed by eevans

Modified:
    cassandra/trunk/interface/cassandra.genavro
    cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java

Modified: cassandra/trunk/interface/cassandra.genavro
URL: http://svn.apache.org/viewvc/cassandra/trunk/interface/cassandra.genavro?rev=991650&r1=991649&r2=991650&view=diff
==============================================================================
--- cassandra/trunk/interface/cassandra.genavro (original)
+++ cassandra/trunk/interface/cassandra.genavro Wed Sep  1 18:57:26 2010
@@ -295,6 +295,19 @@ protocol Cassandra {
     string describe_version();
 
     string describe_partitioner();
+
+    /**
+     * experimental API for hadoop/parallel query support.
+     * may change violently and without warning.
+     *
+     * returns list of token strings such that first subrange is (list[0], list[1]],
+     * next is (list[1], list[2]], etc.
+     */
+    array<string> describe_splits(string keyspace,
+                                  string cfName,
+                                  string start_token,
+                                  string end_token,
+                                  int keys_per_split);
     
     /** 
      * Get the token ring: a map of ranges to host addresses, represented as

Modified: cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java?rev=991650&r1=991649&r2=991650&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/avro/CassandraServer.java Wed Sep  1 18:57:26
2010
@@ -979,6 +979,18 @@ public class CassandraServer implements 
     }
 
     @Override
+    public List<CharSequence> describe_splits(CharSequence keyspace, CharSequence cfName,
CharSequence start_token, CharSequence end_token, int keys_per_split) {
+        Token.TokenFactory<?> tf = StorageService.getPartitioner().getTokenFactory();
+        List<Token> tokens = StorageService.instance.getSplits(keyspace.toString(),
cfName.toString(), new Range(tf.fromString(start_token.toString()), tf.fromString(end_token.toString())),
keys_per_split);
+        List<CharSequence> splits = new ArrayList<CharSequence>(tokens.size());
+        for (Token token : tokens)
+        {
+            splits.add(tf.toString(token));
+        }
+        return splits;
+    }
+
+    @Override
     public List<KeyCountMapEntry> multiget_count(List<ByteBuffer> keys, ColumnParent
columnParent, SlicePredicate predicate, ConsistencyLevel consistencyLevel)
     throws AvroRemoteException, InvalidRequestException, UnavailableException, TimedOutException
     {



Mime
View raw message