utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureException added in v1.0.1

func CaptureException()

func InitMachineID

func InitMachineID(machineID int16)

snow flakes machine_id: 10 bits machineID + 6 bits plugin_type

func MachineID

func MachineID(id int64) int16

func MachineIDHigh

func MachineIDHigh(id int64) int16

func MachineIDLow

func MachineIDLow(id int64) int16

func NewPrometheusHandlerWrapper added in v1.0.1

func NewPrometheusHandlerWrapper(opts ...server.Option) server.HandlerWrapper

func NextID

func NextID(tp int) (int64, error)

func SectionIDRandSelector

func SectionIDRandSelector(id int64) selector.SelectOption

select node by section id: game_id / 10

func SpecificIDSelector

func SpecificIDSelector(id int64) selector.SelectOption

select node by specific game_id

Types

type FakeRandom added in v1.0.1

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

func NewFakeRandom added in v1.0.1

func NewFakeRandom(seed int) *FakeRandom

func (*FakeRandom) Rand added in v1.0.1

func (f *FakeRandom) Rand() int

------------------------------------------------------------------------------- 生成一个SHORT伪随机数 -------------------------------------------------------------------------------

func (*FakeRandom) RandSection added in v1.0.1

func (f *FakeRandom) RandSection(min, max int) int

func (*FakeRandom) Reset added in v1.0.1

func (f *FakeRandom) Reset(seed int)

------------------------------------------------------------------------------- 重置种子 -------------------------------------------------------------------------------

type Snowflakes

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

type WaitGroupWrapper

type WaitGroupWrapper struct {
	sync.WaitGroup
}

func (*WaitGroupWrapper) Wrap

func (w *WaitGroupWrapper) Wrap(cb func())

Jump to

Keyboard shortcuts

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