grpcapi

package
v0.0.0-...-e2d3c20 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2018 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Number            int64 `long:"init_number" default:"0" description:"Initial number"`
	Step              int64 `long:"init_step"   default:"1" description:"Increment step"`
	Limit             int64 `long:"init_limit"  default:"100" description:"Increment loop limit"`
	StrictStoreErrors bool  `long:"store_strict"  description:"Do not ignore store errors"`
}

Config is a program flags group used in constructor

type CounterService

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

CounterService holds object internals

func NewAPI

func NewAPI(log logger.Entry, store kvstore.Store, cfg Config) (*CounterService, error)

NewAPI creates an API object

func (*CounterService) Close

func (s *CounterService) Close()

Close logs final values as warning and closes store.

func (*CounterService) GetNumber

func (s *CounterService) GetNumber(ctx context.Context, in *empty.Empty) (*pb.Number, error)

GetNumber reads number from counter

func (*CounterService) GetSettings

func (s *CounterService) GetSettings(ctx context.Context, in *empty.Empty) (*pb.Settings, error)

GetSettings reads settings from counter

func (*CounterService) IncrementNumber

func (s *CounterService) IncrementNumber(ctx context.Context, in *empty.Empty) (*empty.Empty, error)

IncrementNumber increments counter and stores new number in database

func (*CounterService) SetSettings

func (s *CounterService) SetSettings(ctx context.Context, in *pb.Settings) (*empty.Empty, error)

SetSettings sets settings to counter and stores them in database

Jump to

Keyboard shortcuts

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