sdk

package
v0.0.0-...-0039ccc Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Call

type Call interface {
	log.Recorder
	// session values
	GetUserId() string
	GetRoleId() string
	// sdk clients
	GetDBV1() dbapi_v1.DBClient
	GetGWV1() gwapi_v1.GatewayClient
	// push data to client
	OnReply(OnReplyFunc)
	PushTo(ctx context.Context, roleId string, msg proto.Message) error
}

Call track every rpc call (in/out) provide session informations(userId, roleId) provide access api to libra services

func FromContext

func FromContext(ctx context.Context) (call Call, ok bool)

type Config

type Config struct {
	// local service address
	Bind string
	// log configuration
	Log *zap.Config
	// api endpoints
	DBV1 *Endpoint
	GWV1 *Endpoint
}

export Config just for reference

type Endpoint

type Endpoint struct {
	Target    string
	Authority string
}

type OnReplyFunc

type OnReplyFunc func(context.Context, error) error

type Server

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

func NewServer

func NewServer() (s *Server)

func (*Server) GRPCServer

func (s *Server) GRPCServer() *grpc.Server

SomeService.RegisterSomeServer(s.GRPC(), SomeImplement)

func (*Server) Init

func (s *Server) Init() (err error)

func (*Server) Serve

func (s *Server) Serve() (err error)

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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