seaweedfs/weed/filer/leveldb/leveldb_store_kv.go
Chris Lu 37234bf3f8 filer store adds kv support
can compile now, need to implement those unimplemented
2020-09-01 21:59:00 -07:00

40 lines
659 B
Go

package leveldb
import (
"context"
"fmt"
)
func (store *LevelDBStore) KvPut(ctx context.Context, key []byte, value []byte) (err error) {
err = store.db.Put(key, value, nil)
if err != nil {
return fmt.Errorf("kv put: %v", err)
}
return nil
}
func (store *LevelDBStore) KvGet(ctx context.Context, key []byte) (value []byte, err error) {
value, err = store.db.Get(key, nil)
if err != nil {
return nil, fmt.Errorf("kv get: %v", err)
}
return
}
func (store *LevelDBStore) KvDelete(ctx context.Context, key []byte) (err error) {
err = store.db.Delete(key, nil)
if err != nil {
return fmt.Errorf("kv delete: %v", err)
}
return nil
}