Vladislav Pyatkov created IGNITE-28727:
------------------------------------------

             Summary: Create internal API method to lock cache entry with 
specific version
                 Key: IGNITE-28727
                 URL: https://issues.apache.org/jira/browse/IGNITE-28727
             Project: Ignite
          Issue Type: Improvement
            Reporter: Vladislav Pyatkov
            Assignee: Vladislav Pyatkov


h3. Motivation
In some cases we want to have a guarantee that no other operation splits 
between a read and an update. This case is rather more interesting for SQL than 
the cache API, where the key is always known.
Proposed API:
{code:title=IgniteInternalCache.java}
/**
* Acquires transactional lock for a cached object represented by the given 
entry only if a current entry version
* is equal to the entry version.
*
* @param entry Entry whose key, value and version should be used.
* @param timeout Timeout in milliseconds to wait for lock to be acquired
* (\{@code '0'} for no expiration), \{@code -1} for immediate failure if
* lock cannot be acquired immediately).
* @return \{@code True} if lock was acquired with the same entry version.
* @throws IgniteCheckedException If lock acquisition resulted in an error.
*/
public boolean lock(CacheEntry<K, V> entry, long timeout) throws 
IgniteCheckedException;
{code}

h3. Definition of done
The method is added
All guarantees are satisfied and confirmed by a bunch of tests. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to