Search in sources :

Example 1 with SplitDocType

use of org.apache.jackrabbit.oak.plugins.document.NodeDocument.SplitDocType in project jackrabbit-oak by apache.

the class MongoVersionGCSupport method createQuery.

private DBObject createQuery(Set<SplitDocType> gcTypes, RevisionVector sweepRevs, long oldestRevTimeStamp) {
    List<Integer> gcTypeCodes = Lists.newArrayList();
    QueryBuilder orClause = start();
    for (SplitDocType type : gcTypes) {
        gcTypeCodes.add(type.typeCode());
        for (DBObject query : queriesForType(type, sweepRevs)) {
            orClause.or(query);
        }
    }
    return start().and(start(SD_TYPE).in(gcTypeCodes).get(), orClause.get(), start(NodeDocument.SD_MAX_REV_TIME_IN_SECS).lessThan(NodeDocument.getModifiedInSecs(oldestRevTimeStamp)).get()).get();
}
Also used : SplitDocType(org.apache.jackrabbit.oak.plugins.document.NodeDocument.SplitDocType) QueryBuilder(com.mongodb.QueryBuilder) DBObject(com.mongodb.DBObject) BasicDBObject(com.mongodb.BasicDBObject)

Example 2 with SplitDocType

use of org.apache.jackrabbit.oak.plugins.document.NodeDocument.SplitDocType in project jackrabbit-oak by apache.

the class SplitOperations method setSplitDocProps.

/**
     * Set various split document related flag/properties
     *
     * @param mainDoc main document from which split document is being created
     * @param old updateOp of the old document created via split
     * @param oldDoc old document created via split
     * @param maxRev max revision stored in the split document oldDoc
     */
private static void setSplitDocProps(NodeDocument mainDoc, NodeDocument oldDoc, UpdateOp old, Revision maxRev) {
    setSplitDocMaxRev(old, maxRev);
    SplitDocType type = SplitDocType.DEFAULT;
    if (!mainDoc.hasChildren()) {
        type = SplitDocType.DEFAULT_LEAF;
    } else if (oldDoc.getLocalRevisions().isEmpty()) {
        type = SplitDocType.COMMIT_ROOT_ONLY;
    } else if (oldDoc.getLocalBranchCommits().isEmpty()) {
        type = SplitDocType.DEFAULT_NO_BRANCH;
    }
    // Copy over the hasBinary flag
    if (mainDoc.hasBinary()) {
        setHasBinary(old);
    }
    setSplitDocType(old, type);
}
Also used : SplitDocType(org.apache.jackrabbit.oak.plugins.document.NodeDocument.SplitDocType)

Aggregations

SplitDocType (org.apache.jackrabbit.oak.plugins.document.NodeDocument.SplitDocType)2 BasicDBObject (com.mongodb.BasicDBObject)1 DBObject (com.mongodb.DBObject)1 QueryBuilder (com.mongodb.QueryBuilder)1