Documentation ¶
Index ¶
- Variables
- func MustParseGetPayload(payload []byte) [][]byte
- func NewGetTxnRequest(ks [][]byte) txn.TxnRequest
- func NewMemLog() logservice.Client
- func NewSetTxnRequest(ks, vs [][]byte) txn.TxnRequest
- type Event
- type EventType
- type KV
- type KVLog
- type KVTxnStorage
- func (kv *KVTxnStorage) Close(ctx context.Context) error
- func (kv *KVTxnStorage) Commit(ctx context.Context, txnMeta txn.TxnMeta) (timestamp.Timestamp, error)
- func (kv *KVTxnStorage) Committing(ctx context.Context, txnMeta txn.TxnMeta) error
- func (kv *KVTxnStorage) Debug(ctx context.Context, meta txn.TxnMeta, op uint32, data []byte) ([]byte, error)
- func (kv *KVTxnStorage) Destroy(ctx context.Context) error
- func (kv *KVTxnStorage) GetCommittedKV() *MVCCKV
- func (kv *KVTxnStorage) GetEventC() chan Event
- func (kv *KVTxnStorage) GetUncommittedKV() *KV
- func (kv *KVTxnStorage) GetUncommittedTxn(txnID []byte) *txn.TxnMeta
- func (kv *KVTxnStorage) Prepare(ctx context.Context, txnMeta txn.TxnMeta) (timestamp.Timestamp, error)
- func (kv *KVTxnStorage) Read(ctx context.Context, txnMeta txn.TxnMeta, op uint32, payload []byte) (storage.ReadResult, error)
- func (kv *KVTxnStorage) Rollback(ctx context.Context, txnMeta txn.TxnMeta) error
- func (kv *KVTxnStorage) Start() error
- func (kv *KVTxnStorage) StartRecovery(ctx context.Context, c chan txn.TxnMeta)
- func (kv *KVTxnStorage) Write(ctx context.Context, txnMeta txn.TxnMeta, op uint32, payload []byte) ([]byte, error)
- type MVCCKV
- func (mkv *MVCCKV) AscendRange(rawKey []byte, from timestamp.Timestamp, to timestamp.Timestamp, ...)
- func (mkv *MVCCKV) Delete(rawKey []byte, ts timestamp.Timestamp) bool
- func (mkv *MVCCKV) Get(rawKey []byte, ts timestamp.Timestamp) ([]byte, bool)
- func (mkv *MVCCKV) Set(rawKey []byte, ts timestamp.Timestamp, value []byte)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // PrepareType prepare event PrepareType = EventType(0) // CommitType commit event CommitType = EventType(1) // CommittingType committing type CommittingType = EventType(2) // RollbackType rollback type RollbackType = EventType(3) )
Functions ¶
func MustParseGetPayload ¶
MustParseGetPayload must parse get payload
func NewGetTxnRequest ¶
func NewGetTxnRequest(ks [][]byte) txn.TxnRequest
NewGetTxnRequest returns a kv get txn request
func NewMemLog ¶
func NewMemLog() logservice.Client
NewMemLog new log use memory as backend. Log index is start from 1.
func NewSetTxnRequest ¶
func NewSetTxnRequest(ks, vs [][]byte) txn.TxnRequest
NewSetTxnRequest returns a kv set txn request
Types ¶
type KV ¶
type KV struct {
// contains filtered or unexported fields
}
KV mem kv based on btree. Just used to test transaction.
func (*KV) AscendRange ¶
AscendRange iter in [start, end)
type KVLog ¶
type KVLog struct { Txn txn.TxnMeta `json:"txn"` Keys [][]byte `json:"key,omitempty"` Values [][]byte `json:"value,omitempty"` }
KVLog kv log
func (*KVLog) MustUnmarshal ¶
MustUnmarshal must unmarshal
type KVTxnStorage ¶
KVTxnStorage KV-based implementation of TxnStorage. Just used to test.
func NewKVTxnStorage ¶
func NewKVTxnStorage(recoverFrom logservice.Lsn, logClient logservice.Client, clock clock.Clock) *KVTxnStorage
NewKVTxnStorage create KV-based implementation of TxnStorage
func (*KVTxnStorage) Close ¶ added in v0.6.0
func (kv *KVTxnStorage) Close(ctx context.Context) error
func (*KVTxnStorage) Committing ¶
func (*KVTxnStorage) Destroy ¶ added in v0.6.0
func (kv *KVTxnStorage) Destroy(ctx context.Context) error
func (*KVTxnStorage) GetCommittedKV ¶
func (kv *KVTxnStorage) GetCommittedKV() *MVCCKV
func (*KVTxnStorage) GetEventC ¶ added in v0.5.1
func (kv *KVTxnStorage) GetEventC() chan Event
func (*KVTxnStorage) GetUncommittedKV ¶
func (kv *KVTxnStorage) GetUncommittedKV() *KV
func (*KVTxnStorage) GetUncommittedTxn ¶
func (kv *KVTxnStorage) GetUncommittedTxn(txnID []byte) *txn.TxnMeta
func (*KVTxnStorage) Read ¶
func (kv *KVTxnStorage) Read(ctx context.Context, txnMeta txn.TxnMeta, op uint32, payload []byte) (storage.ReadResult, error)
func (*KVTxnStorage) Start ¶ added in v0.7.0
func (kv *KVTxnStorage) Start() error
func (*KVTxnStorage) StartRecovery ¶
func (kv *KVTxnStorage) StartRecovery(ctx context.Context, c chan txn.TxnMeta)
type MVCCKV ¶
type MVCCKV struct {
// contains filtered or unexported fields
}
MVCCKV mvcc kv based on KV
func (*MVCCKV) AscendRange ¶
func (mkv *MVCCKV) AscendRange(rawKey []byte, from timestamp.Timestamp, to timestamp.Timestamp, fn func([]byte, timestamp.Timestamp))
AscendRange iter in [rawkey:from, rawkey:to)
Click to show internal directories.
Click to hide internal directories.