Skip to content

Commit

Permalink
Port to 1.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JPWatson committed Aug 1, 2018
1 parent 982b782 commit 4493169
Show file tree
Hide file tree
Showing 26 changed files with 298 additions and 207 deletions.
Binary file modified driver/media-driver.jar
Binary file not shown.
6 changes: 2 additions & 4 deletions driver/version.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
Driver built from source
Agrona: 0.9.18-13-g0378ffa
SBE: 1.8.1-48-gdbf2031e
Aeron: 1.9.2-341-gf6b702d9c
Driver source:
http://repo1.maven.org/maven2/io/aeron/aeron-all/1.10.0/aeron-all-1.10.0.jar
2 changes: 1 addition & 1 deletion scripts/build-prerelease-nuget-packages.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off
pushd %~dp0..
SET suffix=pre-alpha1
SET suffix=pre-alpha2
SET nuget_source=https://www.myget.org/F/aeron/api/v2/package

del nupkgs\*.nupkg
Expand Down
12 changes: 0 additions & 12 deletions scripts/build-release-nuget-packages - Copy.bat

This file was deleted.

5 changes: 3 additions & 2 deletions src/Adaptive.Aeron.Tests/LogBuffer/TermAppenderTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

using System;
using Adaptive.Aeron.Exceptions;
using Adaptive.Aeron.LogBuffer;
using Adaptive.Aeron.Protocol;
using Adaptive.Agrona;
Expand Down Expand Up @@ -254,7 +255,7 @@ public void ShouldAppendFragmentedFromVectorsToEmptyLog()
.Then(A.CallTo(() => _termBuffer.PutLong(tail2 + DataHeaderFlyweight.RESERVED_VALUE_OFFSET, RV, ByteOrder.LittleEndian)).MustHaveHappened())
.Then(A.CallTo(() => _termBuffer.PutIntOrdered(tail2, frameTwoLength)).MustHaveHappened());
}

[Test]
public void ShouldAppendFragmentedFromVectorsWithNonZeroOffsetToEmptyLog()
{
Expand Down Expand Up @@ -301,7 +302,7 @@ public void ShouldAppendFragmentedFromVectorsWithNonZeroOffsetToEmptyLog()
}

