Пример #1
0
 private boolean writeNodeRecord(NodeRecord record) throws IOException {
   byte inUse = record.inUse() ? Record.IN_USE.byteValue() : Record.NOT_IN_USE.byteValue();
   channel.put(inUse);
   if (record.inUse()) {
     channel.put(record.isDense() ? (byte) 1 : (byte) 0);
     channel.putLong(record.getNextRel()).putLong(record.getNextProp());
     channel.putLong(record.getLabelField());
   }
   // Always write dynamic label records because we want to know which ones have been deleted
   // especially if the node has been deleted.
   writeDynamicRecords(record.getDynamicLabelRecords());
   return false;
 }
    @Override
    public boolean visitNodeCommand(Command.NodeCommand command) throws IOException {
      long id = channel.getLong();

      NodeRecord before = readNodeRecord(id);
      if (before == null) {
        return true;
      }

      NodeRecord after = readNodeRecord(id);
      if (after == null) {
        return true;
      }

      if (!before.inUse() && after.inUse()) {
        after.setCreated();
      }

      command.init(before, after);
      return false;
    }