src/java/org/apache/cassandra/db/ColumnFamily.java
/*
     * This function will calculate the difference between 2 column families.
     * The external input is assumed to be a superset of internal.
     */
This function will calculate the difference between 2 column families.
The external input is assumed to be a superset of internal.
This function will calculate the difference between 2 column families . The external input is assumed to be a superset of internal .
public ColumnFamily diff(ColumnFamily cfComposite)
    {
        assert cfComposite.id().equals(id());
        ColumnFamily cfDiff = ColumnFamily.create(cfm);
        if (cfComposite.getMarkedForDeleteAt() > getMarkedForDeleteAt())
        {
            cfDiff.delete(cfComposite.getLocalDeletionTime(), cfComposite.getMarkedForDeleteAt());
        }
        for (IColumn columnExternal : cfComposite)
        {
            ByteBuffer cName = columnExternal.name();
            IColumn columnInternal = this.columns.getColumn(cName);
            if (columnInternal == null)
            {
                cfDiff.addColumn(columnExternal);
            }
            else
            {
                IColumn columnDiff = columnInternal.diff(columnExternal);
                if (columnDiff != null)
                {
                    cfDiff.addColumn(columnDiff);
                }
            }
        }
        if (!cfDiff.isEmpty() || cfDiff.isMarkedForDelete())
            return cfDiff;
        return null;
    }
public ColumnFamily diff ( ColumnFamily cfComposite ) { assert cfComposite . id ( ) . equals ( id ( ) ) ; ColumnFamily cfDiff = ColumnFamily . create ( cfm ) ; if ( cfComposite . getMarkedForDeleteAt ( ) > getMarkedForDeleteAt ( ) ) { cfDiff . delete ( cfComposite . getLocalDeletionTime ( ) , cfComposite . getMarkedForDeleteAt ( ) ) ; } for ( IColumn columnExternal : cfComposite ) { ByteBuffer cName = columnExternal . name ( ) ; IColumn columnInternal = this . columns . getColumn ( cName ) ; if ( columnInternal == null ) { cfDiff . addColumn ( columnExternal ) ; } else { IColumn columnDiff = columnInternal . diff ( columnExternal ) ; if ( columnDiff != null ) { cfDiff . addColumn ( columnDiff ) ; } } } if ( ! cfDiff . isEmpty ( ) || cfDiff . isMarkedForDelete ( ) ) return cfDiff ; return null ; }
This function will calculate the difference between 2 column families.
This function will calculate the difference between 2 column families .
// (don't need to worry about cfNew containing IColumns that are shadowed by // the delete tombstone, since cfNew was generated by CF.resolve, which // takes care of those for us.)