service

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package service is a generated protocol buffer package.

It is generated from these files:

nyt-proxy.proto

It has these top-level messages:

MostPopularRequest
MostPopularResponse
CatsRequest
CatsResponse

Index

Constants

This section is empty.

Variables

View Source
var NYTProxyService_serviceDesc = grpc.ServiceDesc{
	ServiceName: "service.NYTProxyService",
	HandlerType: (*NYTProxyServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetMostPopular",
			Handler:    _NYTProxyService_GetMostPopular_Handler,
		},
		{
			MethodName: "GetCats",
			Handler:    _NYTProxyService_GetCats_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "nyt-proxy.proto",
}

Functions

func RegisterNYTProxyServiceServer

func RegisterNYTProxyServiceServer(s *grpc.Server, srv NYTProxyServiceServer)

Types

type CatsRequest

type CatsRequest struct {
}

func (*CatsRequest) Descriptor

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

func (*CatsRequest) ProtoMessage

func (*CatsRequest) ProtoMessage()

func (*CatsRequest) Reset

func (m *CatsRequest) Reset()

func (*CatsRequest) String

func (m *CatsRequest) String() string

type CatsResponse

type CatsResponse struct {
	Results []*nyt.SemanticConceptArticle `protobuf:"bytes,1,rep,name=results" json:"results,omitempty"`
}

func (*CatsResponse) Descriptor

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

func (*CatsResponse) GetResults

func (m *CatsResponse) GetResults() []*nyt.SemanticConceptArticle

func (*CatsResponse) ProtoMessage

func (*CatsResponse) ProtoMessage()

func (*CatsResponse) Reset

func (m *CatsResponse) Reset()

func (*CatsResponse) String

func (m *CatsResponse) String() string

type Config

type Config struct {
	Server           *server.Config
	MostPopularToken string
	SemanticToken    string
}

Config is a struct to contain all the needed configuration for our RPCService

type MostPopularRequest

type MostPopularRequest struct {
	ResourceType   string `protobuf:"bytes,1,opt,name=resourceType" json:"resourceType,omitempty"`
	Section        string `protobuf:"bytes,2,opt,name=section" json:"section,omitempty"`
	TimePeriodDays uint32 `protobuf:"varint,3,opt,name=timePeriodDays" json:"timePeriodDays,omitempty"`
}

func (*MostPopularRequest) Descriptor

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

func (*MostPopularRequest) ProtoMessage

func (*MostPopularRequest) ProtoMessage()

func (*MostPopularRequest) Reset

func (m *MostPopularRequest) Reset()

func (*MostPopularRequest) String

func (m *MostPopularRequest) String() string

type MostPopularResponse

type MostPopularResponse struct {
	Result []*nyt.MostPopularResult `protobuf:"bytes,1,rep,name=result" json:"result,omitempty"`
}

func (*MostPopularResponse) Descriptor

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

func (*MostPopularResponse) GetResult

func (m *MostPopularResponse) GetResult() []*nyt.MostPopularResult

func (*MostPopularResponse) ProtoMessage

func (*MostPopularResponse) ProtoMessage()

func (*MostPopularResponse) Reset

func (m *MostPopularResponse) Reset()

func (*MostPopularResponse) String

func (m *MostPopularResponse) String() string

type NYTProxyServiceClient

type NYTProxyServiceClient interface {
	GetMostPopular(ctx context.Context, in *MostPopularRequest, opts ...grpc.CallOption) (*MostPopularResponse, error)
	GetCats(ctx context.Context, in *CatsRequest, opts ...grpc.CallOption) (*CatsResponse, error)
}

func NewNYTProxyServiceClient

func NewNYTProxyServiceClient(cc *grpc.ClientConn) NYTProxyServiceClient

type NYTProxyServiceServer

type NYTProxyServiceServer interface {
	GetMostPopular(context.Context, *MostPopularRequest) (*MostPopularResponse, error)
	GetCats(context.Context, *CatsRequest) (*CatsResponse, error)
}

type RPCService

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

RPCService will implement server.RPCService and handle all requests to the server.

func NewRPCService

func NewRPCService(cfg *Config) *RPCService

NewRPCService will instantiate a RPCService with the given configuration.

func (*RPCService) ContextEndpoints

func (s *RPCService) ContextEndpoints() map[string]map[string]server.ContextHandlerFunc

ContextEndpoints may be needed if your server has any non-RPC-able endpoints. In this case, we have none but still need this method to satisfy the server.RPCService interface.

func (*RPCService) ContextMiddleware

func (s *RPCService) ContextMiddleware(h server.ContextHandler) server.ContextHandler

ContextMiddleware provides a server.ContextHAndler hook wrapped around all requests. This could be handy if you need to decorate the request context.

func (*RPCService) GetCats

func (s *RPCService) GetCats(ctx ocontext.Context, r *CatsRequest) (*CatsResponse, error)

func (*RPCService) GetCatsJSON

func (s *RPCService) GetCatsJSON(ctx context.Context, r *http.Request) (int, interface{}, error)

func (*RPCService) GetMostPopular

func (s *RPCService) GetMostPopular(ctx ocontext.Context, r *MostPopularRequest) (*MostPopularResponse, error)

func (*RPCService) GetMostPopularJSON

func (s *RPCService) GetMostPopularJSON(ctx context.Context, r *http.Request) (int, interface{}, error)

func (*RPCService) JSONEndpoints

func (s *RPCService) JSONEndpoints() map[string]map[string]server.JSONContextEndpoint

JSONContextEndpoints is a listing of all endpoints available in the RPCService.

func (*RPCService) JSONMiddleware

JSONMiddleware provides a JSONContextEndpoint hook wrapped around all requests. In this implementation, we're using it to provide application logging and to check errors and provide generic responses.

func (*RPCService) Middleware

func (s *RPCService) Middleware(h http.Handler) http.Handler

Middleware provides an http.Handler hook wrapped around all requests. In this implementation, we're using a GzipHandler middleware to compress our responses.

func (*RPCService) Prefix

func (s *RPCService) Prefix() string

Prefix returns the string prefix used for all endpoints within this service.

func (*RPCService) Service

func (s *RPCService) Service() (*grpc.ServiceDesc, interface{})

Service provides the RPCService with a description of the service to serve and the implementation.

Jump to

Keyboard shortcuts

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