sql

package
v1.24.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 36 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// NOTE: transaction ID is *= -1 in DB
	MinTxnID int64 = math.MaxInt64
	MaxTxnID int64 = math.MinInt64 + 1 // int overflow
)

Variables

View Source
var ErrPluginNotSupported = errors.New("plugin not supported")

Functions

func NewQueueV2 added in v1.23.0

func NewQueueV2(db sqlplugin.DB,
	logger log.Logger,
) persistence.QueueV2

NewQueueV2 returns an implementation of persistence.QueueV2.

func NewSQLAdminDB added in v0.27.0

func NewSQLAdminDB(
	dbKind sqlplugin.DbKind,
	cfg *config.SQL,
	r resolver.ServiceResolver,
) (sqlplugin.AdminDB, error)

NewSQLAdminDB returns a AdminDB

func NewSQLDB added in v0.27.0

func NewSQLDB(
	dbKind sqlplugin.DbKind,
	cfg *config.SQL,
	r resolver.ServiceResolver,
) (sqlplugin.DB, error)

NewSQLDB creates a returns a reference to a logical connection to the underlying SQL database. The returned object is to tied to a single SQL database and the object can be used to perform CRUD operations on the tables in the database

func NewSQLExecutionStore added in v0.5.0

func NewSQLExecutionStore(
	db sqlplugin.DB,
	logger log.Logger,
) (p.ExecutionStore, error)

NewSQLExecutionStore creates an instance of ExecutionStore

func NewSqlNexusIncomingServiceStore added in v1.24.0

func NewSqlNexusIncomingServiceStore(
	db sqlplugin.DB,
	logger log.Logger,
) (p.NexusIncomingServiceStore, error)

func RegisterPlugin added in v0.27.0

func RegisterPlugin(pluginName string, plugin sqlplugin.Plugin)

RegisterPlugin will register a SQL plugin

func VerifyCompatibleVersion added in v1.5.7

func VerifyCompatibleVersion(
	cfg config.Persistence,
	r resolver.ServiceResolver,
) error

VerifyCompatibleVersion ensures that the installed version of temporal and visibility is greater than or equal to the expected version.

Types

type DbConn added in v1.12.0

type DbConn struct {
	sqlplugin.DB

	sync.Mutex
	// contains filtered or unexported fields
}

DbConn represents a logical mysql connection - its a wrapper around the standard sql connection pool with additional reference counting

func NewRefCountedDBConn added in v1.12.0

func NewRefCountedDBConn(
	dbKind sqlplugin.DbKind,
	cfg *config.SQL,
	r resolver.ServiceResolver,
) DbConn

NewRefCountedDBConn returns a logical mysql connection that uses reference counting to decide when to close the underlying connection object. The reference count gets incremented everytime get() is called and decremented everytime Close() is called

func (*DbConn) Close added in v1.12.0

func (c *DbConn) Close() error

Close closes the underlying connection if the reference count becomes zero

func (*DbConn) ForceClose added in v1.12.0

func (c *DbConn) ForceClose()

ForceClose ignores reference counts and shutsdown the underlying connection pool

func (*DbConn) Get added in v1.12.0

func (c *DbConn) Get() (sqlplugin.DB, error)

Get returns a mysql db connection and increments a reference count this method will create a new connection, if an existing connection does not exist

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory vends store objects backed by MySQL

func NewFactory

func NewFactory(
	cfg config.SQL,
	r resolver.ServiceResolver,
	clusterName string,
	logger log.Logger,
) *Factory

NewFactory returns an instance of a factory object which can be used to create datastores backed by any kind of SQL store

func (*Factory) Close

func (f *Factory) Close()

Close closes the factory

func (*Factory) GetDB added in v1.23.0

func (f *Factory) GetDB() (sqlplugin.DB, error)

GetDB return a new SQL DB connection

func (*Factory) NewClusterMetadataStore added in v0.27.0

func (f *Factory) NewClusterMetadataStore() (p.ClusterMetadataStore, error)

NewClusterMetadataStore returns a new ClusterMetadata store

func (*Factory) NewExecutionStore

func (f *Factory) NewExecutionStore() (p.ExecutionStore, error)

NewExecutionStore returns a new ExecutionStore

func (*Factory) NewMetadataStore

func (f *Factory) NewMetadataStore() (p.MetadataStore, error)

NewMetadataStore returns a new metadata store

func (*Factory) NewNexusIncomingServiceStore added in v1.24.0

func (f *Factory) NewNexusIncomingServiceStore() (p.NexusIncomingServiceStore, error)

NewNexusIncomingServiceStore returns a new NexusIncomingServiceStore

func (*Factory) NewQueue added in v0.27.0

func (f *Factory) NewQueue(queueType p.QueueType) (p.Queue, error)

NewQueue returns a new queue backed by sql

func (*Factory) NewQueueV2 added in v1.23.0

func (f *Factory) NewQueueV2() (p.QueueV2, error)

NewQueueV2 returns a new data-access object for queues and messages.

func (*Factory) NewShardStore

func (f *Factory) NewShardStore() (p.ShardStore, error)

NewShardStore returns a new shard store

func (*Factory) NewTaskStore

func (f *Factory) NewTaskStore() (p.TaskStore, error)

NewTaskStore returns a new task store

type QueueV2Metadata added in v1.23.0

type QueueV2Metadata struct {
	Metadata *persistencespb.Queue
	Version  int64
}

type SqlStore added in v1.12.0

type SqlStore struct {
	Db sqlplugin.DB
	// contains filtered or unexported fields
}

TODO: Rename all SQL Managers to Stores

func NewSqlStore added in v1.12.0

func NewSqlStore(db sqlplugin.DB, logger log.Logger) SqlStore

func (*SqlStore) Close added in v1.12.0

func (m *SqlStore) Close()

func (*SqlStore) GetDbName added in v1.20.0

func (m *SqlStore) GetDbName() string

func (*SqlStore) GetName added in v1.12.0

func (m *SqlStore) GetName() string

type TestCluster

type TestCluster struct {
	// contains filtered or unexported fields
}

TestCluster allows executing cassandra operations in testing.

func NewTestCluster

func NewTestCluster(
	pluginName string,
	dbName string,
	username string,
	password string,
	host string,
	port int,
	connectAttributes map[string]string,
	schemaDir string,
	faultInjection *config.FaultInjection,
	logger log.Logger,
) *TestCluster

NewTestCluster returns a new SQL test cluster

func (*TestCluster) Config

func (s *TestCluster) Config() config.Persistence

Config returns the persistence config for connecting to this test cluster

func (*TestCluster) CreateDatabase

func (s *TestCluster) CreateDatabase()

CreateDatabase from PersistenceTestCluster interface

func (*TestCluster) DatabaseName

func (s *TestCluster) DatabaseName() string

DatabaseName from PersistenceTestCluster interface

func (*TestCluster) DropDatabase

func (s *TestCluster) DropDatabase()

DropDatabase from PersistenceTestCluster interface

func (*TestCluster) LoadSchema

func (s *TestCluster) LoadSchema(schemaFile string)

LoadSchema from PersistenceTestCluster interface

func (*TestCluster) SetupTestDatabase

func (s *TestCluster) SetupTestDatabase()

SetupTestDatabase from PersistenceTestCluster interface

func (*TestCluster) TearDownTestDatabase

func (s *TestCluster) TearDownTestDatabase()

TearDownTestDatabase from PersistenceTestCluster interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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