You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Alon Peer <al...@supersonicads.com> on 2013/12/30 11:09:26 UTC
SnapshottableMap vs. MapState
In Trident's MemcachedState implementation (
https://github.com/nathanmarz/trident-memcached/blob/master/src/jvm/trident/memcached/MemcachedState.java#L139),
the makeState() method returns an instance of SnapshottableMap, while the
MysqlState implementation (
https://github.com/wilbinsc/storm-mysql/blob/master/src/main/java/storm/trident/state/mysql/MysqlState.java#L302)
returns
an instance of TransactionalMap/OpaqueMap/NonTransactionalMap.
What's the difference? Is this implementation correct? What kind of effect
can this have on the topology?
Re: SnapshottableMap vs. MapState
Posted by Svend Vanderveken <sv...@gmail.com>.
(my humble interpretation as I understand by reading the code)
NonTransactionalMap, TransactionMap and OpaqueMap are all implementations
of MapState, which represent a thing able to keep a state formatted of a
key-value table (=> "map"-"state")
A Snapshottable represents a state which is able to read/update one single
value
=> you either want one of the first 3 or the last one depending on your
topology.
A SnapshottableMap wraps an instance of MapState in order to be expose both
MapState and Snapshottable => it can be used as a generic State handler in
your topology.
I guess the reason the Memcached chose to use the SnapshottableMap was to
make their State implementation a bit more versatile.
On Mon, Dec 30, 2013 at 11:09 AM, Alon Peer <al...@supersonicads.com>wrote:
> In Trident's MemcachedState implementation (
> https://github.com/nathanmarz/trident-memcached/blob/master/src/jvm/trident/memcached/MemcachedState.java#L139),
> the makeState() method returns an instance of SnapshottableMap, while the
> MysqlState implementation (
> https://github.com/wilbinsc/storm-mysql/blob/master/src/main/java/storm/trident/state/mysql/MysqlState.java#L302) returns
> an instance of TransactionalMap/OpaqueMap/NonTransactionalMap.
>
> What's the difference? Is this implementation correct? What kind of effect
> can this have on the topology?
>
>