Repository: ignite Updated Branches: refs/heads/master f79016512 -> a1dcb540b
http://git-wip-us.apache.org/repos/asf/ignite/blob/a1dcb540/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 6e46f4d..71fbaee 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs @@ -53,6 +53,9 @@ namespace Apache.Ignite.Core.Impl.Cache /** Flag: keep binary. */ private readonly bool _flagKeepBinary; + /** Flag: allow atomic operations in transactions. */ + private readonly bool _flagAllowAtomicOpsInTx; + /** Flag: no-retries.*/ private readonly bool _flagNoRetries; @@ -73,15 +76,17 @@ namespace Apache.Ignite.Core.Impl.Cache /// <param name="flagKeepBinary">Keep binary flag.</param> /// <param name="flagNoRetries">No-retries mode flag.</param> /// <param name="flagPartitionRecover">Partition recover mode flag.</param> + /// <param name="flagAllowAtomicOpsInTx">Allow atomic operations in transactions flag.</param> public CacheImpl(IPlatformTargetInternal target, - bool flagSkipStore, bool flagKeepBinary, bool flagNoRetries, bool flagPartitionRecover) - : base(target) + bool flagSkipStore, bool flagKeepBinary, bool flagNoRetries, bool flagPartitionRecover, + bool flagAllowAtomicOpsInTx) : base(target) { _ignite = target.Marshaller.Ignite; _flagSkipStore = flagSkipStore; _flagKeepBinary = flagKeepBinary; _flagNoRetries = flagNoRetries; _flagPartitionRecover = flagPartitionRecover; + _flagAllowAtomicOpsInTx = flagAllowAtomicOpsInTx; _txManager = GetConfiguration().AtomicityMode == CacheAtomicityMode.Transactional ? new CacheTransactionManager(_ignite.GetIgnite().GetTransactions()) @@ -172,7 +177,7 @@ namespace Apache.Ignite.Core.Impl.Cache return this; return new CacheImpl<TK, TV>(DoOutOpObject((int) CacheOp.WithSkipStore), - true, _flagKeepBinary, true, _flagPartitionRecover); + true, _flagKeepBinary, true, _flagPartitionRecover, _flagAllowAtomicOpsInTx); } /// <summary> @@ -196,7 +201,17 @@ namespace Apache.Ignite.Core.Impl.Cache } return new CacheImpl<TK1, TV1>(DoOutOpObject((int) CacheOp.WithKeepBinary), - _flagSkipStore, true, _flagNoRetries, _flagPartitionRecover); + _flagSkipStore, true, _flagNoRetries, _flagPartitionRecover, _flagAllowAtomicOpsInTx); + } + + /** <inheritDoc /> */ + public ICache<TK, TV> WithAllowAtomicOpsInTx() + { + if (_flagAllowAtomicOpsInTx) + return this; + + return new CacheImpl<TK, TV>(DoOutOpObject((int)CacheOp.WithSkipStore), + true, _flagKeepBinary, _flagSkipStore, _flagPartitionRecover, true); } /** <inheritDoc /> */ @@ -207,7 +222,7 @@ namespace Apache.Ignite.Core.Impl.Cache var cache0 = DoOutOpObject((int)CacheOp.WithExpiryPolicy, w => ExpiryPolicySerializer.WritePolicy(w, plc)); return new CacheImpl<TK, TV>(cache0, _flagSkipStore, _flagKeepBinary, - _flagNoRetries, _flagPartitionRecover); + _flagNoRetries, _flagPartitionRecover, _flagAllowAtomicOpsInTx); } /** <inheritDoc /> */ @@ -217,6 +232,11 @@ namespace Apache.Ignite.Core.Impl.Cache } /** <inheritDoc /> */ + public bool IsAllowAtomicOpsInTx { + get { return _flagAllowAtomicOpsInTx; } + } + + /** <inheritDoc /> */ public void LoadCache(ICacheEntryFilter<TK, TV> p, params object[] args) { DoOutInOpX((int) CacheOp.LoadCache, writer => WriteLoadCacheData(writer, p, args), _readException); @@ -1017,7 +1037,7 @@ namespace Apache.Ignite.Core.Impl.Cache return this; return new CacheImpl<TK, TV>(DoOutOpObject((int) CacheOp.WithNoRetries), - _flagSkipStore, _flagKeepBinary, true, _flagPartitionRecover); + _flagSkipStore, _flagKeepBinary, true, _flagPartitionRecover, _flagAllowAtomicOpsInTx); } /** <inheritDoc /> */ @@ -1027,7 +1047,7 @@ namespace Apache.Ignite.Core.Impl.Cache return this; return new CacheImpl<TK, TV>(DoOutOpObject((int) CacheOp.WithPartitionRecover), - _flagSkipStore, _flagKeepBinary, _flagNoRetries, true); + _flagSkipStore, _flagKeepBinary, _flagNoRetries, true, _flagAllowAtomicOpsInTx); } /** <inheritDoc /> */ http://git-wip-us.apache.org/repos/asf/ignite/blob/a1dcb540/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs index f4c683e..ad9a185 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs @@ -517,7 +517,7 @@ namespace Apache.Ignite.Core.Impl /// </returns> public static ICache<TK, TV> GetCache<TK, TV>(IPlatformTargetInternal nativeCache, bool keepBinary = false) { - return new CacheImpl<TK, TV>(nativeCache, false, keepBinary, false, false); + return new CacheImpl<TK, TV>(nativeCache, false, keepBinary, false, false, false); } /** <inheritdoc /> */
