Search in sources :

Example 6 with PersistentStoreTransaction

use of jetbrains.exodus.entitystore.PersistentStoreTransaction in project xodus by JetBrains.

the class PropertyNotNull method instantiate.

@Override
public Iterable<Entity> instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData, InstantiateContext context) {
    final EntityMetaData emd = metaData == null ? null : metaData.getEntityMetaData(entityType);
    final PropertyMetaData pmd = emd == null ? null : emd.getPropertyMetaData(name);
    queryEngine.assertOperational();
    final PersistentStoreTransaction txn = queryEngine.getPersistentStore().getAndCheckCurrentTransaction();
    return pmd == null || pmd.getType() == PropertyType.PRIMITIVE ? txn.findWithProp(entityType, name) : txn.findWithBlob(entityType, name);
}
Also used : PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction) PropertyMetaData(jetbrains.exodus.query.metadata.PropertyMetaData) EntityMetaData(jetbrains.exodus.query.metadata.EntityMetaData)

Example 7 with PersistentStoreTransaction

use of jetbrains.exodus.entitystore.PersistentStoreTransaction in project xodus by JetBrains.

the class PropertiesTable method deleteNoFail.

public boolean deleteNoFail(@NotNull final PersistentStoreTransaction txn, final long localId, @NotNull final ByteIterable value, int propertyId, @NotNull final ComparableValueType type) {
    final ByteIterable key = PropertyKey.propertyKeyToEntry(new PropertyKey(localId, propertyId));
    final Transaction envTxn = txn.getEnvironmentTransaction();
    final ByteIterable secondaryValue = LongBinding.longToCompressedEntry(localId);
    return primaryStore.delete(envTxn, key) && deleteFromStore(envTxn, getOrCreateValueIndex(txn, propertyId), secondaryValue, createSecondaryKeys(store.getPropertyTypes(), value, type)) && deleteFromStore(envTxn, allPropsIndex, secondaryValue, IntegerBinding.intToCompressedEntry(propertyId));
}
Also used : PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction) ByteIterable(jetbrains.exodus.ByteIterable)

Example 8 with PersistentStoreTransaction

use of jetbrains.exodus.entitystore.PersistentStoreTransaction in project xodus by JetBrains.

the class PropertyNotNull method instantiate.

@Override
public Iterable<Entity> instantiate(String entityType, QueryEngine queryEngine, ModelMetaData metaData) {
    final EntityMetaData emd = metaData == null ? null : metaData.getEntityMetaData(entityType);
    final PropertyMetaData pmd = emd == null ? null : emd.getPropertyMetaData(name);
    queryEngine.assertOperational();
    final PersistentStoreTransaction txn = queryEngine.getPersistentStore().getAndCheckCurrentTransaction();
    return pmd == null || pmd.getType() == PropertyType.PRIMITIVE ? txn.findWithProp(entityType, name) : txn.findWithBlob(entityType, name);
}
Also used : PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction) PropertyMetaData(jetbrains.exodus.query.metadata.PropertyMetaData) EntityMetaData(jetbrains.exodus.query.metadata.EntityMetaData)

Example 9 with PersistentStoreTransaction

use of jetbrains.exodus.entitystore.PersistentStoreTransaction in project xodus by JetBrains.

the class QueryTreeTest method prepare.

private void prepare() {
    final PersistentStoreTransaction txn = getStoreTransaction();
    Assert.assertNotNull(txn);
    final Entity enumeration = e(txn, 1);
    t1(txn, enumeration);
    t1(txn, enumeration);
    t2(txn, e(txn, 2));
    propertyEqual = new PropertyEqual("s", "value");
    propertyEqualNull = new PropertyEqual("s", null);
    propertyNotNull = new PropertyNotNull("s");
    linkEqual = new LinkEqual("myEnum", enumeration);
    linkEqualNull = new LinkEqual("itself", null);
    linkNotNull = new LinkNotNull("itself");
    concat = new Concat(propertyEqual, linkNotNull);
}
Also used : Entity(jetbrains.exodus.entitystore.Entity) PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction)

Example 10 with PersistentStoreTransaction

use of jetbrains.exodus.entitystore.PersistentStoreTransaction in project xodus by JetBrains.

the class PropertiesTable method delete.

public void delete(@NotNull final PersistentStoreTransaction txn, final long localId, @NotNull final ByteIterable value, final int propertyId, @NotNull final ComparableValueType type) {
    final ByteIterable key = PropertyKey.propertyKeyToEntry(new PropertyKey(localId, propertyId));
    final Transaction envTxn = txn.getEnvironmentTransaction();
    final ByteIterable secondaryValue = LongBinding.longToCompressedEntry(localId);
    primaryStore.delete(envTxn, key);
    deleteFromStore(envTxn, getOrCreateValueIndex(txn, propertyId), secondaryValue, createSecondaryKeys(store.getPropertyTypes(), value, type));
    allPropsIndex.remove(envTxn, propertyId, localId);
}
Also used : PersistentStoreTransaction(jetbrains.exodus.entitystore.PersistentStoreTransaction) ByteIterable(jetbrains.exodus.ByteIterable)

Aggregations

PersistentStoreTransaction (jetbrains.exodus.entitystore.PersistentStoreTransaction)10 ByteIterable (jetbrains.exodus.ByteIterable)3 EntityMetaData (jetbrains.exodus.query.metadata.EntityMetaData)2 PropertyMetaData (jetbrains.exodus.query.metadata.PropertyMetaData)2 ArrayList (java.util.ArrayList)1 IntHashMap (jetbrains.exodus.core.dataStructures.hash.IntHashMap)1 Entity (jetbrains.exodus.entitystore.Entity)1 EntityIterableType (jetbrains.exodus.entitystore.EntityIterableType)1 EntityStoreTestBase (jetbrains.exodus.entitystore.EntityStoreTestBase)1 PersistentEntityId (jetbrains.exodus.entitystore.PersistentEntityId)1 jetbrains.exodus.entitystore.iterate.binop (jetbrains.exodus.entitystore.iterate.binop)1 Nullable (org.jetbrains.annotations.Nullable)1