Search in sources :

Example 1 with PatriciaTree

use of jetbrains.exodus.tree.patricia.PatriciaTree in project xodus by JetBrains.

the class StoreImpl method openImmutableTree.

ITree openImmutableTree(@NotNull final MetaTree metaTree) {
    final int structureId = getStructureId();
    final long upToDateRootAddress = metaTree.getRootAddress(structureId);
    final boolean hasDuplicates = metaInfo.hasDuplicates();
    final boolean treeIsEmpty = upToDateRootAddress == Loggable.NULL_ADDRESS;
    final Log log = environment.getLog();
    final ITree result;
    if (!metaInfo.isKeyPrefixing()) {
        final BTreeBalancePolicy balancePolicy = environment.getBTreeBalancePolicy();
        result = treeIsEmpty ? new BTreeEmpty(log, balancePolicy, hasDuplicates, structureId) : new BTree(log, balancePolicy, upToDateRootAddress, hasDuplicates, structureId);
    } else {
        if (treeIsEmpty) {
            result = new PatriciaTreeEmpty(log, structureId, hasDuplicates);
        } else {
            result = hasDuplicates ? new PatriciaTreeWithDuplicates(log, upToDateRootAddress, structureId) : new PatriciaTree(log, upToDateRootAddress, structureId);
        }
    }
    return result;
}
Also used : PatriciaTree(jetbrains.exodus.tree.patricia.PatriciaTree) BTreeBalancePolicy(jetbrains.exodus.tree.btree.BTreeBalancePolicy) Log(jetbrains.exodus.log.Log) BTree(jetbrains.exodus.tree.btree.BTree) BTreeEmpty(jetbrains.exodus.tree.btree.BTreeEmpty) ITree(jetbrains.exodus.tree.ITree) PatriciaTreeEmpty(jetbrains.exodus.tree.patricia.PatriciaTreeEmpty) PatriciaTreeWithDuplicates(jetbrains.exodus.tree.patricia.PatriciaTreeWithDuplicates)

Aggregations

Log (jetbrains.exodus.log.Log)1 ITree (jetbrains.exodus.tree.ITree)1 BTree (jetbrains.exodus.tree.btree.BTree)1 BTreeBalancePolicy (jetbrains.exodus.tree.btree.BTreeBalancePolicy)1 BTreeEmpty (jetbrains.exodus.tree.btree.BTreeEmpty)1 PatriciaTree (jetbrains.exodus.tree.patricia.PatriciaTree)1 PatriciaTreeEmpty (jetbrains.exodus.tree.patricia.PatriciaTreeEmpty)1 PatriciaTreeWithDuplicates (jetbrains.exodus.tree.patricia.PatriciaTreeWithDuplicates)1