service

package
v0.0.0-...-7604275 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JScheme = "jim"
)

Variables

Functions

func ComputePrefixKey

func ComputePrefixKey() string

func GetRpcConn

func GetRpcConn(serviceName string) (*grpc.ClientConn, error)

func GetServiceCommonClient

func GetServiceCommonClient() (proto_build.CommonServiceClient, error)

func GetServiceGroupClient

func GetServiceGroupClient() (proto_build.GroupServiceClient, error)

func GetServiceMessageClient

func GetServiceMessageClient() (proto_build.MessageServiceClient, error)

func GetServiceUserClient

func GetServiceUserClient() (proto_build.UserServiceClient, error)

func NewClientV3

func NewClientV3(endPoints []string, timeOut uint64) *clientv3.Client

Types

type BasicService

type BasicService struct {
	Name string
	Host string
	Port uint
	Ttl  int64
}

BasicService 基本服务类

func (*BasicService) AddSpan

func (s *BasicService) AddSpan(c context.Context, funcName string, req interface{}, rsp interface{})

func (*BasicService) FailCommon

func (s *BasicService) FailCommon(errorCode uint64, businessCode uint64, message string) *proto_build.CommonResponse

func (*BasicService) GetAddress

func (s *BasicService) GetAddress() string

func (*BasicService) GetLoginUserId

func (s *BasicService) GetLoginUserId() uint64

func (*BasicService) GetName

func (s *BasicService) GetName() string

GetName 获取服务名称

func (*BasicService) GetTTL

func (s *BasicService) GetTTL() int64

func (*BasicService) SuccessCommon

func (s *BasicService) SuccessCommon() *proto_build.CommonResponse

type Discovery

type Discovery struct {
	Client               *clientv3.Client
	ServiceServerListMap map[string][]string
	// contains filtered or unexported fields
}

func NewServiceDiscovery

func NewServiceDiscovery(client *clientv3.Client) *Discovery

func (*Discovery) DeleteServer

func (d *Discovery) DeleteServer(serviceName string, server string)

func (*Discovery) GetServerList

func (d *Discovery) GetServerList(serviceName string) []string

func (*Discovery) GetServiceServerList

func (d *Discovery) GetServiceServerList() map[string][]string

func (*Discovery) InitServerList

func (d *Discovery) InitServerList() []string

func (*Discovery) PutServer

func (d *Discovery) PutServer(serviceName string, server string)

func (*Discovery) Watch

func (d *Discovery) Watch()

type JResolver

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

func (*JResolver) Close

func (r *JResolver) Close()

func (*JResolver) ResolveNow

func (r *JResolver) ResolveNow(o resolver.ResolveNowOptions)

func (*JResolver) Start

func (r *JResolver) Start()

func (*JResolver) UpdateAddressStore

func (r *JResolver) UpdateAddressStore()

func (*JResolver) Watch

func (r *JResolver) Watch()

type JResolverBuilder

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

func NewJResolverBuilder

func NewJResolverBuilder(client *clientv3.Client) *JResolverBuilder

func (*JResolverBuilder) Build

func (*JResolverBuilder) Scheme

func (b *JResolverBuilder) Scheme() string

type Register

type Register struct {
	Client              *clientv3.Client
	AppName             string
	Service             BasicService
	ServiceLeaseIdMap   map[BasicService]clientv3.LeaseID
	ServiceKeepAliveMap map[BasicService]<-chan *clientv3.LeaseKeepAliveResponse
	ServiceCloseMap     map[BasicService]chan bool
}

func NewServiceRegister

func NewServiceRegister(client *clientv3.Client, appName string) *Register

func (*Register) CloseSrv

func (r *Register) CloseSrv(srv BasicService)

func (*Register) KeepAlive

func (r *Register) KeepAlive()

func (*Register) RegisterService

func (r *Register) RegisterService(srvList ...BasicService)

func (*Register) Stop

func (r *Register) Stop(srv BasicService)

func (*Register) UnRegisterService

func (r *Register) UnRegisterService(srv BasicService)

Jump to

Keyboard shortcuts

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