Search in sources :

Example 11 with RawLog

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);
        }
    }
}
Also used : UdpChannel(io.aeron.driver.media.UdpChannel) RawLog(io.aeron.driver.buffer.RawLog) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint) SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint)

Example 12 with RawLog

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;
}
Also used : RawLog(io.aeron.driver.buffer.RawLog)

Example 13 with 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;
}
Also used : RawLog(io.aeron.driver.buffer.RawLog) ReceiveChannelEndpoint(io.aeron.driver.media.ReceiveChannelEndpoint) SendChannelEndpoint(io.aeron.driver.media.SendChannelEndpoint)

Example 14 with RawLog

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;
}
Also used : RawLog(io.aeron.driver.buffer.RawLog)

Example 15 with 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;
}
Also used : RawLog(io.aeron.driver.buffer.RawLog)

Aggregations

RawLog (io.aeron.driver.buffer.RawLog)18 ReceiveChannelEndpoint (io.aeron.driver.media.ReceiveChannelEndpoint)9 SendChannelEndpoint (io.aeron.driver.media.SendChannelEndpoint)6 InetSocketAddress (java.net.InetSocketAddress)4 InvalidChannelException (io.aeron.driver.exceptions.InvalidChannelException)3 ControlProtocolException (io.aeron.exceptions.ControlProtocolException)3 HeaderWriter (io.aeron.logbuffer.HeaderWriter)3 TermAppender (io.aeron.logbuffer.TermAppender)3 StatusMessageFlyweight (io.aeron.protocol.StatusMessageFlyweight)3 UnsafeBufferPosition (org.agrona.concurrent.status.UnsafeBufferPosition)3 UdpChannel (io.aeron.driver.media.UdpChannel)2 AtomicCounter (org.agrona.concurrent.status.AtomicCounter)2 Position (org.agrona.concurrent.status.Position)2 Test (org.junit.Test)2 Aeron (io.aeron.Aeron)1 ChannelUri (io.aeron.ChannelUri)1 SPY_QUALIFIER (io.aeron.ChannelUri.SPY_QUALIFIER)1 CommonContext (io.aeron.CommonContext)1 FORCE_TRUE (io.aeron.CommonContext.InferableBoolean.FORCE_TRUE)1 INFER (io.aeron.CommonContext.InferableBoolean.INFER)1