talent-plan-tinykv/kv/storage/modify.go
Connor 5e089a2cd1 init course framework
Signed-off-by: Connor <zbk602423539@gmail.com>
Co-authored-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: linning <linningde25@gmail.com>
Co-authored-by: YangKeao <keao.yang@yahoo.com>
Co-authored-by: andylokandy <andylokandy@hotmail.com>
Co-authored-by: Iosmanthus Teng <myosmanthustree@gmail.com>
2020-04-30 15:25:07 +08:00

38 lines
540 B
Go

package storage
// Modify is a single modification to TinyKV's underlying storage.
type Modify struct {
Data interface{}
}
type Put struct {
Key []byte
Value []byte
Cf string
}
type Delete struct {
Key []byte
Cf string
}
func (m *Modify) Key() []byte {
switch m.Data.(type) {
case Put:
return m.Data.(Put).Key
case Delete:
return m.Data.(Delete).Key
}
return nil
}
func (m *Modify) Cf() string {
switch m.Data.(type) {
case Put:
return m.Data.(Put).Cf
case Delete:
return m.Data.(Delete).Cf
}
return ""
}