common

package
v0.0.0-...-c7e0420 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SRV_CHANNEL_REQ_SUFFIX = "__SRV__REQUEST"
	SRV_CHANNEL_RES_SUFFIX = "__SRV__RESPONSE"
)

Variables

This section is empty.

Functions

func CyberIP

func CyberIP() string

func GetFileName

func GetFileName(p string) string

func GetProtoFromFile

func GetProtoFromFile(p string, m proto.Message) error

func Hash

func Hash(key []byte) uint64

func MurmurHash64A

func MurmurHash64A(key []byte, seed uint64) (hash uint64)

MurmurHash64A 是从 github.com/rryqszq4/go-murmurhash 复制而来 目前测试下来与 cyber std::hash 中的结果一致 二者使用的都是 murmur2

func WorkRoot

func WorkRoot() string

func Zero

func Zero[T any]() T

func ZeroByType

func ZeroByType(typ reflect.Type) reflect.Value

Types

type GlobalData

type GlobalData struct {
	ProcessGroup  string
	ComponentNums int
	SchedName     string
	// contains filtered or unexported fields
}
var GlobalDataInstance *GlobalData = NewGlobalData()

func NewGlobalData

func NewGlobalData() *GlobalData

func NewNewGlobalDataE

func NewNewGlobalDataE() (*GlobalData, error)

func (*GlobalData) Config

func (d *GlobalData) Config() *pb.CyberConfig

func (*GlobalData) DisableSimulationMode

func (d *GlobalData) DisableSimulationMode()

func (*GlobalData) EnableSimulationMode

func (d *GlobalData) EnableSimulationMode()

func (*GlobalData) GenerateHashID

func (d *GlobalData) GenerateHashID(name string) uint64

func (*GlobalData) GetChannelByID

func (d *GlobalData) GetChannelByID(id uint64) string

func (*GlobalData) GetNodeByID

func (d *GlobalData) GetNodeByID(id uint64) string

func (*GlobalData) GetServiceByID

func (d *GlobalData) GetServiceByID(id uint64) string

func (*GlobalData) GetTaskNameByID

func (d *GlobalData) GetTaskNameByID(id uint64) string

func (*GlobalData) HostIP

func (d *GlobalData) HostIP() string

func (*GlobalData) HostName

func (d *GlobalData) HostName() string

func (*GlobalData) IsMockTimeMode

func (d *GlobalData) IsMockTimeMode() bool

func (*GlobalData) IsRealityMode

func (d *GlobalData) IsRealityMode() bool

func (*GlobalData) ProcessID

func (d *GlobalData) ProcessID() int

func (*GlobalData) RegisterChannel

func (d *GlobalData) RegisterChannel(channel string) uint64

func (*GlobalData) RegisterNode

func (d *GlobalData) RegisterNode(nodeName string) uint64

func (*GlobalData) RegisterService

func (d *GlobalData) RegisterService(service string) uint64

func (*GlobalData) RegisterTaskName

func (d *GlobalData) RegisterTaskName(taskName string) uint64

Jump to

Keyboard shortcuts

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