tidb_storage

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 7 Imported by: 1

README

Tidb Storage

以tidb为存储引擎

go get -u github.com/storage-lock/go-tidb-storage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TidbConnectionManager

type TidbConnectionManager struct {
	// tidb底层实际上都是跟mysql通用的
	storage.ConnectionManager[*sql.DB]
}

TidbConnectionManager 创建一个TIDB的连接

func NewTidbConnectionProviderFromDSN

func NewTidbConnectionProviderFromDSN(dsn string) *TidbConnectionManager

NewTidbConnectionProviderFromDSN 从DSN创建tidb连接

func NewTidbStorageConnectionProvider

func NewTidbStorageConnectionProvider(host string, port uint, user, passwd, databaseName string) *TidbConnectionManager

NewTidbStorageConnectionProvider 从服务器属性创建数据库连接

type TidbStorage

type TidbStorage struct {

	// 其实底层实现跟MySQL是一样一样的,这里就直接复用mysql的storage的逻辑了
	*mysql_storage.MySQLStorage
	// contains filtered or unexported fields
}

TidbStorage 把锁存储在Tidb数据库中

func NewTidbStorage

func NewTidbStorage(ctx context.Context, options *TidbStorageOptions) (*TidbStorage, error)

NewTidbStorage 创建一个基于tidb的storage

func (*TidbStorage) Close

func (x *TidbStorage) Close(ctx context.Context) error

func (*TidbStorage) DeleteWithVersion

func (x *TidbStorage) DeleteWithVersion(ctx context.Context, lockId string, exceptedVersion storage.Version, lockInformation *storage.LockInformation) error

func (*TidbStorage) Get

func (x *TidbStorage) Get(ctx context.Context, lockId string) (string, error)

func (*TidbStorage) GetTime

func (x *TidbStorage) GetTime(ctx context.Context) (time.Time, error)

func (*TidbStorage) Init

func (x *TidbStorage) Init(ctx context.Context) error

func (*TidbStorage) InsertWithVersion

func (x *TidbStorage) InsertWithVersion(ctx context.Context, lockId string, version storage.Version, lockInformation *storage.LockInformation) error

func (*TidbStorage) List

func (*TidbStorage) UpdateWithVersion

func (x *TidbStorage) UpdateWithVersion(ctx context.Context, lockId string, exceptedVersion, newVersion storage.Version, lockInformation *storage.LockInformation) error

type TidbStorageOptions

type TidbStorageOptions struct {
	*mysql_storage.MySQLStorageOptions
}

func NewTidbStorageOptions

func NewTidbStorageOptions() *TidbStorageOptions

Jump to

Keyboard shortcuts

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