Return-Path: X-Original-To: apmail-ignite-issues-archive@minotaur.apache.org Delivered-To: apmail-ignite-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C896D18ECC for ; Mon, 10 Aug 2015 21:24:47 +0000 (UTC) Received: (qmail 70497 invoked by uid 500); 10 Aug 2015 21:24:47 -0000 Delivered-To: apmail-ignite-issues-archive@ignite.apache.org Received: (qmail 70472 invoked by uid 500); 10 Aug 2015 21:24:47 -0000 Mailing-List: contact issues-help@ignite.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.incubator.apache.org Delivered-To: mailing list issues@ignite.incubator.apache.org Received: (qmail 70463 invoked by uid 99); 10 Aug 2015 21:24:47 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Aug 2015 21:24:47 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 2C172DC0D4 for ; Mon, 10 Aug 2015 21:24:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.009] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id A0ncBOkRO1ZV for ; Mon, 10 Aug 2015 21:24:46 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 3BAE3428CC for ; Mon, 10 Aug 2015 21:24:46 +0000 (UTC) Received: (qmail 70197 invoked by uid 99); 10 Aug 2015 21:24:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Aug 2015 21:24:45 +0000 Date: Mon, 10 Aug 2015 21:24:45 +0000 (UTC) From: "Alexey Goncharuk (JIRA)" To: issues@ignite.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (IGNITE-946) Need to expose versioned cache entry to public API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/IGNITE-946?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14680788#comment-14680788 ] Alexey Goncharuk edited comment on IGNITE-946 at 8/10/15 9:24 PM: ------------------------------------------------------------------ In general, I do not like the current {{VersionedEntryEx}} interface. I think it should have only one method {{IgniteVersion version()}}, and {{IgniteVersion}} should have only {{updateTime}}. Other methods, such as {{topologyVersion}} or let alone {{order}} are meaningless for a user. Moreover, it is hard to implement the most straightforward use-case - check whether the version of a cache entry has changed in between the user calls. In order to do this one has to compare the results of all four methods. The way I see it should work is represented in a snippet below: {code} IgniteVersion ver1 = entry.version(); // Optimistically assume that no updates will happen and do some business-logic based on entry value. ... refreshedEntry = getEntry(key); IgniteVersion ver2 = refreshedEntry.version() if (!ver1.equals(ver2)) { // Entry has been concurrently updated. } {code} Needless to say that an instance of versioned entry has to be immutable, so that {{value()}} method will always be reflected by a correct {{version()}}. was (Author: agoncharuk): In general, I do not like the current {{VersionedEntryEx}} interface. I think it should have only one method {{IgniteVersion version()}}, and {{IgniteVersion}} should have only {{updateTime}}. Other methods, such as {{topologyVersion}} or let alone {{order}} are meaningless for a user. Moreover, it is hard to implement the most straightforward use-case - check whether the version of a cache entry has changed in between the user calls. In order to do this one has to compare the results of all four methods. The way I see it should work is represented in a snippet below: {code} IgniteVersion ver1 = entry.version(); // Optimistically assume that no updates will happen and do some business-logic based on entry value. ... IgniteVersion ver2 = entry.version() if (!ver1.equals(ver2)) { // Entry has been concurrently updated. } {code} Needless to say that an instance of versioned entry has to be immutable, so that {{value()}} method will always be reflected by a correct {{version()}}. > Need to expose versioned cache entry to public API > -------------------------------------------------- > > Key: IGNITE-946 > URL: https://issues.apache.org/jira/browse/IGNITE-946 > Project: Ignite > Issue Type: Bug > Components: cache > Affects Versions: sprint-4 > Reporter: Valentin Kulichenko > Assignee: Denis Magda > Priority: Critical > Labels: Usability > Fix For: ignite-1.4 > > Attachments: ignite-946-2.patch, ignite-946-3.patch, ignite-946.patch > > > Currently we have versioned entry, but it's not available on public API, but knowing version can be useful in some cases. Need to make it accessible via {{unwrap}} method. -- This message was sent by Atlassian JIRA (v6.3.4#6332)