cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r759203 - in /incubator/cassandra/trunk/src/org/apache/cassandra/db: ColumnFamily.java CountFilter.java DBManager.java Memtable.java NamesFilter.java SystemTable.java TimeFilter.java
Date Fri, 27 Mar 2009 16:32:14 GMT
Author: jbellis
Date: Fri Mar 27 16:32:14 2009
New Revision: 759203

URL: http://svn.apache.org/viewvc?rev=759203&view=rev
Log:
r/m redundant name from addColumn(name, IColumn)

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamily.java
    incubator/cassandra/trunk/src/org/apache/cassandra/db/CountFilter.java
    incubator/cassandra/trunk/src/org/apache/cassandra/db/DBManager.java
    incubator/cassandra/trunk/src/org/apache/cassandra/db/Memtable.java
    incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java
    incubator/cassandra/trunk/src/org/apache/cassandra/db/SystemTable.java
    incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamily.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamily.java?rev=759203&r1=759202&r2=759203&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamily.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamily.java Fri Mar 27 16:32:14
2009
@@ -184,12 +184,8 @@
     */
     void addColumns(ColumnFamily cf)
     {
-        Map<String, IColumn> columns = cf.getColumns();
-        Set<String> cNames = columns.keySet();
-
-        for ( String cName : cNames )
-        {
-        	addColumn(cName, columns.get(cName));
+        for (IColumn column : cf.getAllColumns()) {
+            addColumn(column);
         }
     }
 
@@ -202,7 +198,7 @@
     public void createColumn(String name)
     {
     	IColumn column = columnFactory_.createColumn(name);
-    	addColumn(column.name(), column);
+    	addColumn(column);
     }
 
     int getColumnCount()
@@ -230,13 +226,13 @@
     public void createColumn(String name, byte[] value)
     {
     	IColumn column = columnFactory_.createColumn(name, value);
-    	addColumn(column.name(), column);
+    	addColumn(column);
     }
 
 	public void createColumn(String name, byte[] value, long timestamp)
 	{
 		IColumn column = columnFactory_.createColumn(name, value, timestamp);
-		addColumn(column.name(), column);
+		addColumn(column);
 	}
 
     void clear()
@@ -248,9 +244,10 @@
      * If we find an old column that has the same name
      * the ask it to resolve itself else add the new column .
     */
-    void addColumn(String name, IColumn column)
+    void addColumn(IColumn column)
     {
     	int newSize = 0;
+        String name = column.name();
         IColumn oldColumn = columns_.get(name);
         if ( oldColumn != null )
         {
@@ -377,14 +374,14 @@
         	IColumn columnExternal = columns.get(cName);
         	if( columnInternal == null )
         	{
-        		cfDiff.addColumn(cName, columnExternal);
+        		cfDiff.addColumn(columnExternal);
         	}
         	else
         	{
             	IColumn columnDiff = columnInternal.diff(columnExternal);
         		if(columnDiff != null)
         		{
-        			cfDiff.addColumn(cName, columnDiff);
+        			cfDiff.addColumn(columnDiff);
         		}
         	}
         }
@@ -533,7 +530,7 @@
         	column = cf.getColumnSerializer().deserialize(dis);
         	if(column != null)
         	{
-        		cf.addColumn(column.name(), column);
+        		cf.addColumn(column);
         	}
         }
     }
