Documentation ¶
Index ¶
- type KVServer
- func (kvs *KVServer) AppendEntries(ctx context.Context, request *pb.AppendEntriesRequest) (*pb.AppendEntriesResponse, error)
- func (kvs *KVServer) BeginTxn(ctx context.Context, req *pb.BeginTxnRequest) (*pb.BeginTxnResponse, error)
- func (kvs *KVServer) Close()
- func (kvs *KVServer) CommitTxn(ctx context.Context, req *pb.CommitTxnRequest) (*pb.CommitTxnResponse, error)
- func (kvs *KVServer) Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.DeleteResponse, error)
- func (kvs *KVServer) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error)
- func (kvs *KVServer) PeerDelete(ctx context.Context, req *pb.PeerDeleteRequest) (*pb.PeerDeleteResponse, error)
- func (kvs *KVServer) PeerSet(ctx context.Context, req *pb.PeerSetRequest) (*pb.PeerSetResponse, error)
- func (kvs *KVServer) RequestVote(ctx context.Context, request *pb.RequestVoteRequest) (*pb.RequestVoteResponse, error)
- func (kvs *KVServer) RollbackTxn(ctx context.Context, req *pb.RollbackTxnRequest) (*pb.RollbackTxnResponse, error)
- func (kvs *KVServer) Scan(ctx context.Context, req *pb.ScanRequest) (*pb.ScanResponse, error)
- func (kvs *KVServer) Set(ctx context.Context, req *pb.SetRequest) (*pb.SetResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KVServer ¶
type KVServer struct { pb.UnimplementedIcecaneKVServer // the raft server RaftServer *raft.Server // contains filtered or unexported fields }
KVServer is the Key-value server that receives and processes requests from clients. Presently, it forwards all the requests to raft.Server TODO: A lot of these fields may not be required. For eg. We won't be using kvMvcc directly but only via raftServer.
func NewKVServer ¶
NewKVServer creates a new instance of KV Server
func (*KVServer) AppendEntries ¶
func (kvs *KVServer) AppendEntries(ctx context.Context, request *pb.AppendEntriesRequest) (*pb.AppendEntriesResponse, error)
AppendEntries is invoked by leader to replicate log entries; also used as heartbeat
func (*KVServer) BeginTxn ¶
func (kvs *KVServer) BeginTxn(ctx context.Context, req *pb.BeginTxnRequest) (*pb.BeginTxnResponse, error)
BeginTxn begins a MVCC transaction providing ACID guarantees.
func (*KVServer) CommitTxn ¶
func (kvs *KVServer) CommitTxn(ctx context.Context, req *pb.CommitTxnRequest) (*pb.CommitTxnResponse, error)
CommitTxn attempts to commit a MVCC txn
func (*KVServer) Delete ¶
func (kvs *KVServer) Delete(ctx context.Context, req *pb.DeleteRequest) (*pb.DeleteResponse, error)
Delete deletes the value of a key.
func (*KVServer) Get ¶
func (kvs *KVServer) Get(ctx context.Context, req *pb.GetRequest) (*pb.GetResponse, error)
Get gets the value of a key.
func (*KVServer) PeerDelete ¶
func (kvs *KVServer) PeerDelete(ctx context.Context, req *pb.PeerDeleteRequest) (*pb.PeerDeleteResponse, error)
PeerDelete is invoked by a raft peer to delete a kv if this node is a leader
func (*KVServer) PeerSet ¶
func (kvs *KVServer) PeerSet(ctx context.Context, req *pb.PeerSetRequest) (*pb.PeerSetResponse, error)
PeerSet is invoked by a raft peer to set the kv if this node is a leader
func (*KVServer) RequestVote ¶
func (kvs *KVServer) RequestVote(ctx context.Context, request *pb.RequestVoteRequest) (*pb.RequestVoteResponse, error)
RequestVote is used by the raft candidate to request for votes. The current server has to respond to this req by casting vote or decling.
func (*KVServer) RollbackTxn ¶
func (kvs *KVServer) RollbackTxn(ctx context.Context, req *pb.RollbackTxnRequest) (*pb.RollbackTxnResponse, error)
RollbackTxn rollsback a MVCC txn
func (*KVServer) Scan ¶
func (kvs *KVServer) Scan(ctx context.Context, req *pb.ScanRequest) (*pb.ScanResponse, error)
Scan returns a list of key value pairs starting from the given key
func (*KVServer) Set ¶
func (kvs *KVServer) Set(ctx context.Context, req *pb.SetRequest) (*pb.SetResponse, error)
Set sets the value of a key.