diff --git a/RELEASE.md b/RELEASE.md index f614e6c3..b15f5cf3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,4 @@ #### Port Aeron.NET has been ported against Java version: - Agrona: 0.9.18-13-g0378ffa -- Aeron: 1.9.2-341-gf6b702d9c +- Aeron: 1.10.1 diff --git a/driver/Aeron.Driver.nuspec b/driver/Aeron.Driver.nuspec index 43fa6e86..266cab04 100644 --- a/driver/Aeron.Driver.nuspec +++ b/driver/Aeron.Driver.nuspec @@ -2,7 +2,7 @@ Aeron.Driver - 1.10.0 + 1.10.1 Aeron Driver Adaptive Financial Consulting Ltd. Adaptive Financial Consulting Ltd. diff --git a/driver/media-driver.jar b/driver/media-driver.jar index 3043dd7f..1b688470 100644 Binary files a/driver/media-driver.jar and b/driver/media-driver.jar differ diff --git a/driver/version.txt b/driver/version.txt index 972296bc..737e11f9 100644 --- a/driver/version.txt +++ b/driver/version.txt @@ -1,2 +1,2 @@ Driver source: -http://repo1.maven.org/maven2/io/aeron/aeron-all/1.10.0/aeron-all-1.10.0.jar +http://repo1.maven.org/maven2/io/aeron/aeron-all/1.10.1/aeron-all-1.10.1.jar diff --git a/src/Adaptive.Aeron/Adaptive.Aeron.csproj b/src/Adaptive.Aeron/Adaptive.Aeron.csproj index 503ca23e..c7e75b84 100644 --- a/src/Adaptive.Aeron/Adaptive.Aeron.csproj +++ b/src/Adaptive.Aeron/Adaptive.Aeron.csproj @@ -2,7 +2,7 @@ netstandard2.0;net45 Aeron.Client - 1.10.0 + 1.10.1 Adaptive Financial Consulting Ltd. Adaptive Financial Consulting Ltd. Aeron Client diff --git a/src/Adaptive.Aeron/ChannelUri.cs b/src/Adaptive.Aeron/ChannelUri.cs index 814e7d81..e37c4a62 100644 --- a/src/Adaptive.Aeron/ChannelUri.cs +++ b/src/Adaptive.Aeron/ChannelUri.cs @@ -3,7 +3,6 @@ using System.Text; using Adaptive.Aeron.LogBuffer; using Adaptive.Agrona.Collections; -using Adaptive.Agrona.Concurrent; namespace Adaptive.Aeron { @@ -64,7 +63,7 @@ public ChannelUri(string prefix, string media, IDictionary @para _media = media; _params = @params; - _tags = SplitTags(_params[Aeron.Context.TAGS_PARAM_NAME]); + _tags = SplitTags(_params.GetOrDefault(Aeron.Context.TAGS_PARAM_NAME)); } /// diff --git a/src/Adaptive.Cluster/Client/AuthenticationException.cs b/src/Adaptive.Aeron/Security/AuthenticationException.cs similarity index 91% rename from src/Adaptive.Cluster/Client/AuthenticationException.cs rename to src/Adaptive.Aeron/Security/AuthenticationException.cs index bd646b4b..e5f62b8d 100644 --- a/src/Adaptive.Cluster/Client/AuthenticationException.cs +++ b/src/Adaptive.Aeron/Security/AuthenticationException.cs @@ -2,10 +2,10 @@ using System.Runtime.Serialization; using Adaptive.Aeron.Exceptions; -namespace Adaptive.Cluster.Client +namespace Adaptive.Aeron.Security { /// - /// Used to indicated a failed authentication attempt when connecting to the cluster. + /// Used to indicated a failed authentication attempt when connecting to a system. /// public class AuthenticationException : AeronException { diff --git a/src/Adaptive.Aeron/Security/DefaultAuthenticatorSupplier.cs b/src/Adaptive.Aeron/Security/DefaultAuthenticatorSupplier.cs new file mode 100644 index 00000000..e9b0ccbb --- /dev/null +++ b/src/Adaptive.Aeron/Security/DefaultAuthenticatorSupplier.cs @@ -0,0 +1,39 @@ +using System; + +namespace Adaptive.Aeron.Security +{ + /// + /// Default Authenticator that authenticates all connection requests immediately. + /// + public class DefaultAuthenticatorSupplier : IAuthenticatorSupplier + { + public static readonly byte[] NULL_ENCODED_PRINCIPAL = new byte[0]; + public static readonly IAuthenticator DEFAULT_AUTHENTICATOR = new DefaultAuthenticator(); + + public IAuthenticator Get() + { + return DEFAULT_AUTHENTICATOR; + } + + private class DefaultAuthenticator : IAuthenticator + { + public void OnConnectRequest(long sessionId, byte[] encodedCredentials, long nowMs) + { + } + + public void OnChallengeResponse(long sessionId, byte[] encodedCredentials, long nowMs) + { + } + + public void OnConnectedSession(ISessionProxy sessionProxy, long nowMs) + { + sessionProxy.Authenticate(NULL_ENCODED_PRINCIPAL); + } + + public void OnChallengedSession(ISessionProxy sessionProxy, long nowMs) + { + sessionProxy.Authenticate(NULL_ENCODED_PRINCIPAL); + } + } + } +} \ No newline at end of file diff --git a/src/Adaptive.Aeron/Security/IAuthenticator.cs b/src/Adaptive.Aeron/Security/IAuthenticator.cs new file mode 100644 index 00000000..f747d15a --- /dev/null +++ b/src/Adaptive.Aeron/Security/IAuthenticator.cs @@ -0,0 +1,52 @@ +namespace Adaptive.Aeron.Security +{ + /// + /// Interface for Authenticator to handle authentication of clients to a system. + /// + /// The session-id refers to the authentication session and not the Aeron transport session assigned to a publication. + /// + /// + public interface IAuthenticator + { + /// + /// Called upon reception of a Connect Request. + /// + /// to identify the client session connecting. + /// from the Connect Request. Will not be null, but may be 0 length. + /// current epoch time in milliseconds. + void OnConnectRequest(long sessionId, byte[] encodedCredentials, long nowMs); + + /// + /// Called upon reception of a Challenge Response from an unauthenticated client. + /// + /// to identify the client session connecting. + /// from the Challenge Response. Will not be null, but may be 0 length. + /// current epoch time in milliseconds. + void OnChallengeResponse(long sessionId, byte[] encodedCredentials, long nowMs); + + /// + /// Called when a client's response channel has been connected. This method may be called multiple times until the + /// session is timeouts, is challenged, authenticated, or rejected. + /// + /// to use to inform client of status. + /// current epoch time in milliseconds. + /// + void OnConnectedSession(ISessionProxy sessionProxy, long nowMs); + + /// + /// Called when a challenged client should be able to accept a response from the authenticator. + /// + /// When this is called, there is no assumption that a Challenge Response has been received, plus this method + /// may be called multiple times. + /// + /// + /// It is up to the concrete class to provide any timeout management. + /// + /// + /// + /// to use to inform client of status. + /// current epoch time in milliseconds. + /// + void OnChallengedSession(ISessionProxy sessionProxy, long nowMs); + } +} \ No newline at end of file diff --git a/src/Adaptive.Aeron/Security/IAuthenticatorSupplier.cs b/src/Adaptive.Aeron/Security/IAuthenticatorSupplier.cs new file mode 100644 index 00000000..6ce0373d --- /dev/null +++ b/src/Adaptive.Aeron/Security/IAuthenticatorSupplier.cs @@ -0,0 +1,10 @@ +namespace Adaptive.Aeron.Security +{ + /// + /// Used to supply instances of + /// + public interface IAuthenticatorSupplier + { + IAuthenticator Get(); + } +} \ No newline at end of file diff --git a/src/Adaptive.Cluster/Client/ICredentialsSupplier.cs b/src/Adaptive.Aeron/Security/ICredentialsSupplier.cs similarity index 74% rename from src/Adaptive.Cluster/Client/ICredentialsSupplier.cs rename to src/Adaptive.Aeron/Security/ICredentialsSupplier.cs index f73e59f1..365d5ef7 100644 --- a/src/Adaptive.Cluster/Client/ICredentialsSupplier.cs +++ b/src/Adaptive.Aeron/Security/ICredentialsSupplier.cs @@ -1,7 +1,7 @@ -namespace Adaptive.Cluster.Client +namespace Adaptive.Aeron.Security { /// - /// Supplier of credentials for authentication with a cluster leader. + /// Supplier of credentials for authentication with a system. /// /// Implement this interface to supply credentials for clients. If no credentials are required then the /// can be used. @@ -9,17 +9,17 @@ public interface ICredentialsSupplier { /// - /// Provide a credential to be included in Session Connect message to the cluster. + /// Provide a credential to be included in Session Connect message to a system. /// - /// a credential in binary form to be included in the Session Connect message to the cluster. + /// a credential in binary form to be included in the Session Connect message to system. byte[] EncodedCredentials(); /// /// Given some encoded challenge data, provide the credentials to be included in a Challenge Response as part of - /// authentication with a cluster. + /// authentication with a system. /// /// from the cluster to use in providing a credential. - /// encoded credentials in binary form to be included in the Challenge Response to the cluster. + /// encoded credentials in binary form to be included in the Challenge Response to the system. byte[] OnChallenge(byte[] endcodedChallenge); } } \ No newline at end of file diff --git a/src/Adaptive.Aeron/Security/ISessionProxy.cs b/src/Adaptive.Aeron/Security/ISessionProxy.cs new file mode 100644 index 00000000..c362c65f --- /dev/null +++ b/src/Adaptive.Aeron/Security/ISessionProxy.cs @@ -0,0 +1,33 @@ +namespace Adaptive.Aeron.Security +{ + /// + /// Representation for a session which is going through the authentication process. + /// + public interface ISessionProxy + { + /// + /// The session Id of the potential session assigned by the system. + /// + /// session id for the potential session + long SessionId(); + + /// + /// Inform the system that the session requires a challenge and to send the provided encoded challenge. + /// + /// to send to the client. + /// true if challenge was sent or false if challenge could not be sent. + bool Challenge(byte[] encodedChallenge); + + /// + /// Inform the system that the session has met authentication requirements. + /// + /// that has passed authentication. + /// true if success event was sent or false if success event could not be sent. + bool Authenticate(byte[] encodedPrincipal); + + /// + /// Inform the system that the session has NOT met authentication requirements and should be rejected. + /// + void Reject(); + } +} \ No newline at end of file diff --git a/src/Adaptive.Cluster/Client/NullCredentialsSupplier.cs b/src/Adaptive.Aeron/Security/NullCredentialsSupplier.cs similarity index 92% rename from src/Adaptive.Cluster/Client/NullCredentialsSupplier.cs rename to src/Adaptive.Aeron/Security/NullCredentialsSupplier.cs index b24264f3..a15b2acc 100644 --- a/src/Adaptive.Cluster/Client/NullCredentialsSupplier.cs +++ b/src/Adaptive.Aeron/Security/NullCredentialsSupplier.cs @@ -1,4 +1,4 @@ -namespace Adaptive.Cluster.Client +namespace Adaptive.Aeron.Security { /// /// Null provider of credentials when no authentication is required. diff --git a/src/Adaptive.Agrona/Adaptive.Agrona.csproj b/src/Adaptive.Agrona/Adaptive.Agrona.csproj index efc032be..0f6fcf75 100644 --- a/src/Adaptive.Agrona/Adaptive.Agrona.csproj +++ b/src/Adaptive.Agrona/Adaptive.Agrona.csproj @@ -3,7 +3,7 @@ netstandard2.0;net45 true Agrona - 1.10.0 + 1.10.1 Adaptive Financial Consulting Ltd. Adaptive Financial Consulting Ltd. Agrona libraries initially included in Aeron Client diff --git a/src/Adaptive.Agrona/Collections/DictionaryExtensions.cs b/src/Adaptive.Agrona/Collections/DictionaryExtensions.cs new file mode 100644 index 00000000..a228cc6a --- /dev/null +++ b/src/Adaptive.Agrona/Collections/DictionaryExtensions.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Adaptive.Agrona.Collections +{ + public static class DictionaryExtensions + { + public static TValue GetOrDefault( + this IDictionary dictionary, + TKey key, + TValue @default = default(TValue)) + { + return dictionary.TryGetValue(key, out var value) ? value : @default; + } + } +} \ No newline at end of file diff --git a/src/Adaptive.Archiver/Adaptive.Archiver.csproj b/src/Adaptive.Archiver/Adaptive.Archiver.csproj index 60dadea4..f3567a07 100644 --- a/src/Adaptive.Archiver/Adaptive.Archiver.csproj +++ b/src/Adaptive.Archiver/Adaptive.Archiver.csproj @@ -3,7 +3,7 @@ netstandard2.0;net45 true Aeron.Archiver - 1.10.0 + 1.10.1 Adaptive Financial Consulting Ltd. Adaptive Financial Consulting Ltd. Archiving over the Aeron transport diff --git a/src/Adaptive.Cluster/Adaptive.Cluster.csproj b/src/Adaptive.Cluster/Adaptive.Cluster.csproj index ee3a2989..579121c3 100644 --- a/src/Adaptive.Cluster/Adaptive.Cluster.csproj +++ b/src/Adaptive.Cluster/Adaptive.Cluster.csproj @@ -3,7 +3,7 @@ netstandard2.0;net45 true Aeron.Cluster - 1.10.0 + 1.10.1 Adaptive Financial Consulting Ltd. Adaptive Financial Consulting Ltd. Clustering libraries over the Aeron transport diff --git a/src/Adaptive.Cluster/Client/AeronCluster.cs b/src/Adaptive.Cluster/Client/AeronCluster.cs index ca5f0991..b222d8c7 100644 --- a/src/Adaptive.Cluster/Client/AeronCluster.cs +++ b/src/Adaptive.Cluster/Client/AeronCluster.cs @@ -6,6 +6,7 @@ using Adaptive.Agrona; using Adaptive.Agrona.Concurrent; using Adaptive.Cluster.Codecs; +using Adaptive.Aeron.Security; namespace Adaptive.Cluster.Client { @@ -40,7 +41,7 @@ public sealed class AeronCluster : IDisposable private readonly BufferClaim _bufferClaim = new BufferClaim(); private readonly MessageHeaderEncoder _messageHeaderEncoder = new MessageHeaderEncoder(); private readonly SessionKeepAliveRequestEncoder _keepAliveRequestEncoder = new SessionKeepAliveRequestEncoder(); - + private readonly SessionHeaderEncoder _sessionHeaderEncoder = new SessionHeaderEncoder(); private readonly DirectBufferVector[] _vectors = new DirectBufferVector[2]; private readonly DirectBufferVector _messageBuffer = new DirectBufferVector(); @@ -52,7 +53,7 @@ private class Poller : IFragmentHandler private readonly MessageHeaderDecoder _messageHeaderDecoder = new MessageHeaderDecoder(); private readonly SessionHeaderDecoder _sessionHeaderDecoder = new SessionHeaderDecoder(); private readonly NewLeaderEventDecoder _newLeaderEventDecoder = new NewLeaderEventDecoder(); - + private readonly ISessionMessageListener _sessionMessageListener; private readonly long _clusterSessionId; private readonly AeronCluster _cluster; @@ -63,7 +64,7 @@ public Poller(ISessionMessageListener sessionMessageListener, long clusterSessio _clusterSessionId = clusterSessionId; _cluster = cluster; } - + public void OnFragment(IDirectBuffer buffer, int offset, int length, Header header) { _messageHeaderDecoder.Wrap(buffer, offset); @@ -147,7 +148,7 @@ private AeronCluster(Context ctx) _vectors[0] = new DirectBufferVector(headerBuffer, 0, SessionDecorator.SESSION_HEADER_LENGTH); _vectors[1] = _messageBuffer; - + _poller = new Poller(ctx.SessionMessageListener(), _clusterSessionId, this); _fragmentAssembler = new FragmentAssembler(_poller); } @@ -432,7 +433,7 @@ private Publication ConnectToCluster() string channel = channelUri.ToString(); publications[entry.Key] = AddIngressPublication(channel, ingressStreamId); } - + int connectedIndex = -1; while (true) { @@ -814,7 +815,7 @@ public void OnMessage( throw new ConfigurationException("sessionMessageListener must be specified on AeronCluster.Context"); } } - + private long _messageTimeoutNs = Configuration.MessageTimeoutNs(); private string _clusterMemberEndpoints = Configuration.ClusterMemberEndpoints(); private string _ingressChannel = Configuration.IngressChannel(); @@ -859,7 +860,7 @@ public void Conclude() { _credentialsSupplier = new NullCredentialsSupplier(); } - + if (null == _sessionMessageListener) { _sessionMessageListener = new MissingSessionMessageListner(); @@ -1143,7 +1144,7 @@ public Context CredentialsSupplier(ICredentialsSupplier credentialsSupplier) _credentialsSupplier = credentialsSupplier; return this; } - + /// /// Get the to be used for handling any exceptions. /// diff --git a/src/Adaptive.Cluster/Codecs/ClusterActionRequestDecoder.cs b/src/Adaptive.Cluster/Codecs/ClusterActionRequestDecoder.cs index cec53d20..f5c7285b 100644 --- a/src/Adaptive.Cluster/Codecs/ClusterActionRequestDecoder.cs +++ b/src/Adaptive.Cluster/Codecs/ClusterActionRequestDecoder.cs @@ -88,27 +88,27 @@ public void Limit(int limit) this._limit = limit; } - public static int LogPositionId() + public static int LeadershipTermIdId() { return 1; } - public static int LogPositionSinceVersion() + public static int LeadershipTermIdSinceVersion() { return 0; } - public static int LogPositionEncodingOffset() + public static int LeadershipTermIdEncodingOffset() { return 0; } - public static int LogPositionEncodingLength() + public static int LeadershipTermIdEncodingLength() { return 8; } - public static string LogPositionMetaAttribute(MetaAttribute metaAttribute) + public static string LeadershipTermIdMetaAttribute(MetaAttribute metaAttribute) { switch (metaAttribute) { @@ -121,48 +121,48 @@ public static string LogPositionMetaAttribute(MetaAttribute metaAttribute) return ""; } - public static long LogPositionNullValue() + public static long LeadershipTermIdNullValue() { return -9223372036854775808L; } - public static long LogPositionMinValue() + public static long LeadershipTermIdMinValue() { return -9223372036854775807L; } - public static long LogPositionMaxValue() + public static long LeadershipTermIdMaxValue() { return 9223372036854775807L; } - public long LogPosition() + public long LeadershipTermId() { return _buffer.GetLong(_offset + 0, ByteOrder.LittleEndian); } - public static int LeadershipTermIdId() + public static int LogPositionId() { return 2; } - public static int LeadershipTermIdSinceVersion() + public static int LogPositionSinceVersion() { return 0; } - public static int LeadershipTermIdEncodingOffset() + public static int LogPositionEncodingOffset() { return 8; } - public static int LeadershipTermIdEncodingLength() + public static int LogPositionEncodingLength() { return 8; } - public static string LeadershipTermIdMetaAttribute(MetaAttribute metaAttribute) + public static string LogPositionMetaAttribute(MetaAttribute metaAttribute) { switch (metaAttribute) { @@ -175,22 +175,22 @@ public static string LeadershipTermIdMetaAttribute(MetaAttribute metaAttribute) return ""; } - public static long LeadershipTermIdNullValue() + public static long LogPositionNullValue() { return -9223372036854775808L; } - public static long LeadershipTermIdMinValue() + public static long LogPositionMinValue() { return -9223372036854775807L; } - public static long LeadershipTermIdMaxValue() + public static long LogPositionMaxValue() { return 9223372036854775807L; } - public long LeadershipTermId() + public long LogPosition() { return _buffer.GetLong(_offset + 8, ByteOrder.LittleEndian); } @@ -318,16 +318,16 @@ public StringBuilder AppendTo(StringBuilder builder) } builder.Append(BLOCK_LENGTH); builder.Append("):"); - //Token{signal=BEGIN_FIELD, name='logPosition', referencedName='null', description='null', id=1, version=0, deprecated=0, encodedLength=0, offset=0, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} + //Token{signal=BEGIN_FIELD, name='leadershipTermId', referencedName='null', description='null', id=1, version=0, deprecated=0, encodedLength=0, offset=0, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=0, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.Append("LogPosition="); - builder.Append(LogPosition()); - builder.Append('|'); - //Token{signal=BEGIN_FIELD, name='leadershipTermId', referencedName='null', description='null', id=2, version=0, deprecated=0, encodedLength=0, offset=8, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=8, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} builder.Append("LeadershipTermId="); builder.Append(LeadershipTermId()); builder.Append('|'); + //Token{signal=BEGIN_FIELD, name='logPosition', referencedName='null', description='null', id=2, version=0, deprecated=0, encodedLength=0, offset=8, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} + //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=8, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} + builder.Append("LogPosition="); + builder.Append(LogPosition()); + builder.Append('|'); //Token{signal=BEGIN_FIELD, name='timestamp', referencedName='null', description='null', id=3, version=0, deprecated=0, encodedLength=0, offset=16, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} //Token{signal=ENCODING, name='time_t', referencedName='null', description='Epoch time in milliseconds since 1 Jan 1970 UTC', id=-1, version=0, deprecated=0, encodedLength=8, offset=16, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} builder.Append("Timestamp="); diff --git a/src/Adaptive.Cluster/Codecs/ClusterActionRequestEncoder.cs b/src/Adaptive.Cluster/Codecs/ClusterActionRequestEncoder.cs index d909c2f9..293a3148 100644 --- a/src/Adaptive.Cluster/Codecs/ClusterActionRequestEncoder.cs +++ b/src/Adaptive.Cluster/Codecs/ClusterActionRequestEncoder.cs @@ -96,64 +96,64 @@ public void Limit(int limit) this._limit = limit; } - public static int LogPositionEncodingOffset() + public static int LeadershipTermIdEncodingOffset() { return 0; } - public static int LogPositionEncodingLength() + public static int LeadershipTermIdEncodingLength() { return 8; } - public static long LogPositionNullValue() + public static long LeadershipTermIdNullValue() { return -9223372036854775808L; } - public static long LogPositionMinValue() + public static long LeadershipTermIdMinValue() { return -9223372036854775807L; } - public static long LogPositionMaxValue() + public static long LeadershipTermIdMaxValue() { return 9223372036854775807L; } - public ClusterActionRequestEncoder LogPosition(long value) + public ClusterActionRequestEncoder LeadershipTermId(long value) { _buffer.PutLong(_offset + 0, value, ByteOrder.LittleEndian); return this; } - public static int LeadershipTermIdEncodingOffset() + public static int LogPositionEncodingOffset() { return 8; } - public static int LeadershipTermIdEncodingLength() + public static int LogPositionEncodingLength() { return 8; } - public static long LeadershipTermIdNullValue() + public static long LogPositionNullValue() { return -9223372036854775808L; } - public static long LeadershipTermIdMinValue() + public static long LogPositionMinValue() { return -9223372036854775807L; } - public static long LeadershipTermIdMaxValue() + public static long LogPositionMaxValue() { return 9223372036854775807L; } - public ClusterActionRequestEncoder LeadershipTermId(long value) + public ClusterActionRequestEncoder LogPosition(long value) { _buffer.PutLong(_offset + 8, value, ByteOrder.LittleEndian); return this; diff --git a/src/Adaptive.Cluster/Codecs/VoteDecoder.cs b/src/Adaptive.Cluster/Codecs/VoteDecoder.cs index 54d78555..7a0453c1 100644 --- a/src/Adaptive.Cluster/Codecs/VoteDecoder.cs +++ b/src/Adaptive.Cluster/Codecs/VoteDecoder.cs @@ -142,27 +142,27 @@ public long CandidateTermId() } - public static int LogLeaderhipTermIdId() + public static int LogLeadershipTermIdId() { return 2; } - public static int LogLeaderhipTermIdSinceVersion() + public static int LogLeadershipTermIdSinceVersion() { return 0; } - public static int LogLeaderhipTermIdEncodingOffset() + public static int LogLeadershipTermIdEncodingOffset() { return 8; } - public static int LogLeaderhipTermIdEncodingLength() + public static int LogLeadershipTermIdEncodingLength() { return 8; } - public static string LogLeaderhipTermIdMetaAttribute(MetaAttribute metaAttribute) + public static string LogLeadershipTermIdMetaAttribute(MetaAttribute metaAttribute) { switch (metaAttribute) { @@ -175,22 +175,22 @@ public static string LogLeaderhipTermIdMetaAttribute(MetaAttribute metaAttribute return ""; } - public static long LogLeaderhipTermIdNullValue() + public static long LogLeadershipTermIdNullValue() { return -9223372036854775808L; } - public static long LogLeaderhipTermIdMinValue() + public static long LogLeadershipTermIdMinValue() { return -9223372036854775807L; } - public static long LogLeaderhipTermIdMaxValue() + public static long LogLeadershipTermIdMaxValue() { return 9223372036854775807L; } - public long LogLeaderhipTermId() + public long LogLeadershipTermId() { return _buffer.GetLong(_offset + 8, ByteOrder.LittleEndian); } @@ -431,10 +431,10 @@ public StringBuilder AppendTo(StringBuilder builder) builder.Append("CandidateTermId="); builder.Append(CandidateTermId()); builder.Append('|'); - //Token{signal=BEGIN_FIELD, name='logLeaderhipTermId', referencedName='null', description='null', id=2, version=0, deprecated=0, encodedLength=0, offset=8, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} + //Token{signal=BEGIN_FIELD, name='logLeadershipTermId', referencedName='null', description='null', id=2, version=0, deprecated=0, encodedLength=0, offset=8, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=8, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} - builder.Append("LogLeaderhipTermId="); - builder.Append(LogLeaderhipTermId()); + builder.Append("LogLeadershipTermId="); + builder.Append(LogLeadershipTermId()); builder.Append('|'); //Token{signal=BEGIN_FIELD, name='logPosition', referencedName='null', description='null', id=3, version=0, deprecated=0, encodedLength=0, offset=16, componentTokenCount=3, encoding=Encoding{presence=REQUIRED, primitiveType=null, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} //Token{signal=ENCODING, name='int64', referencedName='null', description='null', id=-1, version=0, deprecated=0, encodedLength=8, offset=16, componentTokenCount=1, encoding=Encoding{presence=REQUIRED, primitiveType=INT64, byteOrder=LITTLE_ENDIAN, minValue=null, maxValue=null, nullValue=null, constValue=null, characterEncoding='null', epoch='unix', timeUnit=nanosecond, semanticType='null'}} diff --git a/src/Adaptive.Cluster/Codecs/VoteEncoder.cs b/src/Adaptive.Cluster/Codecs/VoteEncoder.cs index 06f82ce1..0a32a13c 100644 --- a/src/Adaptive.Cluster/Codecs/VoteEncoder.cs +++ b/src/Adaptive.Cluster/Codecs/VoteEncoder.cs @@ -128,32 +128,32 @@ public VoteEncoder CandidateTermId(long value) } - public static int LogLeaderhipTermIdEncodingOffset() + public static int LogLeadershipTermIdEncodingOffset() { return 8; } - public static int LogLeaderhipTermIdEncodingLength() + public static int LogLeadershipTermIdEncodingLength() { return 8; } - public static long LogLeaderhipTermIdNullValue() + public static long LogLeadershipTermIdNullValue() { return -9223372036854775808L; } - public static long LogLeaderhipTermIdMinValue() + public static long LogLeadershipTermIdMinValue() { return -9223372036854775807L; } - public static long LogLeaderhipTermIdMaxValue() + public static long LogLeadershipTermIdMaxValue() { return 9223372036854775807L; } - public VoteEncoder LogLeaderhipTermId(long value) + public VoteEncoder LogLeadershipTermId(long value) { _buffer.PutLong(_offset + 8, value, ByteOrder.LittleEndian); return this; diff --git a/src/Adaptive.Cluster/aeron-cluster-codecs.xml b/src/Adaptive.Cluster/aeron-cluster-codecs.xml index 7f8733b9..7644dd91 100644 --- a/src/Adaptive.Cluster/aeron-cluster-codecs.xml +++ b/src/Adaptive.Cluster/aeron-cluster-codecs.xml @@ -211,8 +211,8 @@ - - + + @@ -308,7 +308,7 @@ id="52" description="Response to a vote request from a follower to the candidate"> - +