@Override public boolean visitRelationshipGroupCommand(Command.RelationshipGroupCommand command) throws IOException { RelationshipGroupRecord record = command.getRecord(); channel.put(NeoCommandType.REL_GROUP_COMMAND); channel.putLong(record.getId()); channel.put((byte) (record.inUse() ? Record.IN_USE.intValue() : Record.NOT_IN_USE.intValue())); channel.putShort((short) record.getType()); channel.putLong(record.getNext()); channel.putLong(record.getFirstOut()); channel.putLong(record.getFirstIn()); channel.putLong(record.getFirstLoop()); channel.putLong(record.getOwningNode()); return false; }
public RecordProxy<Long, RelationshipGroupRecord, Integer> getRelationshipGroup( NodeRecord node, int type) { long groupId = node.getNextRel(); long previousGroupId = Record.NO_NEXT_RELATIONSHIP.intValue(); Set<Integer> allTypes = new HashSet<>(); while (groupId != Record.NO_NEXT_RELATIONSHIP.intValue()) { RecordProxy<Long, RelationshipGroupRecord, Integer> change = recordChangeSet.getRelGroupRecords().getOrLoad(groupId, type); RelationshipGroupRecord record = change.forReadingData(); record.setPrev(previousGroupId); // not persistent so not a "change" allTypes.add(record.getType()); if (record.getType() == type) { return change; } previousGroupId = groupId; groupId = record.getNext(); } return null; }
@Override public boolean visitRelationshipGroupCommand(Command.RelationshipGroupCommand command) throws IOException { long id = channel.getLong(); byte inUseByte = channel.get(); boolean inUse = inUseByte == Record.IN_USE.byteValue(); if (inUseByte != Record.IN_USE.byteValue() && inUseByte != Record.NOT_IN_USE.byteValue()) { throw new IOException("Illegal in use flag: " + inUseByte); } int type = channel.getShort(); RelationshipGroupRecord record = new RelationshipGroupRecord(id, type); record.setInUse(inUse); record.setNext(channel.getLong()); record.setFirstOut(channel.getLong()); record.setFirstIn(channel.getLong()); record.setFirstLoop(channel.getLong()); record.setOwningNode(channel.getLong()); command.init(record); return false; }