Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cse550
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Winston Jodjana
cse550
Commits
48b748ad
Commit
48b748ad
authored
2 years ago
by
WinJ
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/new_main'
parents
312e5cc6
157d44d0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
assignment2/client.py
+2
-2
2 additions, 2 deletions
assignment2/client.py
assignment2/lockmanager.py
+1
-3
1 addition, 3 deletions
assignment2/lockmanager.py
assignment2/paxos.py
+5
-4
5 additions, 4 deletions
assignment2/paxos.py
with
8 additions
and
9 deletions
assignment2/client.py
+
2
−
2
View file @
48b748ad
...
...
@@ -29,8 +29,8 @@ if __name__ == "__main__":
# create a UDP socket
HOST
,
PORT
=
"
localhost
"
,
9000
# TODO: Uncomment below for multiple nodes paxos
# serv_addresses = ((HOST, PORT), (HOST, PORT + 1), (HOST, PORT + 2))
serv_addresses
=
((
HOST
,
PORT
),
)
serv_addresses
=
((
HOST
,
9000
),
(
HOST
,
9001
)
)
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
sock
.
bind
((
'
localhost
'
,
0
))
address
=
sock
.
getsockname
()
...
...
This diff is collapsed.
Click to expand it.
assignment2/lockmanager.py
+
1
−
3
View file @
48b748ad
...
...
@@ -45,11 +45,9 @@ class LockManager:
lock_res
=
self
.
lock
(
int
(
lock_command
.
value
),
client_address
)
elif
lock_command
.
op
==
"
unlock
"
:
lock_res
=
self
.
unlock
(
int
(
lock_command
.
value
),
client_address
)
print
(
"
Current Locks: {
}
"
.
format
(
self
.
locks
)
)
print
(
f
"
Current Locks:
{
self
.
locks
}
"
)
return
lock_res
# quick_test
#if __name__ == "__main__":
#lm = LockManager()
...
...
This diff is collapsed.
Click to expand it.
assignment2/paxos.py
+
5
−
4
View file @
48b748ad
...
...
@@ -430,11 +430,12 @@ def send_msg(obj, dest_addr: Address):
sock
.
close
()
if
__name__
==
"
__main__
"
:
HOST
,
PORT
=
"
localhost
"
,
9000
# addresses = ((HOST, PORT),
(HOST, PORT + 1), (HOST, PORT + 2)
)
addresses
=
((
HOST
,
PORT
),
)
HOST
,
PORT
=
sys
.
argv
[
1
],
int
(
sys
.
argv
[
2
])
# addresses = ((HOST, PORT),)
addresses
=
((
HOST
,
9000
),
(
HOST
,
9001
)
)
# Create the server, binding to localhost on port 9999
server
=
Paxos
((
HOST
,
PORT
),
addresses
)
# Activate the server; this will keep running until you
# interrupt the program with Ctrl-C
server
.
serve_forever
()
server
.
serve_forever
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment