cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r772000 - in /incubator/cassandra/trunk: src/java/org/apache/cassandra/db/ test/unit/org/apache/cassandra/db/
Date Tue, 05 May 2009 22:47:23 GMT
Author: jbellis
Date: Tue May  5 22:47:22 2009
New Revision: 772000

URL: http://svn.apache.org/viewvc?rev=772000&view=rev
Log:
refactor IColumn.addColumn to remove redundant name parameter.  patch by Sandeep Tata; reviewed
by jbellis for CASSANDRA-96

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/AbstractColumnFactory.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CountFilter.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/NamesFilter.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/TimeFilter.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RangeFilterTest.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java
    incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/AbstractColumnFactory.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/AbstractColumnFactory.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/AbstractColumnFactory.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/AbstractColumnFactory.java
Tue May  5 22:47:22 2009
@@ -104,7 +104,7 @@
         if(values.length == 2)
         {
 	        IColumn subColumn = new Column(values[1]);
-	        superColumn.addColumn(values[1], subColumn);
+	        superColumn.addColumn(subColumn);
         }
 		return superColumn;
 	}
@@ -126,7 +126,7 @@
             throw new IllegalArgumentException("Super Column " + name + " in invalid format.
Must be in <super column name>:<column name> format.");
         IColumn superColumn = new SuperColumn(values[0]);
         IColumn subColumn = new Column(values[1], value, timestamp, deleted);
-        superColumn.addColumn(values[1], subColumn);
+        superColumn.addColumn(subColumn);
 		return superColumn;
 	}
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java Tue May  5 22:47:22
2009
@@ -157,7 +157,7 @@
         return size();
     }
 
-    public void addColumn(String name, IColumn column)
+    public void addColumn(IColumn column)
     {
         throw new UnsupportedOperationException("This operation is not supported for simple
columns.");
     }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Tue
May  5 22:47:22 2009
@@ -637,7 +637,7 @@
                     {
                         if (!subColumn.isMarkedForDelete() || subColumn.getLocalDeletionTime()
> gcBefore)
                         {
-                            sc.addColumn(subColumn.name(), subColumn);
+                            sc.addColumn(subColumn);
                         }
                     }
                 }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CountFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CountFilter.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CountFilter.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CountFilter.java Tue May  5
22:47:22 2009
@@ -92,7 +92,7 @@
         		for(IColumn subColumn : subColumns)
         		{
         			if (offset_ <=0 ){
-        				filteredSuperColumn.addColumn(subColumn.name(), subColumn);
+        				filteredSuperColumn.addColumn(subColumn);
         				countLimit_--;
         			} else
         				offset_--;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/IColumn.java Tue May  5 22:47:22
2009
@@ -39,7 +39,7 @@
     public byte[] value(String key);
     public Collection<IColumn> getSubColumns();
     public IColumn getSubColumn(String columnName);
-    public void addColumn(String name, IColumn column);
+    public void addColumn(IColumn column);
     public IColumn diff(IColumn column);
     public int getObjectCount();
     public byte[] digest();

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Memtable.java Tue May  5 22:47:22
2009
@@ -288,7 +288,7 @@
                         columnFamily = cFamily.cloneMeShallow();
                         SuperColumn container = new SuperColumn(superColumn.name());
                         container.markForDeleteAt(superColumn.getLocalDeletionTime(), superColumn.getMarkedForDeleteAt());
-                        container.addColumn(subColumn.name(), subColumn);
+                        container.addColumn(subColumn);
                         columnFamily.addColumn(container);
                     }
                 }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/NamesFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/NamesFilter.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/NamesFilter.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/NamesFilter.java Tue May  5
22:47:22 2009
@@ -77,7 +77,7 @@
     		        if ( names_.contains(subColumn.name()) )
     		        {
     		            names_.remove(subColumn.name());
-    		            filteredSuperColumn.addColumn(subColumn.name(), subColumn);
+    		            filteredSuperColumn.addColumn(subColumn);
     		        }
     				if( isDone() )
     				{

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java Tue May  5
22:47:22 2009
@@ -174,21 +174,21 @@
     	throw new IllegalArgumentException("Value was requested for a column that does not exist.");
     }
 
