Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
c1ba4a4c
Commit
c1ba4a4c
authored
Jul 23, 2018
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5c4d7868
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
go/transaction/transaction.go
go/transaction/transaction.go
+30
-8
No files found.
go/transaction/transaction.go
View file @
c1ba4a4c
...
...
@@ -11,7 +11,7 @@
// WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
// FOR A PARTICULAR PURPOSE.
// Package transaction provides transaction management via Two-Phase
transaction
protocol.
// Package transaction provides transaction management via Two-Phase
commit
protocol.
//
// It is modelled after Python transaction package:
//
...
...
@@ -31,6 +31,9 @@ type Manager interface {
// XXX
//
// XXX There must be no existing in progress transaction.
// XXX kill ^^^ - we should support many simultaneous transactions.
//
// XXX + ctx, errror -> yes, i.e. it needs to sync fetch last tid from db
Begin
()
Transaction
// RegisterSynch registers synchronizer.
...
...
@@ -57,26 +60,35 @@ type Transaction interface {
// Commit finalizes the transaction.
//
// This executes the two-phase commit algorithm for all
//
IDataManager objects associated with the transaction. XXX
//
DataManager objects associated with the transaction.
Commit
(
ctx
context
.
Context
)
error
// Abort aborts the transaction.
//
// This is called from the application.
This can only be called XXX
// before the two-phase commit protocol has been started.
XXX
// This is called from the application. This can only be called XXX
// before the two-phase commit protocol has been started. XXX
Abort
()
// XXX + Doom?
// Add a data manager to the transaction. XXX
// Join associates a data manager to the transaction.
//
// Only associated data managers will participate in the transaction commit.
//
// XXX -> JoinCommit?
Join
(
dm
DataManager
)
// XXX SetData(
oid zodb.Oid, data interface{}
// XXX GetData(
oid zodb.Oid) interface{}
// XXX SetData(
key interface{}, data interface{})
// XXX GetData(
key interface{}) interface{}, ok
}
// DataManager represents transactional storage. // XXX -> transaction.Storage?
// DataManager represents transactional storage.
//
// If DataManager is registered to transaction via Transaction.Join, it will
// participate in that transaction commit.
//
// XXX -> TPCCommitter?
type
DataManager
interface
{
// TPCBegin should begin commit of a transaction, starting the two-phase commit.
TPCBegin
(
txn
Transaction
)
// XXX +ctx, error ?
...
...
@@ -107,6 +119,15 @@ type DataManager interface {
// serious error.
TPCFinish
(
ctx
context
.
Context
,
txn
Transaction
)
// XXX error?
// TPCAbort should Abort a transaction.
//
// This is called by a transaction manager to end a two-phase commit on
// the data manager. Abandon all changes to objects modified by this
// transaction.
//
// This should never fail.
TPCAbort
(
ctx
context
.
Context
,
txn
Transaction
)
// XXX error?
// XXX SortKey() string ?
}
...
...
@@ -121,5 +142,6 @@ type Synchronizer interface {
// NewTransaction is called at the start of a transaction.
// XXX -> TxnStart ?
// XXX + ctx, error (it neeeds to ask storage for last tid)
NewTransaction
(
txn
Transaction
)
}
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