server

package
v0.0.0-...-3736fb9 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package server contains our gRPC server implementation for the pet store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	pb.UnimplementedPetStoreServer
	// contains filtered or unexported fields
}

API implements our gRPC server's API.

func New

func New(addr string, store storage.Data, options ...Option) (*API, error)

New is the constructore for API.

func (*API) AddPets

func (a *API) AddPets(ctx context.Context, req *pb.AddPetsReq) (resp *pb.AddPetsResp, err error)

AddPets adds pets to the pet store.

func (*API) ChangeSampler

func (a *API) ChangeSampler(ctx context.Context, req *pb.ChangeSamplerReq) (resp *pb.ChangeSamplerResp, err error)

ChangeSampler changes the OTEL sampling type.

func (*API) DeletePets

func (a *API) DeletePets(ctx context.Context, req *pb.DeletePetsReq) (resp *pb.DeletePetsResp, err error)

DeletePets deletes pets from the pet store.

func (*API) SearchPets

func (a *API) SearchPets(req *pb.SearchPetsReq, stream pb.PetStore_SearchPetsServer) (err error)

SearchPets finds pets in the pet store.

func (*API) Start

func (a *API) Start() error

Start starts the server. This blocks until Stop() is called.

func (*API) Stop

func (a *API) Stop()

Stop stops the server.

func (*API) UpdatePets

func (a *API) UpdatePets(ctx context.Context, req *pb.UpdatePetsReq) (resp *pb.UpdatePetsResp, err error)

UpdatePets updates pets in the pet store.

type Option

type Option func(a *API)

Option is an optional arguments to New().

func WithGRPCOpts

func WithGRPCOpts(opts ...grpc.ServerOption) Option

WithGRPCOpts creates the gRPC server with the options passed.

Directories

Path Synopsis
Package errors is a replacement for the golang standard library "errors".
Package errors is a replacement for the golang standard library "errors".
Package log is a replacement for the standard library log package that logs to OTEL spans contained in Context objects.
Package log is a replacement for the standard library log package that logs to OTEL spans contained in Context objects.
mem
Package mem contains an in-memory storage implementation of storage.Data.
Package mem contains an in-memory storage implementation of storage.Data.
telemetry
metrics
Package metrics provides setup of metrics that can be used internally to measure various application states.
Package metrics provides setup of metrics that can be used internally to measure various application states.
tracing
Package tracing provides functions for starting and stopping our Open Telemetry tracing.
Package tracing provides functions for starting and stopping our Open Telemetry tracing.
tracing/sampler
Package sampler offers a Sampler that looks for a TraceID.Valid() == true or a gRPC metadata key called "trace" and if they exist will sample.
Package sampler offers a Sampler that looks for a TraceID.Valid() == true or a gRPC metadata key called "trace" and if they exist will sample.

Jump to

Keyboard shortcuts

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