Specialized loader/store API for MultiMaps?

398 views
Skip to first unread message

Timothy Peierls

unread,
Apr 24, 2011, 1:12:56 PM4/24/11
to haze...@googlegroups.com
I have a custom MapLoader/MapStore implementation that works in terms of JClouds BlobStore/BlobMap, which allows me (for example) to have an IMap<String, V> backed by an Amazon S3 bucket/folder, where an object's name is the key and its contents are a serialized version of the value. (In my case, incidentally, I'm using JSON serialization with Jackson for this purpose *and* to implement DataSerializable for my value types.)

I'd like to have a MultiMap<String, V> backed in a similar way, where the set of values for a given key are stored as objects in a virtual folder named by the key.  It doesn't look as though I can use the MapLoader/MapStore interfaces here, though, since a multimap.put(key, value) turns into a call to replace the entire collection of values for key rather than to add a new value, and a multimap.remove(key, value) would replace the entire collection rather than just removing one entry. I would need something that could create a new object or remove a single object without having to rummage through the entire collection associated with a key.

Is there any hope of adding a specialized loader/store API to support a fine-grained backing store of this sort?

Talip Ozturk

unread,
Apr 24, 2011, 1:39:47 PM4/24/11
to haze...@googlegroups.com
Tim,

Can you please propose MultiMapStore/Loader interfaces? We will then
work on it.

http://twitter.com/oztalip

> --
> You received this message because you are subscribed to the Google Groups
> "Hazelcast" group.
> To post to this group, send email to haze...@googlegroups.com.
> To unsubscribe from this group, send email to
> hazelcast+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/hazelcast?hl=en.
>

Timothy Peierls

unread,
Apr 30, 2011, 1:56:30 PM4/30/11
to haze...@googlegroups.com
I'm taking my cue from Guava's Multimap, which comes in three flavors, depending on the semantics of the value collection (Collection<V>) associated with each key (K): List, Set, or SortedSet. List flavor allows duplicates and preserves order of insertion; Set flavor disallows duplicates and does not provide ordering; and SortedSet flavor disallows duplicates but provides ordering by value. 

Hazelcast MultiMap seems be closest to the Set flavor, but in what follows, I'm trying to leave open the possibility of some day introducing other flavors. 

public interface MultiMapStore<K, V> {
    /**
     * Called to store the given value in the collection of values for the given key, additionally
     * passing that collection, which should be treated as unmodifiable.
     */
    void store(K key, V value, Collection<V> values);

    /**
     * Called to remove the given value from the collection of values for the given key, additionally
     * passing that collection, which should be treated as unmodifiable.
     */
    void delete(K key, V value, Collection<V> values);
}

I haven't thought about this very rigorously, but I think it would cover my use case. (I don't think there needs to be a separate MultiMapLoader.) Until MultiMap supports other flavors besides Set, I'm going to have to fake the List flavor by picking value types that are always unique and capturing insertion order with the use of a timestamp field.

--tim

Timothy Peierls

unread,
Apr 30, 2011, 2:03:53 PM4/30/11
to haze...@googlegroups.com
And I'm assuming that MultiMap<K, V> can have a MultiMapStore<K, V> *and* a MapStore<K, Collection<V>>, otherwise I'd have MultiMapStore<K, V> extend MapStore<K, Collection<V>>.

--tim

Fuad Malikov

unread,
Jul 25, 2012, 5:13:08 PM7/25/12
to haze...@googlegroups.com
It is not done yet. We are currently working on simplifying Hazelcast inner structure. It will be super easy to add such functionalities once it is done. That's why it is on hold right now. 

-fuad


On Wed, Jul 25, 2012 at 9:41 PM, <instica...@gmail.com> wrote:
Not sure if this was implemented - do we have store/load for multimaps or any  plan/timeline to put this in place?  
If it was implemented,  kindly share the link for documentation pertaining to store/load functionality for multimaps.
Much appreciated



On Saturday, April 30, 2011 2:03:53 PM UTC-4, Timothy Peierls wrote:
And I'm assuming that MultiMap<K, V> can have a MultiMapStore<K, V> *and* a MapStore<K, Collection<V>>, otherwise I'd have MultiMapStore<K, V> extend MapStore<K, Collection<V>>.

--tim

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hazelcast/-/zstoYYTBqukJ.
Reply all
Reply to author
Forward
0 new messages