tool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIDBackwards = errors.New("ID went backward")
View Source
var ErrSequenceExpired = errors.New("sequence expired")
View Source
var ErrTimeBackwards = errors.New("time has gone backwards")

Functions

func GenerateUniqueId

func GenerateUniqueId(node int64) [16]byte

func GetInternalIP

func GetInternalIP() string

获取本机内网IP

func NewGUIDFactory

func NewGUIDFactory(nodeID int64) *guidFactory

func NewHttpClient

func NewHttpClient() *http.Client

创建一个http client

func PanicHandlerForLog

func PanicHandlerForLog()

Types

type HttpClientPool

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

用sync.pool管理http client 用sync.Pool和不用,QPS提升10%,CPU下降50%

func NewHttpClientPool

func NewHttpClientPool() *HttpClientPool

func (*HttpClientPool) Dial

func (h *HttpClientPool) Dial(req *http.Request) (*http.Response, error)

func (*HttpClientPool) GetClient

func (h *HttpClientPool) GetClient() *http.Client

func (*HttpClientPool) PutClient

func (h *HttpClientPool) PutClient(client *http.Client)

Jump to

Keyboard shortcuts

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