Documentation ¶
Index ¶
- func NewAuthenticationService(logger zap.Logger, config Config, db *sql.DB, registry *SessionRegistry, ...) *authenticationService
- func NewConfig() *config
- func NewMessageRouterService(registry *SessionRegistry) *messageRouterService
- func NewOpsService(logger zap.Logger, multiLogger zap.Logger, version string, config Config, ...) *opsService
- func NewPipeline(config Config, db *sql.DB, socialClient *social.Client, tracker Tracker, ...) *pipeline
- func NewPresenceNotifier(logger zap.Logger, name string, tracker Tracker, messageRouter MessageRouter) *presenceNotifier
- func NewSession(logger zap.Logger, config Config, userID uuid.UUID, ...) *session
- type Config
- type DatabaseConfig
- type MessageRouter
- type Presence
- type PresenceID
- type PresenceMeta
- type SessionConfig
- type SessionRegistry
- type SocialConfig
- type SocialConfigSteam
- type StatsService
- type Tracker
- type TrackerService
- func (t *TrackerService) AddDiffListener(f func([]Presence, []Presence))
- func (t *TrackerService) CheckLocalByIDTopicUser(sessionID uuid.UUID, topic string, userID uuid.UUID) bool
- func (t *TrackerService) Count() int
- func (t *TrackerService) ListByTopic(topic string) []Presence
- func (t *TrackerService) ListLocalByTopic(topic string) []Presence
- func (t *TrackerService) Stop()
- func (t *TrackerService) Track(sessionID uuid.UUID, topic string, userID uuid.UUID, meta PresenceMeta)
- func (t *TrackerService) Untrack(sessionID uuid.UUID, topic string, userID uuid.UUID)
- func (t *TrackerService) UntrackAll(sessionID uuid.UUID)
- func (t *TrackerService) Update(sessionID uuid.UUID, topic string, userID uuid.UUID, meta PresenceMeta) error
- type TransportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuthenticationService ¶
func NewAuthenticationService(logger zap.Logger, config Config, db *sql.DB, registry *SessionRegistry, tracker Tracker, messageRouter MessageRouter) *authenticationService
NewAuthenticationService creates a new AuthenticationService
func NewConfig ¶
func NewConfig() *config
NewConfig constructs a Config struct which represents server settings.
func NewMessageRouterService ¶
func NewMessageRouterService(registry *SessionRegistry) *messageRouterService
func NewOpsService ¶
func NewOpsService(logger zap.Logger, multiLogger zap.Logger, version string, config Config, statsService StatsService) *opsService
NewOpsService creates a new opsService
func NewPipeline ¶
func NewPipeline(config Config, db *sql.DB, socialClient *social.Client, tracker Tracker, messageRouter MessageRouter) *pipeline
NewPipeline creates a new Pipeline
func NewPresenceNotifier ¶
func NewPresenceNotifier(logger zap.Logger, name string, tracker Tracker, messageRouter MessageRouter) *presenceNotifier
NewPresenceNotifier creates a new PresenceNotifier
Types ¶
type Config ¶
type Config interface { GetName() string GetDataDir() string GetPort() int GetOpsPort() int GetDSNS() []string GetSession() *SessionConfig GetTransport() *TransportConfig GetDatabase() *DatabaseConfig GetSocial() *SocialConfig }
Config interface is the Nakama Core configuration
type DatabaseConfig ¶
type DatabaseConfig struct { ConnMaxLifetimeMs int `yaml:"conn_max_lifetime_ms"` MaxOpenConns int `yaml:"max_open_conns"` MaxIdleConns int `yaml:"max_idle_conns"` }
DatabaseConfig is configuration relevant to the Database storage
func NewDatabaseConfig ¶
func NewDatabaseConfig() *DatabaseConfig
NewDatabaseConfig creates a new DatabaseConfig struct
type MessageRouter ¶
MessageRouter is responsible for sending a message to a list of presences
type Presence ¶
type Presence struct { ID PresenceID Topic string UserID uuid.UUID Meta PresenceMeta }
type PresenceID ¶
type PresenceID struct { Node string SessionID uuid.UUID }
type PresenceMeta ¶
type PresenceMeta struct{}
type SessionConfig ¶
type SessionConfig struct { EncryptionKey string `yaml:"encryption_key"` TokenExpiryMs int64 `yaml:"token_expiry_ms"` }
SessionConfig is configuration relevant to the session
func NewSessionConfig ¶
func NewSessionConfig() *SessionConfig
NewSessionConfig creates a new SessionConfig struct
type SessionRegistry ¶
SessionRegistry maintains a list of sessions to their IDs. This is thread-safe.
func NewSessionRegistry ¶
func NewSessionRegistry(logger zap.Logger, config Config, tracker Tracker) *SessionRegistry
NewSessionRegistry creates a new SessionRegistry
func (*SessionRegistry) Get ¶
func (a *SessionRegistry) Get(sessionID uuid.UUID) *session
Get returns a session matching the sessionID
type SocialConfig ¶
type SocialConfig struct {
Steam *SocialConfigSteam `yaml:"steam"`
}
SocialConfig is configuration relevant to the Social providers
func NewSocialConfig ¶
func NewSocialConfig() *SocialConfig
NewSocialConfig creates a new SocialConfig struct
type SocialConfigSteam ¶
type SocialConfigSteam struct { PublisherKey string `yaml:"publisher_key"` AppID int `yaml:"app_id"` }
SocialConfigSteam is configuration relevant to Steam
type StatsService ¶
StatsService is responsible for gathering and reading stats information from metrics
func NewStatsService ¶
func NewStatsService(logger zap.Logger, config Config, version string, tracker Tracker) StatsService
NewStatsService creates a new StatsService
type Tracker ¶
type Tracker interface { AddDiffListener(func([]Presence, []Presence)) Stop() Track(sessionID uuid.UUID, topic string, userID uuid.UUID, meta PresenceMeta) Untrack(sessionID uuid.UUID, topic string, userID uuid.UUID) UntrackAll(sessionID uuid.UUID) Update(sessionID uuid.UUID, topic string, userID uuid.UUID, meta PresenceMeta) error // Get current total number of presences. Count() int // Check if a single presence on the current node exists. CheckLocalByIDTopicUser(sessionID uuid.UUID, topic string, userID uuid.UUID) bool // List presences by topic. ListByTopic(topic string) []Presence // List presences on the current node by topic. ListLocalByTopic(topic string) []Presence }
type TrackerService ¶
func NewTrackerService ¶
func NewTrackerService(name string) *TrackerService
func (*TrackerService) AddDiffListener ¶
func (t *TrackerService) AddDiffListener(f func([]Presence, []Presence))
func (*TrackerService) CheckLocalByIDTopicUser ¶
func (t *TrackerService) CheckLocalByIDTopicUser(sessionID uuid.UUID, topic string, userID uuid.UUID) bool
func (*TrackerService) Count ¶
func (t *TrackerService) Count() int
func (*TrackerService) ListByTopic ¶
func (t *TrackerService) ListByTopic(topic string) []Presence
func (*TrackerService) ListLocalByTopic ¶
func (t *TrackerService) ListLocalByTopic(topic string) []Presence
func (*TrackerService) Stop ¶
func (t *TrackerService) Stop()
func (*TrackerService) Track ¶
func (t *TrackerService) Track(sessionID uuid.UUID, topic string, userID uuid.UUID, meta PresenceMeta)
func (*TrackerService) Untrack ¶
func (t *TrackerService) Untrack(sessionID uuid.UUID, topic string, userID uuid.UUID)
func (*TrackerService) UntrackAll ¶
func (t *TrackerService) UntrackAll(sessionID uuid.UUID)
func (*TrackerService) Update ¶
func (t *TrackerService) Update(sessionID uuid.UUID, topic string, userID uuid.UUID, meta PresenceMeta) error
type TransportConfig ¶
type TransportConfig struct { ServerKey string `yaml:"server_key"` MaxMessageSizeBytes int64 `yaml:"max_message_size_bytes"` WriteWaitMs int `yaml:"write_wait_ms"` PongWaitMs int `yaml:"pong_wait_ms"` PingPeriodMs int `yaml:"ping_period_ms"` }
TransportConfig is configuration relevant to the transport socket and protocol
func NewTransportConfig ¶
func NewTransportConfig() *TransportConfig
NewTransportConfig creates a new TransportConfig struct
Source Files ¶
- config.go
- message_router.go
- ops_accepter.go
- ops_service.go
- pipeline.go
- pipeline_friend.go
- pipeline_group.go
- pipeline_link_unlink.go
- pipeline_match.go
- pipeline_self.go
- pipeline_storage.go
- pipeline_topic.go
- pipeline_user.go
- presence_notifier.go
- session.go
- session_auth.go
- session_registry.go
- tracker.go