-    public void addColumn(String name, IColumn column)
+    public void addColumn(IColumn column)
     {
     	if (!(column instanceof Column))
     		throw new UnsupportedOperationException("A super column can only contain simple columns.");
-    	IColumn oldColumn = columns_.get(name);
+    	IColumn oldColumn = columns_.get(column.name());
     	if ( oldColumn == null )
         {
-    		columns_.put(name, column);
+    		columns_.put(column.name(), column);
             size_.addAndGet(column.size());
         }
     	else
     	{
     		if (((Column)oldColumn).comparePriority((Column)column) <= 0)
             {
-    			columns_.put(name, column);
+    			columns_.put(column.name(), column);
                 int delta = (-1)*oldColumn.size();
                 /* subtract the size of the oldColumn */
                 size_.addAndGet(delta);
@@ -211,7 +211,7 @@
 
         for (IColumn subColumn : column.getSubColumns())
         {
-        	addColumn(subColumn.name(), subColumn);
+        	addColumn(subColumn);
         }
         if (column.getMarkedForDeleteAt() > markedForDeleteAt)
         {
@@ -249,14 +249,14 @@
         	IColumn columnInternal = columns_.get(subColumn.name());
         	if(columnInternal == null )
         	{
-        		columnDiff.addColumn(subColumn.name(), subColumn);
+        		columnDiff.addColumn(subColumn);
         	}
         	else
         	{
             	IColumn subColumnDiff = columnInternal.diff(subColumn);
         		if(subColumnDiff != null)
         		{
-            		columnDiff.addColumn(subColumn.name(), subColumnDiff);
+            		columnDiff.addColumn(subColumnDiff);
         		}
         	}
         }
@@ -371,7 +371,7 @@
         for ( int i = 0; i < size; ++i )
         {
             IColumn subColumn = Column.serializer().deserialize(dis);
-            superColumn.addColumn(subColumn.name(), subColumn);
+            superColumn.addColumn(subColumn);
         }
     }
 
@@ -423,7 +423,7 @@
                     column = Column.serializer().deserialize(dis, filter);
                     if(column != null)
                     {
-                        superColumn.addColumn(column.name(), column);
+                        superColumn.addColumn(column);
                         column = null;
                         if(filter.isDone())
                         {
@@ -457,7 +457,7 @@
                     IColumn subColumn = Column.serializer().deserialize(dis, names[1], filter);
                     if ( subColumn != null )
                     {
-                        superColumn.addColumn(subColumn.name(), subColumn);
+                        superColumn.addColumn(subColumn);
                         break;
                     }
                 }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/TimeFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/TimeFilter.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/TimeFilter.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/TimeFilter.java Tue May  5
22:47:22 2009
@@ -92,7 +92,7 @@
         		{
 	    			if (  subColumn.timestamp()  >=  timeLimit_ )
 	    			{
-			            filteredSuperColumn.addColumn(subColumn.name(), subColumn);
+			            filteredSuperColumn.addColumn(subColumn);
 	    				++i;
 	    			}
 	    			else

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RangeFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RangeFilterTest.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RangeFilterTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RangeFilterTest.java Tue May
 5 22:47:22 2009
@@ -70,24 +70,24 @@
         byte[] val = "test value".getBytes();
         SuperColumn sc = null;
         sc = new SuperColumn("a");
-        sc.addColumn("a1", new Column("a1", val, System.currentTimeMillis()));
-        sc.addColumn("a2", new Column("a2", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("a1", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("a2", val, System.currentTimeMillis()));
         cf.addColumn(sc);
         sc = new SuperColumn("b");
-        sc.addColumn("b1", new Column("b1", val, System.currentTimeMillis()));
-        sc.addColumn("b2", new Column("b2", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("b1", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("b2", val, System.currentTimeMillis()));
         cf.addColumn(sc);
         sc = new SuperColumn("c");
-        sc.addColumn("c1", new Column("c1", val, System.currentTimeMillis()));
-        sc.addColumn("c2", new Column("c2", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("c1", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("c2", val, System.currentTimeMillis()));
         cf.addColumn(sc);
         sc = new SuperColumn("d");
-        sc.addColumn("d1", new Column("d1", val, System.currentTimeMillis()));
-        sc.addColumn("d2", new Column("d2", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("d1", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("d2", val, System.currentTimeMillis()));
         cf.addColumn(sc);
         sc = new SuperColumn("e");
-        sc.addColumn("e1", new Column("e1", val, System.currentTimeMillis()));
-        sc.addColumn("e2", new Column("e2", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("e1", val, System.currentTimeMillis()));
+        sc.addColumn(new Column("e2", val, System.currentTimeMillis()));
         cf.addColumn(sc);
 
         IFilter f = new RangeFilter("b", "d");

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java Tue May  5 22:47:22
2009
@@ -25,7 +25,7 @@
     public void testDiffSuperColumn()
     {
         SuperColumn sc1 = new SuperColumn("one");
-        sc1.addColumn("subcolumn", new Column("subcolumn", "A".getBytes(), 0));
+        sc1.addColumn(new Column("subcolumn", "A".getBytes(), 0));
 
         SuperColumn sc2 = new SuperColumn("one");
         sc2.markForDeleteAt(0, 0);

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java Tue May
 5 22:47:22 2009
@@ -10,7 +10,7 @@
     public void testMissingSubcolumn() {
     	byte[] val = "sample value".getBytes();
     	SuperColumn sc = new SuperColumn("sc1");
-    	sc.addColumn("col1", new Column("col1",val,1L));
+    	sc.addColumn(new Column("col1",val,1L));
     	assertNotNull(sc.getSubColumn("col1"));
     	assertNull(sc.getSubColumn("col2"));
     }

Modified: incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java?rev=772000&r1=771999&r2=772000&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java (original)
+++ incubator/cassandra/trunk/test/unit/org/apache/cassandra/db/TableTest.java Tue May  5
22:47:22 2009
@@ -129,11 +129,11 @@
         RowMutation rm = new RowMutation(TABLE_NAME,TEST_KEY);
         ColumnFamily cf = new ColumnFamily("Super1","Super");
         SuperColumn sc1 = new SuperColumn("sc1");
-        sc1.addColumn("col1", new Column("col1","val1".getBytes(), 1L));
-        sc1.addColumn("col2", new Column("col2","val2".getBytes(), 1L));
+        sc1.addColumn(new Column("col1","val1".getBytes(), 1L));
+        sc1.addColumn(new Column("col2","val2".getBytes(), 1L));
         SuperColumn sc2 = new SuperColumn("sc2");
-        sc2.addColumn("col3", new Column("col3","val3".getBytes(), 1L));
-        sc2.addColumn("col4", new Column("col4","val4".getBytes(), 1L));
+        sc2.addColumn(new Column("col3","val3".getBytes(), 1L));
+        sc2.addColumn(new Column("col4","val4".getBytes(), 1L));
         cf.addColumn(sc1);
         cf.addColumn(sc2);
         rm.add(cf);



Mime
View raw message