tcc

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ActionNameTag = "TccActionName"

	TryMethod     = "Try"
	ConfirmMethod = "Confirm"
	CancelMethod  = "Cancel"

	ActionStartTime = "action-start-time"
	ActionName      = "actionName"
	PrepareMethod   = "sys::prepare"
	CommitMethod    = "sys::commit"
	RollbackMethod  = "sys::rollback"
	HostName        = "host-name"
)
View Source
var (
	ActionContext = "actionContext"
)

Functions

func ImplementTCC

func ImplementTCC(v ProxyService)

Types

type ProxyService

type ProxyService interface {
	GetService() Service
}

type Resource

type Resource struct {
	ActionName         string
	PrepareMethodName  string
	CommitMethodName   string
	CommitMethod       *proxy.MethodDescriptor
	RollbackMethodName string
	RollbackMethod     *proxy.MethodDescriptor
}

func (*Resource) GetBranchType

func (resource *Resource) GetBranchType() api.BranchSession_BranchType

func (*Resource) GetResourceID

func (resource *Resource) GetResourceID() string

type ResourceManager

type ResourceManager struct {
	ResourceCache map[string]*Resource
}

func GetResourceManager

func GetResourceManager() ResourceManager

func (ResourceManager) Commit

func (ResourceManager) GetBranchType

func (resourceManager ResourceManager) GetBranchType() api.BranchSession_BranchType

func (ResourceManager) RegisterResource

func (resourceManager ResourceManager) RegisterResource(resource *Resource)

func (ResourceManager) Rollback

func (resourceManager ResourceManager) Rollback(ctx context.Context, bs *api.BranchSession) (api.BranchSession_BranchStatus, error)

func (ResourceManager) UnregisterResource

func (resourceManager ResourceManager) UnregisterResource(resource *Resource)

type Service

type Service interface {
	Try(ctx *ctx.BusinessActionContext) (bool, error)
	Confirm(ctx *ctx.BusinessActionContext) bool
	Cancel(ctx *ctx.BusinessActionContext) bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL