public boolean isCollectionIndex() { while (true) { try { return storage.callIndexEngine(false, false, indexId, new OIndexEngineCallback<Boolean>() { @Override public Boolean callEngine(OBaseIndexEngine engine) { OLuceneIndexEngine indexEngine = (OLuceneIndexEngine) engine; return indexEngine.isCollectionIndex(); } }); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } }
protected OBinarySerializer determineValueSerializer() { if (binaryFormatVersion >= 13) { return storage.getComponentsFactory().binarySerializerFactory.getObjectSerializer(OMixedIndexRIDContainerSerializer.ID); } return storage.getComponentsFactory().binarySerializerFactory.getObjectSerializer(OStreamSerializerSBTreeIndexRIDContainer.ID); }
@Override public Object set(ATTRIBUTES attribute, Object value) throws IOException { if (attribute == null) throw new IllegalArgumentException("attribute is null"); final String stringValue = value != null ? value.toString() : null; switch (attribute) { case STATUS: { if (stringValue == null) throw new IllegalStateException("Value of attribute is null."); return storageLocal.setClusterStatus(id, OStorageClusterConfiguration.STATUS .valueOf(stringValue.toUpperCase(storageLocal.getConfiguration().getLocaleInstance()))); } default: throw new IllegalArgumentException( "Runtime change of attribute '" + attribute + " is not supported on Offline cluster " + getName()); } }
public OAtomicOperationsManager(OAbstractPaginatedStorage storage) { this.storage = storage; this.writeAheadLog = storage.getWALInstance(); this.readCache = storage.getReadCache(); this.writeCache = storage.getWriteCache(); }
private void removeV0(OIdentifiable value, OModifiableBoolean removed, String word) { Set<OIdentifiable> recs; while (true) { try { //noinspection unchecked recs = (Set<OIdentifiable>) storage.getIndexValue(indexId, word); break; } catch (OInvalidIndexEngineIdException ignore) { doReloadIndexEngine(); } } if (recs != null && !recs.isEmpty()) { while (true) { try { storage.updateIndexEntry(indexId, word, new EntityRemover(value, removed)); break; } catch (OInvalidIndexEngineIdException ignore) { doReloadIndexEngine(); } } } }
private void setRecordGrowFactorInternal(final String stringValue) { try { final float growFactor = Float.parseFloat(stringValue); if (growFactor < 1) { throw new OPaginatedClusterException(ATTRIBUTES.RECORD_GROW_FACTOR + " cannot be less than 1", this); } config.recordGrowFactor = growFactor; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final NumberFormatException nfe) { throw OException.wrapException(new OPaginatedClusterException( "Invalid value for cluster attribute " + OCluster.ATTRIBUTES.RECORD_GROW_FACTOR + " was passed [" + stringValue + "]", this), nfe); } }
try { result = (Collection<ORID>) storage.getIndexValue(indexId, key); break; } catch (OInvalidIndexEngineIdException ignore) {
@Override public Set<OIdentifiable> get(final Object key) { final OBasicTransaction transaction = getDatabase().getMicroOrRegularTransaction(); if (transaction.isActive()) { while (true) { try { return storage.callIndexEngine(false, false, indexId, engine -> { OLuceneIndexEngine indexEngine = (OLuceneIndexEngine) engine; return indexEngine.getInTx(key, getTransactionChanges(transaction)); }); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } } else { while (true) { try { return (Set<OIdentifiable>) storage.getIndexValue(indexId, key); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } } }
private void setNameInternal(final String newName) throws IOException { writeCache.renameFile(fileId, newName + getExtension()); clusterPositionMap.rename(newName); config.name = newName; storageLocal.renameCluster(getName(), newName); setName(newName); ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); }
while (true) { try { luceneDoc = storage.callIndexEngine(false, false, indexId, engine -> { OLuceneIndexEngine oIndexEngine = (OLuceneIndexEngine) engine; return oIndexEngine.buildDocument(key, singleValue); while (true) { try { storage.putIndexValue(indexId, key, Arrays.asList(singleValue)); break; } catch (OInvalidIndexEngineIdException e) {
@Override public OIndexCursor descCursor() { while (true) { try { return storage.getIndexCursor(indexId, null); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } }
@Override public OIndexCursor iterateEntriesBetween(Object fromKey, boolean fromInclusive, Object toKey, boolean toInclusive, boolean ascOrder) { while (true) { try { return storage.iterateIndexEntriesBetween(indexId, fromKey, fromInclusive, toKey, toInclusive, ascOrder, null); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } }
@Override public OIndexCursor iterateEntriesMinor(Object toKey, boolean toInclusive, boolean ascOrder) { while (true) { try { return storage.iterateIndexEntriesMinor(indexId, toKey, toInclusive, ascOrder, null); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } }
@Override public OIndexCursor iterateEntriesMajor(Object fromKey, boolean fromInclusive, boolean ascOrder) { while (true) { try { return storage.iterateIndexEntriesMajor(indexId, fromKey, fromInclusive, ascOrder, null); } catch (OInvalidIndexEngineIdException e) { doReloadIndexEngine(); } } }
private void putV0(Object key, OIdentifiable value) { while (true) { try { storage.putIndexValue(indexId, key, value); break; } catch (OInvalidIndexEngineIdException ignore) { doReloadIndexEngine(); } } }
final OStorage storage = getDatabase().getStorage().getUnderlying(); if (storage instanceof OAbstractPaginatedStorage) { if (((OAbstractPaginatedStorage) storage).getWALInstance() != null) getDatabase().commit(); } else {
private void setRecordGrowFactorInternal(final String stringValue) { try { final float growFactor = Float.parseFloat(stringValue); if (growFactor < 1) { throw new OPaginatedClusterException(ATTRIBUTES.RECORD_GROW_FACTOR + " cannot be less than 1", this); } config.recordGrowFactor = growFactor; ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); } catch (final NumberFormatException nfe) { throw OException.wrapException(new OPaginatedClusterException( "Invalid value for cluster attribute " + ATTRIBUTES.RECORD_GROW_FACTOR + " was passed [" + stringValue + "]", this), nfe); } }
private boolean doRemoveV0(Object key, OIdentifiable value) { Set<OIdentifiable> values; while (true) { try { //noinspection unchecked values = (Set<OIdentifiable>) storage.getIndexValue(indexId, key); break; } catch (OInvalidIndexEngineIdException ignore) { doReloadIndexEngine(); } } if (values == null) { return false; } final OModifiableBoolean removed = new OModifiableBoolean(false); final OIndexKeyUpdater<Object> creator = new EntityRemover(value, removed); while (true) { try { storage.updateIndexEntry(indexId, key, creator); break; } catch (OInvalidIndexEngineIdException ignore) { doReloadIndexEngine(); } } return removed.getValue(); }
public Collection<ORID> get(Object key) { key = getCollatingValue(key); acquireSharedLock(); try { Collection<ORID> values; while (true) { try { //noinspection unchecked values = (Collection<ORID>) storage.getIndexValue(indexId, key); break; } catch (OInvalidIndexEngineIdException ignore) { doReloadIndexEngine(); } } if (values == null) { return Collections.emptyList(); } return values; } finally { releaseSharedLock(); } }
private void setNameInternal(final String newName) throws IOException { writeCache.renameFile(fileId, newName + getExtension()); clusterPositionMap.rename(newName); config.name = newName; storageLocal.renameCluster(getName(), newName); setName(newName); ((OStorageConfigurationImpl) storageLocal.getConfiguration()).update(); }