Documentation ¶
Index ¶
- type Allocator
- func (alloc *Allocator) Alloc(tableID int64) (int64, error)
- func (alloc *Allocator) Base() int64
- func (alloc *Allocator) End() int64
- func (alloc *Allocator) NextGlobalAutoID(tableID int64) (int64, error)
- func (alloc *Allocator) Rebase(tableID, newBase int64, allocIDs bool) error
- func (alloc *Allocator) Reset(newBase int64)
- type KvEncoder
- type KvPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator is an id allocator, it is only used in lightning.
func (*Allocator) NextGlobalAutoID ¶
NextGlobalAutoID returns the next global autoID.
type KvEncoder ¶
type KvEncoder interface { // Encode transfers sql to kv pairs. // Before use Encode() method, please make sure you already created schame by calling ExecDDLSQL() method. // NOTE: now we just support transfers insert statement to kv pairs. // (if we wanna support other statement, we need to add a kv.Storage parameter, // and pass tikv store in.) // return encoded kvs array that generate by sql, and affectRows count. Encode(sql string, tableID int64) (kvPairs []KvPair, affectedRows uint64, err error) // PrepareStmt prepare query statement, and return statement id. // Pass stmtID into EncodePrepareStmt to execute a prepare statement. PrepareStmt(query string) (stmtID uint32, err error) // EncodePrepareStmt transfer prepare query to kv pairs. // stmtID is generated by PrepareStmt. EncodePrepareStmt(tableID int64, stmtID uint32, param ...interface{}) (kvPairs []KvPair, affectedRows uint64, err error) // ExecDDLSQL executes ddl sql, you must use it to create schema infos. ExecDDLSQL(sql string) error // EncodeMetaAutoID encode the table meta info, autoID to coresponding key-value pair. EncodeMetaAutoID(dbID, tableID, autoID int64) (KvPair, error) // SetSystemVariable set system variable name = value. SetSystemVariable(name string, value string) error // GetSystemVariable get the system variable value of name. GetSystemVariable(name string) (string, bool) // Close cleanup the kvEncoder. Close() error }
KvEncoder is an encoder that transfer sql to key-value pairs.
Click to show internal directories.
Click to hide internal directories.