domain

package
v0.0.0-...-ea486a4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInfoSchemaExpired returns the error that information schema is out of date.
	ErrInfoSchemaExpired = terror.ClassDomain.New(codeInfoSchemaExpired, "Information schema is out of date.")
	// ErrInfoSchemaChanged returns the error that information schema is changed.
	ErrInfoSchemaChanged = terror.ClassDomain.New(codeInfoSchemaChanged, "Information schema is changed.")
)

Functions

This section is empty.

Types

type Domain

type Domain struct {
	SchemaValidator SchemaValidator

	MockReloadFailed MockFailure // It mocks reload failed.
	// contains filtered or unexported fields
}

Domain represents a storage space. Different domains can use the same database name. Multiple domains can be used in parallel without synchronization.

func NewDomain

func NewDomain(store kv.Storage, lease time.Duration) (d *Domain, err error)

NewDomain creates a new domain. Should not create multiple domains for the same store.

func (*Domain) Close

func (do *Domain) Close()

Close closes the Domain and release its resource.

func (*Domain) DDL

func (do *Domain) DDL() ddl.DDL

DDL gets DDL from domain.

func (*Domain) GetScope

func (do *Domain) GetScope(status string) variable.ScopeFlag

GetScope gets the status variables scope.

func (*Domain) GetSnapshotInfoSchema

func (do *Domain) GetSnapshotInfoSchema(snapshotTS uint64) (infoschema.InfoSchema, error)

GetSnapshotInfoSchema gets a snapshot information schema.

func (*Domain) InfoSchema

func (do *Domain) InfoSchema() infoschema.InfoSchema

InfoSchema gets information schema from domain.

func (*Domain) LoadPrivilegeLoop

func (do *Domain) LoadPrivilegeLoop(ctx context.Context) error

LoadPrivilegeLoop create a goroutine loads privilege tables in a loop, it should be called only once in BootstrapSession.

func (*Domain) LoadTableStatsLoop

func (do *Domain) LoadTableStatsLoop(ctx context.Context) error

LoadTableStatsLoop creates a goroutine loads stats info in a loop, it should be called only once in BootstrapSession.

func (*Domain) PerfSchema

func (do *Domain) PerfSchema() perfschema.PerfSchema

PerfSchema gets performance schema from domain.

func (*Domain) PrivilegeHandle

func (do *Domain) PrivilegeHandle() *privileges.Handle

PrivilegeHandle returns the MySQLPrivilege.

func (*Domain) Reload

func (do *Domain) Reload() error

Reload reloads InfoSchema. It's public in order to do the test.

func (*Domain) StatsHandle

func (do *Domain) StatsHandle() *statistics.Handle

StatsHandle returns the statistic handle.

func (*Domain) Store

func (do *Domain) Store() kv.Storage

Store gets KV store from domain.

func (*Domain) SysSessionPool

func (do *Domain) SysSessionPool() *sync.Pool

SysSessionPool returns the system session pool.

type MockFailure

type MockFailure struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

MockFailure mocks reload failed. It's used for fixing data race in tests.

func (*MockFailure) SetValue

func (m *MockFailure) SetValue(isFailed bool)

SetValue sets whether we need to mock reload failed.

type SchemaValidator

type SchemaValidator interface {
	// Update the schema validator, add a new item, delete the expired items.
	// The schemaVer is valid within leaseGrantTime plus lease duration.
	Update(leaseGrantTime uint64, schemaVer int64)
	// Check is it valid for a transaction to use schemaVer, at timestamp txnTS.
	Check(txnTS uint64, schemaVer int64) bool
	// Latest returns the latest schema version it knows, but not necessary a valid one.
	Latest() int64
}

SchemaValidator is the interface for checking the validity of schema version.

Jump to

Keyboard shortcuts

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