session

package
v0.0.0-...-3903214 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SessCount int32 = 0
)

Functions

func CreateSessionFunc

func CreateSessionFunc(store kv.Storage) pools.Factory

func DisableStats4Test

func DisableStats4Test()

DisableStats4Test disables the stats for tests.

func GetDomain

func GetDomain(store kv.Storage) (*domain.Domain, error)

GetDomain gets the associated domain for store.

func SetSchemaLease

func SetSchemaLease(lease time.Duration)

SetSchemaLease changes the default schema lease time for DDL. This function is very dangerous, don't use it if you really know what you do. SetSchemaLease only affects not local storage after bootstrapped.

func SetStatsLease

func SetStatsLease(lease time.Duration)

SetStatsLease changes the default stats lease time for loading stats info.

Types

type ColumnInfo

type ColumnInfo struct {
	Schema             string
	Table              string
	OrgTable           string
	Name               string
	OrgName            string
	ColumnLength       uint32
	Decimal            uint8
	Type               uint8
	DefaultValueLength uint64
	DefaultValue       []byte
}

ColumnInfo contains information of a column

type ProcessInfo

type ProcessInfo struct {
}

type RecordSet

type RecordSet interface {
	Columns() []*tspb.ColumnMeta
	// Next(context.Context )
	Next(context.Context) (interface{}, error)

	LastErr() error
	Close() error
}

type ResultSet

type ResultSet interface {
	Columns() []*ColumnInfo
	NewChunk() *chunk.Chunk
	Next(context.Context, *chunk.Chunk) error
	StoreFetchedRows(rows []chunk.Row)
	GetFetchedRows() []chunk.Row
	Close() error
}

ResultSet is the result set of an query.

type RetrieveTxnOpt

type RetrieveTxnOpt struct {
	Committable bool
	IsRawKV     bool
}

type Session

type Session interface {
	sessionctx.Context

	Close()

	SetLabels(map[string]string)
	Labels() map[string]string

	HandleRead(context.Context, rpc.ReadRequest, kv.Transaction) (RecordSet, error)
	HandleMutate(context.Context, rpc.MutationRequest, kv.Transaction) (rpc.Response, error)

	RetrieveTxn(context.Context, *tspb.TransactionSelector, *RetrieveTxnOpt) (*TxnState, error)

	RawkvAccess(context.Context, string) (bool, error)

	CommitTxn(context.Context, kv.Transaction) error
	RollbackTxn(context.Context, kv.Transaction) error

	SetDB(db string)
	GetName() string
	ToProto() *tspb.Session

	SetLastActive(time.Time)
	LastActive() time.Time
	Active() bool
}

func CreateSession

func CreateSession(store kv.Storage) (Session, error)

type SessionManager

type SessionManager interface {
	ShowProcessList() map[uint64]*ProcessInfo
	GetProcessInfo(id uint64) (*ProcessInfo, bool)
	Kill(connectionID uint64, query bool)
}

type TxnState

type TxnState struct {
	// States of a TxnState should be one of the followings:
	// Invalid: kv.Transaction == nil && txnFuture == nil
	// Pending: kv.Transaction == nil && txnFuture != nil
	// Valid:	kv.Transaction != nil && txnFuture == nil
	ID string

	kv.Transaction

	TxnOpt TxnStateOption
	// contains filtered or unexported fields
}

TxnState wraps kv.Transaction to provide a new kv.Transaction. 1. It holds all statement related modification in the buffer before flush to the txn, so if execute statement meets error, the txn won't be made dirty. 2. It's a lazy transaction, that means it's a txnFuture before StartTS() is really need.

func NewTxnState

func NewTxnState(sess *session) (*TxnState, error)

func (*TxnState) BatchGet

func (st *TxnState) BatchGet(ctx context.Context, keys []kv.Key) (map[string][]byte, error)

BatchGet overrides the Transaction interface.

func (*TxnState) Commit

func (st *TxnState) Commit(ctx context.Context) error

Commit overrides the Transaction interface.

func (*TxnState) Delete

func (st *TxnState) Delete(k kv.Key) error

Delete overrides the Transaction interface.

func (*TxnState) Flush

func (st *TxnState) Flush() (int, error)

Flush flushes all staging kvs into parent buffer.

func (*TxnState) Get

func (st *TxnState) Get(ctx context.Context, k kv.Key) ([]byte, error)

Get overrides the Transaction interface.

func (*TxnState) GetMemBuffer

func (st *TxnState) GetMemBuffer() kv.MemBuffer

GetMemBuffer overrides the Transaction interface.

func (*TxnState) GoString

func (st *TxnState) GoString() string

GoString implements the "%#v" format for fmt.Printf.

func (*TxnState) Iter

func (st *TxnState) Iter(k kv.Key, upperBound kv.Key) (kv.Iterator, error)

Iter overrides the Transaction interface.

func (*TxnState) IterReverse

func (st *TxnState) IterReverse(k kv.Key) (kv.Iterator, error)

IterReverse overrides the Transaction interface.

func (*TxnState) KeysNeedToLock

func (st *TxnState) KeysNeedToLock() ([]kv.Key, error)

KeysNeedToLock returns the keys need to be locked.

func (*TxnState) Rollback

func (st *TxnState) Rollback() error

Rollback overrides the Transaction interface.

func (*TxnState) Set

func (st *TxnState) Set(k kv.Key, v []byte) error

Set overrides the Transaction interface.

func (*TxnState) Size

func (st *TxnState) Size() int

Size implements the MemBuffer interface.

func (*TxnState) String

func (st *TxnState) String() string

func (*TxnState) Valid

func (st *TxnState) Valid() bool

Valid implements the kv.Transaction interface.

type TxnStateOption

type TxnStateOption struct {
	ReadOnly bool
	Single   bool
	// contains filtered or unexported fields
}

TxnStateOption Zetta TxnState Option

Jump to

Keyboard shortcuts

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