usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject [16/33] incubator-usergrid git commit: Removed unused 1.0 files.
Date Mon, 13 Apr 2015 19:18:23 GMT
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95d39c7/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/StaticIdIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/StaticIdIterator.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/StaticIdIterator.java
deleted file mode 100644
index e04ac6c..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/StaticIdIterator.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query.ir.result;
-
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.usergrid.persistence.cassandra.CursorCache;
-
-
-/** Simple iterator that just returns UUIDs that are set into it */
-public class StaticIdIterator implements ResultIterator {
-
-    private final Set<ScanColumn> ids;
-
-    private boolean returnedOnce = false;
-
-
-    /**
-     *
-     */
-    public StaticIdIterator( UUID id ) {
-        final ScanColumn col = new UUIDIndexSliceParser.UUIDColumn( id, ByteBuffer.allocate(
0 ) );
-
-        ids = Collections.singleton( col );
-    }
-
-
-    @Override
-    public void reset() {
-        //no op
-    }
-
-
-    @Override
-    public void finalizeCursor( CursorCache cache, UUID lastValue ) {
-        //no cursor, it's a static list
-    }
-
-
-    @Override
-    public Iterator<Set<ScanColumn>> iterator() {
-        return this;
-    }
-
-
-    @Override
-    public boolean hasNext() {
-        return !returnedOnce;
-    }
-
-
-    @Override
-    public Set<ScanColumn> next() {
-        returnedOnce = true;
-        return ids;
-    }
-
-
-    @Override
-    public void remove() {
-        throw new UnsupportedOperationException( "This iterator does not support remove"
);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95d39c7/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIterator.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIterator.java
deleted file mode 100644
index 9cfcf0a..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/SubtractionIterator.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query.ir.result;
-
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.usergrid.persistence.cassandra.CursorCache;
-
-import com.google.common.collect.Sets;
-
-
-/**
- * Simple iterator to perform Unions
- *
- * @author tnine
- */
-public class SubtractionIterator extends MergeIterator {
-
-    private ResultIterator keepIterator;
-    private ResultIterator subtractIterator;
-
-
-    public SubtractionIterator( int pageSize ) {
-        super( pageSize );
-    }
-
-
-    /** @param subtractIterator the subtractIterator to set */
-    public void setSubtractIterator( ResultIterator subtractIterator ) {
-        this.subtractIterator = subtractIterator;
-    }
-
-
-    /** @param keepIterator the keepIterator to set */
-    public void setKeepIterator( ResultIterator keepIterator ) {
-        this.keepIterator = keepIterator;
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.usergrid.persistence.query.ir.result.ResultIterator#reset()
-     */
-    @Override
-    public void doReset() {
-        keepIterator.reset();
-        subtractIterator.reset();
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.usergrid.persistence.query.ir.result.MergeIterator#advance()
-     */
-    @Override
-    protected Set<ScanColumn> advance() {
-        if ( !keepIterator.hasNext() ) {
-            return null;
-        }
-
-        Set<ScanColumn> results = new LinkedHashSet<ScanColumn>( pageSize );
-
-        /**
-         * The order here is important.  We don't want to check the advance unless we're
less than our result size
-         * Otherwise we have issues with side effects of cursor construction.
-         */
-        while (results.size() < pageSize && keepIterator.hasNext() ) {
-
-            Set<ScanColumn> keepPage = keepIterator.next();
-
-            while ( subtractIterator.hasNext() && keepPage.size() > 0 ) {
-                keepPage.removeAll( subtractIterator.next() );
-            }
-
-            subtractIterator.reset();
-
-            results.addAll( keepPage );
-        }
-
-        return results;
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.persistence.query.ir.result.ResultIterator#finalizeCursor(org.apache.usergrid.persistence.cassandra
-     * .CursorCache)
-     */
-    @Override
-    public void finalizeCursor( CursorCache cache, UUID lastLoaded ) {
-        //we can only keep a cursor on our keep result set, we must subtract from every page
of keep when loading
-        // results
-        keepIterator.finalizeCursor( cache, lastLoaded );
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95d39c7/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UUIDIndexSliceParser.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UUIDIndexSliceParser.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UUIDIndexSliceParser.java
deleted file mode 100644
index 4b98cc7..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UUIDIndexSliceParser.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query.ir.result;
-
-
-import java.nio.ByteBuffer;
-import java.util.UUID;
-
-import static org.apache.usergrid.persistence.cassandra.Serializers.*;
-
-/**
- * Parser for reading and writing secondary index composites
- *
- * @author tnine
- */
-public class UUIDIndexSliceParser implements SliceParser {
-
-    /* (non-Javadoc)
-     * @see org.apache.usergrid.persistence.query.ir.result.SliceParser#parse(java.nio.ByteBuffer)
-     */
-    @Override
-    public ScanColumn parse( ByteBuffer buff ) {
-        return new UUIDColumn( ue.fromByteBuffer( buff.duplicate() ), buff );
-    }
-
-
-    public static class UUIDColumn extends AbstractScanColumn {
-
-        public UUIDColumn( UUID uuid, ByteBuffer buffer ) {
-            super( uuid, buffer );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f95d39c7/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
b/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
deleted file mode 100644
index ea7b3f6..0000000
--- a/stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/UnionIterator.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.usergrid.persistence.query.ir.result;
-
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.apache.usergrid.persistence.cassandra.CursorCache;
-import org.apache.usergrid.utils.UUIDUtils;
-
-import static org.apache.usergrid.persistence.cassandra.Serializers.*;
-
-/**
- * Simple iterator to perform Unions
- *
- * @author tnine
- */
-public class UnionIterator extends MultiIterator {
-
-    private static final ScanColumnComparator COMP = new ScanColumnComparator();
-
-    private SortedColumnList list;
-
-    private final int id;
-
-
-    /**
-     * @param pageSize The page size to return
-     * @param id The id assigned to this node
-     * @param minUuid The minimum UUID to return
-     */
-    public UnionIterator( int pageSize, int id, ByteBuffer minUuid ) {
-        super( pageSize );
-
-        this.id = id;
-
-        UUID parseMinUuid = null;
-
-        if(minUuid != null)      {
-            parseMinUuid = ue.fromByteBuffer( minUuid );
-        }
-
-        list = new SortedColumnList( pageSize, parseMinUuid );
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.usergrid.persistence.query.ir.result.MergeIterator#advance()
-     */
-    @Override
-    protected Set<ScanColumn> advance() {
-
-        int size = iterators.size();
-
-        if ( size == 0 ) {
-            return null;
-        }
-
-
-        list.clear();
-
-        for ( ResultIterator itr : iterators ) {
-
-            while ( itr.hasNext() ) {
-                list.addAll( itr.next() );
-            }
-
-            itr.reset();
-        }
-
-        //mark us for the next page
-        list.mark();
-
-
-        return list.asSet();
-    }
-
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.apache.usergrid.persistence.query.ir.result.ResultIterator#finalizeCursor(
-     * org.apache.usergrid.persistence.cassandra.CursorCache)
-     */
-    @Override
-    public void finalizeCursor( CursorCache cache, UUID lastLoaded ) {
-
-        ByteBuffer buff = ue.toByteBuffer( lastLoaded );
-        cache.setNextCursor( id, buff );
-        //get our scan column and put them in the cache
-        //we finalize the cursor of the min
-    }
-
-
-    @Override
-    public void doReset() {
-        //reset sub iterators if we need to
-        super.doReset();
-
-        list.reset();
-
-    }
-
-
-    /**
-     * A Sorted Set with a max size. When a new entry is added, the max is removed.  You
can mark the next "min" by
-     * calling the mark method.  Values > min are accepted.  Values > min and that
are over size are discarded
-     */
-    public static final class SortedColumnList {
-
-        private static final ScanColumnComparator COMP = new ScanColumnComparator();
-
-        private final int maxSize;
-
-        private final List<ScanColumn> list;
-
-
-        private ScanColumn min;
-
-
-        public SortedColumnList( final int maxSize, final UUID minUuid ) {
-            //we need to allocate the extra space if required
-            this.list = new ArrayList<ScanColumn>( maxSize );
-            this.maxSize = maxSize;
-
-            if ( minUuid != null ) {
-                min = new AbstractScanColumn( minUuid, null ) {};
-            }
-        }
-
-
-        /**
-         * Add the column to this list
-         */
-        public void add( ScanColumn col ) {
-            //less than our min, don't add
-            if ( COMP.compare( min, col ) >= 0 ) {
-                return;
-            }
-
-            int index = Collections.binarySearch( this.list, col, COMP );
-
-            //already present
-            if ( index > -1 ) {
-                return;
-            }
-
-            index = ( index * -1 ) - 1;
-
-            //outside the range
-            if ( index >= maxSize ) {
-                return;
-            }
-
-            this.list.add( index, col );
-
-            final int size = this.list.size();
-
-            if ( size > maxSize ) {
-                this.list.subList( maxSize, size ).clear();
-            }
-        }
-
-
-        /**
-         * Add all the elements to this list
-         */
-        public void addAll( final Collection<? extends ScanColumn> cols ) {
-            for ( ScanColumn col : cols ) {
-                add( col );
-            }
-        }
-
-
-        /**
-         * Returns a new list.  If no elements are present, returns null
-         */
-        public Set<ScanColumn> asSet() {
-            if ( this.list.size() == 0 ) {
-                return null;
-            }
-
-            return new LinkedHashSet<ScanColumn>( this.list );
-        }
-
-
-        /**
-         * Mark our last element in the tree as the max
-         */
-        public void mark() {
-
-            final int size = this.list.size();
-
-            //we don't have any elements in the list, and we've never set a min
-            if ( size == 0 ) {
-                return;
-            }
-
-            min = this.list.get( size - 1 );
-        }
-
-
-        /**
-         * Clear the list
-         */
-        public void clear() {
-            this.list.clear();
-        }
-
-        public void reset(){
-            clear();
-            this.min = null;
-        }
-    }
-
-
-    /**
-     * Simple comparator for comparing scan columns.  Orders them by time uuid
-     */
-    private static class ScanColumnComparator implements Comparator<ScanColumn> {
-
-        @Override
-        public int compare( final ScanColumn o1, final ScanColumn o2 ) {
-            if ( o1 == null ) {
-                if ( o2 == null ) {
-                    return 0;
-                }
-
-                return -1;
-            }
-
-            else if ( o2 == null ) {
-                return 1;
-            }
-
-            return UUIDUtils.compare( o1.getUUID(), o2.getUUID() );
-        }
-    }
-}


Mime
View raw message