icecanekv

package
v0.0.0-...-344bb71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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

func NewKVServer(kvConfig *common.KVConfig) (*KVServer, error)

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) Close

func (kvs *KVServer) Close()

Close cleans up the kv server

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL