Documentation ¶
Index ¶
- Constants
- type ATCore
- type AbstractCore
- type DefaultCoordinator
- func (coordinator *DefaultCoordinator) OnCheckMessage(rpcMessage protocal.RpcMessage, session getty.Session)
- func (coordinator *DefaultCoordinator) OnClose(session getty.Session)
- func (coordinator *DefaultCoordinator) OnCron(session getty.Session)
- func (coordinator *DefaultCoordinator) OnError(session getty.Session, err error)
- func (coordinator *DefaultCoordinator) OnMessage(session getty.Session, pkg interface{})
- func (coordinator *DefaultCoordinator) OnOpen(session getty.Session) error
- func (coordinator *DefaultCoordinator) OnRegRmMessage(rpcMessage protocal.RpcMessage, session getty.Session)
- func (coordinator *DefaultCoordinator) OnRegTmMessage(rpcMessage protocal.RpcMessage, session getty.Session)
- func (coordinator *DefaultCoordinator) OnTrxMessage(rpcMessage protocal.RpcMessage, session getty.Session)
- func (coordinator *DefaultCoordinator) SendASyncRequest(session getty.Session, message interface{}) error
- func (coordinator *DefaultCoordinator) SendResponse(request protocal.RpcMessage, session getty.Session, msg interface{})
- func (coordinator *DefaultCoordinator) SendSyncRequest(resourceId string, clientId string, message interface{}) (interface{}, error)
- func (coordinator *DefaultCoordinator) SendSyncRequestByGetty(session getty.Session, message interface{}) (interface{}, error)
- func (coordinator *DefaultCoordinator) SendSyncRequestByGettyWithTimeout(session getty.Session, message interface{}, timeout time.Duration) (interface{}, error)
- func (coordinator *DefaultCoordinator) SendSyncRequestWithTimeout(resourceId string, clientId string, message interface{}, timeout time.Duration) (interface{}, error)
- func (coordinator *DefaultCoordinator) Stop()
- type DefaultCore
- func (core *DefaultCore) Begin(applicationId string, transactionServiceGroup string, name string, ...) (string, error)
- func (core *DefaultCore) BranchRegister(branchType meta.BranchType, resourceId string, clientId string, xid string, ...) (int64, error)
- func (core *DefaultCore) BranchReport(branchType meta.BranchType, xid string, branchId int64, ...) error
- func (core *DefaultCore) Commit(xid string) (meta.GlobalStatus, error)
- func (core *DefaultCore) GetStatus(xid string) (meta.GlobalStatus, error)
- func (core *DefaultCore) GlobalReport(xid string, globalStatus meta.GlobalStatus) (meta.GlobalStatus, error)
- func (core *DefaultCore) LockQuery(branchType meta.BranchType, resourceId string, xid string, lockKeys string) (bool, error)
- func (core *DefaultCore) Rollback(xid string) (meta.GlobalStatus, error)
- type GettySessionManager
- func (manager *GettySessionManager) GetContextFromIdentified(session getty.Session) *RpcContext
- func (manager *GettySessionManager) GetGettySession(resourceId string, clientId string) (getty.Session, error)
- func (manager *GettySessionManager) GetRmSessions() map[string]getty.Session
- func (manager *GettySessionManager) GetRoleFromGettySession(session getty.Session) meta.TransactionRole
- func (manager *GettySessionManager) GetSameClientGettySession(session getty.Session) getty.Session
- func (manager *GettySessionManager) IsRegistered(session getty.Session) bool
- func (manager *GettySessionManager) RegisterRmGettySession(request protocal.RegisterRMRequest, session getty.Session)
- func (manager *GettySessionManager) RegisterTmGettySession(request protocal.RegisterTMRequest, session getty.Session)
- func (manager *GettySessionManager) ReleaseGettySession(session getty.Session)
- type RpcContext
- type RpcContextOption
- func WithRpcContextApplicationId(applicationId string) RpcContextOption
- func WithRpcContextClientId(clientId string) RpcContextOption
- func WithRpcContextClientRole(clientRole meta.TransactionRole) RpcContextOption
- func WithRpcContextResourceSet(resourceSet *model.Set) RpcContextOption
- func WithRpcContextSession(session getty.Session) RpcContextOption
- func WithRpcContextTxServiceGroup(txServiceGroup string) RpcContextOption
- func WithRpcContextVersion(version string) RpcContextOption
- type SAGACore
- type Server
- type ServerMessageListener
- type ServerMessageSender
- type TCInboundHandler
- type TransactionCoordinator
- type TransactionCoordinatorInbound
- type TransactionCoordinatorOutbound
Constants ¶
View Source
const ( RPC_REQUEST_TIMEOUT = 30 * time.Second ALWAYS_RETRY_BOUNDARY = 0 )
View Source
const ( ClientIdSplitChar = ":" DbkeysSplitChar = "," )
View Source
const (
CronPeriod = 20e9
)
View Source
const IpPortSplitChar = ":"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ATCore ¶
type ATCore struct {
AbstractCore
}
type AbstractCore ¶
type AbstractCore struct {
MessageSender ServerMessageSender
}
type DefaultCoordinator ¶
type DefaultCoordinator struct {
// contains filtered or unexported fields
}
func NewDefaultCoordinator ¶
func NewDefaultCoordinator(conf config.ServerConfig) *DefaultCoordinator
func (*DefaultCoordinator) OnCheckMessage ¶
func (coordinator *DefaultCoordinator) OnCheckMessage(rpcMessage protocal.RpcMessage, session getty.Session)
func (*DefaultCoordinator) OnClose ¶
func (coordinator *DefaultCoordinator) OnClose(session getty.Session)
func (*DefaultCoordinator) OnCron ¶
func (coordinator *DefaultCoordinator) OnCron(session getty.Session)
func (*DefaultCoordinator) OnError ¶
func (coordinator *DefaultCoordinator) OnError(session getty.Session, err error)
func (*DefaultCoordinator) OnMessage ¶
func (coordinator *DefaultCoordinator) OnMessage(session getty.Session, pkg interface{})
func (*DefaultCoordinator) OnOpen ¶
func (coordinator *DefaultCoordinator) OnOpen(session getty.Session) error
func (*DefaultCoordinator) OnRegRmMessage ¶
func (coordinator *DefaultCoordinator) OnRegRmMessage(rpcMessage protocal.RpcMessage, session getty.Session)
func (*DefaultCoordinator) OnRegTmMessage ¶
func (coordinator *DefaultCoordinator) OnRegTmMessage(rpcMessage protocal.RpcMessage, session getty.Session)
func (*DefaultCoordinator) OnTrxMessage ¶
func (coordinator *DefaultCoordinator) OnTrxMessage(rpcMessage protocal.RpcMessage, session getty.Session)
func (*DefaultCoordinator) SendASyncRequest ¶
func (coordinator *DefaultCoordinator) SendASyncRequest(session getty.Session, message interface{}) error
func (*DefaultCoordinator) SendResponse ¶
func (coordinator *DefaultCoordinator) SendResponse(request protocal.RpcMessage, session getty.Session, msg interface{})
func (*DefaultCoordinator) SendSyncRequest ¶
func (coordinator *DefaultCoordinator) SendSyncRequest(resourceId string, clientId string, message interface{}) (interface{}, error)
func (*DefaultCoordinator) SendSyncRequestByGetty ¶
func (coordinator *DefaultCoordinator) SendSyncRequestByGetty(session getty.Session, message interface{}) (interface{}, error)
func (*DefaultCoordinator) SendSyncRequestByGettyWithTimeout ¶
func (*DefaultCoordinator) SendSyncRequestWithTimeout ¶
func (*DefaultCoordinator) Stop ¶
func (coordinator *DefaultCoordinator) Stop()
type DefaultCore ¶
type DefaultCore struct { AbstractCore ATCore SAGACore // contains filtered or unexported fields }
func (*DefaultCore) BranchRegister ¶
func (core *DefaultCore) BranchRegister(branchType meta.BranchType, resourceId string, clientId string, xid string, applicationData []byte, lockKeys string) (int64, error)
func (*DefaultCore) BranchReport ¶
func (core *DefaultCore) BranchReport(branchType meta.BranchType, xid string, branchId int64, status meta.BranchStatus, applicationData []byte) error
func (*DefaultCore) Commit ¶
func (core *DefaultCore) Commit(xid string) (meta.GlobalStatus, error)
func (*DefaultCore) GetStatus ¶
func (core *DefaultCore) GetStatus(xid string) (meta.GlobalStatus, error)
func (*DefaultCore) GlobalReport ¶
func (core *DefaultCore) GlobalReport(xid string, globalStatus meta.GlobalStatus) (meta.GlobalStatus, error)
func (*DefaultCore) LockQuery ¶
func (core *DefaultCore) LockQuery(branchType meta.BranchType, resourceId string, xid string, lockKeys string) (bool, error)
func (*DefaultCore) Rollback ¶
func (core *DefaultCore) Rollback(xid string) (meta.GlobalStatus, error)
type GettySessionManager ¶
var SessionManager GettySessionManager
func (*GettySessionManager) GetContextFromIdentified ¶
func (manager *GettySessionManager) GetContextFromIdentified(session getty.Session) *RpcContext
func (*GettySessionManager) GetGettySession ¶
func (*GettySessionManager) GetRmSessions ¶
func (manager *GettySessionManager) GetRmSessions() map[string]getty.Session
func (*GettySessionManager) GetRoleFromGettySession ¶
func (manager *GettySessionManager) GetRoleFromGettySession(session getty.Session) meta.TransactionRole
func (*GettySessionManager) GetSameClientGettySession ¶
func (manager *GettySessionManager) GetSameClientGettySession(session getty.Session) getty.Session
func (*GettySessionManager) IsRegistered ¶
func (manager *GettySessionManager) IsRegistered(session getty.Session) bool
func (*GettySessionManager) RegisterRmGettySession ¶
func (manager *GettySessionManager) RegisterRmGettySession(request protocal.RegisterRMRequest, session getty.Session)
func (*GettySessionManager) RegisterTmGettySession ¶
func (manager *GettySessionManager) RegisterTmGettySession(request protocal.RegisterTMRequest, session getty.Session)
func (*GettySessionManager) ReleaseGettySession ¶
func (manager *GettySessionManager) ReleaseGettySession(session getty.Session)
type RpcContext ¶
type RpcContext struct { Version string TransactionServiceGroup string ClientRole meta.TransactionRole ApplicationId string ClientId string ResourceSets *model.Set Session getty.Session }
func NewRpcContext ¶
func NewRpcContext(opts ...RpcContextOption) *RpcContext
func (*RpcContext) AddResource ¶
func (context *RpcContext) AddResource(resource string)
func (*RpcContext) AddResources ¶
func (context *RpcContext) AddResources(resources *model.Set)
type RpcContextOption ¶
type RpcContextOption func(ctx *RpcContext)
func WithRpcContextApplicationId ¶
func WithRpcContextApplicationId(applicationId string) RpcContextOption
func WithRpcContextClientId ¶
func WithRpcContextClientId(clientId string) RpcContextOption
func WithRpcContextClientRole ¶
func WithRpcContextClientRole(clientRole meta.TransactionRole) RpcContextOption
func WithRpcContextResourceSet ¶
func WithRpcContextResourceSet(resourceSet *model.Set) RpcContextOption
func WithRpcContextSession ¶
func WithRpcContextSession(session getty.Session) RpcContextOption
func WithRpcContextTxServiceGroup ¶
func WithRpcContextTxServiceGroup(txServiceGroup string) RpcContextOption
func WithRpcContextVersion ¶
func WithRpcContextVersion(version string) RpcContextOption
type SAGACore ¶
type SAGACore struct {
AbstractCore
}
type ServerMessageListener ¶
type ServerMessageListener interface { OnTrxMessage(rpcMessage protocal.RpcMessage, session getty.Session) OnRegRmMessage(request protocal.RpcMessage, session getty.Session) OnRegTmMessage(request protocal.RpcMessage, session getty.Session) OnCheckMessage(request protocal.RpcMessage, session getty.Session) }
type ServerMessageSender ¶
type ServerMessageSender interface { // Send response. SendResponse(request protocal.RpcMessage, session getty.Session, msg interface{}) // Sync call to RM SendSyncRequest(resourceId string, clientId string, message interface{}) (interface{}, error) // Sync call to RM with timeout. SendSyncRequestWithTimeout(resourceId string, clientId string, message interface{}, timeout time.Duration) (interface{}, error) // Send request with response object. SendSyncRequestByGetty(session getty.Session, message interface{}) (interface{}, error) // Send request with response object. SendSyncRequestByGettyWithTimeout(session getty.Session, message interface{}, timeout time.Duration) (interface{}, error) // ASync call to RM SendASyncRequest(session getty.Session, message interface{}) error }
type TCInboundHandler ¶
type TCInboundHandler interface {
// contains filtered or unexported methods
}
type TransactionCoordinator ¶
type TransactionCoordinator interface { TransactionCoordinatorInbound TransactionCoordinatorOutbound // contains filtered or unexported methods }
func NewCore ¶
func NewCore(sender ServerMessageSender) TransactionCoordinator
type TransactionCoordinatorInbound ¶
type TransactionCoordinatorInbound interface { tm.TransactionManager rm.ResourceManagerOutbound }
type TransactionCoordinatorOutbound ¶
type TransactionCoordinatorOutbound interface {
// contains filtered or unexported methods
}
Source Files ¶
- default_coordinator.go
- default_coordinator_event_listener.go
- default_coordinator_server_message_listener.go
- default_coordinator_server_message_sender.go
- default_coordinator_tc_inbound_handler.go
- default_core.go
- getty_session_manager.go
- rpc_context.go
- server.go
- server_message_listener.go
- server_message_sender.go
- tc_inbound_handler.go
- transaction_coordinator.go
Click to show internal directories.
Click to hide internal directories.