pb

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterKeyValHandler

func RegisterKeyValHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterKeyValHandler registers the http handlers for service KeyVal to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterKeyValHandlerClient added in v0.2.0

func RegisterKeyValHandlerClient(ctx context.Context, mux *runtime.ServeMux, client KeyValClient) error

RegisterKeyValHandlerClient registers the http handlers for service KeyVal to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "KeyValClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "KeyValClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "KeyValClient" to call the correct interceptors.

func RegisterKeyValHandlerFromEndpoint

func RegisterKeyValHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterKeyValHandlerFromEndpoint is same as RegisterKeyValHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterKeyValHandlerServer added in v0.2.0

func RegisterKeyValHandlerServer(ctx context.Context, mux *runtime.ServeMux, server KeyValServer) error

RegisterKeyValHandlerServer registers the http handlers for service KeyVal to "mux". UnaryRPC :call KeyValServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterKeyValServer

func RegisterKeyValServer(s *grpc.Server, srv KeyValServer)

Types

type KeyValClient

type KeyValClient interface {
	KeyValCreate(ctx context.Context, in *KeyValMessage, opts ...grpc.CallOption) (*KeyValMessage, error)
	KeyValRead(ctx context.Context, in *KeyValMessage, opts ...grpc.CallOption) (*KeyValMessage, error)
	KeyValUpdate(ctx context.Context, in *KeyValMessage, opts ...grpc.CallOption) (*KeyValMessage, error)
	KeyValDelete(ctx context.Context, in *KeyValMessage, opts ...grpc.CallOption) (*KeyValMessage, error)
}

KeyValClient is the client API for KeyVal service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewKeyValClient

func NewKeyValClient(cc *grpc.ClientConn) KeyValClient

type KeyValMessage

type KeyValMessage struct {
	Key                  string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value                string   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*KeyValMessage) Descriptor

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

func (*KeyValMessage) GetKey

func (m *KeyValMessage) GetKey() string

func (*KeyValMessage) GetValue

func (m *KeyValMessage) GetValue() string

func (*KeyValMessage) ProtoMessage

func (*KeyValMessage) ProtoMessage()

func (*KeyValMessage) Reset

func (m *KeyValMessage) Reset()

func (*KeyValMessage) String

func (m *KeyValMessage) String() string

func (*KeyValMessage) XXX_DiscardUnknown added in v0.2.0

func (m *KeyValMessage) XXX_DiscardUnknown()

func (*KeyValMessage) XXX_Marshal added in v0.2.0

func (m *KeyValMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*KeyValMessage) XXX_Merge added in v0.2.0

func (m *KeyValMessage) XXX_Merge(src proto.Message)

func (*KeyValMessage) XXX_Size added in v0.2.0

func (m *KeyValMessage) XXX_Size() int

func (*KeyValMessage) XXX_Unmarshal added in v0.2.0

func (m *KeyValMessage) XXX_Unmarshal(b []byte) error

type KeyValServer

type KeyValServer interface {
	KeyValCreate(context.Context, *KeyValMessage) (*KeyValMessage, error)
	KeyValRead(context.Context, *KeyValMessage) (*KeyValMessage, error)
	KeyValUpdate(context.Context, *KeyValMessage) (*KeyValMessage, error)
	KeyValDelete(context.Context, *KeyValMessage) (*KeyValMessage, error)
}

KeyValServer is the server API for KeyVal service.

type UnimplementedKeyValServer added in v0.2.0

type UnimplementedKeyValServer struct {
}

UnimplementedKeyValServer can be embedded to have forward compatible implementations.

func (*UnimplementedKeyValServer) KeyValCreate added in v0.2.0

func (*UnimplementedKeyValServer) KeyValDelete added in v0.2.0

func (*UnimplementedKeyValServer) KeyValRead added in v0.2.0

func (*UnimplementedKeyValServer) KeyValUpdate added in v0.2.0

Jump to

Keyboard shortcuts

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