talent-plan-tinykv/kv/server/raw_api.go
pupillord bda1e7b85b
Server: Extract raw api to be implemented in Project1 into raw_api.go (#285)
* Extract raw api to be implemented in Project1 into raw_api.go

* Run go fmt to apply automatic formatter and delete redundant comments

* Add comments and hints to each function

Co-authored-by: tison <wander4096@gmail.com>
2021-08-25 17:24:05 +08:00

37 lines
1.4 KiB
Go

package server
import (
"context"
"github.com/pingcap-incubator/tinykv/proto/pkg/kvrpcpb"
)
// The functions below are Server's Raw API. (implements TinyKvServer).
// Some helper methods can be found in sever.go in the current directory
// RawGet return the corresponding Get response based on RawGetRequest's CF and Key fields
func (server *Server) RawGet(_ context.Context, req *kvrpcpb.RawGetRequest) (*kvrpcpb.RawGetResponse, error) {
// Your Code Here (1).
return nil, nil
}
// RawPut puts the target data into storage and returns the corresponding response
func (server *Server) RawPut(_ context.Context, req *kvrpcpb.RawPutRequest) (*kvrpcpb.RawPutResponse, error) {
// Your Code Here (1).
// Hint: Consider using Storage.Modify to store data to be modified
return nil, nil
}
// RawDelete delete the target data from storage and returns the corresponding response
func (server *Server) RawDelete(_ context.Context, req *kvrpcpb.RawDeleteRequest) (*kvrpcpb.RawDeleteResponse, error) {
// Your Code Here (1).
// Hint: Consider using Storage.Modify to store data to be deleted
return nil, nil
}
// RawScan scan the data starting from the start key up to limit. and return the corresponding result
func (server *Server) RawScan(_ context.Context, req *kvrpcpb.RawScanRequest) (*kvrpcpb.RawScanResponse, error) {
// Your Code Here (1).
// Hint: Consider using reader.IterCF
return nil, nil
}