seata-golang

module
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0

README

seata-golang

LICENSE

Introduction | 中文

seata-golang is a distributed transaction middleware based on Golang.

difference between seata-glang and seata
feature seata seata-golang remark
AT mode
TCC mode
SAGA mode ×
rpc dev branch
grpc × v2 branch

Architecture

seata-flow

A typical lifecycle of Seata managed distributed transaction:

  • TM asks TC to begin a new global transaction. TC generates an XID representing the global transaction.
  • XID is propagated through microservices' invoke chain.
  • RM registers local transaction as a branch of the corresponding global transaction of XID to TC.
  • TM asks TC for committing or rolling back the corresponding global transaction of XID.
  • TC drives all branch transactions under the corresponding global transaction of XID to finish branch committing or rolling back.

Directory structure

  • cmd: to startup TC server
    • profiles/dev/config.yml: TC config file
    • tc/main.go: TC startup entrance
  • dist: to build in docker container
  • docs: documentations
  • pkg: TC + RM + TM implementation
    • server/db/*.sql: sql scripts to create DB and tables for TC

Getting started

  • TC server
cd ${projectpath}/cmd/tc
go build -o tc_server
# create database `seata` for TC server
# update storage.dsn.mysql in ${projectpath}/cmd/profiles/dev/config.yml
./tc_server start -config ${projectpath}/cmd/profiles/dev/config.yml
  • Client

Please refer to demo seata-go-samples

  • Prerequisites
    • MySQL server
    • Golang version >= 1.15
    • Business tables that require primary key

Design and implementation

The seata-golang AT and TCC design are actually the same as seata.
Please refer to what-is-seata for more details.

Reference

Contact

Please contact us via DingTalk app if you have any issues. The chat group ID is 33069364.
DingTalk Group

Contributing

Welcome to raise up issue or pull-request to seata-golang!
To contribute, fork from opentrx/seata-golang and push branch to your repo, then open a pull-request.

License

seata-golang software is licenced under the Apache License Version 2.0. See the LICENSE file for details.

Jump to

Keyboard shortcuts

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