Skip to content

Commit

Permalink
IGNITE-52 - Merge branch 'ignite-52' into sprint-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Goncharuk committed Feb 14, 2015
2 parents bdb5ded + c63177e commit 671d144
Show file tree
Hide file tree
Showing 66 changed files with 943 additions and 4,744 deletions.
3 changes: 3 additions & 0 deletions modules/core/src/main/java/org/apache/ignite/IgniteCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
@IgniteAsyncSupported
@Override public boolean containsKey(K key);

@IgniteAsyncSupported
public boolean containsKeys(Set<? extends K> keys);

/** {@inheritDoc} */
@IgniteAsyncSupported
@Override public void put(K key, V val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.ignite;

import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.configuration.*;
import org.apache.ignite.transactions.*;

Expand All @@ -30,7 +31,7 @@ public interface IgniteTransactions {
*
* @return New transaction
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC}.
* @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStart() throws IllegalStateException;

Expand All @@ -41,7 +42,7 @@ public interface IgniteTransactions {
* @param isolation Isolation.
* @return New transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC}.
* @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStart(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation);

Expand All @@ -55,83 +56,11 @@ public interface IgniteTransactions {
* @param txSize Number of entries participating in transaction (may be approximate).
* @return New transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC}.
* @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStart(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, long timeout,
int txSize);

/**
* Starts {@code affinity-group-locked} transaction based on affinity key. In this mode only affinity key
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must have the same affinity key. Node on which transaction
* is started must be primary for the given affinity key (an exception is thrown otherwise).
* <p>
* Since only affinity key is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code affinity-group-locked}
* transaction, otherwise cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if affinity key differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param affinityKey Affinity key for all entries updated by transaction. This node
* must be primary for this key.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws IgniteException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStartAffinity(String cacheName, Object affinityKey, IgniteTxConcurrency concurrency,
IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteException;

/**
* Starts {@code partition-group-locked} transaction based on partition ID. In this mode the whole partition
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must belong to the same partition. Node on which transaction
* is started must be primary for the given partition (an exception is thrown otherwise).
* <p>
* Since only partition is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code partition-group-locked}
* transaction, otherwise, cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if key partition differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param partId Partition id for which transaction is started. This node
* must be primary for this partition.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws IgniteException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStartPartition(String cacheName, int partId, IgniteTxConcurrency concurrency,
IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteException;

/**
* Gets transaction started by this thread or {@code null} if this thread does
* not have a transaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,8 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
public ConcurrentMap<K, V> toMap();

/**
* Returns {@code true} if this cache contains a mapping for the specified
* key.
*
* @param key key whose presence in this map is to be tested.
* @return {@code true} if this map contains a mapping for the specified key.
* @throws NullPointerException if the key is {@code null}.
* @param key Key.
* @return {@code True} if cache contains mapping for a given key.
*/
public boolean containsKey(K key);

Expand All @@ -352,6 +348,18 @@ public interface CacheProjection<K, V> extends Iterable<Cache.Entry<K, V>> {
*/
public IgniteInternalFuture<Boolean> containsKeyAsync(K key);

/**
* @param keys Keys,
* @return {@code True} if cache contains all keys.
*/
public boolean containsKeys(Collection<? extends K> keys);

/**
* @param keys Keys to check.
* @return Future.
*/
public IgniteInternalFuture<Boolean> containsKeysAsync(Collection<? extends K> keys);

/**
* Returns {@code true} if this cache contains given value.
*
Expand Down Expand Up @@ -1223,78 +1231,6 @@ public IgniteInternalFuture<?> putAllAsync(@Nullable Map<? extends K, ? extends
public IgniteTx txStart(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, long timeout,
int txSize);

/**
* Starts {@code affinity-group-locked} transaction based on affinity key. In this mode only affinity key
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must have the same affinity key. Node on which transaction
* is started must be primary for the given affinity key (an exception is thrown otherwise).
* <p>
* Since only affinity key is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code affinity-group-locked}
* transaction, otherwise cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link org.apache.ignite.configuration.IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if affinity key differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param affinityKey Affinity key for all entries updated by transaction. This node
* must be primary for this key.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws IgniteCheckedException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStartAffinity(Object affinityKey, IgniteTxConcurrency concurrency,
IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteCheckedException;

/**
* Starts {@code partition-group-locked} transaction based on partition ID. In this mode the whole partition
* is locked and all other entries in transaction are written without locking. However,
* all keys in such transaction must belong to the same partition. Node on which transaction
* is started must be primary for the given partition (an exception is thrown otherwise).
* <p>
* Since only partition is locked, and no individual keys, it is user's responsibility to make sure
* there are no other concurrent explicit updates directly on individual keys participating in the
* transaction. All updates to the keys involved should always go through {@code partition-group-locked}
* transaction, otherwise, cache may be left in inconsistent state.
* <p>
* If cache sanity check is enabled ({@link org.apache.ignite.configuration.IgniteConfiguration#isCacheSanityCheckEnabled()}),
* the following checks are performed:
* <ul>
* <li>
* An exception will be thrown if key partition differs from one specified on transaction start.
* </li>
* <li>
* An exception is thrown if entry participating in transaction is externally locked at commit.
* </li>
* </ul>
*
* @param partId Partition id for which transaction is started. This node
* must be primary for this partition.
* @param timeout Timeout ({@code 0} for default).
* @param txSize Number of entries participating in transaction (may be approximate), {@code 0} for default.
* @param concurrency Transaction concurrency control.
* @param isolation Cache transaction isolation level.
* @return Started transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws IgniteCheckedException If local node is not primary for any of provided keys.
* @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStartPartition(int partId, IgniteTxConcurrency concurrency,
IgniteTxIsolation isolation, long timeout, int txSize) throws IllegalStateException, IgniteCheckedException;

/**
* Gets transaction started by this thread or {@code null} if this thread does
* not have a transaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.ignite.internal;

import org.apache.ignite.*;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.internal.processors.cache.*;
import org.apache.ignite.internal.processors.cache.transactions.*;
import org.apache.ignite.transactions.*;
Expand All @@ -36,7 +37,7 @@ public interface IgniteTransactionsEx extends IgniteTransactions {
* @param txSize Number of entries participating in transaction (may be approximate).
* @return New transaction.
* @throws IllegalStateException If transaction is already started by this thread.
* @throws UnsupportedOperationException If cache is {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC}.
* @throws UnsupportedOperationException If cache is {@link CacheAtomicityMode#ATOMIC}.
*/
public IgniteTx txStartSystem(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation, long timeout,
int txSize);
Expand All @@ -62,38 +63,4 @@ public IgniteInternalTx txStartEx(GridCacheContext ctx,
* @return New transaction.
*/
public IgniteInternalTx txStartEx(GridCacheContext ctx, IgniteTxConcurrency concurrency, IgniteTxIsolation isolation);

/**
* @param ctx Cache context.
* @param partId Partition.
* @param concurrency Concurrency.
* @param isolation Isolation.
* @param timeout Timeout.
* @param txSize Number of entries participating in transaction (may be approximate).
* @return New transaction.
* @throws IgniteCheckedException If failed.
*/
public IgniteInternalTx txStartPartitionEx(GridCacheContext ctx,
int partId,
IgniteTxConcurrency concurrency,
IgniteTxIsolation isolation,
long timeout,
int txSize) throws IgniteCheckedException;

/**
* @param ctx Cache context.
* @param affinityKey Affinity key.
* @param concurrency Concurrency.
* @param isolation Isolation.
* @param timeout Timeout.
* @param txSize Number of entries participating in transaction (may be approximate).
* @return New transaction.
* @throws IgniteCheckedException If failed.
*/
public IgniteInternalTx txStartAffinity(GridCacheContext ctx,
Object affinityKey,
IgniteTxConcurrency concurrency,
IgniteTxIsolation isolation,
long timeout,
int txSize) throws IgniteCheckedException;
}

0 comments on commit 671d144

Please sign in to comment.