Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
algorand
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nilak
algorand
Commits
f636f76c
Commit
f636f76c
authored
Apr 22, 2019
by
THAKARE AKSHAY HARIBHAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean
parent
12ada05c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
Node.py
Node.py
+4
-0
OverlayNode.py
OverlayNode.py
+2
-0
TestCases.py
TestCases.py
+4
-3
No files found.
Node.py
View file @
f636f76c
...
...
@@ -12,6 +12,7 @@ class Node(SystemEntity):
self
.
adjacentNodes
=
[]
self
.
messageQueue
=
[]
self
.
sk
,
self
.
pk
=
Utility
.
genratePublicPrivateKey
()
self
.
ResumeTasks
=
[]
'''make sure methods included here are not overriddenn'''
self
.
commands
=
{
"sendMessage"
:
self
.
sendMessage
,
"nextOn"
:
self
.
nextOn
...
...
@@ -84,6 +85,9 @@ class Node(SystemEntity):
self
.
dequeMessage
()
# check if main ba* has to be resumed or not
# TODO : perform task from todolist which are relevant for current tick
try
:
...
...
OverlayNode.py
View file @
f636f76c
...
...
@@ -9,6 +9,8 @@ class OverlayNode(Node):
def
__init__
(
self
,
id
,
network
,
weight
):
Node
.
__init__
(
self
,
id
,
network
,
weight
)
self
.
startNodeLifeCycleGenerator
=
self
.
startNodeLifeCycle
()
# adding initial task of bootstraping node.
self
.
todoList
[
'0'
]
.
append
((
"nextOn"
,
self
.
startNodeLifeCycleGenerator
,))
self
.
commands
.
update
({})
def
processMessage
(
self
,
time
,
payload
):
...
...
TestCases.py
View file @
f636f76c
...
...
@@ -18,11 +18,12 @@ def populateTodolist(net):
instruction
=
row
[
0
]
.
split
()
# tuple of a link
node
=
network
.
nodes
.
get
(
instruction
[
0
])
node
.
todoList
[
instruction
[
1
]]
.
append
(
tuple
(
instruction
[
2
:]))
for
id
,
node
in
network
.
nodes
.
items
():
node
.
todoList
[
'0'
]
.
append
((
"nextOn"
,
node
.
startNodeLifeCycleGenerator
,))
#
for id, node in network.nodes.items():
#
node.todoList['0'].append(("nextOn",node.startNodeLifeCycleGenerator,))
for
id
,
node
in
network
.
nodes
.
items
():
logger
.
info
(
id
+
" : "
+
str
(
node
.
todoList
))
# logger.info(id +" : "+str(node.todoList))
pass
def
simulateNetwork
(
net
):
if
not
net
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment