Re: [PATCH] Bug 3686 - refactor the config options controlling max object size

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Fri, 08 Feb 2013 21:58:50 -0700

On 02/08/2013 05:54 PM, Amos Jeffries wrote:
>>> - virtual int64_t maxObjectSize() const { return max_objsize; }
>>> + int64_t maxObjectSize() const;

>> Please do not remove "virtual". It is a useful reminder that this is a
>> part of the Store API.

> Why add virtual table entries? this is not a replaceable function any
> more. This is an accessor method for the SwapDir base object.

Store, the SwapDir's parent class has the "virtual" keyword for this
method. Thus, the method will be virtual in all child classes and will
be in the virtual table regardless of whether we say "virtual" explicitly:

> Store.h: virtual int64_t maxObjectSize() const = 0;

The above Store class API gets implemented by these Store children:

> MemStore.h: virtual int64_t maxObjectSize() const;
> StoreHashIndex.h: virtual int64_t maxObjectSize() const;
> SwapDir.h: virtual int64_t maxObjectSize() const;
> SwapDir.h: int64_t maxObjectSize() const;

The reason I believe it is better to say "virtual" explicitly in this
case is to remind us that maxObjectSize() is a part of the [semi-broken]
Store API and not some SwapDir "own" method. This will help us when we
polish the API to remove the common Store root.

Again, being explicit here does not add or remove any virtual table entries.

Hope this clarifies,

Alex.
Received on Sat Feb 09 2013 - 04:58:53 MST

This archive was generated by hypermail 2.2.0 : Sat Feb 09 2013 - 12:00:13 MST