util

package
v0.0.0-...-b742d14 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStatCycle   = time.Second * 3
	DefaultGRPCTimeout = 15 * time.Second
)

Variables

This section is empty.

Functions

func GetServiceInfo

func GetServiceInfo(nc nrpc.NatsConn, nid string, selfnid string) (map[string][]*reflection.MethodDescriptor, error)

Get service information through reflection, this feature can be used to create json-rpc, restful API

func NewNatsConn

func NewNatsConn(url string) (*nats.Conn, error)

NewNatsConn .

func ParseSDP

func ParseSDP(sdpstr string) ([]*ion.Stream, error)

ParseSDP .

func RandomString

func RandomString(n int) string

RandomString generate a random string

func Recover

func Recover(flag string)

Recover print stack

Types

type AtomicBool

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

AtomicBool represents a atomic bool

func (*AtomicBool) Get

func (b *AtomicBool) Get() bool

Get atomic bool

func (*AtomicBool) Set

func (b *AtomicBool) Set(value bool) (swapped bool)

Set atomic bool

type ClientConnInterface

type ClientConnInterface interface {
	grpc.ClientConnInterface
	Close() error
}

ClientConnInterface .

func NewGRPCClientConnForNode

func NewGRPCClientConnForNode(node discovery.Node) (ClientConnInterface, error)

NewGRPCClientForNode .

type ServiceInterface

type ServiceInterface interface {
	grpc.ServiceRegistrar
	Serve(lis net.Listener) error
	Stop()
}

ServiceInterface .

func NewGRPCServiceForNode

func NewGRPCServiceForNode(node discovery.Node) (ServiceInterface, error)

NewGRPCServiceForNode .

Jump to

Keyboard shortcuts

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