You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/10/28 09:42:39 UTC
[04/17] ignite git commit: IGNITE-1655: Decoupled Date and Timestamp
in Java.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 96f94ad..62ab1a6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Events/EventBase.cs
@@ -69,7 +69,7 @@ namespace Apache.Ignite.Core.Events
_type = r.ReadInt();
_name = r.ReadString();
- var timestamp = r.ReadDate();
+ var timestamp = r.ReadTimestamp();
Debug.Assert(timestamp.HasValue);
_timestamp = timestamp.Value;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 81a9a5a..9d86311 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs
@@ -35,7 +35,7 @@ namespace Apache.Ignite.Core.Impl.Cluster
{
LastUpdateTimeRaw = reader.ReadLong();
- var lastUpdateTime = reader.ReadDate();
+ var lastUpdateTime = reader.ReadTimestamp();
Debug.Assert(lastUpdateTime.HasValue);
LastUpdateTime = lastUpdateTime.Value;
@@ -86,11 +86,11 @@ namespace Apache.Ignite.Core.Impl.Cluster
NonHeapMemoryTotal = reader.ReadLong();
Uptime = reader.ReadLong();
- var startTime = reader.ReadDate();
+ var startTime = reader.ReadTimestamp();
Debug.Assert(startTime.HasValue);
StartTime = startTime.Value;
- var nodeStartTime = reader.ReadDate();
+ var nodeStartTime = reader.ReadTimestamp();
Debug.Assert(nodeStartTime.HasValue);
NodeStartTime = nodeStartTime.Value;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
index 4031d17..7037c6f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
@@ -71,8 +71,8 @@ namespace Apache.Ignite.Core.Impl.Portable.Metadata
return PortableTypeNames.TypeNameString;
case PortableUtils.TypeGuid:
return PortableTypeNames.TypeNameGuid;
- case PortableUtils.TypeDate:
- return PortableTypeNames.TypeNameDate;
+ case PortableUtils.TypeTimestamp:
+ return PortableTypeNames.TypeNameTimestamp;
case PortableUtils.TypeEnum:
return PortableTypeNames.TypeNameEnum;
case PortableUtils.TypePortable:
@@ -100,8 +100,8 @@ namespace Apache.Ignite.Core.Impl.Portable.Metadata
return PortableTypeNames.TypeNameArrayString;
case PortableUtils.TypeArrayGuid:
return PortableTypeNames.TypeNameArrayGuid;
- case PortableUtils.TypeArrayDate:
- return PortableTypeNames.TypeNameArrayDate;
+ case PortableUtils.TypeArrayTimestamp:
+ return PortableTypeNames.TypeNameArrayTimestamp;
case PortableUtils.TypeArrayEnum:
return PortableTypeNames.TypeNameArrayEnum;
case PortableUtils.TypeArray:
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 3241c1c..ac7a957 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
@@ -96,16 +96,12 @@ namespace Apache.Ignite.Core.Impl.Portable
TypeIds[typeof(string[])] = PortableUtils.TypeArrayString;
// 3. Guid.
- TypeIds[typeof(Guid)] = PortableUtils.TypeGuid;
TypeIds[typeof(Guid?)] = PortableUtils.TypeGuid;
- TypeIds[typeof(Guid[])] = PortableUtils.TypeArrayGuid;
TypeIds[typeof(Guid?[])] = PortableUtils.TypeArrayGuid;
// 4. Date.
- TypeIds[typeof(DateTime)] = PortableUtils.TypeDate;
- TypeIds[typeof(DateTime?)] = PortableUtils.TypeDate;
- TypeIds[typeof(DateTime[])] = PortableUtils.TypeArrayDate;
- TypeIds[typeof(DateTime?[])] = PortableUtils.TypeArrayDate;
+ TypeIds[typeof(DateTime?)] = PortableUtils.TypeTimestamp;
+ TypeIds[typeof(DateTime?[])] = PortableUtils.TypeArrayTimestamp;
}
/// <summary>
@@ -632,7 +628,7 @@ namespace Apache.Ignite.Core.Impl.Portable
break;
- case PortableUtils.TypeDate:
+ case PortableUtils.TypeTimestamp:
TransferBytes(inStream, outStream, 12);
break;
@@ -680,7 +676,7 @@ namespace Apache.Ignite.Core.Impl.Portable
case PortableUtils.TypeArrayDecimal:
case PortableUtils.TypeArrayString:
case PortableUtils.TypeArrayGuid:
- case PortableUtils.TypeArrayDate:
+ case PortableUtils.TypeArrayTimestamp:
case PortableUtils.TypeArrayEnum:
case PortableUtils.TypeArray:
int arrLen = inStream.ReadInt();
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 6e06007..2d50499 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs
@@ -323,53 +323,29 @@ namespace Apache.Ignite.Core.Impl.Portable
}
/** <inheritdoc /> */
- public DateTime? ReadDate(string fieldName)
+ public DateTime? ReadTimestamp(string fieldName)
{
- return ReadDate(fieldName, false);
+ return ReadField(fieldName, PortableUtils.ReadTimestamp);
}
/** <inheritdoc /> */
- public DateTime? ReadDate(string fieldName, bool local)
+ public DateTime? ReadTimestamp()
{
- return ReadField(fieldName, r => PortableUtils.ReadDate(r, local));
+ return Read(PortableUtils.ReadTimestamp);
}
-
- /** <inheritdoc /> */
- public DateTime? ReadDate()
- {
- return ReadDate(false);
- }
-
+
/** <inheritdoc /> */
- public DateTime? ReadDate(bool local)
+ public DateTime?[] ReadTimestampArray(string fieldName)
{
- return Read(r => PortableUtils.ReadDate(r, local));
+ return ReadField(fieldName, PortableUtils.ReadTimestampArray);
}
-
- /** <inheritdoc /> */
- public DateTime?[] ReadDateArray(string fieldName)
- {
- return ReadDateArray(fieldName, false);
- }
-
+
/** <inheritdoc /> */
- public DateTime?[] ReadDateArray(string fieldName, bool local)
+ public DateTime?[] ReadTimestampArray()
{
- return ReadField(fieldName, r => PortableUtils.ReadDateArray(r, local));
+ return Read(PortableUtils.ReadTimestampArray);
}
-
- /** <inheritdoc /> */
- public DateTime?[] ReadDateArray()
- {
- return ReadDateArray(false);
- }
-
- /** <inheritdoc /> */
- public DateTime?[] ReadDateArray(bool local)
- {
- return Read(r => PortableUtils.ReadDateArray(r, local));
- }
-
+
/** <inheritdoc /> */
public string ReadString(string fieldName)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 261a172..d79cc0b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs
@@ -256,8 +256,8 @@ namespace Apache.Ignite.Core.Impl.Portable
}
else if (elemType == typeof(DateTime?))
{
- writeAction = GetWriter<DateTime?[]>(field, (f, w, o) => w.WriteDateArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDateArray(f));
+ writeAction = GetWriter<DateTime?[]>(field, (f, w, o) => w.WriteTimestampArray(f, o));
+ readAction = GetReader(field, (f, r) => r.ReadTimestampArray(f));
}
else if (elemType.IsEnum)
{
@@ -310,13 +310,13 @@ 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));
+ writeAction = GetWriter<DateTime>(field, (f, w, o) => w.WriteTimestamp(f, o));
+ readAction = GetReader(field, (f, r) => r.ReadTimestamp(f));
}
else if (nullable && nullableType == typeof(DateTime))
{
- writeAction = GetWriter<DateTime?>(field, (f, w, o) => w.WriteDate(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDate(f));
+ writeAction = GetWriter<DateTime?>(field, (f, w, o) => w.WriteTimestamp(f, o));
+ readAction = GetReader(field, (f, r) => r.ReadTimestamp(f));
}
else if (type.IsEnum)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs
index 3dff691..849230e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs
@@ -33,7 +33,7 @@ namespace Apache.Ignite.Core.Impl.Portable
/// zone. It means that this difference will be different as you change time zones.
/// To overcome this discrepancy Ignite always converts .Net date to UTC form
/// before serializing and allows user to decide whether to deserialize them
- /// in UTC or local form using <c>ReadDate(..., true/false)</c> methods in
+ /// in UTC or local form using <c>ReadTimestamp(..., true/false)</c> methods in
/// <see cref="IPortableReader"/> and <see cref="IPortableRawReader"/>.
/// This serializer always read dates in UTC form. It means that if you have
/// local date in any field/property, it will be implicitly converted to UTC
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 ff3fb85..ed2e9ea 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
@@ -66,7 +66,7 @@ namespace Apache.Ignite.Core.Impl.Portable
ReadHandlers[PortableUtils.TypeDecimal] = new PortableSystemReader<decimal?>(PortableUtils.ReadDecimal);
// 2. Date.
- ReadHandlers[PortableUtils.TypeDate] = new PortableSystemReader<DateTime?>(s => PortableUtils.ReadDate(s, false));
+ ReadHandlers[PortableUtils.TypeTimestamp] = new PortableSystemReader<DateTime?>(PortableUtils.ReadTimestamp);
// 3. String.
ReadHandlers[PortableUtils.TypeString] = new PortableSystemReader<string>(PortableUtils.ReadString);
@@ -104,8 +104,8 @@ namespace Apache.Ignite.Core.Impl.Portable
new PortableSystemReader<decimal?[]>(PortableUtils.ReadDecimalArray);
// 6. Date array.
- ReadHandlers[PortableUtils.TypeArrayDate] =
- new PortableSystemReader<DateTime?[]>(s => PortableUtils.ReadDateArray(s, false));
+ ReadHandlers[PortableUtils.TypeArrayTimestamp] =
+ new PortableSystemReader<DateTime?[]>(PortableUtils.ReadTimestampArray);
// 7. String array.
ReadHandlers[PortableUtils.TypeArrayString] = new PortableSystemTypedArrayReader<string>();
@@ -162,7 +162,7 @@ namespace Apache.Ignite.Core.Impl.Portable
private static PortableSystemWriteDelegate FindWriteHandler(Type type)
{
// 1. Well-known types.
- if (type == typeof (string))
+ if (type == typeof(string))
return WriteString;
if (type == typeof(decimal))
return WriteDecimal;
@@ -210,18 +210,14 @@ namespace Apache.Ignite.Core.Impl.Portable
if (elemType == typeof(ulong))
return WriteUlongArray;
// Special types.
- else if (elemType == typeof (decimal?))
+ if (elemType == typeof (decimal?))
return WriteDecimalArray;
if (elemType == typeof(string))
return WriteStringArray;
-// else if (elemType == typeof(DateTime))
-// return WriteDateArray;
if (elemType == typeof(DateTime?))
- return WriteNullableDateArray;
-// else if (elemType == typeof(Guid))
-// return WriteGuidArray;
+ return WriteTimestampArray;
if (elemType == typeof(Guid?))
- return WriteNullableGuidArray;
+ return WriteGuidArray;
// Enums.
if (elemType.IsEnum)
return WriteEnumArray;
@@ -299,9 +295,9 @@ namespace Apache.Ignite.Core.Impl.Portable
/// <param name="obj">Value.</param>
private static void WriteDate(PortableWriterImpl ctx, object obj)
{
- ctx.Stream.WriteByte(PortableUtils.TypeDate);
+ ctx.Stream.WriteByte(PortableUtils.TypeTimestamp);
- PortableUtils.WriteDate((DateTime)obj, ctx.Stream);
+ PortableUtils.WriteTimestamp((DateTime)obj, ctx.Stream);
}
/// <summary>
@@ -483,29 +479,17 @@ namespace Apache.Ignite.Core.Impl.Portable
PortableUtils.WriteDecimalArray((decimal?[])obj, ctx.Stream);
}
-
- /// <summary>
- /// Write date array.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="obj">Value.</param>
- private static void WriteDateArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArrayDate);
-
- PortableUtils.WriteDateArray((DateTime[])obj, ctx.Stream);
- }
-
+
/// <summary>
/// Write nullable date array.
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteNullableDateArray(PortableWriterImpl ctx, object obj)
+ private static void WriteTimestampArray(PortableWriterImpl ctx, object obj)
{
- ctx.Stream.WriteByte(PortableUtils.TypeArrayDate);
+ ctx.Stream.WriteByte(PortableUtils.TypeArrayTimestamp);
- PortableUtils.WriteDateArray((DateTime?[])obj, ctx.Stream);
+ PortableUtils.WriteTimestampArray((DateTime?[])obj, ctx.Stream);
}
/// <summary>
@@ -519,25 +503,13 @@ namespace Apache.Ignite.Core.Impl.Portable
PortableUtils.WriteStringArray((string[])obj, ctx.Stream);
}
-
- /// <summary>
- /// Write GUID array.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="obj">Value.</param>
- private static void WriteGuidArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArrayGuid);
-
- PortableUtils.WriteGuidArray((Guid[])obj, ctx.Stream);
- }
-
+
/// <summary>
/// Write nullable GUID array.
/// </summary>
/// <param name="ctx">Context.</param>
/// <param name="obj">Value.</param>
- private static void WriteNullableGuidArray(PortableWriterImpl ctx, object obj)
+ private static void WriteGuidArray(PortableWriterImpl ctx, object obj)
{
ctx.Stream.WriteByte(PortableUtils.TypeArrayGuid);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 26cf5b5..e9ef369 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
@@ -105,7 +105,7 @@ namespace Apache.Ignite.Core.Impl.Portable
public const byte TypeGuid = 10;
/** Type: date. */
- public const byte TypeDate = 11;
+ public const byte TypeTimestamp = 33;
/** Type: unsigned byte array. */
public const byte TypeArrayByte = 12;
@@ -141,7 +141,7 @@ namespace Apache.Ignite.Core.Impl.Portable
public const byte TypeArrayGuid = 21;
/** Type: date array. */
- public const byte TypeArrayDate = 22;
+ public const byte TypeArrayTimestamp = 34;
/** Type: object array. */
public const byte TypeArray = 23;
@@ -212,6 +212,9 @@ namespace Apache.Ignite.Core.Impl.Portable
/** Type: stream receiver holder. */
public const byte TypeStreamReceiverHolder = 94;
+ /** Type: DateTime. */
+ public const byte TypeDateTime = 95;
+
/** Collection: custom. */
public const byte CollectionCustom = 0;
@@ -621,7 +624,7 @@ namespace Apache.Ignite.Core.Impl.Portable
* <param name="val">Date.</param>
* <param name="stream">Stream.</param>
*/
- public static void WriteDate(DateTime val, IPortableStream stream)
+ public static void WriteTimestamp(DateTime val, IPortableStream stream)
{
long high;
int low;
@@ -638,37 +641,20 @@ namespace Apache.Ignite.Core.Impl.Portable
* <param name="local">Local flag.</param>
* <returns>Date</returns>
*/
- public static DateTime? ReadDate(IPortableStream stream, bool local)
+ public static DateTime? ReadTimestamp(IPortableStream stream)
{
long high = stream.ReadLong();
int low = stream.ReadInt();
- return ToDotNetDate(high, low, local);
- }
-
- /// <summary>
- /// Write date array.
- /// </summary>
- /// <param name="vals">Values.</param>
- /// <param name="stream">Stream.</param>
- public static void WriteDateArray(DateTime[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- foreach (DateTime val in vals)
- {
- stream.WriteByte(TypeDate);
-
- WriteDate(val, stream);
- }
+ return new DateTime(JavaDateTicks + high * TimeSpan.TicksPerMillisecond + low / 100, DateTimeKind.Utc);
}
-
+
/// <summary>
/// Write nullable date array.
/// </summary>
/// <param name="vals">Values.</param>
/// <param name="stream">Stream.</param>
- public static void WriteDateArray(DateTime?[] vals, IPortableStream stream)
+ public static void WriteTimestampArray(DateTime?[] vals, IPortableStream stream)
{
stream.WriteInt(vals.Length);
@@ -676,9 +662,9 @@ namespace Apache.Ignite.Core.Impl.Portable
{
if (val.HasValue)
{
- stream.WriteByte(TypeDate);
+ stream.WriteByte(TypeTimestamp);
- WriteDate(val.Value, stream);
+ WriteTimestamp(val.Value, stream);
}
else
stream.WriteByte(HdrNull);
@@ -1008,24 +994,7 @@ namespace Apache.Ignite.Core.Impl.Portable
return *(Guid*) (&dotnetGuid);
}
-
- /// <summary>
- /// Write GUID array.
- /// </summary>
- /// <param name="vals">Values.</param>
- /// <param name="stream">Stream.</param>
- public static void WriteGuidArray(Guid[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- foreach (Guid val in vals)
- {
- stream.WriteByte(TypeGuid);
-
- WriteGuid(val, stream);
- }
- }
-
+
/// <summary>
/// Write GUID array.
/// </summary>
@@ -1125,20 +1094,19 @@ namespace Apache.Ignite.Core.Impl.Portable
return vals;
}
- /**
- * <summary>Read DateTime array.</summary>
- * <param name="stream">Stream.</param>
- * <param name="local">Local flag.</param>
- * <returns>Array.</returns>
- */
- public static DateTime?[] ReadDateArray(IPortableStream stream, bool local)
+ /// <summary>
+ /// Read timestamp array.
+ /// </summary>
+ /// <param name="stream">Stream.</param>
+ /// <returns>Timestamp array.</returns>
+ public static DateTime?[] ReadTimestampArray(IPortableStream stream)
{
int len = stream.ReadInt();
DateTime?[] vals = new DateTime?[len];
for (int i = 0; i < len; i++)
- vals[i] = stream.ReadByte() == HdrNull ? null : ReadDate(stream, local);
+ vals[i] = stream.ReadByte() == HdrNull ? null : ReadTimestamp(stream);
return vals;
}
@@ -1460,7 +1428,7 @@ namespace Apache.Ignite.Core.Impl.Portable
case TypeDecimal:
case TypeString:
case TypeGuid:
- case TypeDate:
+ case TypeTimestamp:
case TypeEnum:
case TypeArrayByte:
case TypeArrayShort:
@@ -1473,7 +1441,7 @@ namespace Apache.Ignite.Core.Impl.Portable
case TypeArrayDecimal:
case TypeArrayString:
case TypeArrayGuid:
- case TypeArrayDate:
+ case TypeArrayTimestamp:
case TypeArrayEnum:
case TypeArray:
case TypeCollection:
@@ -1912,21 +1880,6 @@ namespace Apache.Ignite.Core.Impl.Portable
low = (int)(diff % TimeSpan.TicksPerMillisecond) * 100;
}
- /**
- * <summary>Convert Java ticks to date.</summary>
- * <param name="high">High part (milliseconds).</param>
- * <param name="low">Low part (nanoseconds).</param>
- * <param name="local">Whether the time should be treaten as local.</param>
- * <returns>Date.</returns>
- */
- private static DateTime ToDotNetDate(long high, int low, bool local)
- {
- DateTime res =
- new DateTime(JavaDateTicks + high * TimeSpan.TicksPerMillisecond + low / 100, DateTimeKind.Utc);
-
- return local ? res.ToLocalTime() : res;
- }
-
/// <summary>
/// Read additional configuration from the stream.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 b75292f..d5fb6ec 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
@@ -610,9 +610,9 @@ namespace Apache.Ignite.Core.Impl.Portable
/// </summary>
/// <param name="fieldName">Field name.</param>
/// <param name="val">Date value.</param>
- public void WriteDate(string fieldName, DateTime? val)
+ public void WriteTimestamp(string fieldName, DateTime? val)
{
- WriteFieldId(fieldName, PU.TypeDate);
+ WriteFieldId(fieldName, PU.TypeTimestamp);
if (val == null)
WriteNullField();
@@ -620,8 +620,8 @@ namespace Apache.Ignite.Core.Impl.Portable
{
_stream.WriteInt(PU.LengthTypeId + 12);
- _stream.WriteByte(PortableUtils.TypeDate);
- PortableUtils.WriteDate(val.Value, _stream);
+ _stream.WriteByte(PortableUtils.TypeTimestamp);
+ PortableUtils.WriteTimestamp(val.Value, _stream);
}
}
@@ -629,14 +629,14 @@ namespace Apache.Ignite.Core.Impl.Portable
/// Write date value.
/// </summary>
/// <param name="val">Date value.</param>
- public void WriteDate(DateTime? val)
+ public void WriteTimestamp(DateTime? val)
{
if (val == null)
WriteNullRawField();
else
{
- _stream.WriteByte(PortableUtils.TypeDate);
- PortableUtils.WriteDate(val.Value, _stream);
+ _stream.WriteByte(PortableUtils.TypeTimestamp);
+ PortableUtils.WriteTimestamp(val.Value, _stream);
}
}
@@ -645,9 +645,9 @@ namespace Apache.Ignite.Core.Impl.Portable
/// </summary>
/// <param name="fieldName">Field name.</param>
/// <param name="val">Date array.</param>
- public void WriteDateArray(string fieldName, DateTime?[] val)
+ public void WriteTimestampArray(string fieldName, DateTime?[] val)
{
- WriteFieldId(fieldName, PU.TypeDate);
+ WriteFieldId(fieldName, PU.TypeTimestamp);
if (val == null)
WriteNullField();
@@ -655,8 +655,8 @@ namespace Apache.Ignite.Core.Impl.Portable
{
int pos = SkipFieldLength();
- _stream.WriteByte(PortableUtils.TypeArrayDate);
- PortableUtils.WriteDateArray(val, _stream);
+ _stream.WriteByte(PortableUtils.TypeArrayTimestamp);
+ PortableUtils.WriteTimestampArray(val, _stream);
WriteFieldLength(_stream, pos);
}
@@ -666,14 +666,14 @@ namespace Apache.Ignite.Core.Impl.Portable
/// Write date array.
/// </summary>
/// <param name="val">Date array.</param>
- public void WriteDateArray(DateTime?[] val)
+ public void WriteTimestampArray(DateTime?[] val)
{
if (val == null)
WriteNullRawField();
else
{
- _stream.WriteByte(PortableUtils.TypeArrayDate);
- PortableUtils.WriteDateArray(val, _stream);
+ _stream.WriteByte(PortableUtils.TypeArrayTimestamp);
+ PortableUtils.WriteTimestampArray(val, _stream);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 4b15150..8afc36b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs
@@ -33,11 +33,11 @@ namespace Apache.Ignite.Core.Impl.Transactions
/// <param name="reader">The reader.</param>
public TransactionMetricsImpl(IPortableRawReader reader)
{
- var commitTime = reader.ReadDate();
+ var commitTime = reader.ReadTimestamp();
Debug.Assert(commitTime.HasValue);
CommitTime = commitTime.Value;
- var rollbackTime = reader.ReadDate();
+ var rollbackTime = reader.ReadTimestamp();
Debug.Assert(rollbackTime.HasValue);
RollbackTime = rollbackTime.Value;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 f0408a8..1c30aad 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs
@@ -134,31 +134,17 @@ namespace Apache.Ignite.Core.Portable
decimal?[] ReadDecimalArray();
/// <summary>
- /// Read date value in UTC form. Shortcut for <c>ReadDate(false)</c>.
+ /// Read date value in UTC form. Shortcut for <c>ReadTimestamp(false)</c>.
/// </summary>
/// <returns>Date value.</returns>
- DateTime? ReadDate();
-
- /// <summary>
- /// Read date value.
- /// </summary>
- /// <param name="local">Whether to read date in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
- /// <returns></returns>
- DateTime? ReadDate(bool local);
-
- /// <summary>
- /// Read date array in UTC form. Shortcut for <c>ReadDateArray(false)</c>.
- /// </summary>
- /// <returns>Date array.</returns>
- DateTime?[] ReadDateArray();
-
+ DateTime? ReadTimestamp();
+
/// <summary>
- /// Read date array.
+ /// Read date array in UTC form. Shortcut for <c>ReadTimestampArray(false)</c>.
/// </summary>
- /// <param name="local">Whether to read date array in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
/// <returns>Date array.</returns>
- DateTime?[] ReadDateArray(bool local);
-
+ DateTime?[] ReadTimestampArray();
+
/// <summary>
/// Read string value.
/// </summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 71b0c07..fcd449c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs
@@ -137,13 +137,13 @@ namespace Apache.Ignite.Core.Portable
/// Write date value.
/// </summary>
/// <param name="val">Date value.</param>
- void WriteDate(DateTime? val);
+ void WriteTimestamp(DateTime? val);
/// <summary>
/// Write date array.
/// </summary>
/// <param name="val">Date array.</param>
- void WriteDateArray(DateTime?[] val);
+ void WriteTimestampArray(DateTime?[] val);
/// <summary>
/// Write string value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 03702d3..7797ba2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs
@@ -170,34 +170,18 @@ namespace Apache.Ignite.Core.Portable
decimal?[] ReadDecimalArray(string fieldName);
/// <summary>
- /// Read named date value in UTC form. Shortcut for <c>ReadDate(fieldName, false)</c>.
+ /// Read named date value in UTC form.
/// </summary>
/// <param name="fieldName">Field name.</param>
/// <returns>Date value.</returns>
- DateTime? ReadDate(string fieldName);
-
- /// <summary>
- /// Read named date value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="local">Whether to read date in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
- /// <returns>Date vaule.</returns>
- DateTime? ReadDate(string fieldName, bool local);
-
- /// <summary>
- /// Read named date array in UTC form. Shortcut for <c>ReadDateArray(fieldName, false)</c>.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Date array.</returns>
- DateTime?[] ReadDateArray(string fieldName);
-
+ DateTime? ReadTimestamp(string fieldName);
+
/// <summary>
- /// Read named date array.
+ /// Read named date array in UTC form.
/// </summary>
/// <param name="fieldName">Field name.</param>
- /// <param name="local">Whether to read date in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
/// <returns>Date array.</returns>
- DateTime?[] ReadDateArray(string fieldName, bool local);
+ DateTime?[] ReadTimestampArray(string fieldName);
/// <summary>
/// Read named string value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/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 6e5d680..c7b8e11 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs
@@ -156,14 +156,14 @@ namespace Apache.Ignite.Core.Portable
/// </summary>
/// <param name="fieldName">Field name.</param>
/// <param name="val">Date value.</param>
- void WriteDate(string fieldName, DateTime? val);
+ void WriteTimestamp(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 WriteTimestampArray(string fieldName, DateTime?[] val);
/// <summary>
/// Write named string value.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f8b18ccd/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
index ed792c3..14d9da9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
@@ -55,9 +55,12 @@ namespace Apache.Ignite.Core.Portable
/** Type name: UUID. */
public const string TypeNameGuid = "UUID";
- /** Type name: Date. */
+ /** Type name: date. */
public const string TypeNameDate = "Date";
+ /** Type name: timestamp. */
+ public const string TypeNameTimestamp = "Timestamp";
+
/** Type name: Enum. */
public const string TypeNameEnum = "Enum";
@@ -97,9 +100,12 @@ namespace Apache.Ignite.Core.Portable
/** Type name: UUID array. */
public const string TypeNameArrayGuid = "UUID[]";
- /** Type name: Date array. */
+ /** Type name: timestamp array. */
public const string TypeNameArrayDate = "Date[]";
+ /** Type name: timestamp array. */
+ public const string TypeNameArrayTimestamp = "Timestamp[]";
+
/** Type name: Enum array. */
public const string TypeNameArrayEnum = "Enum[]";