Repository: ignite Updated Branches: refs/heads/ignite-1282 0d7fd86bd -> 7c1ef1ae6
IGNITE-1571 .Fixed date/guid/decimal handling. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7c1ef1ae Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7c1ef1ae Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7c1ef1ae Branch: refs/heads/ignite-1282 Commit: 7c1ef1ae6889ec093357c8426d07b1b5147b62e4 Parents: 0d7fd86 Author: Pavel Tupitsyn <[email protected]> Authored: Fri Oct 9 14:47:31 2015 +0300 Committer: vozerov-gridgain <[email protected]> Committed: Fri Oct 9 14:47:31 2015 +0300 ---------------------------------------------------------------------- .../Apache.Ignite.Benchmarks/Model/TestModel.cs | 6 +- .../Portable/PortableWriteBenchmark.cs | 2 +- .../Compute/ComputeApiTest.cs | 1 - .../Apache.Ignite.Core.Tests/EventsTest.cs | 18 ++- .../Portable/PortableApiSelfTest.cs | 8 +- .../Portable/PortableSelfTest.cs | 58 +++---- .../Apache.Ignite.Core/Common/IgniteGuid.cs | 9 +- .../Apache.Ignite.Core/Events/CacheEvent.cs | 14 +- .../Events/CacheQueryExecutedEvent.cs | 6 +- .../Events/CacheQueryReadEvent.cs | 6 +- .../Apache.Ignite.Core/Events/EventBase.cs | 10 +- .../Apache.Ignite.Core/Events/IEventFilter.cs | 2 +- .../dotnet/Apache.Ignite.Core/Events/IEvents.cs | 4 +- .../Apache.Ignite.Core/Events/JobEvent.cs | 14 +- .../Apache.Ignite.Core/Events/TaskEvent.cs | 12 +- .../Impl/Cluster/ClusterMetricsImpl.cs | 18 ++- .../Impl/Cluster/ClusterNodeImpl.cs | 7 +- .../Impl/Common/DelegateTypeDescriptor.cs | 8 +- .../Impl/Compute/ComputeTaskHolder.cs | 6 +- .../Apache.Ignite.Core/Impl/Events/Events.cs | 6 +- .../Impl/Events/EventsAsync.cs | 2 +- .../Impl/Events/RemoteListenEventFilter.cs | 6 +- .../Impl/Portable/PortableBuilderImpl.cs | 2 +- .../Impl/Portable/PortableMarshaller.cs | 2 +- .../Impl/Portable/PortableReaderImpl.cs | 8 +- .../Impl/Portable/PortableReflectiveRoutines.cs | 8 +- .../Impl/Portable/PortableSystemHandlers.cs | 8 +- .../Impl/Portable/PortableUtils.cs | 23 ++- .../Impl/Portable/PortableWriterImpl.cs | 151 +++---------------- .../Impl/Transactions/TransactionMetricsImpl.cs | 10 +- .../Portable/IPortableRawReader.cs | 4 +- .../Portable/IPortableRawWriter.cs | 28 +--- .../Portable/IPortableReader.cs | 4 +- .../Portable/IPortableWriter.cs | 32 +--- .../Events/EventsExample.cs | 5 +- .../Events/LocalListener.cs | 2 +- .../Events/RemoteFilter.cs | 2 +- 37 files changed, 195 insertions(+), 317 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Model/TestModel.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Model/TestModel.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Model/TestModel.cs index 1c87018..2685dec 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Model/TestModel.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Model/TestModel.cs @@ -41,8 +41,8 @@ namespace Apache.Ignite.Benchmarks.Model public float[] FloatArray { get; set; } public double Double { get; set; } public double[] DoubleArray { get; set; } - public decimal Decimal { get; set; } - public decimal[] DecimalArray { get; set; } + public decimal? Decimal { get; set; } + public decimal?[] DecimalArray { get; set; } public DateTime? Date { get; set; } public DateTime?[] DateArray { get; set; } public string String { get; set; } @@ -104,7 +104,7 @@ namespace Apache.Ignite.Benchmarks.Model DateArray = reader.ReadDateArray("DateArray"); String = reader.ReadString("String"); StringArray = reader.ReadStringArray("StringArray"); - Guid = reader.ReadGuid("Guid"); + Guid = reader.ReadObject<Guid>("Guid"); GuidArray = reader.ReadGuidArray("GuidArray"); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs index 7ac27ea..7815106 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Benchmarks/Portable/PortableWriteBenchmark.cs @@ -51,7 +51,7 @@ namespace Apache.Ignite.Benchmarks.Portable Date = DateTime.Now, DateArray = Enumerable.Range(1, 15).Select(x => (DateTime?) DateTime.Now.AddDays(x)).ToArray(), Decimal = decimal.MinValue, - DecimalArray = new[] {1.1M, decimal.MinValue, decimal.MaxValue, decimal.MinusOne, decimal.One}, + DecimalArray = new decimal?[] {1.1M, decimal.MinValue, decimal.MaxValue, decimal.MinusOne, decimal.One}, Double = double.MaxValue/2, DoubleArray = new[] {double.MaxValue, double.MinValue, double.Epsilon, double.NegativeInfinity}, Float = 98, http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs index ffc6e34..f7ab05b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs @@ -25,7 +25,6 @@ namespace Apache.Ignite.Core.Tests.Compute using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Common; using Apache.Ignite.Core.Compute; - using Apache.Ignite.Core.Impl; using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Portable; using Apache.Ignite.Core.Resource; http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs index de90cd3..2c014e2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs @@ -397,13 +397,15 @@ namespace Apache.Ignite.Core.Tests if (async) listenId = events.GetFuture<Guid>().Get(); + Assert.IsNotNull(listenId); + CheckSend(3, typeof(JobEvent), expectedType); _grid3.GetEvents().DisableLocal(EventType.EventsJobExecution); CheckSend(2, typeof(JobEvent), expectedType); - events.StopRemoteListen(listenId); + events.StopRemoteListen(listenId.Value); if (async) events.GetFuture().Get(); @@ -745,7 +747,7 @@ namespace Apache.Ignite.Core.Tests public static readonly CountdownEvent ReceivedEvent = new CountdownEvent(0); /** */ - public static readonly ConcurrentStack<Guid> LastNodeIds = new ConcurrentStack<Guid>(); + public static readonly ConcurrentStack<Guid?> LastNodeIds = new ConcurrentStack<Guid?>(); /** */ public static volatile bool ListenResult = true; @@ -813,7 +815,7 @@ namespace Apache.Ignite.Core.Tests /// </summary> /// <param name="id">Originating node ID.</param> /// <param name="evt">Event.</param> - private static bool Listen(Guid id, IEvent evt) + private static bool Listen(Guid? id, IEvent evt) { try { @@ -841,19 +843,19 @@ namespace Apache.Ignite.Core.Tests public class EventFilter<T> : IEventFilter<T> where T : IEvent { /** */ - private readonly Func<Guid, T, bool> _invoke; + private readonly Func<Guid?, T, bool> _invoke; /// <summary> /// Initializes a new instance of the <see cref="RemoteListenEventFilter"/> class. /// </summary> /// <param name="invoke">The invoke delegate.</param> - public EventFilter(Func<Guid, T, bool> invoke) + public EventFilter(Func<Guid?, T, bool> invoke) { _invoke = invoke; } /** <inheritdoc /> */ - bool IEventFilter<T>.Invoke(Guid nodeId, T evt) + bool IEventFilter<T>.Invoke(Guid? nodeId, T evt) { return _invoke(nodeId, evt); } @@ -880,7 +882,7 @@ namespace Apache.Ignite.Core.Tests } /** <inheritdoc /> */ - public bool Invoke(Guid nodeId, IEvent evt) + public bool Invoke(Guid? nodeId, IEvent evt) { return evt.Type == _type; } @@ -904,7 +906,7 @@ namespace Apache.Ignite.Core.Tests } /** <inheritdoc /> */ - public bool Invoke(Guid nodeId, IEvent evt) + public bool Invoke(Guid? nodeId, IEvent evt) { return evt.Type == _type; } http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs index 90f49a0..009a2da 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableApiSelfTest.cs @@ -415,7 +415,7 @@ namespace Apache.Ignite.Core.Tests.Portable { IPortableObject portObj = _grid.GetPortables().GetBuilder(typeof(DecimalHolder)) .SetField("val", decimal.One) - .SetField("valArr", new[] { decimal.MinusOne }) + .SetField("valArr", new decimal?[] { decimal.MinusOne }) .Build(); IPortableMetadata meta = portObj.GetMetadata(); @@ -428,12 +428,12 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(PortableTypeNames.TypeNameArrayDecimal, meta.GetFieldTypeName("valArr")); Assert.AreEqual(decimal.One, portObj.GetField<decimal>("val")); - Assert.AreEqual(new[] { decimal.MinusOne }, portObj.GetField<decimal[]>("valArr")); + Assert.AreEqual(new decimal?[] { decimal.MinusOne }, portObj.GetField<decimal?[]>("valArr")); DecimalHolder obj = portObj.Deserialize<DecimalHolder>(); Assert.AreEqual(decimal.One, obj.Val); - Assert.AreEqual(new[] { decimal.MinusOne }, obj.ValArr); + Assert.AreEqual(new decimal?[] { decimal.MinusOne }, obj.ValArr); } /// <summary> @@ -1758,7 +1758,7 @@ namespace Apache.Ignite.Core.Tests.Portable public decimal Val; /** */ - public decimal[] ValArr; + public decimal?[] ValArr; } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs index db9a2f7..275460f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Portable/PortableSelfTest.cs @@ -59,7 +59,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<bool>(_marsh.Marshal(true)), true); Assert.AreEqual(_marsh.Unmarshal<bool?>(_marsh.Marshal((bool?)false)), false); - Assert.AreEqual(_marsh.Unmarshal<bool?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<bool?>(_marsh.Marshal((bool?)null)), null); } /** @@ -71,6 +71,10 @@ namespace Apache.Ignite.Core.Tests.Portable bool[] vals = { true, false }; Assert.AreEqual(_marsh.Unmarshal<bool[]>(_marsh.Marshal(vals)), vals); + + bool?[] vals2 = { true, false }; + + Assert.AreEqual(_marsh.Unmarshal<bool?[]>(_marsh.Marshal(vals2)), vals2); } /** @@ -84,7 +88,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<sbyte>(_marsh.Marshal(sbyte.MaxValue)), sbyte.MaxValue); Assert.AreEqual(_marsh.Unmarshal<sbyte?>(_marsh.Marshal((sbyte?)1)), (sbyte?)1); - Assert.AreEqual(_marsh.Unmarshal<sbyte?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<sbyte?>(_marsh.Marshal((sbyte?)null)), null); } /** @@ -110,7 +114,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<byte>(_marsh.Marshal(byte.MaxValue)), byte.MaxValue); Assert.AreEqual(_marsh.Unmarshal<byte?>(_marsh.Marshal((byte?)1)), (byte?)1); - Assert.AreEqual(_marsh.Unmarshal<byte?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<byte?>(_marsh.Marshal((byte?)null)), null); } /** @@ -136,7 +140,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<short>(_marsh.Marshal(short.MaxValue)), short.MaxValue); Assert.AreEqual(_marsh.Unmarshal<short?>(_marsh.Marshal((short?)1)), (short?)1); - Assert.AreEqual(_marsh.Unmarshal<short?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<short?>(_marsh.Marshal((short?)null)), null); } /** @@ -162,7 +166,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<ushort>(_marsh.Marshal(ushort.MaxValue)), ushort.MaxValue); Assert.AreEqual(_marsh.Unmarshal<ushort?>(_marsh.Marshal((ushort?)1)), (ushort?)1); - Assert.AreEqual(_marsh.Unmarshal<ushort?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<ushort?>(_marsh.Marshal((ushort?)null)), null); } /** @@ -188,7 +192,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<char>(_marsh.Marshal(char.MaxValue)), char.MaxValue); Assert.AreEqual(_marsh.Unmarshal<char?>(_marsh.Marshal((char?)1)), (char?)1); - Assert.AreEqual(_marsh.Unmarshal<char?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<char?>(_marsh.Marshal((char?)null)), null); } /** @@ -214,7 +218,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<int>(_marsh.Marshal(int.MaxValue)), int.MaxValue); Assert.AreEqual(_marsh.Unmarshal<int?>(_marsh.Marshal((int?)1)), (int?)1); - Assert.AreEqual(_marsh.Unmarshal<int?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<int?>(_marsh.Marshal((int?)null)), null); } /** @@ -240,7 +244,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<uint>(_marsh.Marshal(uint.MaxValue)), uint.MaxValue); Assert.AreEqual(_marsh.Unmarshal<uint?>(_marsh.Marshal((uint?)1)), (int?)1); - Assert.AreEqual(_marsh.Unmarshal<uint?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<uint?>(_marsh.Marshal((uint?)null)), null); } /** @@ -266,7 +270,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<long>(_marsh.Marshal(long.MaxValue)), long.MaxValue); Assert.AreEqual(_marsh.Unmarshal<long?>(_marsh.Marshal((long?)1)), (long?)1); - Assert.AreEqual(_marsh.Unmarshal<long?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<long?>(_marsh.Marshal((long?)null)), null); } /** @@ -292,7 +296,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<ulong>(_marsh.Marshal(ulong.MaxValue)), ulong.MaxValue); Assert.AreEqual(_marsh.Unmarshal<ulong?>(_marsh.Marshal((ulong?)1)), (ulong?)1); - Assert.AreEqual(_marsh.Unmarshal<ulong?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<ulong?>(_marsh.Marshal((ulong?)null)), null); } /** @@ -318,7 +322,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<float>(_marsh.Marshal(float.MaxValue)), float.MaxValue); Assert.AreEqual(_marsh.Unmarshal<float?>(_marsh.Marshal((float?)1)), (float?)1); - Assert.AreEqual(_marsh.Unmarshal<float?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<float?>(_marsh.Marshal((float?)null)), null); } /** @@ -344,7 +348,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<double>(_marsh.Marshal(double.MaxValue)), double.MaxValue); Assert.AreEqual(_marsh.Unmarshal<double?>(_marsh.Marshal((double?)1)), (double?)1); - Assert.AreEqual(_marsh.Unmarshal<double?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<double?>(_marsh.Marshal((double?)null)), null); } /** @@ -404,7 +408,7 @@ namespace Apache.Ignite.Core.Tests.Portable Assert.AreEqual(_marsh.Unmarshal<decimal>(_marsh.Marshal(val = decimal.Parse("-11,12"))), val); // Test null. - Assert.AreEqual(_marsh.Unmarshal<decimal?>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<decimal?>(_marsh.Marshal((decimal?)null)), null); } /** @@ -413,8 +417,8 @@ namespace Apache.Ignite.Core.Tests.Portable [Test] public void TestWritePrimitiveDecimalArray() { - decimal[] vals = { decimal.One, decimal.Parse("11,12") }; - decimal[] newVals = _marsh.Unmarshal<decimal[]>(_marsh.Marshal(vals)); + decimal?[] vals = { decimal.One, decimal.Parse("11,12") }; + var newVals = _marsh.Unmarshal<decimal?[]>(_marsh.Marshal(vals)); Assert.AreEqual(vals, newVals); } @@ -426,7 +430,7 @@ namespace Apache.Ignite.Core.Tests.Portable public void TestWriteString() { Assert.AreEqual(_marsh.Unmarshal<string>(_marsh.Marshal("str")), "str"); - Assert.AreEqual(_marsh.Unmarshal<string>(_marsh.Marshal(null)), null); + Assert.AreEqual(_marsh.Unmarshal<string>(_marsh.Marshal((string) null)), null); } /** @@ -706,13 +710,13 @@ namespace Apache.Ignite.Core.Tests.Portable DecimalReflective obj1 = new DecimalReflective { Val = decimal.Zero, - ValArr = new[] {decimal.One, decimal.MinusOne} + ValArr = new decimal?[] {decimal.One, decimal.MinusOne} }; IPortableObject portObj = marsh.Unmarshal<IPortableObject>(marsh.Marshal(obj1), PortableMode.ForcePortable); Assert.AreEqual(obj1.Val, portObj.GetField<decimal>("val")); - Assert.AreEqual(obj1.ValArr, portObj.GetField<decimal[]>("valArr")); + Assert.AreEqual(obj1.ValArr, portObj.GetField<decimal?[]>("valArr")); Assert.AreEqual(obj1.Val, portObj.Deserialize<DecimalReflective>().Val); Assert.AreEqual(obj1.ValArr, portObj.Deserialize<DecimalReflective>().ValArr); @@ -721,14 +725,14 @@ namespace Apache.Ignite.Core.Tests.Portable DecimalMarshalAware obj2 = new DecimalMarshalAware(); obj2.Val = decimal.Zero; - obj2.ValArr = new[] { decimal.One, decimal.MinusOne }; + obj2.ValArr = new decimal?[] { decimal.One, decimal.MinusOne }; obj2.RawVal = decimal.MaxValue; - obj2.RawValArr = new[] { decimal.MinusOne, decimal.One} ; + obj2.RawValArr = new decimal?[] { decimal.MinusOne, decimal.One} ; portObj = marsh.Unmarshal<IPortableObject>(marsh.Marshal(obj2), PortableMode.ForcePortable); Assert.AreEqual(obj2.Val, portObj.GetField<decimal>("val")); - Assert.AreEqual(obj2.ValArr, portObj.GetField<decimal[]>("valArr")); + Assert.AreEqual(obj2.ValArr, portObj.GetField<decimal?[]>("valArr")); Assert.AreEqual(obj2.Val, portObj.Deserialize<DecimalMarshalAware>().Val); Assert.AreEqual(obj2.ValArr, portObj.Deserialize<DecimalMarshalAware>().ValArr); @@ -1604,7 +1608,7 @@ namespace Apache.Ignite.Core.Tests.Portable PUlong = *(ulong*)&uLong; PString = reader.ReadString("string"); - PGuid = reader.ReadGuid("guid").Value; + PGuid = reader.ReadObject<Guid>("guid"); PnGuid = reader.ReadGuid("nguid"); } } @@ -1724,7 +1728,7 @@ namespace Apache.Ignite.Core.Tests.Portable obj0.PUlong = *(ulong*)&uLong; obj0.PString = reader.ReadString("string"); - obj0.PGuid = reader.ReadGuid("guid").Value; + obj0.PGuid = reader.ReadObject<Guid>("guid"); obj0.PnGuid = reader.ReadGuid("nguid"); } } @@ -1945,19 +1949,19 @@ namespace Apache.Ignite.Core.Tests.Portable public class DecimalReflective { /** */ - public decimal Val; + public decimal? Val; /** */ - public decimal[] ValArr; + public decimal?[] ValArr; } public class DecimalMarshalAware : DecimalReflective, IPortableMarshalAware { /** */ - public decimal RawVal; + public decimal? RawVal; /** */ - public decimal[] RawValArr; + public decimal?[] RawValArr; /** <inheritDoc /> */ public void WritePortable(IPortableWriter writer) http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs index 6c77531..7386a03 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs @@ -102,13 +102,14 @@ namespace Apache.Ignite.Core.Common /// Reads this object from the given reader. /// </summary> /// <param name="r">Reader.</param> - public static IgniteGuid ReadPortable(IPortableRawReader r) + public static IgniteGuid? ReadPortable(IPortableRawReader r) { var guid = r.ReadGuid(); - return guid == null - ? new IgniteGuid(Guid.Empty, 0) - : new IgniteGuid(guid.Value, r.ReadLong()); + if (guid == null) + return null; + + return new IgniteGuid(guid.Value, r.ReadLong()); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs index bd8a41a..095a49f 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs @@ -44,7 +44,7 @@ namespace Apache.Ignite.Core.Events private readonly object _key; /** */ - private readonly IgniteGuid _xid; + private readonly IgniteGuid? _xid; /** */ private readonly object _lockId; @@ -62,7 +62,7 @@ namespace Apache.Ignite.Core.Events private readonly bool _hasNewValue; /** */ - private readonly Guid _subjectId; + private readonly Guid? _subjectId; /** */ private readonly string _closureClassName; @@ -87,7 +87,7 @@ namespace Apache.Ignite.Core.Events _oldValue = r.ReadObject<object>(); _hasOldValue = r.ReadBoolean(); _hasNewValue = r.ReadBoolean(); - _subjectId = r.ReadGuid() ?? Guid.Empty; + _subjectId = r.ReadGuid(); _closureClassName = r.ReadString(); _taskName = r.ReadString(); } @@ -120,7 +120,7 @@ namespace Apache.Ignite.Core.Events /// <summary> /// ID of surrounding cache cache transaction or null if there is no surrounding transaction. /// </summary> - public IgniteGuid Xid { get { return _xid; } } + public IgniteGuid? Xid { get { return _xid; } } /// <summary> /// ID of the lock if held or null if no lock held. @@ -151,11 +151,11 @@ namespace Apache.Ignite.Core.Events /// <summary> /// Gets security subject ID initiated this cache event, if available. This property is available only for <see - /// cref="EventType.EvtCacheObjectPut" />, <see cref="EventType.EvtCacheObjectRemoved" /> and <see - /// cref="EventType.EvtCacheObjectRead" /> cache events. Subject ID will be set either to nodeId initiated + /// cref="EventType.EventCacheObjectPut" />, <see cref="EventType.EventCacheObjectRemoved" /> and <see + /// cref="EventType.EventCacheObjectRead" /> cache events. Subject ID will be set either to nodeId initiated /// cache update or read or client ID initiated cache update or read. /// </summary> - public Guid SubjectId { get { return _subjectId; } } + public Guid? SubjectId { get { return _subjectId; } } /// <summary> /// Gets closure class name (applicable only for TRANSFORM operations). http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs index 5107b84..fd43c5a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs @@ -39,7 +39,7 @@ namespace Apache.Ignite.Core.Events private readonly string _clause; /** */ - private readonly Guid _subjectId; + private readonly Guid? _subjectId; /** */ private readonly string _taskName; @@ -54,7 +54,7 @@ namespace Apache.Ignite.Core.Events _cacheName = r.ReadString(); _className = r.ReadString(); _clause = r.ReadString(); - _subjectId = r.ReadGuid() ?? Guid.Empty; + _subjectId = r.ReadGuid(); _taskName = r.ReadString(); } @@ -81,7 +81,7 @@ namespace Apache.Ignite.Core.Events /// <summary> /// Gets security subject ID. /// </summary> - public Guid SubjectId { get { return _subjectId; } } + public Guid? SubjectId { get { return _subjectId; } } /// <summary> /// Gets the name of the task that executed the query (if any). http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs index ea99927..5c9e632 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs @@ -39,7 +39,7 @@ namespace Apache.Ignite.Core.Events private readonly string _clause; /** */ - private readonly Guid _subjectId; + private readonly Guid? _subjectId; /** */ private readonly string _taskName; @@ -66,7 +66,7 @@ namespace Apache.Ignite.Core.Events _cacheName = r.ReadString(); _className = r.ReadString(); _clause = r.ReadString(); - _subjectId = r.ReadGuid() ?? Guid.Empty; + _subjectId = r.ReadGuid(); _taskName = r.ReadString(); _key = r.ReadObject<object>(); _value = r.ReadObject<object>(); @@ -97,7 +97,7 @@ namespace Apache.Ignite.Core.Events /// <summary> /// Gets security subject ID. /// </summary> - public Guid SubjectId { get { return _subjectId; } } + public Guid? SubjectId { get { return _subjectId; } } /// <summary> /// Gets the name of the task that executed the query (if any). http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs index a03c373..96f94ad 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs @@ -18,6 +18,7 @@ namespace Apache.Ignite.Core.Events { using System; + using System.Diagnostics; using System.Globalization; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Common; @@ -56,7 +57,9 @@ namespace Apache.Ignite.Core.Events /// <param name="r">The reader to read data from.</param> protected EventBase(IPortableRawReader r) { - _id = IgniteGuid.ReadPortable(r); + var id = IgniteGuid.ReadPortable(r); + Debug.Assert(id.HasValue); + _id = id.Value; _localOrder = r.ReadLong(); @@ -65,7 +68,10 @@ namespace Apache.Ignite.Core.Events _message = r.ReadString(); _type = r.ReadInt(); _name = r.ReadString(); - _timestamp = r.ReadDate() ?? DateTime.Now; + + var timestamp = r.ReadDate(); + Debug.Assert(timestamp.HasValue); + _timestamp = timestamp.Value; } /** <inheritDoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs index 7523c52..83aca53 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs @@ -31,6 +31,6 @@ namespace Apache.Ignite.Core.Events /// <param name="nodeId">Node identifier.</param> /// <param name="evt">Event.</param> /// <returns>Value indicating whether specified event passes this filtger.</returns> - bool Invoke(Guid nodeId, T evt); + bool Invoke(Guid? nodeId, T evt); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEvents.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEvents.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEvents.cs index 9676873..be38104 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEvents.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/IEvents.cs @@ -91,7 +91,7 @@ namespace Apache.Ignite.Core.Events /// Operation ID that can be passed to <see cref="StopRemoteListen"/> method to stop listening. /// </returns> [AsyncSupported] - Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, + Guid? RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, params int[] types) where T : IEvent; @@ -128,7 +128,7 @@ namespace Apache.Ignite.Core.Events /// Operation ID that can be passed to <see cref="StopRemoteListen"/> method to stop listening. /// </returns> [AsyncSupported] - Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, + Guid? RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, IEnumerable<int> types = null) where T : IEvent; http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs index 87090e4..ee5bdae 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/JobEvent.cs @@ -35,16 +35,16 @@ namespace Apache.Ignite.Core.Events private readonly string _taskClassName; /** */ - private readonly IgniteGuid _taskSessionId; + private readonly IgniteGuid? _taskSessionId; /** */ - private readonly IgniteGuid _jobId; + private readonly IgniteGuid? _jobId; /** */ private readonly IClusterNode _taskNode; /** */ - private readonly Guid _taskSubjectId; + private readonly Guid? _taskSubjectId; /// <summary> /// Constructor. @@ -57,7 +57,7 @@ namespace Apache.Ignite.Core.Events _taskSessionId = IgniteGuid.ReadPortable(r); _jobId = IgniteGuid.ReadPortable(r); _taskNode = ReadNode(r); - _taskSubjectId = r.ReadGuid() ?? Guid.Empty; + _taskSubjectId = r.ReadGuid(); } /// <summary> @@ -73,12 +73,12 @@ namespace Apache.Ignite.Core.Events /// <summary> /// Gets task session ID of the task that triggered this event. /// </summary> - public IgniteGuid TaskSessionId { get { return _taskSessionId; } } + public IgniteGuid? TaskSessionId { get { return _taskSessionId; } } /// <summary> /// Gets job ID. /// </summary> - public IgniteGuid JobId { get { return _jobId; } } + public IgniteGuid? JobId { get { return _jobId; } } /// <summary> /// Get node where parent task of the job has originated. @@ -88,7 +88,7 @@ namespace Apache.Ignite.Core.Events /// <summary> /// Gets task subject ID. /// </summary> - public Guid TaskSubjectId { get { return _taskSubjectId; } } + public Guid? TaskSubjectId { get { return _taskSubjectId; } } /** <inheritDoc /> */ public override string ToShortString() http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs index c17e72b..8de22d2 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs @@ -34,13 +34,13 @@ namespace Apache.Ignite.Core.Events private readonly string _taskClassName; /** */ - private readonly IgniteGuid _taskSessionId; + private readonly IgniteGuid? _taskSessionId; /** */ private readonly bool _internal; /** */ - private readonly Guid _subjectId; + private readonly Guid? _subjectId; /// <summary> /// Constructor. @@ -52,7 +52,7 @@ namespace Apache.Ignite.Core.Events _taskClassName = r.ReadString(); _taskSessionId = IgniteGuid.ReadPortable(r); _internal = r.ReadBoolean(); - _subjectId = r.ReadGuid() ?? Guid.Empty; + _subjectId = r.ReadGuid(); } /// <summary> @@ -68,7 +68,7 @@ namespace Apache.Ignite.Core.Events /// <summary> /// Gets session ID of the task that triggered the event. /// </summary> - public IgniteGuid TaskSessionId { get { return _taskSessionId; } } + public IgniteGuid? TaskSessionId { get { return _taskSessionId; } } /// <summary> /// Returns true if task is created by Ignite and is used for system needs. @@ -77,10 +77,10 @@ namespace Apache.Ignite.Core.Events /// <summary> /// Gets security subject ID initiated this task event, if available. This property is not available for - /// <see cref="EventType.EvtTaskSessionAttrSet" /> task event. + /// <see cref="EventType.EventTaskSessionAttrSet" /> task event. /// Subject ID will be set either to node ID or client ID initiated task execution. /// </summary> - public Guid SubjectId { get { return _subjectId; } } + public Guid? SubjectId { get { return _subjectId; } } /** <inheritDoc /> */ public override string ToShortString() http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs index 52d5236..81a9a5a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs @@ -18,6 +18,7 @@ namespace Apache.Ignite.Core.Impl.Cluster { using System; + using System.Diagnostics; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Portable; @@ -34,9 +35,10 @@ namespace Apache.Ignite.Core.Impl.Cluster { LastUpdateTimeRaw = reader.ReadLong(); - DateTime? lastUpdateTime0 = reader.ReadDate(); + var lastUpdateTime = reader.ReadDate(); + Debug.Assert(lastUpdateTime.HasValue); + LastUpdateTime = lastUpdateTime.Value; - LastUpdateTime = lastUpdateTime0 ?? default(DateTime); MaximumActiveJobs = reader.ReadInt(); CurrentActiveJobs = reader.ReadInt(); AverageActiveJobs = reader.ReadFloat(); @@ -84,13 +86,13 @@ namespace Apache.Ignite.Core.Impl.Cluster NonHeapMemoryTotal = reader.ReadLong(); Uptime = reader.ReadLong(); - DateTime? startTime0 = reader.ReadDate(); + var startTime = reader.ReadDate(); + Debug.Assert(startTime.HasValue); + StartTime = startTime.Value; - StartTime = startTime0 ?? default(DateTime); - - DateTime? nodeStartTime0 = reader.ReadDate(); - - NodeStartTime = nodeStartTime0 ?? default(DateTime); + var nodeStartTime = reader.ReadDate(); + Debug.Assert(nodeStartTime.HasValue); + NodeStartTime = nodeStartTime.Value; CurrentThreadCount = reader.ReadInt(); MaximumThreadCount = reader.ReadInt(); http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs index da49feb..1b6358a 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs @@ -19,6 +19,7 @@ namespace Apache.Ignite.Core.Impl.Cluster { using System; using System.Collections.Generic; + using System.Diagnostics; using Apache.Ignite.Core.Cluster; using Apache.Ignite.Core.Impl.Collections; using Apache.Ignite.Core.Impl.Common; @@ -62,7 +63,11 @@ namespace Apache.Ignite.Core.Impl.Cluster /// <param name="reader">The reader.</param> public ClusterNodeImpl(IPortableRawReader reader) { - _id = reader.ReadGuid() ?? default(Guid); + var id = reader.ReadGuid(); + + Debug.Assert(id.HasValue); + + _id = id.Value; _attrs = reader.ReadGenericDictionary<string, object>().AsReadOnly(); _addrs = reader.ReadGenericCollection<string>().AsReadOnly(); http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs index d974654..8b97884 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs @@ -48,7 +48,7 @@ namespace Apache.Ignite.Core.Impl.Common private readonly Func<object, object, object> _computeFunc; /** */ - private readonly Func<object, Guid, object, bool> _eventFilter; + private readonly Func<object, Guid?, object, bool> _eventFilter; /** */ private readonly Func<object, object, object, bool> _cacheEntryFilter; @@ -100,7 +100,7 @@ namespace Apache.Ignite.Core.Impl.Common /// </summary> /// <param name="type">Type.</param> /// <returns>Precompiled invocator delegate.</returns> - public static Func<object, Guid, object, bool> GetEventFilter(Type type) + public static Func<object, Guid?, object, bool> GetEventFilter(Type type) { return Get(type)._eventFilter; } @@ -245,8 +245,8 @@ namespace Apache.Ignite.Core.Impl.Common var args = iface.GetGenericArguments(); - _eventFilter = DelegateConverter.CompileFunc<Func<object, Guid, object, bool>>(iface, - new[] {typeof (Guid), args[0]}, new[] {false, true, false}); + _eventFilter = DelegateConverter.CompileFunc<Func<object, Guid?, object, bool>>(iface, + new[] {typeof (Guid?), args[0]}, new[] {false, true, false}); } else if (genericTypeDefinition == typeof (ICacheEntryFilter<,>)) { http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs index dfe0d18..552e0eb 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs @@ -290,7 +290,9 @@ namespace Apache.Ignite.Core.Impl.Compute // 1. Unmarshal result. PortableReaderImpl reader = _compute.Marshaller.StartUnmarshal(stream); - Guid nodeId = reader.ReadGuid().Value; + var nodeId = reader.ReadGuid(); + Debug.Assert(nodeId.HasValue); + bool cancelled = reader.ReadBoolean(); try @@ -300,7 +302,7 @@ namespace Apache.Ignite.Core.Impl.Compute var data = PortableUtils.ReadWrappedInvocationResult(reader, out err); // 2. Process the result. - return (int) JobResult0(new ComputeJobResultImpl(data, (Exception) err, job.Job, nodeId, cancelled)); + return (int) JobResult0(new ComputeJobResultImpl(data, (Exception) err, job.Job, nodeId.Value, cancelled)); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs index 726dd87..f4cc341 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs @@ -130,7 +130,7 @@ namespace Apache.Ignite.Core.Impl.Events } /** <inheritDoc /> */ - public virtual Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, + public virtual Guid? RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, params int[] types) where T : IEvent { @@ -159,11 +159,11 @@ namespace Apache.Ignite.Core.Impl.Events WriteEventTypes(types, writer); }, - reader => Marshaller.StartUnmarshal(reader).ReadGuid() ?? Guid.Empty); + reader => Marshaller.StartUnmarshal(reader).ReadGuid()); } /** <inheritDoc /> */ - public Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, + public Guid? RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, IEnumerable<int> types = null) where T : IEvent { http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs index 84bcb19..461f2ae 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs @@ -69,7 +69,7 @@ namespace Apache.Ignite.Core.Impl.Events } /** <inheritdoc /> */ - public override Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, + public override Guid? RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true, IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, params int[] types) { _lastAsyncOp.Value = (int) Op.RemoteListen; http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs index ca6d8f6..ac50b35 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs @@ -33,14 +33,14 @@ namespace Apache.Ignite.Core.Impl.Events private readonly Ignite _ignite; /** */ - private readonly Func<Guid, IEvent, bool> _filter; + private readonly Func<Guid?, IEvent, bool> _filter; /// <summary> /// Initializes a new instance of the <see cref="RemoteListenEventFilter"/> class. /// </summary> /// <param name="ignite">The grid.</param> /// <param name="filter">The filter.</param> - public RemoteListenEventFilter(Ignite ignite, Func<Guid, IEvent, bool> filter) + public RemoteListenEventFilter(Ignite ignite, Func<Guid?, IEvent, bool> filter) { _ignite = ignite; _filter = filter; @@ -53,7 +53,7 @@ namespace Apache.Ignite.Core.Impl.Events var evt = EventReader.Read<IEvent>(reader); - var nodeId = reader.ReadGuid() ?? Guid.Empty; + var nodeId = reader.ReadGuid(); return _filter(nodeId, evt) ? 1 : 0; } http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs index 9723f79..c65038c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs @@ -91,7 +91,7 @@ namespace Apache.Ignite.Core.Impl.Portable TypeIds[typeof(long[])] = PortableUtils.TypeArrayLong; TypeIds[typeof(float[])] = PortableUtils.TypeArrayFloat; TypeIds[typeof(double[])] = PortableUtils.TypeArrayDouble; - TypeIds[typeof(decimal[])] = PortableUtils.TypeArrayDecimal; + TypeIds[typeof(decimal?[])] = PortableUtils.TypeArrayDecimal; // 2. String. TypeIds[typeof(string)] = PortableUtils.TypeString; http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs index e1cd4c5..67d8f2b 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs @@ -114,7 +114,7 @@ namespace Apache.Ignite.Core.Impl.Portable /// </summary> /// <param name="val">Value.</param> /// <returns>Serialized data as byte array.</returns> - public byte[] Marshal(object val) + public byte[] Marshal<T>(T val) { PortableHeapStream stream = new PortableHeapStream(128); http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs index cfc84fd..dfc7c74 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs @@ -300,25 +300,25 @@ namespace Apache.Ignite.Core.Impl.Portable } /** <inheritdoc /> */ - public decimal ReadDecimal(string fieldName) + public decimal? ReadDecimal(string fieldName) { return ReadField(fieldName, PortableUtils.ReadDecimal); } /** <inheritdoc /> */ - public decimal ReadDecimal() + public decimal? ReadDecimal() { return Read(PortableUtils.ReadDecimal); } /** <inheritdoc /> */ - public decimal[] ReadDecimalArray(string fieldName) + public decimal?[] ReadDecimalArray(string fieldName) { return ReadField(fieldName, PortableUtils.ReadDecimalArray); } /** <inheritdoc /> */ - public decimal[] ReadDecimalArray() + public decimal?[] ReadDecimalArray() { return Read(PortableUtils.ReadDecimalArray); } http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs index d939d29..907c480 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs @@ -255,9 +255,9 @@ namespace Apache.Ignite.Core.Impl.Portable writeAction = GetWriter<double[]>(field, (f, w, o) => w.WriteDoubleArray(f, o)); readAction = GetReader(field, (f, r) => r.ReadDoubleArray(f)); } - else if (elemType == typeof(decimal)) + else if (elemType == typeof(decimal?)) { - writeAction = GetWriter<decimal[]>(field, (f, w, o) => w.WriteDecimalArray(f, o)); + writeAction = GetWriter<decimal?[]>(field, (f, w, o) => w.WriteDecimalArray(f, o)); readAction = GetReader(field, (f, r) => r.ReadDecimalArray(f)); } else if (elemType == typeof(string)) @@ -317,7 +317,7 @@ namespace Apache.Ignite.Core.Impl.Portable else if (type == typeof(Guid)) { writeAction = GetWriter<Guid>(field, (f, w, o) => w.WriteGuid(f, o)); - readAction = GetReader(field, (f, r) => r.ReadGuid(f) ?? default(Guid)); + readAction = GetReader(field, (f, r) => r.ReadObject<Guid>(f)); } else if (nullable && nullableType == typeof(Guid)) { @@ -327,7 +327,7 @@ namespace Apache.Ignite.Core.Impl.Portable else if (type == typeof(DateTime)) { writeAction = GetWriter<DateTime>(field, (f, w, o) => w.WriteDate(f, o)); - readAction = GetReader(field, (f, r) => r.ReadDate(f) ?? default(DateTime)); + readAction = GetReader(field, (f, r) => r.ReadDate(f)); } else if (nullable && nullableType == typeof(DateTime)) { http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs index c02c457..6b5e20d 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs @@ -87,7 +87,7 @@ namespace Apache.Ignite.Core.Impl.Portable ReadHandlers[PortableUtils.TypeLong] = new PortableSystemReader<long>(s => s.ReadLong()); ReadHandlers[PortableUtils.TypeFloat] = new PortableSystemReader<float>(s => s.ReadFloat()); ReadHandlers[PortableUtils.TypeDouble] = new PortableSystemReader<double>(s => s.ReadDouble()); - ReadHandlers[PortableUtils.TypeDecimal] = new PortableSystemReader<decimal>(PortableUtils.ReadDecimal); + ReadHandlers[PortableUtils.TypeDecimal] = new PortableSystemReader<decimal?>(PortableUtils.ReadDecimal); // 2. Date. ReadHandlers[PortableUtils.TypeDate] = new PortableSystemReader<DateTime?>(s => PortableUtils.ReadDate(s, false)); @@ -125,7 +125,7 @@ namespace Apache.Ignite.Core.Impl.Portable new PortableSystemReader<double[]>(PortableUtils.ReadDoubleArray); ReadHandlers[PortableUtils.TypeArrayDecimal] = - new PortableSystemReader<decimal[]>(PortableUtils.ReadDecimalArray); + new PortableSystemReader<decimal?[]>(PortableUtils.ReadDecimalArray); // 6. Date array. ReadHandlers[PortableUtils.TypeArrayDate] = @@ -237,7 +237,7 @@ namespace Apache.Ignite.Core.Impl.Portable else if (elemType == typeof(ulong)) return WriteUlongArray; // Special types. - else if (elemType == typeof (decimal)) + else if (elemType == typeof (decimal?)) return WriteDecimalArray; else if (elemType == typeof(string)) return WriteStringArray; @@ -514,7 +514,7 @@ namespace Apache.Ignite.Core.Impl.Portable { ctx.Stream.WriteByte(PortableUtils.TypeArrayDecimal); - PortableUtils.WriteDecimalArray((decimal[])obj, ctx.Stream); + PortableUtils.WriteDecimalArray((decimal?[])obj, ctx.Stream); } /// <summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs index d02fcf1..f80a199 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs @@ -901,7 +901,7 @@ namespace Apache.Ignite.Core.Impl.Portable * <param name="stream">Stream.</param> * <returns>Decimal value.</returns> */ - public static decimal ReadDecimal(IPortableStream stream) + public static decimal? ReadDecimal(IPortableStream stream) { int scale = stream.ReadInt(); @@ -961,12 +961,21 @@ namespace Apache.Ignite.Core.Impl.Portable * <param name="vals">Decimal array.</param> * <param name="stream">Stream.</param> */ - public static void WriteDecimalArray(decimal[] vals, IPortableStream stream) + public static void WriteDecimalArray(decimal?[] vals, IPortableStream stream) { stream.WriteInt(vals.Length); - foreach (decimal val in vals) - WriteDecimal(val, stream); + foreach (var val in vals) + { + if (val.HasValue) + { + stream.WriteByte(TypeDecimal); + + WriteDecimal(val.Value, stream); + } + else + stream.WriteByte(HdrNull); + } } /** @@ -974,14 +983,14 @@ namespace Apache.Ignite.Core.Impl.Portable * <param name="stream">Stream.</param> * <returns>Decimal array.</returns> */ - public static decimal[] ReadDecimalArray(IPortableStream stream) + public static decimal?[] ReadDecimalArray(IPortableStream stream) { int len = stream.ReadInt(); - decimal[] vals = new decimal[len]; + var vals = new decimal?[len]; for (int i = 0; i < len; i++) - vals[i] = ReadDecimal(stream); + vals[i] = stream.ReadByte() == HdrNull ? (decimal?) null : ReadDecimal(stream); return vals; } http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs index 0ff4c64..b490460 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs @@ -545,26 +545,36 @@ namespace Apache.Ignite.Core.Impl.Portable /// </summary> /// <param name="fieldName">Field name.</param> /// <param name="val">Decimal value.</param> - public void WriteDecimal(string fieldName, decimal val) + public void WriteDecimal(string fieldName, decimal? val) { WriteFieldId(fieldName, PU.TypeDecimal); - int pos = SkipFieldLength(); + if (val == null) + WriteNullField(); + else + { + int pos = SkipFieldLength(); - _stream.WriteByte(PU.TypeDecimal); - PortableUtils.WriteDecimal(val, _stream); + _stream.WriteByte(PU.TypeDecimal); + PortableUtils.WriteDecimal(val.Value, _stream); - WriteFieldLength(_stream, pos); + WriteFieldLength(_stream, pos); + } } /// <summary> /// Write decimal value. /// </summary> /// <param name="val">Decimal value.</param> - public void WriteDecimal(decimal val) + public void WriteDecimal(decimal? val) { - _stream.WriteByte(PU.TypeDecimal); - PortableUtils.WriteDecimal(val, _stream); + if (val == null) + WriteNullRawField(); + else + { + _stream.WriteByte(PU.TypeDecimal); + PortableUtils.WriteDecimal(val.Value, _stream); + } } /// <summary> @@ -572,7 +582,7 @@ namespace Apache.Ignite.Core.Impl.Portable /// </summary> /// <param name="fieldName">Field name.</param> /// <param name="val">Decimal array.</param> - public void WriteDecimalArray(string fieldName, decimal[] val) + public void WriteDecimalArray(string fieldName, decimal?[] val) { WriteFieldId(fieldName, PU.TypeArrayDecimal); @@ -593,7 +603,7 @@ namespace Apache.Ignite.Core.Impl.Portable /// Write decimal array. /// </summary> /// <param name="val">Decimal array.</param> - public void WriteDecimalArray(decimal[] val) + public void WriteDecimalArray(decimal?[] val) { if (val == null) WriteNullRawField(); @@ -604,63 +614,6 @@ namespace Apache.Ignite.Core.Impl.Portable } } -// /// <summary> -// /// Write named date value. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">Date value.</param> -// public void WriteDate(string fieldName, DateTime val) -// { -// WriteFieldId(fieldName, PU.TypeDate); -// -// _stream.WriteInt(PU.LengthTypeId + 12); -// -// _stream.WriteByte(PortableUtils.TypeDate); -// PortableUtils.WriteDate(val, _stream); -// } -// -// /// <summary> -// /// Write date value. -// /// </summary> -// /// <param name="val">Date value.</param> -// public void WriteDate(DateTime val) -// { -// _stream.WriteByte(PortableUtils.TypeDate); -// PortableUtils.WriteDate(val, _stream); -// } -// -// /// <summary> -// /// Write named date array. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">Date array.</param> -// public void WriteDateArray(string fieldName, DateTime[] val) -// { -// WriteFieldId(fieldName, PU.TypeDate); -// -// if (val == null) -// WriteNullField(); -// else -// { -// int pos = SkipFieldLength(); -// -// _stream.WriteByte(PortableUtils.TypeArrayDate); -// PortableUtils.WriteDateArray(val, _stream); -// -// WriteFieldLength(_stream, pos); -// } -// } -// -// /// <summary> -// /// Write date array. -// /// </summary> -// /// <param name="val">Date array.</param> -// public void WriteDateArray(DateTime[] val) -// { -// _stream.WriteByte(PortableUtils.TypeArrayDate); -// PortableUtils.WriteDateArray(val, _stream); -// } - /// <summary> /// Write named date value. /// </summary> @@ -807,68 +760,6 @@ namespace Apache.Ignite.Core.Impl.Portable } } -// /// <summary> -// /// Write named GUID value. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">GUID value.</param> -// public void WriteGuid(string fieldName, Guid val) -// { -// WriteFieldId(fieldName, PU.TypeGuid); -// -// _stream.WriteInt(PU.LengthTypeId + 16); -// -// _stream.WriteByte(PU.TypeGuid); -// PU.WriteGuid(val, _stream); -// } -// -// /// <summary> -// /// Write GUID value. -// /// </summary> -// /// <param name="val">GUID value.</param> -// public void WriteGuid(Guid val) -// { -// _stream.WriteByte(PU.TypeGuid); -// PU.WriteGuid(val, _stream); -// } -// -// /// <summary> -// /// Write named GUID array. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">GUID array.</param> -// public void WriteGuidArray(string fieldName, Guid[] val) -// { -// WriteFieldId(fieldName, PU.TypeArrayGuid); -// -// if (val == null) -// WriteNullField(); -// else -// { -// int pos = SkipFieldLength(); -// -// _stream.WriteByte(PU.TypeArrayGuid); -// PU.WriteGuidArray(val, _stream); -// -// WriteFieldLength(_stream, pos); -// } -// } -// -// /// <summary> -// /// Write GUID array. -// /// </summary> -// /// <param name="val">GUID array.</param> -// public void WriteGuidArray(Guid[] val) -// { -// if (val == null) -// WriteNullRawField(); -// else -// { -// _stream.WriteByte(PU.TypeArrayGuid); -// PU.WriteGuidArray(val, _stream); -// } -// } - /// <summary> /// Write named GUID value. /// </summary> @@ -1255,7 +1146,7 @@ namespace Apache.Ignite.Core.Impl.Portable _marsh = marsh; _stream = stream; } - + /// <summary> /// Write object. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs index e2528f4..4b15150 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs @@ -18,6 +18,7 @@ namespace Apache.Ignite.Core.Impl.Transactions { using System; + using System.Diagnostics; using Apache.Ignite.Core.Portable; using Apache.Ignite.Core.Transactions; @@ -32,8 +33,13 @@ namespace Apache.Ignite.Core.Impl.Transactions /// <param name="reader">The reader.</param> public TransactionMetricsImpl(IPortableRawReader reader) { - CommitTime = reader.ReadDate() ?? default(DateTime); - RollbackTime = reader.ReadDate() ?? default(DateTime); + var commitTime = reader.ReadDate(); + Debug.Assert(commitTime.HasValue); + CommitTime = commitTime.Value; + + var rollbackTime = reader.ReadDate(); + Debug.Assert(rollbackTime.HasValue); + RollbackTime = rollbackTime.Value; TxCommits = reader.ReadInt(); TxRollbacks = reader.ReadInt(); http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs index ee2520d..a3e8dd5 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs @@ -126,13 +126,13 @@ namespace Apache.Ignite.Core.Portable /// Read decimal value. /// </summary> /// <returns>Decimal value.</returns> - decimal ReadDecimal(); + decimal? ReadDecimal(); /// <summary> /// Read decimal array. /// </summary> /// <returns>Decimal array.</returns> - decimal[] ReadDecimalArray(); + decimal?[] ReadDecimalArray(); /// <summary> /// Read date value in UTC form. Shortcut for <c>ReadDate(false)</c>. http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs index 42d8c66..cc14f45 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs @@ -126,25 +126,13 @@ namespace Apache.Ignite.Core.Portable /// Write decimal value. /// </summary> /// <param name="val">Decimal value.</param> - void WriteDecimal(decimal val); + void WriteDecimal(decimal? val); /// <summary> /// Write decimal array. /// </summary> /// <param name="val">Decimal array.</param> - void WriteDecimalArray(decimal[] val); - -// /// <summary> -// /// Write date value. -// /// </summary> -// /// <param name="val">Date value.</param> -// void WriteDate(DateTime val); -// -// /// <summary> -// /// Write date array. -// /// </summary> -// /// <param name="val">Date array.</param> -// void WriteDateArray(DateTime[] val); + void WriteDecimalArray(decimal?[] val); /// <summary> /// Write date value. @@ -170,18 +158,6 @@ namespace Apache.Ignite.Core.Portable /// <param name="val">String array.</param> void WriteStringArray(string[] val); -// /// <summary> -// /// Write GUID value. -// /// </summary> -// /// <param name="val">GUID value.</param> -// void WriteGuid(Guid val); -// -// /// <summary> -// /// Write GUID array. -// /// </summary> -// /// <param name="val">GUID array.</param> -// void WriteGuidArray(Guid[] val); - /// <summary> /// Write GUID value. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs index 96f5757..ed86b7e 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs @@ -175,14 +175,14 @@ namespace Apache.Ignite.Core.Portable /// </summary> /// <param name="fieldName">Field name.</param> /// <returns>Decimal value.</returns> - decimal ReadDecimal(string fieldName); + decimal? ReadDecimal(string fieldName); /// <summary> /// Read named decimal array. /// </summary> /// <param name="fieldName">Field name.</param> /// <returns>Decimal array.</returns> - decimal[] ReadDecimalArray(string fieldName); + decimal?[] ReadDecimalArray(string fieldName); /// <summary> /// Read named date value in UTC form. Shortcut for <c>ReadDate(fieldName, false)</c>. http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs index edca218..670a137 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs @@ -143,28 +143,14 @@ namespace Apache.Ignite.Core.Portable /// </summary> /// <param name="fieldName">Field name.</param> /// <param name="val">Decimal value.</param> - void WriteDecimal(string fieldName, decimal val); + void WriteDecimal(string fieldName, decimal? val); /// <summary> /// Write named decimal array. /// </summary> /// <param name="fieldName">Field name.</param> /// <param name="val">Decimal array.</param> - void WriteDecimalArray(string fieldName, decimal[] val); - -// /// <summary> -// /// Write named date value. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">Date value.</param> -// void WriteDate(string fieldName, DateTime val); -// -// /// <summary> -// /// Write named date array. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">Date array.</param> -// void WriteDateArray(string fieldName, DateTime[] val); + void WriteDecimalArray(string fieldName, decimal?[] val); /// <summary> /// Write named date value. @@ -194,20 +180,6 @@ namespace Apache.Ignite.Core.Portable /// <param name="val">String array.</param> void WriteStringArray(string fieldName, string[] val); -// /// <summary> -// /// Write named GUID value. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">GUID value.</param> -// void WriteGuid(string fieldName, Guid val); -// -// /// <summary> -// /// Write named GUID array. -// /// </summary> -// /// <param name="fieldName">Field name.</param> -// /// <param name="val">GUID array.</param> -// void WriteGuidArray(string fieldName, Guid[] val); - /// <summary> /// Write named GUID value. /// </summary> http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs index 16074a0..ed87309 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.Examples/Events/EventsExample.cs @@ -81,9 +81,12 @@ namespace Apache.Ignite.Examples.Events var listenId = ignite.GetEvents().RemoteListen(localListener: localListener, remoteFilter: remoteFilter, types: EventType.EventsJobExecution); + if (listenId == null) + throw new InvalidOperationException("Subscription failed."); + ExecuteTask(ignite); - ignite.GetEvents().StopRemoteListen(listenId); + ignite.GetEvents().StopRemoteListen(listenId.Value); Console.WriteLine(">>> Received events count: " + localListener.EventsReceived); } http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs index 8a28355..5cdb20c 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs @@ -43,7 +43,7 @@ namespace Apache.Ignite.ExamplesDll.Events /// <param name="nodeId">Node identifier.</param> /// <param name="evt">Event.</param> /// <returns>Value indicating whether specified event passes this filter.</returns> - public bool Invoke(Guid nodeId, IEvent evt) + public bool Invoke(Guid? nodeId, IEvent evt) { Interlocked.Increment(ref _eventsReceived); http://git-wip-us.apache.org/repos/asf/ignite/blob/7c1ef1ae/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs index db3204a..45a957c 100644 --- a/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs +++ b/modules/platforms/dotnet/examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs @@ -32,7 +32,7 @@ namespace Apache.Ignite.ExamplesDll.Events /// <param name="nodeId">Node identifier.</param> /// <param name="evt">Event.</param> /// <returns>Value indicating whether specified event passes this filter.</returns> - public bool Invoke(Guid nodeId, IEvent evt) + public bool Invoke(Guid? nodeId, IEvent evt) { Console.WriteLine("Remote filter received event [evt={0}]", evt.Name);