@@ -562,7 +559,7 @@
             	column = cf.getColumnSerializer().deserialize(dis, filter);
             	if(column != null)
             	{
-            		cf.addColumn(column.name(), column);
+            		cf.addColumn(column);
             		column = null;
             		if(filter.isDone())
             		{
@@ -599,7 +596,7 @@
 	            IColumn column = cf.getColumnSerializer().deserialize(dis, columnName, filter);
 	            if ( column != null )
 	            {
-	                cf.addColumn(column.name(), column);
+	                cf.addColumn(column);
 	                break;
 	            }
             }

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/CountFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/CountFilter.java?rev=759203&r1=759202&r2=759203&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/CountFilter.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/CountFilter.java Fri Mar 27 16:32:14
2009
@@ -62,7 +62,7 @@
     		Collection<IColumn> columns = columnFamily.getAllColumns();
     		for(IColumn column : columns)
     		{
-    			filteredCf.addColumn(column.name(), column);
+    			filteredCf.addColumn(column);
     			countLimit_--;
     			if( countLimit_ <= 0 )
     			{
@@ -78,7 +78,7 @@
     		{
     			SuperColumn superColumn = (SuperColumn)column;
     			SuperColumn filteredSuperColumn = new SuperColumn(superColumn.name());
-				filteredCf.addColumn(filteredSuperColumn.name(), filteredSuperColumn);
+				filteredCf.addColumn(filteredSuperColumn);
         		Collection<IColumn> subColumns = superColumn.getSubColumns();
         		for(IColumn subColumn : subColumns)
         		{

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/DBManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/DBManager.java?rev=759203&r1=759202&r2=759203&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/DBManager.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/DBManager.java Fri Mar 27 16:32:14
2009
@@ -175,8 +175,8 @@
             String key = FBUtilities.getHostName();
             row = new Row(key);
             ColumnFamily cf = new ColumnFamily(SystemTable.cfName_);
-            cf.addColumn(SystemTable.token_, new Column(SystemTable.token_, token.toByteArray())
);
-            cf.addColumn(SystemTable.generation_, new Column(SystemTable.generation_, BasicUtilities.intToByteArray(generation))
);
+            cf.addColumn(new Column(SystemTable.token_, token.toByteArray()));
+            cf.addColumn(new Column(SystemTable.generation_, BasicUtilities.intToByteArray(generation)));
             row.addColumnFamily(cf);
             sysTable.apply(row);
             storageMetadata = new StorageMetadata( token, generation);
@@ -197,8 +197,7 @@
                 IColumn generation = columnFamily.getColumn(SystemTable.generation_);
                 int gen = BasicUtilities.byteArrayToInt(generation.value()) + 1;
 
-                Column generation2 = new Column("Generation", BasicUtilities.intToByteArray(gen),
generation.timestamp() + 1);
-                columnFamily.addColumn("Generation", generation2);
+                columnFamily.addColumn(new Column("Generation", BasicUtilities.intToByteArray(gen),
generation.timestamp() + 1));
                 storageMetadata = new StorageMetadata( bi, gen );
                 break;
             }

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/Memtable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/Memtable.java?rev=759203&r1=759202&r2=759203&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/Memtable.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/Memtable.java Fri Mar 27 16:32:14
2009
@@ -359,7 +359,7 @@
         		if(column != null )
         		{
         			columnFamily = new ColumnFamily(cfName_);
-        			columnFamily.addColumn(column.name(), column);
+        			columnFamily.addColumn(column);
         		}
         	}
         	else

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java?rev=759203&r1=759202&r2=759203&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java Fri Mar 27 16:32:14
2009
@@ -56,7 +56,7 @@
 		        if ( names_.contains(column.name()) )
 		        {
 		            names_.remove(column.name());            
-					filteredCf.addColumn(column.name(), column);
+					filteredCf.addColumn(column);
 		        }
 				if( isDone() )
 				{
@@ -70,8 +70,8 @@
     		for(IColumn column : columns)
     		{
     			SuperColumn superColumn = (SuperColumn)column;
-    			SuperColumn filteredSuperColumn = new SuperColumn(superColumn.name());
-				filteredCf.addColumn(filteredSuperColumn.name(), filteredSuperColumn);
+                SuperColumn filteredSuperColumn = new SuperColumn(superColumn.name());
+                filteredCf.addColumn(filteredSuperColumn);
         		Collection<IColumn> subColumns = superColumn.getSubColumns();
         		for(IColumn subColumn : subColumns)
         		{

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/SystemTable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/SystemTable.java?rev=759203&r1=759202&r2=759203&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/SystemTable.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/SystemTable.java Fri Mar 27 16:32:14
2009
@@ -160,7 +160,7 @@
             IColumn tokenColumn = new Column(SystemTable.token_, token.toByteArray(), oldTokenColumnTimestamp
+ 1);
             /* replace the old "Token" column with this new one. */
             logger_.debug("Replacing old token " + new BigInteger( columnFamily.getColumn(SystemTable.token_).value()
).toString() + " with token " + token.toString());
-            columnFamily.addColumn(SystemTable.token_, tokenColumn);
+            columnFamily.addColumn(tokenColumn);
             reset(systemRow_);
         }
     }

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java?rev=759203&r1=759202&r2=759203&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/TimeFilter.java Fri Mar 27 16:32:14
2009
@@ -58,7 +58,7 @@
     		{
     			if ( column.timestamp() >=  timeLimit_ )
     			{
-    				filteredCf.addColumn(column.name(), column);
+    				filteredCf.addColumn(column);
     				++i;
     			}
     			else
@@ -82,8 +82,8 @@
     		for(IColumn column : columns)
     		{
     			SuperColumn superColumn = (SuperColumn)column;
-    			SuperColumn filteredSuperColumn = new SuperColumn(superColumn.name());
-				filteredCf.addColumn(filteredSuperColumn.name(), filteredSuperColumn);
+       			SuperColumn filteredSuperColumn = new SuperColumn(superColumn.name());
+				filteredCf.addColumn(filteredSuperColumn);
         		Collection<IColumn> subColumns = superColumn.getSubColumns();
         		int i = 0;
         		for(IColumn subColumn : subColumns)



Mime
View raw message