Documentation
¶
Index ¶
- func EntitiesToProtobuf(entities []*Entity) []*hagallpb.Entity
- func ParticipantsToProtobuf(participants []*Participant) []*hagallpb.Participant
- type Entity
- type EntityComponentHandler
- type EntityComponentStore
- func (s *EntityComponentStore) Add(ec *hagallpb.EntityComponent) error
- func (s *EntityComponentStore) AddType(name string) uint32
- func (s *EntityComponentStore) Delete(entityComponentTypeID uint32, entityID uint32) bool
- func (s *EntityComponentStore) DeleteByEntityID(entityID uint32)
- func (s *EntityComponentStore) GetTypeID(entityComponentTypeName string) (uint32, error)
- func (s *EntityComponentStore) GetTypeName(entityComponentTypeID uint32) (string, error)
- func (s *EntityComponentStore) List(entityComponentTypeID uint32) []*hagallpb.EntityComponent
- func (s *EntityComponentStore) ListAll() []*hagallpb.EntityComponent
- func (s *EntityComponentStore) ListByEntityID(entityID uint32) []*hagallpb.EntityComponent
- func (s *EntityComponentStore) Notify(entityComponentTypeID uint32, h EntityComponentHandler)
- func (s *EntityComponentStore) Subscribe(entityComponentTypeID, participantID uint32) error
- func (s *EntityComponentStore) Unsubscribe(entityComponentTypeID, participantID uint32)
- func (s *EntityComponentStore) UnsubscribeByParticipant(participantID uint32)
- func (s *EntityComponentStore) Update(ec *hagallpb.EntityComponent) error
- type LatencyMetricsData
- type Participant
- type Pose
- type SequentialIDGenerator
- type Session
- func (s *Session) AddEntity(e *Entity)
- func (s *Session) AddParticipant(p *Participant)
- func (s *Session) Broadcast(sender *Participant, protoMsg hwebsocket.ProtoMsg)
- func (s *Session) BroadcastTo(sender *Participant, protoMsg hwebsocket.ProtoMsg, participantIds ...uint32)
- func (s *Session) Close()
- func (s *Session) Entities() []*Entity
- func (s *Session) EntityByID(id uint32) (*Entity, bool)
- func (s *Session) GetEntityComponents() *EntityComponentStore
- func (s *Session) GetParticipants() []*Participant
- func (s *Session) GetParticipantsByIDs(ids ...uint32) []*Participant
- func (s *Session) HandleFrame(h func()) (cancel func())
- func (s *Session) ModuleState(moduleName string) (any, bool)
- func (s *Session) NewEntityID() uint32
- func (s *Session) NewParticipantID() uint32
- func (s *Session) ParticipantCount() int
- func (s *Session) RemoveEntity(e *Entity)
- func (s *Session) RemoveParticipant(p *Participant)
- func (s *Session) SetModuleState(moduleName string, state any)
- func (s *Session) StartDispatchFrames()
- type SessionDiscoveryService
- type SessionStore
- func (s *SessionStore) Add(ctx context.Context, session *Session) error
- func (s *SessionStore) GetByGlobalID(v string) (*Session, bool)
- func (s *SessionStore) GlobalSessionID(sessionID uint32) string
- func (s *SessionStore) NewID() uint32
- func (s *SessionStore) Remove(ctx context.Context, session *Session)
- type SignedLatency
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EntitiesToProtobuf ¶
func ParticipantsToProtobuf ¶
func ParticipantsToProtobuf(participants []*Participant) []*hagallpb.Participant
Types ¶
type Entity ¶
type Entity struct { ID uint32 ParticipantID uint32 Persist bool Flag hagallpb.EntityFlag // contains filtered or unexported fields }
func (*Entity) ToProtobuf ¶
type EntityComponentHandler ¶
type EntityComponentHandler func([]uint32)
type EntityComponentStore ¶
type EntityComponentStore struct {
// contains filtered or unexported fields
}
func (*EntityComponentStore) Add ¶
func (s *EntityComponentStore) Add(ec *hagallpb.EntityComponent) error
func (*EntityComponentStore) AddType ¶
func (s *EntityComponentStore) AddType(name string) uint32
func (*EntityComponentStore) Delete ¶
func (s *EntityComponentStore) Delete(entityComponentTypeID uint32, entityID uint32) bool
func (*EntityComponentStore) DeleteByEntityID ¶
func (s *EntityComponentStore) DeleteByEntityID(entityID uint32)
func (*EntityComponentStore) GetTypeID ¶
func (s *EntityComponentStore) GetTypeID(entityComponentTypeName string) (uint32, error)
func (*EntityComponentStore) GetTypeName ¶
func (s *EntityComponentStore) GetTypeName(entityComponentTypeID uint32) (string, error)
func (*EntityComponentStore) List ¶
func (s *EntityComponentStore) List(entityComponentTypeID uint32) []*hagallpb.EntityComponent
func (*EntityComponentStore) ListAll ¶
func (s *EntityComponentStore) ListAll() []*hagallpb.EntityComponent
func (*EntityComponentStore) ListByEntityID ¶
func (s *EntityComponentStore) ListByEntityID(entityID uint32) []*hagallpb.EntityComponent
func (*EntityComponentStore) Notify ¶
func (s *EntityComponentStore) Notify(entityComponentTypeID uint32, h EntityComponentHandler)
func (*EntityComponentStore) Subscribe ¶
func (s *EntityComponentStore) Subscribe(entityComponentTypeID, participantID uint32) error
func (*EntityComponentStore) Unsubscribe ¶
func (s *EntityComponentStore) Unsubscribe(entityComponentTypeID, participantID uint32)
func (*EntityComponentStore) UnsubscribeByParticipant ¶
func (s *EntityComponentStore) UnsubscribeByParticipant(participantID uint32)
func (*EntityComponentStore) Update ¶
func (s *EntityComponentStore) Update(ec *hagallpb.EntityComponent) error
type LatencyMetricsData ¶ added in v0.5.8
type Participant ¶
type Participant struct { ID uint32 Responder hwebsocket.ResponseSender SignedLatency *SignedLatency // contains filtered or unexported fields }
A session participant.
func (*Participant) AddEntity ¶
func (p *Participant) AddEntity(e *Entity)
func (*Participant) EntityIDs ¶
func (p *Participant) EntityIDs() map[uint32]struct{}
func (*Participant) RemoveEntity ¶
func (p *Participant) RemoveEntity(e *Entity)
func (*Participant) ToProtobuf ¶
func (p *Participant) ToProtobuf() *hagallpb.Participant
type Pose ¶
func (Pose) ToProtobuf ¶
type SequentialIDGenerator ¶
type SequentialIDGenerator struct {
// contains filtered or unexported fields
}
A sequential id generator.
func (*SequentialIDGenerator) New ¶
func (g *SequentialIDGenerator) New() uint32
New returns a sequental id.
func (*SequentialIDGenerator) Reuse ¶
func (g *SequentialIDGenerator) Reuse(id uint32)
Reuse marks the given id as reusable. Reusable ids are returned in priority when using New.
type Session ¶
type Session struct { ID uint32 SessionUUID string AppKey string // contains filtered or unexported fields }
Session represents a session that contains entities and participants who can communicate between each other.
func (*Session) AddParticipant ¶
func (s *Session) AddParticipant(p *Participant)
func (*Session) Broadcast ¶
func (s *Session) Broadcast(sender *Participant, protoMsg hwebsocket.ProtoMsg)
func (*Session) BroadcastTo ¶
func (s *Session) BroadcastTo(sender *Participant, protoMsg hwebsocket.ProtoMsg, participantIds ...uint32)
func (*Session) GetEntityComponents ¶
func (s *Session) GetEntityComponents() *EntityComponentStore
func (*Session) GetParticipants ¶
func (s *Session) GetParticipants() []*Participant
func (*Session) GetParticipantsByIDs ¶
func (s *Session) GetParticipantsByIDs(ids ...uint32) []*Participant
func (*Session) HandleFrame ¶
func (s *Session) HandleFrame(h func()) (cancel func())
func (*Session) NewEntityID ¶
func (*Session) NewParticipantID ¶
func (*Session) ParticipantCount ¶
func (*Session) RemoveEntity ¶
func (*Session) RemoveParticipant ¶
func (s *Session) RemoveParticipant(p *Participant)
func (*Session) SetModuleState ¶
func (*Session) StartDispatchFrames ¶
func (s *Session) StartDispatchFrames()
type SessionDiscoveryService ¶
type SessionDiscoveryService interface { // Returns the id attributed to the current Hagall server. ServerID() string }
SessionDiscoveryService is the interface to communicate with a session discovery service such as HDS.
type SessionStore ¶
type SessionStore struct { // The session discovery service where sessions are registered. DiscoveryService SessionDiscoveryService // contains filtered or unexported fields }
func (*SessionStore) GetByGlobalID ¶
func (s *SessionStore) GetByGlobalID(v string) (*Session, bool)
func (*SessionStore) GlobalSessionID ¶
func (s *SessionStore) GlobalSessionID(sessionID uint32) string
func (*SessionStore) NewID ¶
func (s *SessionStore) NewID() uint32
type SignedLatency ¶ added in v0.5.8
type SignedLatency struct { RequestID uint32 StartedAt time.Time Iteration uint32 PingRequests map[uint32]LatencyMetricsData SessionID string ClientID string WalletAddress string // contains filtered or unexported fields }
func (*SignedLatency) OnPing ¶ added in v0.5.8
func (s *SignedLatency) OnPing(pingReqID uint32) error
func (*SignedLatency) Start ¶ added in v0.5.8
func (s *SignedLatency) Start(privateKey *ecdsa.PrivateKey, sender hwebsocket.ResponseSender, requestID, iteration uint32, sessionID, clientID, walletAddress string)
Click to show internal directories.
Click to hide internal directories.