use of org.neo4j.kernel.impl.nioneo.store.PersistenceWindow in project neo4j-mobile-android by neo4j-contrib.
the class LegacyDynamicStoreReader method getPropertyChain.
public List<LegacyDynamicRecord> getPropertyChain(long startBlockId) {
List<LegacyDynamicRecord> recordList = new LinkedList<LegacyDynamicRecord>();
long blockId = startBlockId;
while (blockId != Record.NO_NEXT_BLOCK.intValue()) {
PersistenceWindow window = windowPool.acquire(blockId, OperationType.READ);
try {
LegacyDynamicRecord record = getRecord(blockId, window);
recordList.add(record);
blockId = record.getNextBlock();
} finally {
windowPool.release(window);
}
}
return recordList;
}
use of org.neo4j.kernel.impl.nioneo.store.PersistenceWindow in project neo4j-mobile-android by neo4j-contrib.
the class LegacyPropertyStoreReader method readPropertyRecord.
public LegacyPropertyRecord readPropertyRecord(long id) throws IOException {
PersistenceWindow persistenceWindow = windowPool.acquire(id, OperationType.READ);
try {
Buffer buffer = persistenceWindow.getOffsettedBuffer(id);
// [ , x] in use
// [xxxx, ] high prev prop bits
long inUseByte = buffer.get();
boolean inUse = (inUseByte & 0x1) == Record.IN_USE.intValue();
if (!inUse) {
throw new IllegalArgumentException(MessageFormat.format("Record {0} not in use", id));
}
LegacyPropertyRecord record = new LegacyPropertyRecord(id);
// [ , ][ , ][xxxx,xxxx][xxxx,xxxx] type
// [ , ][ ,xxxx][ , ][ , ] high next prop bits
long typeInt = buffer.getInt();
record.setType(getEnumType((int) typeInt & 0xFFFF));
record.setInUse(true);
record.setKeyIndexId(buffer.getInt());
record.setPropBlock(buffer.getLong());
long prevProp = buffer.getUnsignedInt();
long prevModifier = (inUseByte & 0xF0L) << 28;
long nextProp = buffer.getUnsignedInt();
long nextModifier = (typeInt & 0xF0000L) << 16;
record.setPrevProp(LegacyStore.longFromIntAndMod(prevProp, prevModifier));
record.setNextProp(LegacyStore.longFromIntAndMod(nextProp, nextModifier));
return record;
} finally {
windowPool.release(persistenceWindow);
}
}
Aggregations