Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
02dad3fa
Commit
02dad3fa
authored
Jul 24, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7bc2dd46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
go/transaction/api.go
go/transaction/api.go
+6
-1
go/transaction/transaction.go
go/transaction/transaction.go
+28
-2
No files found.
go/transaction/api.go
View file @
02dad3fa
...
...
@@ -168,6 +168,8 @@ type Transaction interface {
// RegisterSync registers sync to be notified in this transaction boundary events.
//
// See Synchronizer for details.
//
// RegisterSync must be called before transaction completion begins.
RegisterSync
(
sync
Synchronizer
)
// XXX SetData(key interface{}, data interface{})
...
...
@@ -243,7 +245,10 @@ type DataManager interface {
// This should never fail.
TPCAbort
(
ctx
context
.
Context
,
txn
Transaction
)
// XXX error?
// XXX SortKey() string ?
// XXX better do without SortKey - with it it is assumed that
// datamanagers are processed serially.
// SortKey() string
}
// Synchronizer is the interface to participate in transaction-boundary notifications.
...
...
go/transaction/transaction.go
View file @
02dad3fa
...
...
@@ -81,14 +81,40 @@ func (txn *transaction) Abort() {
panic
(
"TODO"
)
}
// checkNotYetCompleting asserts that transaction completion has not yet began.
//
// and panics if the assert fails.
// must be called with .mu held.
func
(
txn
*
transaction
)
checkNotYetCompleting
(
who
string
)
{
switch
txn
.
status
{
case
Active
:
// XXX + Doomed ?
// ok
default
:
panic
(
"transaction: "
+
who
+
": transaction completion already began"
)
}
}
// Join implements Transaction.
func
(
txn
*
transaction
)
Join
(
dm
DataManager
)
{
panic
(
"TODO"
)
txn
.
mu
.
Lock
()
defer
txn
.
mu
.
Unlock
()
txn
.
checkNotYetCompleting
(
"join"
)
// XXX forbid double join?
txn
.
datav
=
append
(
txn
.
datav
,
dm
)
}
// RegisterSync implements Transaction.
func
(
txn
*
transaction
)
RegisterSync
(
sync
Synchronizer
)
{
panic
(
"TODO"
)
txn
.
mu
.
Lock
()
defer
txn
.
mu
.
Unlock
()
txn
.
checkNotYetCompleting
(
"register sync"
)
// XXX forbid double register?
txn
.
syncv
=
append
(
txn
.
syncv
,
sync
)
}
...
...
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