use of org.neo4j.kernel.impl.index.IndexCommand.RemoveCommand in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_4Test method shouldReadNoKeyIdAsMinusOne.
@Test
public void shouldReadNoKeyIdAsMinusOne() throws Exception {
// GIVEN
InMemoryClosableChannel channel = new InMemoryClosableChannel();
IndexDefineCommand definitions = new IndexDefineCommand();
int indexNameId = 10;
definitions.init(MapUtil.<String, Integer>genericMap("myindex", indexNameId), MapUtil.<String, Integer>genericMap());
definitions.serialize(channel);
RemoveCommand removeCommand = new IndexCommand.RemoveCommand();
removeCommand.init(indexNameId, IndexEntityType.Node.id(), 1234, -1, null);
removeCommand.serialize(channel);
// WHEN
PhysicalLogCommandReaderV2_2_4 reader = new PhysicalLogCommandReaderV2_2_4();
assertTrue(reader.read(channel) instanceof IndexDefineCommand);
RemoveCommand readRemoveCommand = (RemoveCommand) reader.read(channel);
// THEN
assertEquals(removeCommand.getIndexNameId(), readRemoveCommand.getIndexNameId());
assertEquals(removeCommand.getEntityType(), readRemoveCommand.getEntityType());
assertEquals(removeCommand.getEntityId(), readRemoveCommand.getEntityId());
assertEquals(removeCommand.getKeyId(), readRemoveCommand.getKeyId());
assertNull(removeCommand.getValue());
}
use of org.neo4j.kernel.impl.index.IndexCommand.RemoveCommand in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2 method visitIndexRemoveCommand.
private Command visitIndexRemoveCommand(ReadableChannel channel) throws IOException {
IndexCommandHeader header = readIndexCommandHeader(channel);
Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt();
Object value = readIndexValue(header.valueType, channel);
RemoveCommand command = new RemoveCommand();
command.init(header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value);
return command;
}
use of org.neo4j.kernel.impl.index.IndexCommand.RemoveCommand in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_4 method visitIndexRemoveCommand.
private Command visitIndexRemoveCommand(ReadableChannel channel) throws IOException {
IndexCommandHeader header = readIndexCommandHeader(channel);
Number entityId = header.entityIdNeedsLong ? channel.getLong() : channel.getInt();
Object value = readIndexValue(header.valueType, channel);
RemoveCommand command = new RemoveCommand();
command.init(header.indexNameId, header.entityType, entityId.longValue(), header.keyId, value);
return command;
}
use of org.neo4j.kernel.impl.index.IndexCommand.RemoveCommand in project neo4j by neo4j.
the class LegacyIndexTransactionStateImpl method removeNode.
@Override
public void removeNode(String indexName, long id, String keyOrNull, Object valueOrNull) {
RemoveCommand command = new RemoveCommand();
command.init(definitions().getOrAssignIndexNameId(indexName), IndexEntityType.Node.id(), id, definitions().getOrAssignKeyId(keyOrNull), valueOrNull);
addCommand(indexName, command);
}
use of org.neo4j.kernel.impl.index.IndexCommand.RemoveCommand in project neo4j by neo4j.
the class LegacyIndexTransactionStateImpl method removeRelationship.
@Override
public void removeRelationship(String indexName, long id, String keyOrNull, Object valueOrNull) {
RemoveCommand command = new RemoveCommand();
command.init(definitions().getOrAssignIndexNameId(indexName), IndexEntityType.Relationship.id(), id, definitions().getOrAssignKeyId(keyOrNull), valueOrNull);
addCommand(indexName, command);
}
Aggregations