[Test]
[ExpectedException(typeof(InvalidOperationException))]
[ExpectedException(typeof(AeronException))]
public void ShouldDetectInvalidTerm()
{
var length = 128;
Expand Down
14 changes: 7 additions & 7 deletions src/Adaptive.Aeron/Aeron.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public long NextCorrelationId()
{
if (_conductor.IsClosed())
{
throw new InvalidOperationException("Client is closed");
throw new AeronException("Client is closed");
}

return _commandBuffer.NextCorrelationId();
Expand All @@ -311,7 +311,7 @@ public CountersReader CountersReader()
{
if (_conductor.IsClosed())
{
throw new InvalidOperationException("Client is closed");
throw new AeronException("Client is closed");
}

return _conductor.CountersReader();
Expand Down Expand Up @@ -1191,7 +1191,7 @@ private void ConnectToDriver()

if (CncFileDescriptor.CNC_VERSION != cncVersion)
{
throw new InvalidOperationException("CnC file version not supported: version=" + cncVersion);
throw new AeronException("CnC file version not supported: version=" + cncVersion);
}

ManyToOneRingBuffer ringBuffer =
Expand Down Expand Up @@ -1241,7 +1241,7 @@ private static MappedByteBuffer WaitForFileMapping(FileInfo cncFile, long deadLi
{
if (epochClock.Time() > deadLineMs)
{
throw new InvalidOperationException("CnC file is created but not populated.");
throw new AeronException("CnC file is created but not populated.");
}

Sleep(IdleSleepMs);
Expand All @@ -1251,7 +1251,7 @@ private static MappedByteBuffer WaitForFileMapping(FileInfo cncFile, long deadLi
}
catch (Exception ex)
{
throw new InvalidOperationException("cannot open CnC file", ex);
throw new AeronException("cannot open CnC file", ex);
}
}

Expand Down Expand Up @@ -1361,7 +1361,7 @@ public static bool IsDriverActive(long driverTimeoutMs, Action<string> logger,

if (CncFileDescriptor.CNC_VERSION != cncVersion)
{
throw new InvalidOperationException("Aeron CnC version does not match: version=" + cncVersion +
throw new AeronException("Aeron CnC version does not match: version=" + cncVersion +
" required=" + CncFileDescriptor.CNC_VERSION);
}

Expand Down Expand Up @@ -1414,7 +1414,7 @@ public int SaveErrorLog(StreamWriter writer, MappedByteBuffer cncByteBuffer)

if (CncFileDescriptor.CNC_VERSION != cncVersion)
{
throw new InvalidOperationException(
throw new AeronException(
"Aeron CnC version does not match: required=" + CncFileDescriptor.CNC_VERSION + " version=" +
cncVersion);
}
Expand Down
20 changes: 20 additions & 0 deletions src/Adaptive.Aeron/AeronThrowHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Runtime.CompilerServices;
using Adaptive.Aeron.Exceptions;

namespace Adaptive.Aeron
{
public class AeronThrowHelper
{
[MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowAeronException(string message)
{
throw GetAeronException(message);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static AeronException GetAeronException(string message)
{
return new AeronException(message);
}
}
}
10 changes: 5 additions & 5 deletions src/Adaptive.Aeron/ClientConductor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void OnClose()

if (_lingeringResources.Count > lingeringResourcesSize)
{
Aeron.Sleep(1);
Aeron.Sleep(15);
}

for (int i = 0, size = _lingeringResources.Count; i < size; i++)
Expand Down Expand Up @@ -171,9 +171,9 @@ public bool IsClosed()
return _isClosed;
}

public void OnError(long correlationId, ErrorCode errorCode, string message)
public void OnError(long correlationId, int codeValue, ErrorCode errorCode, string message)
{
_driverException = new RegistrationException(errorCode, message);
_driverException = new RegistrationException(codeValue, errorCode, message);
}

public void OnChannelEndpointError(int statusIndicatorId, string message)
Expand Down Expand Up @@ -642,7 +642,7 @@ private void EnsureOpen()
{
if (_isClosed)
{
throw new InvalidOperationException("Aeron client conductor is closed");
throw new AeronException("Aeron client conductor is closed");
}
}

Expand Down Expand Up @@ -699,7 +699,7 @@ private void AwaitResponse(long correlationId)

Service(correlationId);

if (_driverEventsAdapter.LastReceivedCorrelationId() == correlationId)
if (_driverEventsAdapter.ReceivedCorrelationId() == correlationId)
{
if (null != _driverException)
{
Expand Down
12 changes: 12 additions & 0 deletions src/Adaptive.Aeron/Command/ErrorResponseFlyweight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using System;
using Adaptive.Agrona;

namespace Adaptive.Aeron.Command
Expand Down Expand Up @@ -86,8 +87,19 @@ public ErrorResponseFlyweight OffendingCommandCorrelationId(long correlationId)
/// <returns> error code for the command </returns>
public ErrorCode ErrorCode()
{


return (ErrorCode)_buffer.GetInt(_offset + ERROR_CODE_OFFSET);
}

/// <summary>
/// Error code value for the command.
/// </summary>
/// <returns>error code value for the command </returns>
public int ErrorCodeValue()
{
return _buffer.GetInt(_offset + ERROR_CODE_OFFSET);
}

/// <summary>
/// Set the error code for the command.
Expand Down
6 changes: 3 additions & 3 deletions src/Adaptive.Aeron/Counter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using Adaptive.Aeron.Exceptions;
using Adaptive.Agrona.Concurrent;
using Adaptive.Agrona.Concurrent.Status;

Expand Down Expand Up @@ -26,13 +26,13 @@ internal Counter(long registrationId, ClientConductor clientConductor, IAtomicBu
/// <param name="countersReader"> for getting access to the buffers. </param>
/// <param name="registrationId"> assigned by the driver for the counter or <see cref="Aeron.NULL_VALUE"/> if not known. </param>
/// <param name="counterId"> for the counter to be viewed. </param>
/// <exception cref="InvalidOperationException"> if the id has for the counter has not been allocated. </exception>
/// <exception cref="AeronException"> if the id has for the counter has not been allocated. </exception>
internal Counter(CountersReader countersReader, long registrationId, int counterId) : base(
countersReader.ValuesBuffer, counterId)
{
if (countersReader.GetCounterState(counterId) != CountersReader.RECORD_ALLOCATED)
{
throw new InvalidOperationException("Counter id has not been allocated: " + counterId);
throw new AeronException("Counter id has not been allocated: " + counterId);
}

this.registrationId = registrationId;
Expand Down
Loading

0 comments on commit 4493169

Please sign in to comment.