use of io.pravega.client.state.impl.UpdateOrInitSerializer in project pravega by pravega.
the class ClientFactoryImpl method createStateSynchronizer.
@Override
public <StateT extends Revisioned, UpdateT extends Update<StateT>, InitT extends InitialUpdate<StateT>> StateSynchronizer<StateT> createStateSynchronizer(String streamName, Serializer<UpdateT> updateSerializer, Serializer<InitT> initialSerializer, SynchronizerConfig config) {
log.info("Creating state synchronizer with stream: {} and configuration: {}", streamName, config);
Segment segment = new Segment(scope, streamName, 0);
if (!Futures.getAndHandleExceptions(controller.isSegmentOpen(segment), InvalidStreamException::new)) {
throw new InvalidStreamException("Segment does not exist: " + segment);
}
val serializer = new UpdateOrInitSerializer<>(updateSerializer, initialSerializer);
return new StateSynchronizerImpl<StateT>(segment, createRevisionedStreamClient(streamName, serializer, config));
}
Aggregations