dtmsvr

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: BSD-3-Clause Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CronForwardDuration = time.Duration(0)

CronForwardDuration will be set in test. cron will fetch trans which expire in CronForwardDuration

View Source
var NowForwardDuration = time.Duration(0)

NowForwardDuration will be set in test, trans may be timeout

View Source
var TransProcessedTestChan chan string

TransProcessedTestChan only for test usage. when transaction processed once, write gid to this chan

View Source
var UpdateBranchAsyncInterval = 200 * time.Millisecond

UpdateBranchAsyncInterval interval to flush branch

View Source
var Version = ""

Version store the passin version for dtm server

Functions

func CronExpiredTrans

func CronExpiredTrans(num int)

CronExpiredTrans cron expired trans, num == -1 indicate for ever

func CronTransOnce

func CronTransOnce() (gid string)

CronTransOnce cron expired trans. use expireIn as expire time

func CronUpdateTopicsMap added in v1.16.4

func CronUpdateTopicsMap()

CronUpdateTopicsMap cron updates topics map

func CronUpdateTopicsMapOnce added in v1.17.4

func CronUpdateTopicsMapOnce()

CronUpdateTopicsMapOnce cron updates topics map once

func GenGid

func GenGid() string

GenGid generate gid, use uuid

func GetStore

func GetStore() storage.Store

GetStore returns storage.Store

func NewAsyncContext added in v1.17.4

func NewAsyncContext(ctx context.Context) context.Context

NewAsyncContext create a new async context the context will not be canceled when the parent context is canceled

func PopulateDB

func PopulateDB(skipDrop bool)

PopulateDB setup mysql data

func StartSvr

func StartSvr() *gin.Engine

StartSvr StartSvr

func Subscribe added in v1.16.4

func Subscribe(topic, url, remark string) error

Subscribe subscribes topic, create topic if not exist

func Unsubscribe added in v1.16.4

func Unsubscribe(topic, url string) error

Unsubscribe unsubscribes the topic

Types

type Subscriber added in v1.16.4

type Subscriber struct {
	URL    string `json:"url"`
	Remark string `json:"remark"`
}

Subscriber define subscriber info

type Topic added in v1.16.4

type Topic struct {
	Name        string       `json:"k"`
	Subscribers []Subscriber `json:"v"`
	Version     uint64       `json:"version"`
}

Topic define topic info

type TransBranch

type TransBranch = storage.TransBranchStore

TransBranch branch transaction

type TransGlobal

type TransGlobal struct {
	storage.TransGlobalStore
	ReqExtra map[string]string `json:"req_extra"`
	Context  context.Context
	// contains filtered or unexported fields
}

TransGlobal global transaction

func GetTransGlobal

func GetTransGlobal(gid string) *TransGlobal

GetTransGlobal construct trans from db

func TransFromContext

func TransFromContext(c *gin.Context) *TransGlobal

TransFromContext TransFromContext

func TransFromDtmRequest

func TransFromDtmRequest(ctx context.Context, c *dtmgpb.DtmRequest) *TransGlobal

TransFromDtmRequest TransFromContext

func TransFromJrpcParams added in v1.13.1

func TransFromJrpcParams(params interface{}) *TransGlobal

TransFromJrpcParams construct TransGlobal from jrpc params

func (*TransGlobal) Process

func (t *TransGlobal) Process(branches []TransBranch) error

Process process global transaction once

Directories

Path Synopsis
boltdb
package boltdb implement the storage for boltdb
package boltdb implement the storage for boltdb
redis
package reds implement the storage for reds
package reds implement the storage for reds
sql
package boltdb implement the storage for sql database
package boltdb implement the storage for sql database

Jump to

Keyboard shortcuts

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