Search in sources :

Example 6 with IndexOptions

use of com.torodb.mongodb.commands.pojos.index.IndexOptions in project torodb by torodb.

the class AkkaDbCloner method getIndexesToClone.

private List<IndexOptions> getIndexesToClone(List<IndexOptions> listindexes, String toDb, String toCol, String fromCol, String fromDb, CloneOptions opts) {
    List<IndexOptions> indexesToClone = new ArrayList<>();
    for (Iterator<IndexOptions> iterator = listindexes.iterator(); iterator.hasNext(); ) {
        IndexOptions indexEntry = iterator.next();
        if (!opts.getIndexFilter().test(toCol, indexEntry.getName(), indexEntry.isUnique(), indexEntry.getKeys())) {
            LOGGER.info("Not cloning index {}.{} because it didn't pass the given filter predicate", toCol, indexEntry.getName());
            continue;
        }
        LOGGER.info("Index {}.{}.{} will be cloned", fromDb, fromCol, indexEntry.getName());
        indexesToClone.add(indexEntry);
    }
    return indexesToClone;
}
Also used : IndexOptions(com.torodb.mongodb.commands.pojos.index.IndexOptions) ArrayList(java.util.ArrayList)

Aggregations

IndexOptions (com.torodb.mongodb.commands.pojos.index.IndexOptions)6 MongoException (com.eightkdata.mongowp.exceptions.MongoException)3 UserException (com.torodb.core.exceptions.user.UserException)3 CreateIndexesArgument (com.torodb.mongodb.commands.signatures.admin.CreateIndexesCommand.CreateIndexesArgument)3 CreateIndexesResult (com.torodb.mongodb.commands.signatures.admin.CreateIndexesCommand.CreateIndexesResult)3 ArrayList (java.util.ArrayList)3 Request (com.eightkdata.mongowp.server.api.Request)2 AttributeReference (com.torodb.core.language.AttributeReference)2 ObjectKey (com.torodb.core.language.AttributeReference.ObjectKey)2 FieldIndexOrdering (com.torodb.core.transaction.metainf.FieldIndexOrdering)2 AscIndexType (com.torodb.mongodb.commands.pojos.index.type.AscIndexType)2 DescIndexType (com.torodb.mongodb.commands.pojos.index.type.DescIndexType)2 IndexType (com.torodb.mongodb.commands.pojos.index.type.IndexType)2 IndexFieldInfo (com.torodb.torod.IndexFieldInfo)2 Status (com.eightkdata.mongowp.Status)1 CommandFailed (com.eightkdata.mongowp.exceptions.CommandFailed)1 HostAndPort (com.google.common.net.HostAndPort)1 UnsupportedCompoundIndexException (com.torodb.core.exceptions.user.UnsupportedCompoundIndexException)1 UnsupportedUniqueIndexException (com.torodb.core.exceptions.user.UnsupportedUniqueIndexException)1 CreateIndexesCommand (com.torodb.mongodb.commands.signatures.admin.CreateIndexesCommand)1