hptx
High-performance non-intrusive distributed transaction solution, inspired by kubernetes, only for golang language.
Features
- High-performance and non-intrusive
- Support AT mode And TCC mode
- Support check global lock in local transaction
Requirements
- Go 1.16 or higher.
- ETCD(3+)
- AT mode: Mysql (5.7+), MariaDB
Installation
Simple install the package to your $GOPATH with the go tool from shell:
$ go get -u github.com/cectc/hptxIf you use AT mode to solve distributed transaction problems, you should also install the following package:
$ go get -u github.com/cectc/mysqlMake sure Git is installed on your machine and in your system's PATH.
Usage
You should have your ETCD ready first. then, you can initialize hptx via hptx.InitFromFile:
import (
"github.com/cectc/hptx"
"github.com/cectc/hptx/pkg/config"
"github.com/cectc/hptx/pkg/resource"
"github.com/cectc/mysql"
)
//...
hptx.InitFromFile("${path of your config file}")
// If you use at mode, initial with following code
mysql.RegisterResource(config.GetATConfig().DSN)
resource.InitATBranchResource(mysql.GetDataSourceManager())It is also possible to set the configuration directly:
import (
"github.com/cectc/hptx"
"github.com/cectc/hptx/pkg/config"
"github.com/cectc/hptx/pkg/resource"
"github.com/cectc/mysql"
)
//...
// Fill in the fields as needed.
hptx.InitWithConf(&config.DistributedTransaction{
ApplicationID: "",
RetryDeadThreshold: 0,
RollbackRetryTimeoutUnlockEnable: false,
EtcdConfig: clientv3.Config{},
ATConfig: config.ATConfig{},
TMConfig: config.TMConfig{},
})
// If you use at mode, initial with following code
mysql.RegisterResource(config.GetATConfig().DSN)
resource.InitATBranchResource(mysql.GetDataSourceManager())Support GlobalLock:
db.ExecContext(context.WithValue(context.Background(), "GlobalLock", true), sql, args...)Examples are available in our repos
License
hptx is licensed under the GNU General Public License v3.0.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
