common

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelDataMessage

type ChannelDataMessage = proto.Message //protoreflect.Message

type ChannelId

type ChannelId uint32

Each channel uses a goroutine and we can have at most millions of goroutines at the same time. So we won't use 64-bit channel ID unless we use a distributed architecture for channeld itself.

type Message

type Message = proto.Message //protoreflect.ProtoMessage

type SpatialInfo

type SpatialInfo struct {
	X float64
	Y float64
	Z float64
}

channeldpb.SpatialInfo is heavy with mutex lock and other allocations. We need a light struct for frequent value copy.

func (*SpatialInfo) Dist2D

func (info1 *SpatialInfo) Dist2D(info2 *SpatialInfo) float64

func (*SpatialInfo) Dot2D

func (info1 *SpatialInfo) Dot2D(info2 *SpatialInfo) float64

func (*SpatialInfo) Magnitude2D

func (info1 *SpatialInfo) Magnitude2D() float64

func (*SpatialInfo) Normalize2D

func (info *SpatialInfo) Normalize2D()

func (*SpatialInfo) String

func (s *SpatialInfo) String() string

func (*SpatialInfo) Unit2D

func (info *SpatialInfo) Unit2D() SpatialInfo

type SpatialInfoChangedNotifier

type SpatialInfoChangedNotifier interface {
	// The handover data provider has three parameters:
	// 	- srcChannelId: the channel that an object is handed over from.
	// 	- dstChannelId: the channel that an object is handed over to.
	// 	- handoverData:
	//		if use group-based handover, the data should be the id of the migrating entity;
	//		if use the query-context handover, the data should be the message wrapped in ChannelDataHandoverMessage;
	//		if nil, no handover will happend.
	Notify(oldInfo SpatialInfo, newInfo SpatialInfo, handoverDataProvider func(ChannelId, ChannelId, interface{}))
}

Notifies the spatial/entity channel from the ChannelDataUpdate that the spatial info of an entity has changed, so the channel's SpatialController will check the handover. If the handover happpens, `handoverDataProvider` will be called to provide the data for the ChannelDataHandoverMessage.

Jump to

Keyboard shortcuts

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