forked from apache/incubator-seata-go
/
transaction_store_manager.go
105 lines (85 loc) · 2.45 KB
/
transaction_store_manager.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package holder
import (
"fmt"
"github.com/xiaobudongzhang/seata-golang/tc/model"
"github.com/xiaobudongzhang/seata-golang/tc/session"
)
type LogOperation byte
const (
LogOperationGlobalAdd LogOperation = iota
/**
* Global update log operation.
*/
LogOperationGlobalUpdate
/**
* Global remove log operation.
*/
LogOperationGlobalRemove
/**
* Branch add log operation.
*/
LogOperationBranchAdd
/**
* Branch update log operation.
*/
LogOperationBranchUpdate
/**
* Branch remove log operation.
*/
LogOperationBranchRemove
)
func (t LogOperation) String() string {
switch t {
case LogOperationGlobalAdd:
return "GlobalAdd"
case LogOperationGlobalUpdate:
return "GlobalUpdate"
case LogOperationGlobalRemove:
return "GlobalRemove"
case LogOperationBranchAdd:
return "BranchAdd"
case LogOperationBranchUpdate:
return "BranchUpdate"
case LogOperationBranchRemove:
return "BranchRemove"
default:
return fmt.Sprintf("%d", t)
}
}
type Reloadable interface {
// Reload states.
Reload()
}
type TransactionStoreManager interface {
// Write session boolean.
WriteSession(logOperation LogOperation, session session.SessionStorable) bool
// Read global session global session.
ReadSession(xid string) *session.GlobalSession
// Read session global session.
ReadSessionWithBranchSessions(xid string, withBranchSessions bool) *session.GlobalSession
// Read session by status list.
ReadSessionWithSessionCondition(sessionCondition model.SessionCondition) []*session.GlobalSession
// Shutdown.
Shutdown()
// Gets current max session id.
GetCurrentMaxSessionId() int64
}
type AbstractTransactionStoreManager struct {
}
func (transactionStoreManager *AbstractTransactionStoreManager) WriteSession(logOperation LogOperation, session session.SessionStorable) bool {
return true
}
func (transactionStoreManager *AbstractTransactionStoreManager) ReadSession(xid string) *session.GlobalSession {
return nil
}
func (transactionStoreManager *AbstractTransactionStoreManager) ReadSessionWithBranchSessions(xid string, withBranchSessions bool) *session.GlobalSession {
return nil
}
func (transactionStoreManager *AbstractTransactionStoreManager) ReadSessionWithSessionCondition(sessionCondition model.SessionCondition) []*session.GlobalSession {
return nil
}
func (transactionStoreManager *AbstractTransactionStoreManager) Shutdown() {
}
func (transactionStoreManager *AbstractTransactionStoreManager) GetCurrentMaxSessionId() int64 {
return 0
}