use of io.aeron.driver.buffer.RawLog in project aeron by real-logic.
the class DriverConductor method onCreatePublicationImage.
public void onCreatePublicationImage(final int sessionId, final int streamId, final int initialTermId, final int activeTermId, final int initialTermOffset, final int termBufferLength, final int senderMtuLength, final InetSocketAddress controlAddress, final InetSocketAddress sourceAddress, final ReceiveChannelEndpoint channelEndpoint) {
Configuration.validateMtuLength(senderMtuLength);
Configuration.validateInitialWindowLength(context.initialWindowLength(), senderMtuLength);
final long joinPosition = computePosition(activeTermId, initialTermOffset, LogBufferDescriptor.positionBitsToShift(termBufferLength), initialTermId);
final List<SubscriberPosition> subscriberPositions = createSubscriberPositions(sessionId, streamId, channelEndpoint, joinPosition);
if (subscriberPositions.size() > 0) {
final UdpChannel udpChannel = channelEndpoint.udpChannel();
final String channel = udpChannel.originalUriString();
final long registrationId = toDriverCommands.nextCorrelationId();
final RawLog rawLog = newPublicationImageLog(sessionId, streamId, initialTermId, termBufferLength, senderMtuLength, udpChannel, registrationId);
final CongestionControl congestionControl = context.congestionControlSupplier().newInstance(registrationId, udpChannel, streamId, sessionId, termBufferLength, senderMtuLength, cachedNanoClock, context, countersManager);
final PublicationImage image = new PublicationImage(registrationId, imageLivenessTimeoutNs, channelEndpoint, controlAddress, sessionId, streamId, initialTermId, activeTermId, initialTermOffset, rawLog, udpChannel.isMulticast() ? NAK_MULTICAST_DELAY_GENERATOR : NAK_UNICAST_DELAY_GENERATOR, positionArray(subscriberPositions), ReceiverHwm.allocate(tempBuffer, countersManager, registrationId, sessionId, streamId, channel), ReceiverPos.allocate(tempBuffer, countersManager, registrationId, sessionId, streamId, channel), nanoClock, cachedNanoClock, cachedEpochClock, context.systemCounters(), sourceAddress, congestionControl, context.lossReport(), subscriberPositions.get(0).subscription().isReliable());
publicationImages.add(image);
receiverProxy.newPublicationImage(channelEndpoint, image);
final String sourceIdentity = generateSourceIdentity(sourceAddress);
for (int i = 0, size = subscriberPositions.size(); i < size; i++) {
final SubscriberPosition position = subscriberPositions.get(i);
position.addLink(image);
clientProxy.onAvailableImage(registrationId, streamId, sessionId, position.subscription().registrationId(), position.positionCounterId(), rawLog.fileName(), sourceIdentity);
}
}
}
use of io.aeron.driver.buffer.RawLog in project aeron by real-logic.
the class DriverConductor method newIpcPublicationLog.
private RawLog newIpcPublicationLog(final int sessionId, final int streamId, final int initialTermId, final long registrationId, final PublicationParams params) {
final RawLog rawLog = rawLogFactory.newIpcPublication(sessionId, streamId, registrationId, params.termLength);
initPublicationMetadata(sessionId, streamId, initialTermId, registrationId, params, rawLog);
return rawLog;
}
use of io.aeron.driver.buffer.RawLog in project aeron by real-logic.
the class DriverConductor method addIpcPublication.
private IpcPublication addIpcPublication(final long registrationId, final int streamId, final String channel, final boolean isExclusive, final PublicationParams params) {
final int sessionId = params.hasSessionId ? params.sessionId : nextAvailableSessionId();
final int initialTermId = params.isReplay ? params.initialTermId : BitUtil.generateRandomisedId();
final RawLog rawLog = newIpcPublicationLog(sessionId, streamId, initialTermId, registrationId, params);
final IpcPublication publication = new IpcPublication(registrationId, sessionId, streamId, PublisherLimit.allocate(tempBuffer, countersManager, registrationId, sessionId, streamId, channel), rawLog, publicationUnblockTimeoutNs, params.lingerTimeoutNs, cachedNanoClock.nanoTime(), context.systemCounters(), isExclusive);
ipcPublications.add(publication);
activeSessionIds.add(sessionId);
return publication;
}
use of io.aeron.driver.buffer.RawLog in project aeron by real-logic.
the class DriverConductor method newNetworkPublicationLog.
private RawLog newNetworkPublicationLog(final int sessionId, final int streamId, final int initialTermId, final UdpChannel udpChannel, final long registrationId, final PublicationParams params) {
final RawLog rawLog = rawLogFactory.newNetworkPublication(udpChannel.canonicalForm(), sessionId, streamId, registrationId, params.termLength);
initPublicationMetadata(sessionId, streamId, initialTermId, registrationId, params, rawLog);
return rawLog;
}
use of io.aeron.driver.buffer.RawLog in project Aeron by real-logic.
the class DriverConductor method newPublicationImageLog.
private RawLog newPublicationImageLog(final int sessionId, final int streamId, final int initialTermId, final int termBufferLength, final boolean isSparse, final int senderMtuLength, final long correlationId) {
final RawLog rawLog = logFactory.newImage(correlationId, termBufferLength, isSparse);
initLogMetadata(sessionId, streamId, initialTermId, senderMtuLength, correlationId, rawLog);
return rawLog;
}
Aggregations