Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cse550
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
25b1d908
Commit
25b1d908
authored
2 years ago
by
Dixon Tirtayadi
Browse files
Options
Downloads
Patches
Plain Diff
Added client code
parent
7dc82523
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assignment2/client.py
+23
-0
23 additions, 0 deletions
assignment2/client.py
with
23 additions
and
0 deletions
assignment2/client.py
0 → 100644
+
23
−
0
View file @
25b1d908
# Client to send lock / unlock to servers
class
Client
:
def
__init__
(
self
,
server_ips
)
->
None
:
self
.
server_ips
=
server_ips
# Returns true if lock is successful, false otherwise
# x : value to lock (int)
def
lock
(
self
,
x
)
->
bool
:
json
=
{
"
op
"
:
"
lock
"
,
"
value
"
:
x
}
for
server_ip
in
self
.
server_ips
:
pass
# Send JSON to servers, will be treated as command
# Wait for response to return
# Returns true if unlock is successful, false otherwise
# x : value to lock (int)
def
unlock
(
self
,
x
)
->
bool
:
json
=
{
"
op
"
:
"
unlock
"
,
"
value
"
:
x
}
for
server_ip
in
self
.
server_ips
:
pass
# Send JSON to servers, will be treated as command
# Wait for response to return
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