示例#1
0
 @Override
 public Map<String, Object> getNodeProperties(long nodeId) {
   NodeRecord record = getNodeRecord(nodeId);
   if (record.getNextProp() != Record.NO_NEXT_PROPERTY.intValue()) {
     return getPropertyChain(record.getNextProp());
   }
   return Collections.emptyMap();
 }
示例#2
0
 @Override
 public void setNodeProperties(long node, Map<String, Object> properties) {
   NodeRecord record = getNodeRecord(node);
   if (record.getNextProp() != Record.NO_NEXT_PROPERTY.intValue()) {
     deletePropertyChain(record.getNextProp());
     /*
      * Batch inserter does not make any attempt to maintain the store's
      * integrity. It makes sense however to keep some things intact where
      * the cost is relatively low. So here, when we delete the property
      * chain we first make sure that the node record (or the relationship
      * record below) does not point anymore to the deleted properties. This
      * way, if during creation, something goes wrong, it will not have the properties
      * expected instead of throwing invalid record exceptions.
      */
     record.setNextProp(Record.NO_NEXT_PROPERTY.intValue());
     getNodeStore().updateRecord(record);
   }
   record.setNextProp(createPropertyChain(properties));
   getNodeStore().updateRecord(record);
 }
示例#3
0
 @Override
 public void setNodeProperties(long node, Map<String, Object> properties) {
   NodeRecord record = getNodeRecord(node).forChangingData();
   if (record.getNextProp() != Record.NO_NEXT_PROPERTY.intValue()) {
     propertyDeletor.getAndDeletePropertyChain(record, recordAccess.getPropertyRecords());
   }
   record.setNextProp(
       propertyCreator.createPropertyChain(
           record, propertiesIterator(properties), recordAccess.getPropertyRecords()));
   recordAccess.commit();
 }
 private void migrateNodes(NodeStore nodeStore, PropertyWriter propertyWriter)
     throws IOException {
   Iterable<NodeRecord> records = legacyStore.getNodeStoreReader().readNodeStore();
   // estimate total number of nodes using file size then calc number of dots or percentage
   // complete
   for (NodeRecord nodeRecord : records) {
     reportProgress(nodeRecord.getId());
     nodeStore.setHighId(nodeRecord.getId() + 1);
     if (nodeRecord.inUse()) {
       long startOfPropertyChain = nodeRecord.getNextProp();
       if (startOfPropertyChain != Record.NO_NEXT_RELATIONSHIP.intValue()) {
         long propertyRecordId = migrateProperties(startOfPropertyChain, propertyWriter);
         nodeRecord.setNextProp(propertyRecordId);
       }
       nodeStore.updateRecord(nodeRecord);
     } else {
       nodeStore.freeId(nodeRecord.getId());
     }
   }
   legacyStore.getNodeStoreReader().close();
 }
 public void updateFirstRelationships() {
   for (RecordProxy<Long, NodeRecord, Void> change : recordChangeSet.getNodeRecords().changes()) {
     NodeRecord record = change.forReadingLinkage();
     txState.setFirstIds(record.getId(), record.getNextRel(), record.getNextProp());
   }
 }