use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class NeoStoreIndexStoreView method nodeAsUpdates.
@Override
public void nodeAsUpdates(long nodeId, Collection<NodeUpdates> target) {
NodeRecord node = nodeStore.getRecord(nodeId, nodeStore.newRecord(), FORCE);
if (!node.inUse()) {
return;
}
long firstPropertyId = node.getNextProp();
if (firstPropertyId == Record.NO_NEXT_PROPERTY.intValue()) {
// no properties => no updates (it's not going to be in any index)
return;
}
long[] labels = parseLabelsField(node).get(nodeStore);
if (labels.length == 0) {
// no labels => no updates (it's not going to be in any index)
return;
}
NodeUpdates.Builder update = NodeUpdates.forNode(nodeId, labels);
for (PropertyRecord propertyRecord : propertyStore.getPropertyRecordChain(firstPropertyId)) {
for (PropertyBlock property : propertyRecord) {
Object value = property.getType().getValue(property, propertyStore);
update.added(property.getKeyIndexId(), value);
}
}
target.add(update.build());
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class NeoStoreIndexStoreView method getProperty.
@Override
public Property getProperty(long nodeId, int propertyKeyId) throws EntityNotFoundException {
NodeRecord node = nodeStore.getRecord(nodeId, nodeStore.newRecord(), FORCE);
if (!node.inUse()) {
throw new EntityNotFoundException(EntityType.NODE, nodeId);
}
long firstPropertyId = node.getNextProp();
if (firstPropertyId == Record.NO_NEXT_PROPERTY.intValue()) {
return Property.noNodeProperty(nodeId, propertyKeyId);
}
for (PropertyRecord propertyRecord : propertyStore.getPropertyRecordChain(firstPropertyId)) {
PropertyBlock propertyBlock = propertyRecord.getPropertyBlock(propertyKeyId);
if (propertyBlock != null) {
return propertyBlock.newPropertyData(propertyStore);
}
}
return Property.noNodeProperty(nodeId, propertyKeyId);
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class StoreViewNodeStoreScan method process.
@Override
public void process(NodeRecord node) throws FAILURE {
long[] labels = parseLabelsField(node).get(this.nodeStore);
if (labels.length == 0) {
// This node has no labels at all
return;
}
if (labelUpdateVisitor != null) {
// Notify the label update visitor
labelUpdateVisitor.visit(labelChanges(node.getId(), EMPTY_LONG_ARRAY, labels));
}
if (propertyUpdatesVisitor != null && containsAnyLabel(labelIds, labels)) {
// TODO: reuse object instead? Better in terms of speed and GC?
NodeUpdates.Builder updates = NodeUpdates.forNode(node.getId(), labels);
// Notify the property update visitor
for (PropertyBlock property : properties(node)) {
int propertyKeyId = property.getKeyIndexId();
if (propertyKeyIdFilter.test(propertyKeyId)) {
// This node has a property of interest to us
Object value = valueOf(property);
Validators.INDEX_VALUE_VALIDATOR.validate(value);
updates.added(propertyKeyId, value);
}
}
if (updates.hasUpdates()) {
propertyUpdatesVisitor.visit(updates.build());
}
}
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class ChainCheck method keys.
public static int[] keys(PropertyRecord property) {
int[] toStartWith = new int[MAX_BLOCK_PER_RECORD_COUNT];
int index = 0;
for (PropertyBlock propertyBlock : property) {
toStartWith[index++] = propertyBlock.getKeyIndexId();
}
return Arrays.copyOf(toStartWith, index);
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class PropertyReader method propertyBlocks.
public List<PropertyBlock> propertyBlocks(NodeRecord nodeRecord) {
Collection<PropertyRecord> records = propertyStore.getPropertyRecordChain(nodeRecord.getNextProp());
List<PropertyBlock> propertyBlocks = new ArrayList<>();
for (PropertyRecord record : records) {
for (PropertyBlock block : record) {
propertyBlocks.add(block);
}
}
return propertyBlocks;
}
Aggregations