You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2019/02/22 08:15:52 UTC
[GitHub] ivandasch commented on a change in pull request #6082: IGNITE-6563
Implement GetSizeLong
ivandasch commented on a change in pull request #6082: IGNITE-6563 Implement GetSizeLong
URL: https://github.com/apache/ignite/pull/6082#discussion_r259246139
##########
File path: modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
##########
@@ -817,36 +817,129 @@ public Task RemoveAllAsync()
/** <inheritDoc /> */
public int GetLocalSize(params CachePeekMode[] modes)
{
- return Size0(true, modes);
+ return Size0<int>(true, null, modes);
}
/** <inheritDoc /> */
public int GetSize(params CachePeekMode[] modes)
{
- return Size0(false, modes);
+ return Size0<int>(false, null, modes);
}
/** <inheritDoc /> */
public Task<int> GetSizeAsync(params CachePeekMode[] modes)
{
- var modes0 = IgniteUtils.EncodePeekModes(modes);
+ return SizeAsync0<int>(null, modes);
+ }
+
+ /** <inheritDoc /> */
+ public long GetSizeLong(params CachePeekMode[] modes)
+ {
+ return Size0<long>(false, null, modes);
+ }
+
+ /** <inheritDoc /> */
+ public long GetSizeLong(int partition, params CachePeekMode[] modes)
+ {
+ return Size0<long>(false, partition, modes);
+ }
- return DoOutOpAsync<int>(CacheOp.SizeAsync, w => w.WriteInt(modes0));
+ /** <inheritDoc /> */
+ public Task<long> GetSizeLongAsync(params CachePeekMode[] modes)
+ {
+ return SizeAsync0<long>(null, modes);
+ }
+
+ /** <inheritDoc /> */
+ public Task<long> GetSizeLongAsync(int partition, params CachePeekMode[] modes)
+ {
+ return SizeAsync0<long>(partition, modes);
+ }
+
+ /** <inheritDoc /> */
+ public long GetLocalSizeLong(params CachePeekMode[] modes)
+ {
+ return Size0<long>(true, null, modes);
+ }
+
+ /** <inheritDoc /> */
+ public long GetLocalSizeLong(int partition, params CachePeekMode[] modes)
+ {
+ return Size0<long>(true, partition, modes);
}
/// <summary>
/// Internal size routine.
/// </summary>
/// <param name="loc">Local flag.</param>
+ /// <param name="part">Partition number</param>
/// <param name="modes">peek modes</param>
/// <returns>Size.</returns>
- private int Size0(bool loc, params CachePeekMode[] modes)
+ private T Size0<T>(bool loc, int? part, params CachePeekMode[] modes)
{
var modes0 = IgniteUtils.EncodePeekModes(modes);
- var op = loc ? CacheOp.SizeLoc : CacheOp.Size;
+ var op = loc ?
+ (typeof(T) == typeof(long) ? CacheOp.SizeLongLoc : CacheOp.SizeLoc) :
+ (typeof(T) == typeof(long) ? CacheOp.SizeLong : CacheOp.Size);
+
+ long ret;
+
+ if (typeof(T) == typeof(long))
Review comment:
Yes, it's seems to be a little bit overengineered.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services