Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ECE 428 - Distributed Systems
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
djq2
ECE 428 - Distributed Systems
Commits
64cb4446
Commit
64cb4446
authored
3 years ago
by
Kevin Villanueva
Browse files
Options
Downloads
Patches
Plain Diff
fdasf
parent
a68e8eb7
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
mp3/src/servers/coordinator.go
+10
-0
10 additions, 0 deletions
mp3/src/servers/coordinator.go
with
10 additions
and
0 deletions
mp3/src/servers/coordinator.go
+
10
−
0
View file @
64cb4446
...
@@ -288,6 +288,8 @@ func (host *Server) Coordinator(name string) {
...
@@ -288,6 +288,8 @@ func (host *Server) Coordinator(name string) {
if
msg
.
Command
==
"ABORT"
{
if
msg
.
Command
==
"ABORT"
{
fmt
.
Println
(
"Started Abort."
)
fmt
.
Println
(
"Started Abort."
)
host
.
abort
()
host
.
abort
()
client_out
:=
Client_resp
{
Success
:
true
,
Msg
:
"ABORTED"
}
host
.
client_write
(
client_out
)
return
return
}
}
if
msg
.
Command
==
"COMMIT"
{
if
msg
.
Command
==
"COMMIT"
{
...
@@ -723,6 +725,14 @@ func (host *Server) abort() {
...
@@ -723,6 +725,14 @@ func (host *Server) abort() {
// - Careful about timing with threads, make sure all updates are done
// - Careful about timing with threads, make sure all updates are done
func
(
host
*
Server
)
commit
()
{
func
(
host
*
Server
)
commit
()
{
// Iterate Local Transaction
// Iterate Local Transaction
for
_
,
data
:=
range
host
.
Tr
.
Accounts
{
if
data
.
Balance
<
0
{
host
.
abort
()
client_out
:=
Client_resp
{
Success
:
false
,
Msg
:
"ABORTED"
}
host
.
client_write
(
client_out
)
return
}
}
for
acc
,
data
:=
range
host
.
Tr
.
Accounts
{
for
acc
,
data
:=
range
host
.
Tr
.
Accounts
{
div
:=
strings
.
Split
(
acc
,
"."
)
div
:=
strings
.
Split
(
acc
,
"."
)
acc_name
:=
div
[
1
]
acc_name
:=
div
[
1
]
...
...
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