api

package
v0.0.0-...-c4685af Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package api is a generated protocol buffer package.

It is generated from these files:

api.proto

It has these top-level messages:

Request
Response

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterKvServer

func RegisterKvServer(s *grpc.Server, srv KvServer)

Types

type KvClient

type KvClient interface {
	Get(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Put(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Delete(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Keys(ctx context.Context, in *google_protobuf.Empty, opts ...grpc.CallOption) (*Response, error)
	HasKey(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

func NewKvClient

func NewKvClient(cc *grpc.ClientConn) KvClient

type Request

type Request struct {
	Key   string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
}

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) GetKey

func (m *Request) GetKey() string

func (*Request) GetValue

func (m *Request) GetValue() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

type Response

type Response struct {
	Key   string   `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"`
	Value string   `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
	Err   string   `protobuf:"bytes,3,opt,name=err" json:"err,omitempty"`
	Keys  []string `protobuf:"bytes,4,rep,name=keys" json:"keys,omitempty"`
}

func (*Response) Descriptor

func (*Response) Descriptor() ([]byte, []int)

func (*Response) GetErr

func (m *Response) GetErr() string

func (*Response) GetKey

func (m *Response) GetKey() string

func (*Response) GetKeys

func (m *Response) GetKeys() []string

func (*Response) GetValue

func (m *Response) GetValue() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) Reset

func (m *Response) Reset()

func (*Response) String

func (m *Response) String() string

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents the gRPC server.

func New

func New(db *bitcask.Bitcask) *Server

New creates a server handler.

func (*Server) Delete

func (s *Server) Delete(ctx context.Context, in *Request) (*Response, error)

Delete key from db.

func (*Server) Get

func (s *Server) Get(ctx context.Context, in *Request) (*Response, error)

Get from db.

func (*Server) HasKey

func (s *Server) HasKey(ctx context.Context, in *Request) (*Response, error)

HasKey return the key if key exists in db.

func (*Server) Keys

func (s *Server) Keys(ctx context.Context, in *empty.Empty) (*Response, error)

Keys returns existing keyes.

func (*Server) Put

func (s *Server) Put(ctx context.Context, in *Request) (*Response, error)

Put key value in db.

Jump to

Keyboard shortcuts

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