Return-Path: X-Original-To: apmail-directory-kerby-archive@minotaur.apache.org Delivered-To: apmail-directory-kerby-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63BC7189AA for ; Wed, 1 Jul 2015 07:45:51 +0000 (UTC) Received: (qmail 63726 invoked by uid 500); 1 Jul 2015 07:45:51 -0000 Delivered-To: apmail-directory-kerby-archive@directory.apache.org Received: (qmail 63705 invoked by uid 500); 1 Jul 2015 07:45:51 -0000 Mailing-List: contact kerby-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: kerby@directory.apache.org Delivered-To: mailing list kerby@directory.apache.org Received: (qmail 63692 invoked by uid 99); 1 Jul 2015 07:45:50 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Jul 2015 07:45:50 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 863C21817AA for ; Wed, 1 Jul 2015 07:45:50 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id bKYbDPDaHPYF for ; Wed, 1 Jul 2015 07:45:49 +0000 (UTC) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 20BF842AD0 for ; Wed, 1 Jul 2015 07:45:49 +0000 (UTC) Received: by pactm7 with SMTP id tm7so18987169pac.2 for ; Wed, 01 Jul 2015 00:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=hsBojre4lb+gIXDU05AZ3UsbzTvN8u/zqXZX9627iEM=; b=JB5fExUfwR9WrR+CuSY0jxnkZWHWvpOM+fAnhopsF5Y8xJIkUgwseX62qhOub+/cEf O56fbn7tMCyPcXACkazt1wMkmBlM7KJO7DdjhzWxxvKj+XN0NVhQCU1+/AAyR4aMAnAd 4Y35jdLE2ibOFaVm1JgjaXhzOLNLsZLIE+Gb4bUo4z+vWHlFDUzOm/zxK1S8IB18FkQE /0yttx0rncoeUhqfXuxV1M/BgR3pWhMpQ3tQfduBfEOzmomTC3z3OEbnzOlsIhOL4hd+ LaQ1dFZqexEC3y1chjQ+Ktx1cOx8dR1O8lD2mhNCAIQbThbri4eQLj4Cx8FsY1XQpNIG F3Lg== X-Received: by 10.68.226.42 with SMTP id rp10mr8434170pbc.155.1435736748362; Wed, 01 Jul 2015 00:45:48 -0700 (PDT) Received: from [192.168.1.29] (i19-les01-ix2-212-195-127-200.sfr.lns.abo.bbox.fr. [212.195.127.200]) by mx.google.com with ESMTPSA id dd3sm1200010pad.45.2015.07.01.00.45.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jul 2015 00:45:47 -0700 (PDT) Message-ID: <55939AA6.4070603@gmail.com> Date: Wed, 01 Jul 2015 09:45:42 +0200 From: =?UTF-8?B?RW1tYW51ZWwgTMOpY2hhcm55?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: kerby@directory.apache.org Subject: Re: [backend] AbstractIdentityBackend interface References: <8D5F7E3237B3ED47B84CF187BB17B66611B8AA97@SHSMSX103.ccr.corp.intel.com> <8D5F7E3237B3ED47B84CF187BB17B66611B8AEA4@SHSMSX103.ccr.corp.intel.com> <8D5F7E3237B3ED47B84CF187BB17B66611B8B6BA@SHSMSX103.ccr.corp.intel.com> <8D5F7E3237B3ED47B84CF187BB17B66611B8B737@SHSMSX103.ccr.corp.intel.com> <8D5F7E3237B3ED47B84CF187BB17B66611B8B76A@SHSMSX103.ccr.corp.intel.com> <5593937D.2070005@gmail.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Le 01/07/15 09:33, Kiran Ayyagari a écrit : > On Wed, Jul 1, 2015 at 3:15 PM, Emmanuel Lécharny > wrote: > >> Hi Kiran, Kai, >> >> just reading this thread (for some weird reason, my mail client wasn't >> refreshing this mailing list, so I have missed it from day one...) >> >> I have reviewed the code and I'd like to add my perception. >> >> * the doXXX method >> >> I don't see anything wrong on having protected doXXX methods in such a >> code, where you have some Interfaces describing the contract, some >> implementation classes and an abstract layer that gather some common >> beahviour and delegates what is specific to the implementation classes >> through doXXX methods. >> >> As Kai says, this is a very common pattern. >> >> I think that Kiran expressed his concern - which is real, but bear with >> me, I'll come to that later - the wrong way, by pointing to those doXXX >> in his first mail. IMHO, the name is not a problem, and I interpret >> Kiran's first mail this way : "the doXXX methods, as part of an API, are >> less readable than XXX". Kai, you correctly explained that those doXXX >> methods are not part of the API >> >> * the Cache >> >> Now, let's get to the real pb : what Kiran says, and I think he is >> correct, is that the only reason those doXXX methods exists is for the >> abstract class to implement a cache, which will b updated after the >> impelmentation doXXX method has been called. >> >> Let's do some mental exercise now : let say we don't have a cache at >> all. In this case, we immediatly see that those doXXX methods are >> useless. We can simply replace the doXXX methods in the implementations >> by the XXX methods, which is part of the API, instead of having to go >> through the abstract class. >> >> So far, so good. But what if we need a cache, then ? That's a very valid >> concern. I would expect that, for performances reason, we don't pound >> the backend every time we need to get an identity. The cache serves this >> purpose, AFAICT. So let's say xe need a cache. >> >> At this point, this is the real question Kiran is raising : if we need a >> cache, where should this cache been implemented ? >> >> * When and where should we implement a cache ? >> >> That's an important point. There are two reasons for having a cache : >> because we want to answer fast to a client request, and because the >> backend does not have such a cache. >> >> Now, that's one of Kiran's point : as he is to implement a Mavibot >> implementation, he does not need a cache, as Mavibot already implement >> this cache. His suggestion then is quite natural : we should have two >> categories of abstract classes : one with a cache, one with no cache, >> and the inheritance schema should be like : >> >> (IdentityBackend/IdentityService) >> o >> | >> +-- [[AbstractIdentityBackend]] >> ^ ^ >> | | >> | +-- [[AbstractCacheableIdentityBackend]] >> | ^ >> | | >> | +-- [JsonIdentityBackend] >> | | >> | +-- [LdapIdentityBackend] >> | | >> | +-- [ZookeeperIdentityBackend] >> | | >> | +-- [InMemoryIdentityBackend] >> | >> +-- [MavibotIdentityBackend] >> >> This is my understanding of Kiran's proposal. > yes, you did, but a minor difference, the idea is not to have an > AbstractCacheableIdentityBackend > but instead make a cache based backend that contains a cache and accepts > another instance of > backend and delegates the calls to the wrapped backend instance when a > cache miss occurs > or when an update needs to be performed. > > In the end all those backedns that actually persist data are free from > cache and server > finally instantiates a cacheable backend(which takes another persisting > backend instance). > That's definitively an option.