Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/blockchain node communication zqm #10

Merged
merged 52 commits into from
Dec 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
af9c3c9
chore: deleting unused class
AllanCapistrano Oct 26, 2023
3a6db15
chore: update NodeServiceType
AllanCapistrano Oct 26, 2023
8ceb655
feat: create publishNodeServices and removing unnecessary methods
AllanCapistrano Oct 26, 2023
2ec9ec9
chore: removing unused properties and add publishNodeServiceTaskTime
AllanCapistrano Oct 27, 2023
203c743
feat: create PublishNodeServicesTask
AllanCapistrano Oct 27, 2023
e92b7b9
fix: pubishNodeServices and removing unused timeouts
AllanCapistrano Oct 27, 2023
93eabd2
feat: using nodeIp
AllanCapistrano Oct 27, 2023
fb5b727
feat: create getNodesServices
AllanCapistrano Oct 31, 2023
78c5c79
chore: removing unused things
AllanCapistrano Oct 31, 2023
5e3ddfc
feat: create CheckNodesServicesTask
AllanCapistrano Oct 31, 2023
6b4f9ae
feat: add checkNodesServicesTaskTime property
AllanCapistrano Oct 31, 2023
d014082
chore: using CheckNodesServicesTask
AllanCapistrano Oct 31, 2023
64d3ce9
feat: add TODO
AllanCapistrano Oct 31, 2023
b1e446f
chore: removing unused classes, variables and methods
AllanCapistrano Nov 9, 2023
68e2e67
fix: ReputationService constructor
AllanCapistrano Nov 9, 2023
79a17d7
feat: create checkNodesServicesTaskTime
AllanCapistrano Nov 9, 2023
473e686
feat: create CheckNodesServicesTask
AllanCapistrano Nov 9, 2023
e8e1027
feat: start to develop node service
AllanCapistrano Nov 9, 2023
83f3ace
fix: node service type
AllanCapistrano Nov 10, 2023
6a2c099
fix: communication between nodes by tangle hornet
AllanCapistrano Nov 10, 2023
f15564a
chore: checking if a request is in progress
AllanCapistrano Nov 13, 2023
f08c33b
feat: check the response of node service provider and add new topics …
AllanCapistrano Nov 13, 2023
45663cc
feat: create WaitNodesResponsesTask
AllanCapistrano Nov 13, 2023
def69bb
feat: create waitNodesResponsesTaskTime property
AllanCapistrano Nov 13, 2023
99eaa84
chore: using WaitNodesResponsesTask
AllanCapistrano Nov 13, 2023
2a84de2
feat: create NodeReputation class
AllanCapistrano Nov 14, 2023
a94c177
feat: create checkNodesReputation method
AllanCapistrano Nov 14, 2023
ec07ec6
chore: using checkNodesReputation
AllanCapistrano Nov 14, 2023
11458b5
fix: invalid amount of nodes with highest reputation
AllanCapistrano Nov 15, 2023
b08fa2c
chore: set variables to default values if the process has not been co…
AllanCapistrano Nov 15, 2023
ae9cbc9
fix: evaluating devices when receive a FLOW message by MQTT
AllanCapistrano Nov 15, 2023
adabcbe
feat: create requestNodeService method
AllanCapistrano Nov 15, 2023
e281289
fix: check nodes services task when no node responds
AllanCapistrano Nov 16, 2023
2b6e3fe
feat: create enableDevicesPage and starting to evaluating the nodes
AllanCapistrano Nov 16, 2023
b0c66b9
fix: evatuation when request some node service
AllanCapistrano Nov 17, 2023
2deeb43
docs: add docs to enableDevicesPage and requestNodeService
AllanCapistrano Nov 17, 2023
c43bf5e
feat: create JsonStringToJsonObject class
AllanCapistrano Nov 17, 2023
2f7bfae
chore: using JsonStringToJsonObject
AllanCapistrano Nov 17, 2023
8730544
refactor: start and publishNodeServices methods
AllanCapistrano Nov 17, 2023
0c43581
chore: change class name
AllanCapistrano Nov 25, 2023
ade96d8
chore: update get and set method name
AllanCapistrano Nov 25, 2023
4511fe0
feat: create getDeviceWithHighestReputation method
AllanCapistrano Nov 26, 2023
6d36bc6
docs: add docs to getDeviceWithHighestReputation
AllanCapistrano Nov 26, 2023
e386db5
chore: renaming method
AllanCapistrano Nov 26, 2023
67f37cd
refactor: usenodeService method
AllanCapistrano Nov 26, 2023
9b1503d
fix: thing id with highest reputation index
AllanCapistrano Nov 26, 2023
f5eb5c1
feat: create ReputationCalc class and interface
AllanCapistrano Nov 26, 2023
68ace07
chore: using reputation calc
AllanCapistrano Nov 27, 2023
6af6bf0
fix: starvation problem on the device list
AllanCapistrano Nov 27, 2023
bd3e161
chore: disabling evaluation JSON messages view
AllanCapistrano Nov 27, 2023
6f941c4
chore: removing TODO
AllanCapistrano Dec 10, 2023
68d7f22
chore: update class version
AllanCapistrano Dec 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: thing id with highest reputation index
AllanCapistrano committed Nov 26, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9b1503d689d2df5a6e63a493aa1ef61b1e3b79b2
26 changes: 21 additions & 5 deletions src/main/java/reputation/node/models/Node.java
Original file line number Diff line number Diff line change
@@ -29,6 +29,8 @@
import node.type.services.INodeType;
import reputation.node.enums.NodeServiceType;
import reputation.node.mqtt.ListenerDevices;
import reputation.node.reputation.IReputationCalc;
import reputation.node.reputation.ReputationCalc;
import reputation.node.services.NodeTypeService;
import reputation.node.tangle.LedgerConnector;
import reputation.node.tasks.CheckDevicesTask;
@@ -299,11 +301,17 @@ private String getNodeIdWithHighestReputation() {
this.ledgerConnector.getLedgerReader().getTransactionsByIndex(nodeId);

if (evaluationTransactions.isEmpty()) {
logger.info("Não era para entrar aqui 1!");
reputation = 0.5;
} else {
logger.info("AAAAAA"); // TODO: Remover
IReputationCalc reputationCalc = new ReputationCalc();
reputation = 0.5; // TODO: Implementar o cáculo da reputação e modificar essa variável.
// reputation = reputationCalc.calc(evaluationTransactions);
}

logger.info(reputation.toString()); // TODO: Remover

nodesReputations.add(new ThingReputation(nodeId, reputation));

if (reputation > highestReputation) {
@@ -324,9 +332,9 @@ private String getNodeIdWithHighestReputation() {
/**
* Obtendo o ID de um dos nós com a maior reputação.
*/
if (temp.size() == 0) {
if (temp.size() == 1) {
highestReputationNodeId = temp.get(0).getThingId();
} else if (temp.size() > 0) {
} else if (temp.size() > 1) {
int randomIndex = new Random().nextInt(temp.size());

highestReputationNodeId = temp.get(randomIndex).getThingId();
@@ -362,11 +370,17 @@ private DeviceSensorId getDeviceWithHighestReputation(
.getTransactionsByIndex(deviceSensorId.getDeviceId());

if (evaluationTransactions.isEmpty()) {
logger.info("Não era para entrar aqui 2!");
reputation = 0.5;
} else {
reputation = 0.5; // TODO: Implementar o cáculo da reputação dos dispositivos e modificar essa variável.
logger.info("BBBBBBB"); // TODO: Remover
IReputationCalc reputationCalc = new ReputationCalc();
reputation = 0.5; // TODO: Implementar o cáculo da reputação e modificar essa variável.
// reputation = reputationCalc.calc(evaluationTransactions);
}

logger.info(reputation.toString()); // TODO: Remover

devicesReputations.add(
new ThingReputation(
String.format(
@@ -384,6 +398,8 @@ private DeviceSensorId getDeviceWithHighestReputation(
}

final Double innerHighestReputation = Double.valueOf(highestReputation);
logger.info("CCCCCC");
logger.info(innerHighestReputation.toString());

/**
* Verificando quais dispositivos possuem a maior reputação.
@@ -398,9 +414,9 @@ private DeviceSensorId getDeviceWithHighestReputation(
/**
* Obtendo o ID de um dos dispositivos com a maior reputação.
*/
if (temp.size() == 0) {
if (temp.size() == 1) {
index = 0;
} else if (temp.size() > 0) {
} else if (temp.size() > 1) {
index = new Random().nextInt(temp.size());
} else {
logger.severe("Invalid amount of devices with the highest reputation.");