use of org.neo4j.causalclustering.catchup.storecopy.FileHeaderHandler in project neo4j by neo4j.
the class CatchUpClientChannelPipeline method initChannel.
static void initChannel(SocketChannel ch, CatchUpResponseHandler handler, LogProvider logProvider, Monitors monitors) throws Exception {
CatchupClientProtocol protocol = new CatchupClientProtocol();
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4));
pipeline.addLast(new LengthFieldPrepender(4));
pipeline.addLast(new VersionDecoder(logProvider));
pipeline.addLast(new VersionPrepender());
pipeline.addLast(new TxPullRequestEncoder());
pipeline.addLast(new GetStoreRequestEncoder());
pipeline.addLast(new CoreSnapshotRequestEncoder());
pipeline.addLast(new GetStoreIdRequestEncoder());
pipeline.addLast(new ResponseMessageTypeEncoder());
pipeline.addLast(new RequestMessageTypeEncoder());
pipeline.addLast(new ClientMessageTypeHandler(protocol, logProvider));
RequestDecoderDispatcher<CatchupClientProtocol.State> decoderDispatcher = new RequestDecoderDispatcher<>(protocol, logProvider);
decoderDispatcher.register(CatchupClientProtocol.State.STORE_ID, new GetStoreIdResponseDecoder());
decoderDispatcher.register(CatchupClientProtocol.State.TX_PULL_RESPONSE, new TxPullResponseDecoder());
decoderDispatcher.register(CatchupClientProtocol.State.CORE_SNAPSHOT, new CoreSnapshotDecoder());
decoderDispatcher.register(CatchupClientProtocol.State.STORE_COPY_FINISHED, new StoreCopyFinishedResponseDecoder());
decoderDispatcher.register(CatchupClientProtocol.State.TX_STREAM_FINISHED, new TxStreamFinishedResponseDecoder());
decoderDispatcher.register(CatchupClientProtocol.State.FILE_HEADER, new FileHeaderDecoder());
decoderDispatcher.register(CatchupClientProtocol.State.FILE_CONTENTS, new FileChunkDecoder());
pipeline.addLast(decoderDispatcher);
pipeline.addLast(new TxPullResponseHandler(protocol, handler));
pipeline.addLast(new CoreSnapshotResponseHandler(protocol, handler));
pipeline.addLast(new StoreCopyFinishedResponseHandler(protocol, handler));
pipeline.addLast(new TxStreamFinishedResponseHandler(protocol, handler));
pipeline.addLast(new FileHeaderHandler(protocol, handler, logProvider));
pipeline.addLast(new FileChunkHandler(protocol, handler));
pipeline.addLast(new GetStoreIdResponseHandler(protocol, handler));
pipeline.addLast(new ExceptionLoggingHandler(logProvider.getLog(CatchUpClient.class)));
pipeline.addLast(new ExceptionMonitoringHandler(monitors.newMonitor(ExceptionMonitoringHandler.Monitor.class, CatchUpClient.class)));
pipeline.addLast(new ExceptionSwallowingHandler());
}
Aggregations