Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeExtraTxnStatusKey(extraKey []byte) (key []byte)
- func DecodeKeyTS(buf []byte) uint64
- func EncodeExtraTxnStatusKey(key []byte, startTS uint64) []byte
- func EncodeLockCFValue(lock *Lock) ([]byte, []byte)
- func EncodeWriteCFValue(t WriteType, startTs uint64, shortVal []byte) []byte
- type DBBundle
- type DBSnapshot
- type DBUserMeta
- type DBWriter
- type LatchHandle
- type Lock
- type LockHdr
- type LockType
- type WriteBatch
- type WriteCFValue
- type WriteType
Constants ¶
const ( LockUserMetaNoneByte = 0 LockUserMetaDeleteByte = 2 )
UserMeta value for lock.
const (
//ShortValueMaxLen defines max length of short value.
ShortValueMaxLen = 64
)
Variables ¶
var ( LockUserMetaNone = []byte{LockUserMetaNoneByte} LockUserMetaDelete = []byte{LockUserMetaDeleteByte} )
UserMeta byte slices for lock.
Functions ¶
func DecodeExtraTxnStatusKey ¶
DecodeExtraTxnStatusKey decodes a extra transaction status key.
func EncodeExtraTxnStatusKey ¶
EncodeExtraTxnStatusKey encodes a extra transaction status key. It is only used for Rollback and Op_Lock.
func EncodeLockCFValue ¶
EncodeLockCFValue encodes the mvcc lock and returns putLock value and putDefault value if exists.
Types ¶
type DBBundle ¶
type DBBundle struct { DB *badger.DB LockStore *lockstore.MemStore MemStoreMu sync.Mutex StateTS uint64 }
DBBundle represents the db bundle.
type DBSnapshot ¶
DBSnapshot represents the db snapshot.
func NewDBSnapshot ¶
func NewDBSnapshot(db *DBBundle) *DBSnapshot
NewDBSnapshot returns a new db snapshot.
type DBUserMeta ¶
type DBUserMeta []byte
DBUserMeta is the user meta used in DB.
func NewDBUserMeta ¶
func NewDBUserMeta(startTS, commitTS uint64) DBUserMeta
NewDBUserMeta creates a new DBUserMeta.
func (DBUserMeta) CommitTS ¶
func (m DBUserMeta) CommitTS() uint64
CommitTS reads the commitTS from the DBUserMeta.
func (DBUserMeta) StartTS ¶
func (m DBUserMeta) StartTS() uint64
StartTS reads the startTS from the DBUserMeta.
type DBWriter ¶
type DBWriter interface { Open() Close() Write(batch WriteBatch) error DeleteRange(start, end []byte, latchHandle LatchHandle) error NewWriteBatch(startTS, commitTS uint64, ctx *kvrpcpb.Context) WriteBatch }
DBWriter is the interface to persistent data.
type LatchHandle ¶
LatchHandle is the interface for handling latches.
type Lock ¶
Lock is the structure for MVCC lock.
func DecodeLock ¶
DecodeLock decodes data to lock, the primary and value is copied, the secondaries are copied if async commit is enabled.
func (*Lock) MarshalBinary ¶
MarshalBinary implements encoding.BinaryMarshaler interface.
type LockHdr ¶
type LockHdr struct { StartTS uint64 ForUpdateTS uint64 MinCommitTS uint64 TTL uint32 Op uint8 HasOldVer bool PrimaryLen uint16 UseAsyncCommit bool SecondaryNum uint32 }
LockHdr holds fixed size fields for mvcc Lock.
type WriteBatch ¶
type WriteBatch interface { Prewrite(key []byte, lock *Lock) Commit(key []byte, lock *Lock) Rollback(key []byte, deleleLock bool) PessimisticLock(key []byte, lock *Lock) PessimisticRollback(key []byte) }
WriteBatch is the interface to batch write.
type WriteCFValue ¶
WriteCFValue represents a write CF value.
func ParseWriteCFValue ¶
func ParseWriteCFValue(data []byte) (wv WriteCFValue, err error)
ParseWriteCFValue parses the []byte data and returns a WriteCFValue.