From 4aaa6218b853873c632aba0ed8696f29640041d1 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Mon, 6 Jan 2020 16:55:11 +0100 Subject: Setup GossipGirl --- .../agent/messages/GossipGirlMessage.java | 25 ++++++++++++++++++++++ .../agent/messages/InitiateGossipMessage.java | 11 ++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java new file mode 100644 index 0000000..705d64a --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java @@ -0,0 +1,25 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.agent.modules.Module; +import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; + +public abstract class GossipGirlMessage extends AgentMessage { + public enum Type { + INITIATE + } + + private Type type; + + public GossipGirlMessage(String messageId, long timestamp, Type type) { + super(messageId, ModuleType.GOSSIP, timestamp); + this.type = type; + } + + public Type getType() { + return type; + } + + public void callMe(Module module) throws InterruptedException, Module.InvalidMessageType { + module.handleTyped(this); + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java new file mode 100644 index 0000000..d216d59 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java @@ -0,0 +1,11 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; + +public class InitiateGossipMessage extends GossipGirlMessage { + private long nextGossipId = 0; + + public InitiateGossipMessage(String messageId, long timestamp) { + super(messageId, timestamp, Type.INITIATE); + } +} -- cgit v1.2.3 From ce76dbc406da1a8fe839b1e311ed699f9d5c7498 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Mon, 6 Jan 2020 23:01:16 +0100 Subject: Start implementing gossip initiator path --- .../agent/messages/AttributesMessage.java | 31 ++++++++++++++ .../agent/messages/GossipGirlMessage.java | 5 ++- .../cloudatlas/agent/messages/HejkaMessage.java | 32 ++++++++++++++ .../agent/messages/InitiateGossipMessage.java | 17 +++++++- .../cloudatlas/agent/messages/NoCoTamMessage.java | 50 ++++++++++++++++++++++ .../agent/messages/RemoteGossipGirlMessage.java | 28 ++++++++++++ 6 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AttributesMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/HejkaMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/NoCoTamMessage.java create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemoteGossipGirlMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AttributesMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AttributesMessage.java new file mode 100644 index 0000000..49bda14 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/AttributesMessage.java @@ -0,0 +1,31 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import java.util.Map; + +import pl.edu.mimuw.cloudatlas.model.AttributesMap; +import pl.edu.mimuw.cloudatlas.model.PathName; + +public class AttributesMessage extends RemoteGossipGirlMessage { + private PathName path; + private AttributesMap attributes; + private long receiverGossipId; + + public AttributesMessage(String messageId, long timestamp, PathName path, AttributesMap attributes, long receiverGossipId) { + super(messageId, timestamp, Type.ATTRIBUTES); + this.path = path; + this.attributes = attributes; + this.receiverGossipId = receiverGossipId; + } + + public PathName getPath() { + return path; + } + + public AttributesMap getAttributes() { + return attributes; + } + + public long getReceiverGossipId() { + return receiverGossipId; + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java index 705d64a..2016447 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java @@ -5,7 +5,10 @@ import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; public abstract class GossipGirlMessage extends AgentMessage { public enum Type { - INITIATE + ATTRIBUTES, + HEJKA, + INITIATE, + NO_CO_TAM } private Type type; diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/HejkaMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/HejkaMessage.java new file mode 100644 index 0000000..340d939 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/HejkaMessage.java @@ -0,0 +1,32 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import java.util.Map; + +import pl.edu.mimuw.cloudatlas.model.Attribute; +import pl.edu.mimuw.cloudatlas.model.PathName; +import pl.edu.mimuw.cloudatlas.model.ValueTime; + +public class HejkaMessage extends RemoteGossipGirlMessage { + private long senderGossipId; + private Map zoneTimestamps; + private Map queryTimestamps; + + public HejkaMessage(String messageId, long timestamp, long senderGossipId, Map zoneTimestamps, Map queryTimestamps) { + super(messageId, timestamp, Type.HEJKA); + this.senderGossipId = senderGossipId; + this.zoneTimestamps = zoneTimestamps; + this.queryTimestamps = queryTimestamps; + } + + public long getSenderGossipId() { + return senderGossipId; + } + + public Map getZoneTimestamps() { + return zoneTimestamps; + } + + public Map getQueryTimestamps() { + return queryTimestamps; + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java index d216d59..955570e 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/InitiateGossipMessage.java @@ -1,11 +1,24 @@ package pl.edu.mimuw.cloudatlas.agent.messages; import pl.edu.mimuw.cloudatlas.agent.modules.ModuleType; +import pl.edu.mimuw.cloudatlas.model.PathName; +import pl.edu.mimuw.cloudatlas.model.ValueContact; public class InitiateGossipMessage extends GossipGirlMessage { - private long nextGossipId = 0; + private PathName ourPath; + private ValueContact theirContact; - public InitiateGossipMessage(String messageId, long timestamp) { + public InitiateGossipMessage(String messageId, long timestamp, PathName ourPath, ValueContact theirContact) { super(messageId, timestamp, Type.INITIATE); + this.ourPath = ourPath; + this.theirContact = theirContact; + } + + public PathName getOurPath() { + return ourPath; + } + + public ValueContact getTheirContact() { + return theirContact; } } diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/NoCoTamMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/NoCoTamMessage.java new file mode 100644 index 0000000..3dd0c4d --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/NoCoTamMessage.java @@ -0,0 +1,50 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import java.util.Map; + +import pl.edu.mimuw.cloudatlas.model.Attribute; +import pl.edu.mimuw.cloudatlas.model.PathName; +import pl.edu.mimuw.cloudatlas.model.ValueTime; + +public class NoCoTamMessage extends RemoteGossipGirlMessage { + private long receiverGossipId; + private long senderGossipId; + private Map zoneTimestamps; + private Map queryTimestamps; + private ValueTime hejkaSendTimestamp; + private ValueTime hejkaReceiveTimestamp; + + public NoCoTamMessage(String messageId, long timestamp, long receiverGossipId, long senderGossipId, Map zoneTimestamps, Map queryTimestamps, ValueTime hejkaSendTimestamp, ValueTime hejkaReceiveTimestamp) { + super(messageId, timestamp, Type.NO_CO_TAM); + this.receiverGossipId = receiverGossipId; + this.senderGossipId = senderGossipId; + this.zoneTimestamps = zoneTimestamps; + this.queryTimestamps = queryTimestamps; + this.hejkaSendTimestamp = hejkaSendTimestamp; + this.hejkaReceiveTimestamp = hejkaReceiveTimestamp; + } + + public long getReceiverGossipId() { + return receiverGossipId; + } + + public long getSenderGossipId() { + return senderGossipId; + } + + public Map getZoneTimestamps() { + return zoneTimestamps; + } + + public Map getQueryTimestamps() { + return queryTimestamps; + } + + public ValueTime getHejkaSendTimestamp() { + return hejkaSendTimestamp; + } + + public ValueTime getHejkaReceiveTimestamp() { + return hejkaReceiveTimestamp; + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemoteGossipGirlMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemoteGossipGirlMessage.java new file mode 100644 index 0000000..0a3a868 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/RemoteGossipGirlMessage.java @@ -0,0 +1,28 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.model.ValueTime; + +public class RemoteGossipGirlMessage extends GossipGirlMessage { + private ValueTime sentTimestamp; + private ValueTime receivedTimestamp; + + public RemoteGossipGirlMessage(String messageId, long timestamp, Type type) { + super(messageId, timestamp, type); + } + + public void setSentTimestamp(ValueTime sentTimestamp) { + this.sentTimestamp = sentTimestamp; + } + + public void setReceivedTimestamp(ValueTime receivedTimestamp) { + this.receivedTimestamp = receivedTimestamp; + } + + public ValueTime getSentTimestamp() { + return sentTimestamp; + } + + public ValueTime getReceivedTimestamp() { + return receivedTimestamp; + } +} -- cgit v1.2.3 From 98ec32765bd769b457561dd9fdf34fee544dd54b Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Thu, 9 Jan 2020 22:41:11 +0100 Subject: Send info from gossip initiator --- .../agent/messages/GossipGirlMessage.java | 3 ++- .../cloudatlas/agent/messages/QueryMessage.java | 29 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/QueryMessage.java (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/messages') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java index 2016447..508fe88 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/GossipGirlMessage.java @@ -8,7 +8,8 @@ public abstract class GossipGirlMessage extends AgentMessage { ATTRIBUTES, HEJKA, INITIATE, - NO_CO_TAM + NO_CO_TAM, + QUERY } private Type type; diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/QueryMessage.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/QueryMessage.java new file mode 100644 index 0000000..2b3b064 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/messages/QueryMessage.java @@ -0,0 +1,29 @@ +package pl.edu.mimuw.cloudatlas.agent.messages; + +import pl.edu.mimuw.cloudatlas.model.Attribute; +import pl.edu.mimuw.cloudatlas.model.ValueQuery; + +public class QueryMessage extends RemoteGossipGirlMessage { + private Attribute name; + private ValueQuery query; + private long receiverGossipId; + + public QueryMessage(String messageId, long timestamp, Attribute name, ValueQuery query, long receiverGossipId) { + super(messageId, timestamp, Type.QUERY); + this.name = name; + this.query = query; + this.receiverGossipId = receiverGossipId; + } + + public Attribute getName() { + return name; + } + + public ValueQuery getQuery() { + return query; + } + + public long getReceiverGossipId() { + return receiverGossipId; + } +} -- cgit v1.2.3