You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by pt...@apache.org on 2016/09/09 10:35:55 UTC
[3/3] ignite git commit: Refactor internal invoke codes
Refactor internal invoke codes
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/55df081b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/55df081b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/55df081b
Branch: refs/heads/ignite-3199-1
Commit: 55df081b2f681fb7f6b2bef8b0f533c4c29b3f82
Parents: a7c1a03
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Fri Sep 9 13:35:39 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Fri Sep 9 13:35:39 2016 +0300
----------------------------------------------------------------------
.../IgniteSessionStateStoreProvider.cs | 15 ++-------
.../Apache.Ignite.Core.csproj | 1 +
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 4 +--
.../Impl/Cache/CacheInvokeOp.cs | 35 ++++++++++++++++++++
.../Impl/Cache/ICacheInternal.cs | 2 +-
5 files changed, 42 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/55df081b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index 0d3ebda..59c1fe1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -47,15 +47,6 @@ namespace Apache.Ignite.AspNet
/// </summary>
public class IgniteSessionStateStoreProvider : SessionStateStoreProviderBase
{
- /// <summary>
- /// Op codes.
- /// </summary>
- private enum Op // TODO: Move this to core to maintain a single list of codes.
- {
- Lock = 1,
- SetAndUnlock = 2
- }
-
/** Application id config parameter. */
private const string ApplicationId = "applicationId";
@@ -440,7 +431,7 @@ namespace Apache.Ignite.AspNet
/// </summary>
private SessionStateLockResult LockItem(string key, long lockId)
{
- return ((ICacheInternal) Cache).Invoke<SessionStateLockResult>((int) Op.Lock, w =>
+ return ((ICacheInternal) Cache).Invoke<SessionStateLockResult>(CacheInvokeOp.SessionLock, w =>
{
w.WriteString(key);
WriteLockInfo(w, lockId, true);
@@ -452,7 +443,7 @@ namespace Apache.Ignite.AspNet
/// </summary>
private void UnlockItem(string key, long lockId)
{
- ((ICacheInternal) Cache).Invoke<object>((int) Op.SetAndUnlock, w =>
+ ((ICacheInternal) Cache).Invoke<object>(CacheInvokeOp.SessionSetAndUnlock, w =>
{
w.WriteString(key);
w.WriteBoolean(false); // Only unlock.
@@ -469,7 +460,7 @@ namespace Apache.Ignite.AspNet
var cache = _expiryCacheHolder.GetCacheWithExpiry(data.Timeout * 60);
- ((ICacheInternal) cache).Invoke<object>((int) Op.SetAndUnlock, w =>
+ ((ICacheInternal) cache).Invoke<object>(CacheInvokeOp.SessionSetAndUnlock, w =>
{
w.WriteString(key);
w.WriteBoolean(true); // Unlock and update.
http://git-wip-us.apache.org/repos/asf/ignite/blob/55df081b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 4be28ac..e565c5e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -181,6 +181,7 @@
<Compile Include="Impl\Binary\UserSerializerProxy.cs" />
<Compile Include="Impl\Cache\Affinity\AffinityFunctionSerializer.cs" />
<Compile Include="Impl\Cache\Affinity\PlatformAffinityFunction.cs" />
+ <Compile Include="Impl\Cache\CacheInvokeOp.cs" />
<Compile Include="Impl\Collections\KeyValueDirtyTrackedCollection.cs" />
<Compile Include="Impl\Common\ObjectInfoHolder.cs" />
<Compile Include="Impl\Common\Platform.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/55df081b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 6cecb6d..5172db4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -873,11 +873,11 @@ namespace Apache.Ignite.Core.Impl.Cache
}
/** <inheritDoc /> */
- public T Invoke<T>(int opCode, Action<IBinaryRawWriter> writeAction)
+ public T Invoke<T>(CacheInvokeOp opCode, Action<IBinaryRawWriter> writeAction)
{
return DoOutInOpX((int) CacheOp.InvokeInternal, writer =>
{
- writer.WriteInt(opCode);
+ writer.WriteInt((int) opCode);
writeAction(writer);
},
(input, res) => res == True ? Marshaller.Unmarshal<T>(input) : default(T), ReadException);
http://git-wip-us.apache.org/repos/asf/ignite/blob/55df081b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheInvokeOp.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheInvokeOp.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheInvokeOp.cs
new file mode 100644
index 0000000..15329c3
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheInvokeOp.cs
@@ -0,0 +1,35 @@
+\ufeff/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Impl.Cache
+{
+ /// <summary>
+ /// Op codes for <see cref="ICacheInternal.Invoke{T}"/>.
+ /// </summary>
+ public enum CacheInvokeOp
+ {
+ /// <summary>
+ /// Lock the session data.
+ /// </summary>
+ SessionLock = 1,
+
+ /// <summary>
+ /// Update and unlock the session data.
+ /// </summary>
+ SessionSetAndUnlock = 2
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/55df081b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
index 27cdf0a..19c1bfa 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
@@ -46,6 +46,6 @@ namespace Apache.Ignite.Core.Impl.Cache
/// <returns>
/// Result of the processing.
/// </returns>
- T Invoke<T>(int opCode, Action<IBinaryRawWriter> writeAction);
+ T Invoke<T>(CacheInvokeOp opCode, Action<IBinaryRawWriter> writeAction);
}
}