use of org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4 in project neo4j by neo4j.
the class TxPullRequestDecoder method decode.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
long txId = msg.readLong();
StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal(new NetworkReadableClosableChannelNetty4(msg));
out.add(new TxPullRequest(txId, storeId));
}
use of org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4 in project neo4j by neo4j.
the class TxPullResponseDecoder method decode.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
NetworkReadableClosableChannelNetty4 logChannel = new NetworkReadableClosableChannelNetty4(msg);
StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal(logChannel);
LogEntryReader<NetworkReadableClosableChannelNetty4> reader = new VersionAwareLogEntryReader<>(new RecordStorageCommandReaderFactory());
PhysicalTransactionCursor<NetworkReadableClosableChannelNetty4> transactionCursor = new PhysicalTransactionCursor<>(logChannel, reader);
transactionCursor.next();
CommittedTransactionRepresentation tx = transactionCursor.get();
if (tx != null) {
out.add(new TxPullResponse(storeId, tx));
}
}
use of org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4 in project neo4j by neo4j.
the class ReplicatedTokenRequestSerializer method extractCommands.
static Collection<StorageCommand> extractCommands(byte[] commandBytes) {
ByteBuf txBuffer = Unpooled.wrappedBuffer(commandBytes);
NetworkReadableClosableChannelNetty4 channel = new NetworkReadableClosableChannelNetty4(txBuffer);
LogEntryReader<ReadableClosablePositionAwareChannel> reader = new VersionAwareLogEntryReader<>(new RecordStorageCommandReaderFactory());
LogEntryCommand entryRead;
List<StorageCommand> commands = new LinkedList<>();
try {
while ((entryRead = (LogEntryCommand) reader.readLogEntry(channel)) != null) {
commands.add(entryRead.getXaCommand());
}
} catch (IOException e) {
// TODO: Handle or throw.
e.printStackTrace();
}
return commands;
}
use of org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4 in project neo4j by neo4j.
the class GetStoreIdResponseDecoder method decode.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
StoreId storeId = StoreIdMarshal.INSTANCE.unmarshal(new NetworkReadableClosableChannelNetty4(msg));
out.add(new GetStoreIdResponse(storeId));
}
use of org.neo4j.causalclustering.messaging.NetworkReadableClosableChannelNetty4 in project neo4j by neo4j.
the class GetStoreRequestDecoder method decode.
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception {
StoreId expectedStoreId = StoreIdMarshal.INSTANCE.unmarshal(new NetworkReadableClosableChannelNetty4(msg));
out.add(new GetStoreRequest(expectedStoreId));
}
Aggregations