On Thu, May 25, 2017 at 11:58 AM, Mirage Abeysekara <mirage...@cse.mrt.ac.lk
> wrote:

> Why do we pass message object to the shouldRepicated method?
>
>
> *Mirage Abeysekara*
> Undergraduate
> Computer Science and Engineering
> University of Moratuwa
> Twitter: https://twitter.com/MiRAGECreator
> GooglePlus: https://plus.google.com/u/0/+MirageAbeysekara
>
> On 24 May 2017 at 20:39, Edward Capriolo <edlinuxg...@gmail.com> wrote:
>
>>
>>
>> On Wed, May 24, 2017 at 10:24 AM, Mirage Abeysekara <
>> mirage...@cse.mrt.ac.lk> wrote:
>>
>>> Hi Edward,
>>>
>>> Yes, In the design documentation[1] I wrote a sample of creating a data
>>> object which is only replicated in one data center by adding meta-data to
>>> the key.
>>>
>>> For case 1 we can use empty values to dataCenter and replicateNodes
>>>
>>> {
>>> key: lock/foo,
>>> replicateNodes: <List of all nodes in ds1>,
>>> dataCenter: ds1,
>>> expireOn: 2 min
>>> }
>>>
>>> For case 3 we can use a * (star) like special character for the
>>> replicateNodes to indicate that value needs to be replicate in this data
>>> center.
>>>
>>> {
>>> key: lock/foo,
>>> replicateNodes: *,
>>> dataCenter: ds1,
>>> expireOn: 2 min
>>> }
>>>
>>> I didn't get the case 2, Can you please give an example for case 2 ?
>>>
>>> [1] https://docs.google.com/document/d/1sKbDs3aLcJxjKeEjXVRt9BnI
>>> 1zKIPQTDN6RkDL_jEZc/edit?usp=sharing
>>>
>>> Thanks,
>>>
>>> *Mirage Abeysekara*
>>> Undergraduate
>>> Computer Science and Engineering
>>> University of Moratuwa
>>> Twitter: https://twitter.com/MiRAGECreator
>>> GooglePlus: https://plus.google.com/u/0/+MirageAbeysekara
>>>
>>> On 22 May 2017 at 20:48, Edward Capriolo <edlinuxg...@gmail.com> wrote:
>>>
>>>> Mirage,
>>>>
>>>> We can keep a majority of communication on list but our mentor-mentee
>>>> specific communications like updates can probably be personal to you and 
>>>> me.
>>>>
>>>> During reading your paper we discussed a need for a feature that would
>>>> be tangential but important for your work.
>>>>
>>>> Currently all the shared and per node data are replicated to all nodes.
>>>> We need a way to control this that should account for three cases
>>>>
>>>> 1) Data should never be replicated
>>>> 2) Data should only be replicated to nodes in white list/ black list
>>>> 3) Data should be replicated to nodes that are in the same
>>>> datacenter/cluster (using the map of key value properties that is part of
>>>> each gossip member)
>>>>
>>>> Do you remember this conversation and can you share your thoughts?
>>>>
>>>> Thanks,
>>>> Edward
>>>>
>>>>
>>>>
>>>> On Mon, May 22, 2017 at 11:11 AM, Mirage Abeysekara <
>>>> mirage...@cse.mrt.ac.lk> wrote:
>>>>
>>>>> What I worked on since last meeting?
>>>>>
>>>>>    - None
>>>>>
>>>>> What am I going to work on next?
>>>>>
>>>>>    - Go through the new multi-module project structure
>>>>>
>>>>> Any blockers?
>>>>>
>>>>>    - None
>>>>>
>>>>> Thanks,
>>>>>
>>>>> *Mirage Abeysekara*
>>>>> Undergraduate
>>>>> Computer Science and Engineering
>>>>> University of Moratuwa
>>>>> Twitter: https://twitter.com/MiRAGECreator
>>>>> GooglePlus: https://plus.google.com/u/0/+MirageAbeysekara
>>>>>
>>>>
>>>>
>>>
>> Yes I want to refine this a bit:
>>
>> Note:
>> https://github.com/apache/incubator-gossip/blob/master/gossi
>> p-base/src/main/java/org/apache/gossip/manager/AbstractActiv
>> eGossiper.java#L72
>>
>> https://github.com/apache/incubator-gossip/blob/master/gossi
>> p-base/src/main/java/org/apache/gossip/manager/AbstractActiv
>> eGossiper.java#L87
>>
>> https://github.com/apache/incubator-gossip/blob/master/gossi
>> p-base/src/main/java/org/apache/gossip/model/SharedDataMessage.java
>>
>> A role of the ActiveGossiper is to periodically sweep through data and
>> re-transmit it. What we need is an interface that will be a member of
>> SharedDataMessage and PerNodeMessage.
>>
>> Something like this:
>>
>> public interface Replicatable {
>>    boolean shouldRepicated(LocalMember me, LocalMember destination,
>> SharedDataMessage)
>> }
>>
>> public class NotReplicatable implements Replicatable {
>>   boolean shouldRepicated(LocalMember me, LocalMember destination,
>> SharedDataMessage) {
>>   return false
>>   }
>> }
>>
>> public class OnlySameDcReplicatable implements Replicatable {
>>     boolean shouldRepicated(LocalMember me, LocalMember destination,
>> SharedDataMessage) {
>>      return me.getProperties().equals(destination.getProperties())
>>   }
>> }
>>
>>
>> When someone creates a SharedDataMessage this would be set as a required
>> property.
>>
>> So the loop changes to:
>>
>> for (Entry<String, SharedDataMessage> innerEntry : gossipCore.
>> getSharedData().entrySet()){
>>
>> if (!innerEntry.getReplication.shouldReplicate(me, other, innerEntry){
>> continue;
>> }
>>
>> Does this make sense? We should be able to do this and ticket it as a
>> separate entity.
>>
>
>
Q: Why do we pass message object to the shouldRepicated method?

A: While this use case does not strictly require knowledge of the message
object, I can imagine some use cases in the future where this could be
useful. It is fairly cheap to pass the reference to the message object and
if we need it down the road e do not have to refactor.

::just an opinion::

Reply via email to