ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitriy Setrakyan <dsetrak...@apache.org>
Subject Re: keepBinaryInStore
Date Thu, 10 Dec 2015 20:15:09 GMT
I actually think we should take a bit different approach here.

How about adding CacheBinaryStore interface which will always receive
binary objects? In this case, user has an option of either implementing
CacheStore or CacheBinaryStore (which extends CacheStore). Based on the
implementation, we can decide on whether we pass objects in serialized
binary form or in deserialized Java form.

BTW, I don’t think we should take *withKeepBinary()* flag into account at
all when working with a CacheStore. As Vladimir pointed out, the same API
can be called with or without the binary format enabled, so basing
CacheStore logic on how user decides to call the API seems ill-suited and
hacky to me.

Thoughts?

D.

On Thu, Dec 10, 2015 at 11:52 AM, Denis Magda <dmagda@gridgain.com> wrote:

> Guys,
>
> Take a look at this situation from a different view.
>
> The following code snippet provided by Vladimir will guarantee that in
> both cases "put" calls will store data in the binary format in a cache (if
> BinaryMarshaller is used by default).
>
> Cache c1 = ...;
> c1.put(...);
> Cache c2 = c1.withKeepBinary();
> c2.put(...);
>
> This guarantee sounds natural for me because I'm as a user don't want to
> run into the situation when an entry is stored not in the binary format
> just because I forgot to use "withKeepBinary()" at some point.
>
> In my understanding the same approach should be implemented for the
> storage as well. If "keepPortableInStore" is set to "true" then entries are
> always stored in the binary format regardless on whether I used
> "withKeepBinary()" or not.
> I doubt that the user may want to keep data in the storage in both the
> binary and non binary formats. So I don't see any reason why
> "withKeepBinary()" is useful for the storage at all (the same as for
> cache.puts).
>
> --
> Denis
>
>
> On 12/10/2015 5:05 PM, Vladimir Ozerov wrote:
>
>> Alex,
>>
>> What should happen if user do this?
>>
>> Cache c1 = ...;
>> c1.put(...);
>> Cache c2 = c1.withKeepBinary();
>> c2.put(...);
>> 10 дек. 2015 г. 17:02 пользователь "Alexey Goncharuk" <
>> alexey.goncharuk@gmail.com> написал:
>>
>> Igniters,
>>>
>>> We introduced a cache configuration property keepBinaryInStore which was
>>> meant to determine the way persisted objects are passed to the store.
>>> This
>>> flag overrides the value of withKeepBinary() projection flag, i.e. the
>>> current behavior is:
>>>
>>> withKeepBinary=false, keepBinaryInStore=false, store receives
>>> Deserialized
>>> values
>>> withKeepBinary=true, keepBinaryInStore=false, store receives Deserialized
>>> values
>>> withKeepBinary=false, keepBinaryInStore=true, store receives
>>> BinaryObjects
>>> withKeepBinary=true, keepBinaryInStore=true, store receives BinaryObjects
>>>
>>> However, from the -b1 user feedback it looks like this configuration
>>> property and behavior is confusing. I think it makes sense to remove the
>>> configuration property and rely solely on the projection flag, i.e.
>>>
>>> withKeepBinary=false, store receives Deserialized values
>>> withKeepBinary=true, store receives BinaryObjects
>>>
>>> which is much simpler to understand.
>>>
>>> Am I missing something?
>>>
>>> --AG
>>>
>>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message