runtime

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxUserID        ctxKey = "user_id"
	CtxUsername      ctxKey = "username"
	CtxVars          ctxKey = "vars"
	CtxClientIP      ctxKey = "client_ip"
	CtxEnv           ctxKey = "env"
	CtxQueryParams   ctxKey = "query_params"
	CtxHeaders       ctxKey = "headers"
	CtxExecutionMode ctxKey = "execution_mode"
)
View Source
const RpcFuncHookID = "RpcFunc"

RpcFuncHookID is the request-hook id for custom RPC (REST /v2/rpc/*, gRPC RpcFunc, WS rpc envelopes).

Variables

This section is empty.

Functions

func ApplyRpcFuncBeforeResult

func ApplyRpcFuncBeforeResult(req map[string]interface{}, result interface{}) map[string]interface{}

ApplyRpcFuncBeforeResult merges a before-hook result map into id/payload fields.

func CodeFromError

func CodeFromError(err error) codes.Code

CodeFromError extracts a gRPC code from err (default Internal).

func EmitStreamPresenceRemovals

func EmitStreamPresenceRemovals(router presence.MessageRouter, tracker *presence.LocalTracker, removals []presence.StreamPresenceRemoval)

EmitStreamPresenceRemovals fans out leave events for custom streams after UntrackAllDetailed. Used by the socket gateway when it owns the tracker untrack path.

func EnvelopeHookIDFromJSON

func EnvelopeHookIDFromJSON(m map[string]interface{}) string

EnvelopeHookIDFromJSON returns the first known RT payload key in a JSON envelope map.

func ExecuteJSAfterHook

func ExecuteJSAfterHook(vm *goja.Runtime, funcName string, ctx context.Context, out interface{}, in interface{}) error

ExecuteJSAfterHook runs a JS after hook.

func ExecuteJSBeforeHook

func ExecuteJSBeforeHook(vm *goja.Runtime, funcName string, ctx context.Context, in interface{}) (interface{}, error)

ExecuteJSBeforeHook runs a JS before hook.

func ExecuteJSRPC

func ExecuteJSRPC(vm *goja.Runtime, funcName string, ctx context.Context, payload string) (string, error)

ExecuteJSRPC runs a JS RPC function.

func ExecuteLuaAfterHook

func ExecuteLuaAfterHook(L *lua.LState, funcName string, ctx context.Context, out interface{}, in interface{}) error

ExecuteLuaAfterHook runs a Lua after hook.

func ExecuteLuaBeforeHook

func ExecuteLuaBeforeHook(L *lua.LState, funcName string, ctx context.Context, in interface{}) (interface{}, error)

ExecuteLuaBeforeHook runs a Lua before hook.

func ExecuteLuaRPC

func ExecuteLuaRPC(L *lua.LState, funcName string, ctx context.Context, payload string) (string, error)

ExecuteLuaRPC runs a Lua RPC function.

func LoadJSModules

func LoadJSModules(ctx context.Context, dir string, vm *goja.Runtime, logger Logger) error

LoadJSModules scans dir for *.js files and evaluates them in alphabetical order.

func LoadLuaModules

func LoadLuaModules(ctx context.Context, dir string, L *lua.LState, logger Logger) error

LoadLuaModules scans dir for *.lua files and evaluates them in alphabetical order. Modules register RPCs/hooks via nk.register_* at load time (reference-style init). Match handler files that only define match_* functions are safe to load — they do not start matches.

func MapJSNK

func MapJSNK(vm *goja.Runtime, nk RuntimeModule, timeout time.Duration, registry ...*HookRegistry)

MapJSNK binds the core storage APIs to a Goja JS VM.

func MapLuaNK

func MapLuaNK(L *lua.LState, nk RuntimeModule, registry ...*HookRegistry)

MapLuaNK binds the core storage APIs to a Gopher-Lua VM.

func MountHTTPHandlers

func MountHTTPHandlers(mux *http.ServeMux, handlers []*RuntimeHTTPHandler)

MountHTTPHandlers registers custom handlers onto mux.

func ParseEnvelopeMap

func ParseEnvelopeMap(payload []byte) (map[string]interface{}, error)

ParseEnvelopeMap unmarshals raw JSON into a generic map.

func RegisterCronEnabled

func RegisterCronEnabled() bool

RegisterCronEnabled reports whether Optional RegisterCron is enabled.

func ResolveRtHookID

func ResolveRtHookID(hookID string) string

ResolveRtHookID normalizes protobuf hook IDs to runtime registry keys.

func ToGoValue

func ToGoValue(val lua.LValue) interface{}

func ToLuaValue

func ToLuaValue(L *lua.LState, val interface{}) lua.LValue

ToLuaValue converts Go primitives/slices/maps to Lua values.

Types

type Account

type Account struct {
	ID         string    `json:"id"`
	Username   string    `json:"username"`
	CreateTime time.Time `json:"create_time"`
	UpdateTime time.Time `json:"update_time"`
}

type AccountUpdateParams

type AccountUpdateParams struct {
	UserID      string  `json:"user_id"`
	Username    *string `json:"username,omitempty"`
	DisplayName *string `json:"display_name,omitempty"`
	AvatarURL   *string `json:"avatar_url,omitempty"`
	LangTag     *string `json:"lang_tag,omitempty"`
	Location    *string `json:"location,omitempty"`
	Timezone    *string `json:"timezone,omitempty"`
	Metadata    *string `json:"metadata,omitempty"`
}

AccountUpdateParams updates account fields in MultiUpdate.

type AddFriendsRequest

type AddFriendsRequest struct {
	IDs       []string `json:"ids"`
	Usernames []string `json:"usernames"`
}

type AddGroupUsersRequest

type AddGroupUsersRequest struct {
	GroupID string   `json:"group_id"`
	UserIDs []string `json:"user_ids"`
}

type AfterHook

type AfterHook func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out interface{}, in interface{}) error

AfterHook represents an HTTP/gRPC after request interceptor. Go native after hooks receive logger, db, and nk for full server API access.

type AuthenticateAppleRequest

type AuthenticateAppleRequest struct {
	Token    string            `json:"token"`
	Username string            `json:"username"`
	Create   *bool             `json:"create"`
	Vars     map[string]string `json:"vars"`
}

type AuthenticateCustomRequest

type AuthenticateCustomRequest struct {
	ID       string            `json:"id"`
	Username string            `json:"username"`
	Create   *bool             `json:"create"`
	Vars     map[string]string `json:"vars"`
}

type AuthenticateDeviceRequest

type AuthenticateDeviceRequest struct {
	ID       string            `json:"id"`
	Username string            `json:"username"`
	Create   *bool             `json:"create"`
	Vars     map[string]string `json:"vars"`
}

Priority typed before-hook request shapes (HTTP/gRPC method-name IDs).

type AuthenticateEmailRequest

type AuthenticateEmailRequest struct {
	Email       string `json:"email"`
	Password    string `json:"password"`
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	Register    bool   `json:"register"`
}

type AuthenticateFacebookInstantGameRequest

type AuthenticateFacebookInstantGameRequest struct {
	SignedPlayerInfo string            `json:"signed_player_info"`
	Username         string            `json:"username"`
	Create           *bool             `json:"create"`
	Vars             map[string]string `json:"vars"`
}

type AuthenticateFacebookRequest

type AuthenticateFacebookRequest struct {
	Token    string            `json:"token"`
	Username string            `json:"username"`
	Create   *bool             `json:"create"`
	Vars     map[string]string `json:"vars"`
}

type AuthenticateGameCenterRequest

type AuthenticateGameCenterRequest struct {
	PlayerID     string            `json:"player_id"`
	BundleID     string            `json:"bundle_id"`
	Timestamp    int64             `json:"timestamp_seconds"`
	Salt         string            `json:"salt"`
	Signature    string            `json:"signature"`
	PublicKeyURL string            `json:"public_key_url"`
	Username     string            `json:"username"`
	Create       *bool             `json:"create"`
	Vars         map[string]string `json:"vars"`
}

type AuthenticateGoogleRequest

type AuthenticateGoogleRequest struct {
	Token    string            `json:"token"`
	Username string            `json:"username"`
	Create   *bool             `json:"create"`
	Vars     map[string]string `json:"vars"`
}

type AuthenticateSteamRequest

type AuthenticateSteamRequest struct {
	Token    string            `json:"token"`
	Username string            `json:"username"`
	Create   *bool             `json:"create"`
	Vars     map[string]string `json:"vars"`
}

type BanGroupUsersRequest

type BanGroupUsersRequest struct {
	GroupID string   `json:"group_id"`
	UserIDs []string `json:"user_ids"`
}

type BeforeHook

type BeforeHook func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in interface{}) (interface{}, error)

BeforeHook represents an HTTP/gRPC before request interceptor. Go native before hooks receive logger, db, and nk for full server API access.

type BlockFriendsRequest

type BlockFriendsRequest struct {
	IDs       []string `json:"ids"`
	Usernames []string `json:"usernames"`
}

type ChannelMessageAckView

type ChannelMessageAckView struct {
	ChannelID  string    `json:"channel_id"`
	MessageID  string    `json:"message_id"`
	Code       int16     `json:"code"`
	Username   string    `json:"username"`
	CreateTime time.Time `json:"create_time"`
	UpdateTime time.Time `json:"update_time"`
	Persistent bool      `json:"persistent"`
	RoomName   string    `json:"room_name,omitempty"`
	GroupID    string    `json:"group_id,omitempty"`
	UserIDOne  string    `json:"user_id_one,omitempty"`
	UserIDTwo  string    `json:"user_id_two,omitempty"`
}

ChannelMessageAckView is returned by runtime channel send/update/remove.

type ChannelMessageList

type ChannelMessageList struct {
	Messages        []*ChannelMessageView `json:"messages"`
	NextCursor      string                `json:"next_cursor,omitempty"`
	PrevCursor      string                `json:"prev_cursor,omitempty"`
	CacheableCursor string                `json:"cacheable_cursor,omitempty"`
}

type ChannelMessageView

type ChannelMessageView struct {
	ChannelID  string    `json:"channel_id"`
	MessageID  string    `json:"message_id"`
	Code       int16     `json:"code"`
	SenderID   string    `json:"sender_id"`
	Username   string    `json:"username"`
	Content    string    `json:"content"`
	CreateTime time.Time `json:"create_time"`
	UpdateTime time.Time `json:"update_time"`
	Persistent bool      `json:"persistent"`
	RoomName   string    `json:"room_name,omitempty"`
	GroupID    string    `json:"group_id,omitempty"`
	UserIDOne  string    `json:"user_id_one,omitempty"`
	UserIDTwo  string    `json:"user_id_two,omitempty"`
}

ChannelMessageView is a listed channel message.

type CreateGroupRequest

type CreateGroupRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	LangTag     string `json:"lang_tag"`
	Metadata    string `json:"metadata"`
	AvatarURL   string `json:"avatar_url"`
	Open        bool   `json:"open"`
	MaxCount    int32  `json:"max_count"`
}

type CreateMatchRequest

type CreateMatchRequest struct {
	Name string `json:"name"`
}

type CreatePartyRequest

type CreatePartyRequest struct {
	Open    bool  `json:"open"`
	MaxSize int32 `json:"max_size"`
}

type CronClusterLock

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

CronClusterLock ensures only one node runs a named leadership lease when Redis is configured.

func NewCronClusterLock

func NewCronClusterLock(rdb *redis.Client, nodeID string) *CronClusterLock

NewCronClusterLock creates a Redis lease helper for cron leadership.

func NewNamedClusterLock

func NewNamedClusterLock(rdb *redis.Client, nodeID, key string) *CronClusterLock

NewNamedClusterLock creates a Redis SETNX lease for an arbitrary leadership key.

func (*CronClusterLock) TryAcquire

func (l *CronClusterLock) TryAcquire(ctx context.Context) bool

TryAcquire returns true when this node holds (or acquired) the leadership lease.

type CronJob

type CronJob struct {
	Schedule string
	Handler  func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule) error
	Expr     *cronexpr.Expression // parsed at RegisterCron
}

CronJob represents a scheduled event job (UGE extension; ADR-0025).

type CronScheduler

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

CronScheduler runs RegisterCron jobs on a single node (ADR-0025). Overlap policy: skip if the previous invocation is still running.

func NewCronScheduler

func NewCronScheduler(registry *HookRegistry, logger Logger, db *sql.DB, nk RuntimeModule) *CronScheduler

NewCronScheduler creates a scheduler bound to the given registry and runtime deps.

func (*CronScheduler) SetClusterLock

func (s *CronScheduler) SetClusterLock(lock *CronClusterLock)

SetClusterLock attaches a Redis leadership lock to the scheduler.

func (*CronScheduler) Start

func (s *CronScheduler) Start(parent context.Context)

Start begins the background tick loop. Safe to call once.

func (*CronScheduler) Stop

func (s *CronScheduler) Stop()

Stop cancels the loop and waits for in-flight handlers to finish or context cancel.

type DeleteAccountRequest

type DeleteAccountRequest struct{}

type DeleteFriendsRequest

type DeleteFriendsRequest struct {
	IDs       []string `json:"ids"`
	Usernames []string `json:"usernames"`
}

type DeleteGroupRequest

type DeleteGroupRequest struct {
	GroupID string `json:"group_id"`
}

type DeleteLeaderboardRecordRequest

type DeleteLeaderboardRecordRequest struct {
	LeaderboardID string `json:"leaderboard_id"`
}

type DeleteNotificationsRequest

type DeleteNotificationsRequest struct {
	IDs []string `json:"ids"`
}

type DeleteStorageObjectsRequest

type DeleteStorageObjectsRequest struct {
	ObjectIDs []StorageDelete `json:"object_ids"`
}

type DeleteTournamentRecordRequest

type DeleteTournamentRecordRequest struct {
	TournamentID string `json:"tournament_id"`
}

type DemoteGroupUsersRequest

type DemoteGroupUsersRequest struct {
	GroupID string   `json:"group_id"`
	UserIDs []string `json:"user_ids"`
}

type Error

type Error struct {
	Message string
	Code    codes.Code
}

Error is a typed runtime error with a gRPC status code (1–16).

func NewError

func NewError(msg string, code int) *Error

NewError creates a typed error. Invalid codes are coerced to Internal (13).

func (*Error) Error

func (e *Error) Error() string

type Event

type Event struct {
	Name       string
	Properties map[string]string
	Timestamp  int64
}

Event represents a server-side event (session start/end, matchmaker match, etc.).

type EventHandler

type EventHandler func(ctx context.Context, logger Logger, evt *Event)

EventHandler represents an asynchronous event handler.

type EventRequest

type EventRequest struct {
	Name       string            `json:"name"`
	Properties map[string]string `json:"properties"`
	Timestamp  int64             `json:"timestamp"`
	External   bool              `json:"external"`
}

type Friend

type Friend struct {
	User       *UserView `json:"user"`
	State      int       `json:"state"`
	UpdateTime time.Time `json:"update_time"`
	Metadata   string    `json:"metadata"`
}

type FriendEdge

type FriendEdge struct {
	UserID      string    `json:"user_id"`
	Username    string    `json:"username"`
	DisplayName string    `json:"display_name"`
	State       int       `json:"state"`
	UpdateTime  time.Time `json:"update_time"`
	Metadata    string    `json:"metadata"`
}

FriendEdge is a runtime representation of a friend list entry.

type FriendList

type FriendList struct {
	Friends    []*Friend `json:"friends"`
	NextCursor string    `json:"next_cursor,omitempty"`
}

type FriendOfFriend

type FriendOfFriend struct {
	Referrer string    `json:"referrer"`
	User     *UserView `json:"user"`
}

type FriendOfFriendEdge

type FriendOfFriendEdge struct {
	Referrer string `json:"referrer"`
	UserID   string `json:"user_id"`
	Username string `json:"username"`
}

FriendOfFriendEdge is a runtime FoF entry.

type FriendsOfFriendsList

type FriendsOfFriendsList struct {
	FriendsOfFriends []*FriendOfFriend `json:"friends_of_friends"`
	Cursor           string            `json:"cursor,omitempty"`
}

type GetAccountRequest

type GetAccountRequest struct{}

type GetMatchmakerStatsRequest

type GetMatchmakerStatsRequest struct{}

type GetSubscriptionRequest

type GetSubscriptionRequest struct {
	ProductID string `json:"product_id"`
}

type GetUsersRequest

type GetUsersRequest struct {
	IDs         []string `json:"ids"`
	Usernames   []string `json:"usernames"`
	FacebookIDs []string `json:"facebook_ids"`
}

type GetWalletRequest

type GetWalletRequest struct{}

type GoRuntimeManager

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

GoRuntimeManager manages Go native runtime modules loaded from .so plugins. It handles plugin loading, initialization, panic recovery, and runtime precedence.

func NewGoRuntimeManager

func NewGoRuntimeManager(logger Logger, db *sql.DB, nk RuntimeModule) *GoRuntimeManager

NewGoRuntimeManager creates a new Go runtime manager with the given dependencies.

func (*GoRuntimeManager) DB

func (m *GoRuntimeManager) DB() *sql.DB

DB returns the database connection.

func (*GoRuntimeManager) DispatchRPC

func (m *GoRuntimeManager) DispatchRPC(ctx context.Context, id, payload string, opts RPCDispatchOpts, luaVM *lua.LState, jsVM *goja.Runtime, cfg RPCConfig) (string, codes.Code, error)

DispatchRPC invokes a registered RPC (Go > Lua > JS) with timeout and size checks.

func (*GoRuntimeManager) HasAfterHook

func (m *GoRuntimeManager) HasAfterHook(name string) bool

HasAfterHook checks if an after hook is registered (Go → Lua → JS).

func (*GoRuntimeManager) HasBeforeHook

func (m *GoRuntimeManager) HasBeforeHook(name string) bool

HasBeforeHook checks if a before hook is registered (Go → Lua → JS).

func (*GoRuntimeManager) HasRPC

func (m *GoRuntimeManager) HasRPC(id string) bool

HasRPC checks if a Go RPC handler is registered for the given function ID.

func (*GoRuntimeManager) InvokeAfterHook

func (m *GoRuntimeManager) InvokeAfterHook(ctx context.Context, name string, response interface{}, request interface{}) error

InvokeAfterHook invokes a Go-registered after hook by name. All invocations are wrapped with panic recovery.

func (*GoRuntimeManager) InvokeBeforeHook

func (m *GoRuntimeManager) InvokeBeforeHook(ctx context.Context, name string, in interface{}) (out interface{}, err error)

InvokeBeforeHook invokes a Go-registered before hook by name. All invocations are wrapped with panic recovery.

func (*GoRuntimeManager) InvokeRPC

func (m *GoRuntimeManager) InvokeRPC(ctx context.Context, id string, payload string) (result string, err error)

InvokeRPC invokes a Go-registered RPC handler by function ID. All invocations are wrapped with panic recovery.

func (*GoRuntimeManager) LoadPlugins

func (m *GoRuntimeManager) LoadPlugins(ctx context.Context, dir string) error

LoadPlugins scans the specified directory for .so files and loads them as Go plugins. Each plugin must export an InitModule function matching InitModuleFunc. Plugins are loaded in alphabetical order. If a plugin fails to load, the error is logged and the next plugin is attempted — the server does not crash.

func (*GoRuntimeManager) Logger

func (m *GoRuntimeManager) Logger() Logger

Logger returns the logger.

func (*GoRuntimeManager) NK

NK returns the runtime module.

func (*GoRuntimeManager) NewInitializer

func (m *GoRuntimeManager) NewInitializer() Initializer

NewInitializer constructs a new Initializer bound to this runtime manager.

func (*GoRuntimeManager) Registry

func (m *GoRuntimeManager) Registry() *HookRegistry

Registry returns the hook registry.

type GoRuntimeModule

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

func NewGoRuntimeModule

func NewGoRuntimeModule(dbPool *pgxpool.Pool, logger Logger) *GoRuntimeModule

func (*GoRuntimeModule) AccountDeleteId

func (m *GoRuntimeModule) AccountDeleteId(ctx context.Context, userID string) error

func (*GoRuntimeModule) AccountGetId

func (m *GoRuntimeModule) AccountGetId(ctx context.Context, userID string) (*Account, error)

func (*GoRuntimeModule) AccountUpdateId

func (m *GoRuntimeModule) AccountUpdateId(ctx context.Context, userID, username string, metadata map[string]interface{}, displayName, timezone, location, langTag, avatarURL string) error

func (*GoRuntimeModule) AuthenticateCustom

func (m *GoRuntimeModule) AuthenticateCustom(ctx context.Context, id, username string, create bool) (string, string, bool, error)

func (*GoRuntimeModule) AuthenticateDevice

func (m *GoRuntimeModule) AuthenticateDevice(ctx context.Context, id, username string, create bool) (string, string, bool, error)

func (*GoRuntimeModule) AuthenticateEmail

func (m *GoRuntimeModule) AuthenticateEmail(ctx context.Context, email, password, username string, create bool) (string, string, bool, error)

func (*GoRuntimeModule) AuthenticateTokenGenerate

func (m *GoRuntimeModule) AuthenticateTokenGenerate(userID, username string, expiresAt int64, vars map[string]string) (string, int64, error)

func (*GoRuntimeModule) BcryptCompare

func (m *GoRuntimeModule) BcryptCompare(hashStr, password string) bool

func (*GoRuntimeModule) BcryptHash

func (m *GoRuntimeModule) BcryptHash(password string) (string, error)

func (*GoRuntimeModule) ChannelIdBuild

func (m *GoRuntimeModule) ChannelIdBuild(ctx context.Context, userID, target string, chanType int) (string, error)

func (*GoRuntimeModule) ChannelMessageRemove

func (m *GoRuntimeModule) ChannelMessageRemove(ctx context.Context, channelID, messageID, senderID, senderUsername string, persist bool) (*ChannelMessageAckView, error)

func (*GoRuntimeModule) ChannelMessageSend

func (m *GoRuntimeModule) ChannelMessageSend(ctx context.Context, channelID string, content map[string]interface{}, senderID, senderUsername string, persist bool) (*ChannelMessageAckView, error)

func (*GoRuntimeModule) ChannelMessageUpdate

func (m *GoRuntimeModule) ChannelMessageUpdate(ctx context.Context, channelID, messageID string, content map[string]interface{}, senderID, senderUsername string, persist bool) (*ChannelMessageAckView, error)

func (*GoRuntimeModule) ChannelMessagesList

func (m *GoRuntimeModule) ChannelMessagesList(ctx context.Context, channelID string, limit int, forward bool, cursor string) ([]*ChannelMessageView, string, string, string, error)

func (*GoRuntimeModule) CronNext

func (m *GoRuntimeModule) CronNext(expression string, timestamp int64) (int64, error)

CronNext returns the next UTC unix timestamp matching expression after timestamp (ADR-0025).

func (*GoRuntimeModule) CronPrev

func (m *GoRuntimeModule) CronPrev(expression string, timestamp int64) (int64, error)

CronPrev returns the previous UTC unix timestamp matching expression before timestamp (ADR-0025).

func (*GoRuntimeModule) CryptoHash

func (m *GoRuntimeModule) CryptoHash(algo, input string) (string, error)

func (*GoRuntimeModule) CryptoHmacHash

func (m *GoRuntimeModule) CryptoHmacHash(algo, key, input string) (string, error)

func (*GoRuntimeModule) FriendMetadataUpdate

func (m *GoRuntimeModule) FriendMetadataUpdate(ctx context.Context, userID, friendID string, metadata map[string]any) error

func (*GoRuntimeModule) FriendsAdd

func (m *GoRuntimeModule) FriendsAdd(ctx context.Context, userID string, ids, usernames []string, metadata map[string]any) error

func (*GoRuntimeModule) FriendsBlock

func (m *GoRuntimeModule) FriendsBlock(ctx context.Context, userID string, ids, usernames []string) error

func (*GoRuntimeModule) FriendsDelete

func (m *GoRuntimeModule) FriendsDelete(ctx context.Context, userID string, ids, usernames []string) error

func (*GoRuntimeModule) FriendsList

func (m *GoRuntimeModule) FriendsList(ctx context.Context, userID string, limit int, state *int, cursor string) ([]*FriendEdge, string, error)

func (*GoRuntimeModule) FriendsOfFriendsList

func (m *GoRuntimeModule) FriendsOfFriendsList(ctx context.Context, userID string, limit int, cursor string) ([]*FriendOfFriendEdge, string, error)

func (*GoRuntimeModule) GetFleetManager

func (m *GoRuntimeModule) GetFleetManager() fleet.Manager

func (*GoRuntimeModule) GetSatori

func (m *GoRuntimeModule) GetSatori() satori.Satori

func (*GoRuntimeModule) GroupCreate

func (m *GoRuntimeModule) GroupCreate(ctx context.Context, userID, name, description, avatarURL, langTag, metadata string, open bool, maxCount int) (*GroupView, error)

func (*GoRuntimeModule) GroupDelete

func (m *GoRuntimeModule) GroupDelete(ctx context.Context, groupID, userID string) error

func (*GoRuntimeModule) GroupUpdate

func (m *GoRuntimeModule) GroupUpdate(ctx context.Context, groupID, userID, name, description, avatarURL, langTag, metadata string, open bool, maxCount int) error

func (*GoRuntimeModule) GroupUserJoin

func (m *GoRuntimeModule) GroupUserJoin(ctx context.Context, groupID, userID, username string) error

func (*GoRuntimeModule) GroupUserLeave

func (m *GoRuntimeModule) GroupUserLeave(ctx context.Context, groupID, userID, username string) error

func (*GoRuntimeModule) GroupUsersAdd

func (m *GoRuntimeModule) GroupUsersAdd(ctx context.Context, groupID, callerID string, userIDs []string) error

func (*GoRuntimeModule) GroupUsersBan

func (m *GoRuntimeModule) GroupUsersBan(ctx context.Context, groupID, callerID string, userIDs []string) error

func (*GoRuntimeModule) GroupUsersDemote

func (m *GoRuntimeModule) GroupUsersDemote(ctx context.Context, groupID, callerID string, userIDs []string) error

func (*GoRuntimeModule) GroupUsersKick

func (m *GoRuntimeModule) GroupUsersKick(ctx context.Context, groupID, callerID string, userIDs []string) error

func (*GoRuntimeModule) GroupUsersList

func (m *GoRuntimeModule) GroupUsersList(ctx context.Context, groupID string, limit int, cursor string) ([]*GroupUserView, string, error)

func (*GoRuntimeModule) GroupUsersPromote

func (m *GoRuntimeModule) GroupUsersPromote(ctx context.Context, groupID, callerID string, userIDs []string) error

func (*GoRuntimeModule) GroupsGetId

func (m *GoRuntimeModule) GroupsGetId(ctx context.Context, groupIDs []string) ([]*GroupView, error)

func (*GoRuntimeModule) GroupsGetRandom

func (m *GoRuntimeModule) GroupsGetRandom(ctx context.Context, count int) ([]*GroupView, error)

func (*GoRuntimeModule) GroupsList

func (m *GoRuntimeModule) GroupsList(ctx context.Context, name, langTag string, open *bool, members, limit int, cursor string) ([]*GroupView, string, error)

func (*GoRuntimeModule) HttpRequest

func (m *GoRuntimeModule) HttpRequest(ctx context.Context, urlStr, method string, headers map[string]string, body string, timeoutMs int) (int, map[string]string, string, error)

func (*GoRuntimeModule) LeaderboardCreate

func (m *GoRuntimeModule) LeaderboardCreate(ctx context.Context, id string, authoritative bool, sortOrder int, operator int, resetSchedule string, metadata map[string]interface{}, enableRanks bool) error

func (*GoRuntimeModule) LeaderboardDelete

func (m *GoRuntimeModule) LeaderboardDelete(ctx context.Context, id string) error

func (*GoRuntimeModule) LeaderboardList

func (m *GoRuntimeModule) LeaderboardList(ctx context.Context, limit int, cursor string) ([]*Leaderboard, string, error)

func (*GoRuntimeModule) LeaderboardRanksDisable

func (m *GoRuntimeModule) LeaderboardRanksDisable(ctx context.Context, id string) error

func (*GoRuntimeModule) LeaderboardRecordDelete

func (m *GoRuntimeModule) LeaderboardRecordDelete(ctx context.Context, id, ownerID string) error

func (*GoRuntimeModule) LeaderboardRecordWrite

func (m *GoRuntimeModule) LeaderboardRecordWrite(ctx context.Context, id, ownerID, username string, score, subscore int64, metadata map[string]interface{}) (*LeaderboardRecord, error)

func (*GoRuntimeModule) LeaderboardRecordsAroundOwner

func (m *GoRuntimeModule) LeaderboardRecordsAroundOwner(ctx context.Context, id, ownerID string, limit int, expiry int64) ([]*LeaderboardRecord, error)

func (*GoRuntimeModule) LeaderboardRecordsHaystack

func (m *GoRuntimeModule) LeaderboardRecordsHaystack(ctx context.Context, id, ownerID string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)

func (*GoRuntimeModule) LeaderboardRecordsList

func (m *GoRuntimeModule) LeaderboardRecordsList(ctx context.Context, id string, ownerIDs []string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)

func (*GoRuntimeModule) LeaderboardRecordsListCursorFromRank

func (m *GoRuntimeModule) LeaderboardRecordsListCursorFromRank(ctx context.Context, leaderboardID string, rank, expiry int64) (string, error)

func (*GoRuntimeModule) LeaderboardsGetId

func (m *GoRuntimeModule) LeaderboardsGetId(ctx context.Context, ids []string) ([]*Leaderboard, error)

func (*GoRuntimeModule) LinkCustom

func (m *GoRuntimeModule) LinkCustom(ctx context.Context, userID, customID string) error

func (*GoRuntimeModule) LinkDevice

func (m *GoRuntimeModule) LinkDevice(ctx context.Context, userID, deviceID string) error

func (*GoRuntimeModule) LinkEmail

func (m *GoRuntimeModule) LinkEmail(ctx context.Context, userID, email, password string) error

func (*GoRuntimeModule) LocalCacheGet

func (m *GoRuntimeModule) LocalCacheGet(key string) (interface{}, bool)

func (*GoRuntimeModule) LocalCacheSet

func (m *GoRuntimeModule) LocalCacheSet(key string, value interface{}, ttlSec int64)

func (*GoRuntimeModule) MatchCreate

func (m *GoRuntimeModule) MatchCreate(ctx context.Context, module string, params map[string]interface{}) (string, error)

func (*GoRuntimeModule) MatchGet

func (m *GoRuntimeModule) MatchGet(ctx context.Context, matchID string) (*MatchInfo, error)

func (*GoRuntimeModule) MatchList

func (m *GoRuntimeModule) MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize int) ([]*MatchInfo, error)

func (*GoRuntimeModule) MatchSignal

func (m *GoRuntimeModule) MatchSignal(ctx context.Context, matchID, data string) (string, error)

func (*GoRuntimeModule) MultiUpdate

func (m *GoRuntimeModule) MultiUpdate(ctx context.Context, accountUpdates []*AccountUpdateParams, storageWrites []*StorageWrite, storageDeletes []*StorageDelete, walletUpdates []*WalletUpdateParams, updateLedger bool) ([]*StorageObjectAck, []*WalletUpdateResultView, error)

func (*GoRuntimeModule) NotificationSend

func (m *GoRuntimeModule) NotificationSend(ctx context.Context, userID, subject string, content map[string]interface{}, code int, senderID string, persistent bool) error

func (*GoRuntimeModule) NotificationSendAll

func (m *GoRuntimeModule) NotificationSendAll(ctx context.Context, subject string, content map[string]interface{}, code int, persistent bool) error

func (*GoRuntimeModule) NotificationsDelete

func (m *GoRuntimeModule) NotificationsDelete(ctx context.Context, userID string, ids []string) error

func (*GoRuntimeModule) NotificationsDeleteId

func (m *GoRuntimeModule) NotificationsDeleteId(ctx context.Context, userID string, ids []string) error

func (*GoRuntimeModule) NotificationsGetId

func (m *GoRuntimeModule) NotificationsGetId(ctx context.Context, userID string, ids []string) ([]*NotificationView, error)

func (*GoRuntimeModule) NotificationsList

func (m *GoRuntimeModule) NotificationsList(ctx context.Context, userID string, limit int, cursor string) ([]*NotificationView, string, error)

func (*GoRuntimeModule) NotificationsSend

func (m *GoRuntimeModule) NotificationsSend(ctx context.Context, notifications []*NotificationSendParams) error

func (*GoRuntimeModule) NotificationsUpdate

func (m *GoRuntimeModule) NotificationsUpdate(ctx context.Context, updates []*NotificationUpdateParams) error

func (*GoRuntimeModule) PartyList

func (m *GoRuntimeModule) PartyList(ctx context.Context, limit int, open *bool, showHidden bool, query, cursor string) ([]*PartyListEntry, string, error)

func (*GoRuntimeModule) PurchaseValidateApple

func (m *GoRuntimeModule) PurchaseValidateApple(ctx context.Context, userID, receipt string, persist bool) (*ValidatedPurchaseView, error)

func (*GoRuntimeModule) PurchaseValidateFacebookInstant

func (m *GoRuntimeModule) PurchaseValidateFacebookInstant(ctx context.Context, userID, signedRequest string, persist bool) (*ValidatedPurchaseView, error)

func (*GoRuntimeModule) PurchaseValidateGoogle

func (m *GoRuntimeModule) PurchaseValidateGoogle(ctx context.Context, userID, productID, purchaseToken string, persist bool) (*ValidatedPurchaseView, error)

func (*GoRuntimeModule) PurchaseValidateHuawei

func (m *GoRuntimeModule) PurchaseValidateHuawei(ctx context.Context, userID, purchaseData, signature string, persist bool) (*ValidatedPurchaseView, error)

func (*GoRuntimeModule) PurchaseValidateSamsung

func (m *GoRuntimeModule) PurchaseValidateSamsung(ctx context.Context, userID, purchaseID string, persist bool) (*ValidatedPurchaseView, error)

func (*GoRuntimeModule) PurchasesList

func (m *GoRuntimeModule) PurchasesList(ctx context.Context, userID string, limit int) ([]*ValidatedPurchaseView, error)

func (*GoRuntimeModule) RegisterStorageIndex

func (m *GoRuntimeModule) RegisterStorageIndex(name, collection, key string, fields, sortableFields []string, maxEntries int, indexOnly bool) error

func (*GoRuntimeModule) RegisterStorageIndexFilter

func (m *GoRuntimeModule) RegisterStorageIndexFilter(indexName string, fn func(ctx context.Context, write *storage.StorageObject) (bool, error)) error

func (*GoRuntimeModule) RpcCall

func (m *GoRuntimeModule) RpcCall(ctx context.Context, id, payload string) (string, error)

RpcCall invokes another RPC from the runtime (server-to-server style).

func (*GoRuntimeModule) SessionDisconnect

func (m *GoRuntimeModule) SessionDisconnect(sessionID string) error

func (*GoRuntimeModule) SessionLogout

func (m *GoRuntimeModule) SessionLogout(userID, token, refreshToken string) error

func (*GoRuntimeModule) SetAuthSession

func (m *GoRuntimeModule) SetAuthSession(tm *auth.TokenManager, store auth.SessionStore)

SetAuthSession wires JWT minting and session logout into the runtime module.

func (*GoRuntimeModule) SetFleetManager

func (m *GoRuntimeModule) SetFleetManager(fm fleet.Manager)

func (*GoRuntimeModule) SetMatchRegistry

func (m *GoRuntimeModule) SetMatchRegistry(reg MatchRegistry)

func (*GoRuntimeModule) SetPartyLister

func (m *GoRuntimeModule) SetPartyLister(l PartyLister)

func (*GoRuntimeModule) SetRPCDispatcher

func (m *GoRuntimeModule) SetRPCDispatcher(fn RPCDispatcherFunc)

func (*GoRuntimeModule) SetSatoriClient

func (m *GoRuntimeModule) SetSatoriClient(c *satori.Client)

func (*GoRuntimeModule) SetStatusFollower

func (m *GoRuntimeModule) SetStatusFollower(sf StatusFollower)

func (*GoRuntimeModule) SetStorageIndex

func (m *GoRuntimeModule) SetStorageIndex(idx *storage.BlugeStorageIndex)

func (*GoRuntimeModule) SetStreamManager

func (m *GoRuntimeModule) SetStreamManager(sm StreamManager)

func (*GoRuntimeModule) SqlExec

func (m *GoRuntimeModule) SqlExec(ctx context.Context, query string, args []interface{}) (int64, error)

func (*GoRuntimeModule) SqlQuery

func (m *GoRuntimeModule) SqlQuery(ctx context.Context, query string, args []interface{}) ([]map[string]interface{}, error)

func (*GoRuntimeModule) StatusFollow

func (m *GoRuntimeModule) StatusFollow(sessionID string, userIDs []string) error

func (*GoRuntimeModule) StatusUnfollow

func (m *GoRuntimeModule) StatusUnfollow(sessionID string, userIDs []string) error

func (*GoRuntimeModule) StorageDelete

func (m *GoRuntimeModule) StorageDelete(ctx context.Context, deletes []*StorageDelete) error

func (*GoRuntimeModule) StorageIndexList

func (m *GoRuntimeModule) StorageIndexList(ctx context.Context, callerID, indexName, query string, limit int, order []string, cursor string) ([]*StorageObject, string, error)

func (*GoRuntimeModule) StorageList

func (m *GoRuntimeModule) StorageList(ctx context.Context, callerID, userID, collection string, limit int, cursor string) ([]*StorageObject, string, error)

func (*GoRuntimeModule) StorageRead

func (m *GoRuntimeModule) StorageRead(ctx context.Context, reads []*StorageRead) ([]*StorageObject, error)

func (*GoRuntimeModule) StorageWrite

func (m *GoRuntimeModule) StorageWrite(ctx context.Context, writes []*StorageWrite) ([]*StorageObjectAck, error)

func (*GoRuntimeModule) StorageWriteRetry

func (m *GoRuntimeModule) StorageWriteRetry(ctx context.Context, reads []*StorageRead, updateFn func([]*StorageObject) ([]*StorageWrite, error), maxRetries int) ([]*StorageObjectAck, error)

func (*GoRuntimeModule) StreamClose

func (m *GoRuntimeModule) StreamClose(mode int16, subject, subcontext, label string) error

func (*GoRuntimeModule) StreamCount

func (m *GoRuntimeModule) StreamCount(mode int16, subject, subcontext, label string) (int, error)

func (*GoRuntimeModule) StreamSend

func (m *GoRuntimeModule) StreamSend(mode int16, subject, subcontext, label, data string, sessionIDs []string, reliable bool) error

func (*GoRuntimeModule) StreamSendRaw

func (m *GoRuntimeModule) StreamSendRaw(mode int16, subject, subcontext, label string, data []byte, sessionIDs []string, reliable bool) error

func (*GoRuntimeModule) StreamUserGet

func (m *GoRuntimeModule) StreamUserGet(mode int16, subject, subcontext, label, userID, sessionID string) (*StreamPresenceView, error)

func (*GoRuntimeModule) StreamUserJoin

func (m *GoRuntimeModule) StreamUserJoin(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) (bool, error)

func (*GoRuntimeModule) StreamUserKick

func (m *GoRuntimeModule) StreamUserKick(mode int16, subject, subcontext, label string, presence StreamPresenceView) error

func (*GoRuntimeModule) StreamUserLeave

func (m *GoRuntimeModule) StreamUserLeave(mode int16, subject, subcontext, label, userID, sessionID string) error

func (*GoRuntimeModule) StreamUserList

func (m *GoRuntimeModule) StreamUserList(mode int16, subject, subcontext, label string, includeHidden, includeNotHidden bool) ([]StreamPresenceView, error)

func (*GoRuntimeModule) StreamUserUpdate

func (m *GoRuntimeModule) StreamUserUpdate(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) error

func (*GoRuntimeModule) SubscriptionGetProductID

func (m *GoRuntimeModule) SubscriptionGetProductID(ctx context.Context, userID, productID string) (*ValidatedSubscriptionView, error)

func (*GoRuntimeModule) SubscriptionValidateApple

func (m *GoRuntimeModule) SubscriptionValidateApple(ctx context.Context, userID, receipt string, persist bool) (*ValidatedSubscriptionView, error)

func (*GoRuntimeModule) SubscriptionValidateGoogle

func (m *GoRuntimeModule) SubscriptionValidateGoogle(ctx context.Context, userID, productID, purchaseToken string, persist bool) (*ValidatedSubscriptionView, error)

func (*GoRuntimeModule) SubscriptionsList

func (m *GoRuntimeModule) SubscriptionsList(ctx context.Context, userID string, limit int) ([]*ValidatedSubscriptionView, error)

func (*GoRuntimeModule) TournamentAddAttempt

func (m *GoRuntimeModule) TournamentAddAttempt(ctx context.Context, id, ownerID string, count int) error

func (*GoRuntimeModule) TournamentCreate

func (m *GoRuntimeModule) TournamentCreate(ctx context.Context, id string, authoritative bool, sortOrder, operator int, resetSchedule string, metadata map[string]interface{}, title, description string, category int, startTime, endTime int64, duration, maxSize, maxNumScore int, joinRequired, enableRanks bool) error

func (*GoRuntimeModule) TournamentDelete

func (m *GoRuntimeModule) TournamentDelete(ctx context.Context, id string) error

func (*GoRuntimeModule) TournamentJoin

func (m *GoRuntimeModule) TournamentJoin(ctx context.Context, id, ownerID, username string) error

func (*GoRuntimeModule) TournamentList

func (m *GoRuntimeModule) TournamentList(ctx context.Context, categoryStart, categoryEnd int, startTime, endTime int64, limit int, cursor string, active bool) ([]*TournamentView, string, error)

func (*GoRuntimeModule) TournamentRanksDisable

func (m *GoRuntimeModule) TournamentRanksDisable(ctx context.Context, id string) error

func (*GoRuntimeModule) TournamentRecordDelete

func (m *GoRuntimeModule) TournamentRecordDelete(ctx context.Context, id, ownerID string) error

func (*GoRuntimeModule) TournamentRecordWrite

func (m *GoRuntimeModule) TournamentRecordWrite(ctx context.Context, id, ownerID, username string, score, subscore int64, metadata map[string]interface{}) (*LeaderboardRecord, error)

func (*GoRuntimeModule) TournamentRecordsAroundOwner

func (m *GoRuntimeModule) TournamentRecordsAroundOwner(ctx context.Context, id, ownerID string, limit int, expiry int64) ([]*LeaderboardRecord, error)

func (*GoRuntimeModule) TournamentRecordsHaystack

func (m *GoRuntimeModule) TournamentRecordsHaystack(ctx context.Context, id, ownerID string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)

func (*GoRuntimeModule) TournamentRecordsList

func (m *GoRuntimeModule) TournamentRecordsList(ctx context.Context, id string, ownerIDs []string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)

func (*GoRuntimeModule) TournamentsGetId

func (m *GoRuntimeModule) TournamentsGetId(ctx context.Context, ids []string) ([]*Leaderboard, error)

func (*GoRuntimeModule) UnlinkCustom

func (m *GoRuntimeModule) UnlinkCustom(ctx context.Context, userID string) error

func (*GoRuntimeModule) UnlinkDevice

func (m *GoRuntimeModule) UnlinkDevice(ctx context.Context, userID, deviceID string) error

func (*GoRuntimeModule) UnlinkEmail

func (m *GoRuntimeModule) UnlinkEmail(ctx context.Context, userID string) error

func (*GoRuntimeModule) UserGroupsList

func (m *GoRuntimeModule) UserGroupsList(ctx context.Context, userID string, limit int, cursor string) ([]*UserGroupView, string, error)

func (*GoRuntimeModule) UsersBanId

func (m *GoRuntimeModule) UsersBanId(ctx context.Context, userIDs []string) error

func (*GoRuntimeModule) UsersGetFriendStatus

func (m *GoRuntimeModule) UsersGetFriendStatus(ctx context.Context, userID string, friendIDs []string) (map[string]int, error)

func (*GoRuntimeModule) UsersGetId

func (m *GoRuntimeModule) UsersGetId(ctx context.Context, userIDs []string) ([]*UserView, error)

func (*GoRuntimeModule) UsersGetRandom

func (m *GoRuntimeModule) UsersGetRandom(ctx context.Context, count int) ([]*UserView, error)

func (*GoRuntimeModule) UsersGetUsername

func (m *GoRuntimeModule) UsersGetUsername(ctx context.Context, usernames []string) ([]*UserView, error)

func (*GoRuntimeModule) UsersUnbanId

func (m *GoRuntimeModule) UsersUnbanId(ctx context.Context, userIDs []string) error

func (*GoRuntimeModule) UuidV4

func (m *GoRuntimeModule) UuidV4() string

func (*GoRuntimeModule) WalletLedgerList

func (m *GoRuntimeModule) WalletLedgerList(ctx context.Context, userID string, limit int, cursor string) ([]*WalletLedgerView, string, error)

func (*GoRuntimeModule) WalletLedgerUpdate

func (m *GoRuntimeModule) WalletLedgerUpdate(ctx context.Context, ledgerID, userID string, metadata map[string]interface{}) error

func (*GoRuntimeModule) WalletUpdate

func (m *GoRuntimeModule) WalletUpdate(ctx context.Context, userID string, changeset map[string]int64, metadata map[string]interface{}, updateLedger bool) (map[string]int64, map[string]int64, error)

func (*GoRuntimeModule) WalletsUpdate

func (m *GoRuntimeModule) WalletsUpdate(ctx context.Context, updates []*WalletUpdateParams, updateLedger bool) ([]*WalletUpdateResultView, error)

type GroupList

type GroupList struct {
	Groups     []*GroupView `json:"groups"`
	NextCursor string       `json:"next_cursor,omitempty"`
}

type GroupUser

type GroupUser struct {
	User  *UserView `json:"user"`
	State int       `json:"state"`
}

type GroupUserList

type GroupUserList struct {
	GroupUsers []*GroupUser `json:"group_users"`
	NextCursor string       `json:"next_cursor,omitempty"`
}

type GroupUserView

type GroupUserView struct {
	UserID   string `json:"user_id"`
	Username string `json:"username"`
	State    int    `json:"state"`
}

GroupUserView is a runtime group member row.

type GroupView

type GroupView struct {
	ID          string `json:"id"`
	CreatorID   string `json:"creator_id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	AvatarURL   string `json:"avatar_url"`
	LangTag     string `json:"lang_tag"`
	Metadata    string `json:"metadata"`
	Open        bool   `json:"open"`
	EdgeCount   int    `json:"edge_count"`
	MaxCount    int    `json:"max_count"`
}

GroupView is a runtime group record.

type HookRegistry

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

HookRegistry stores registered custom RPCs, before/after hooks, and cron jobs.

func NewHookRegistry

func NewHookRegistry() *HookRegistry

NewHookRegistry creates a new instance of HookRegistry.

func (*HookRegistry) ConsoleHTTPHandlers

func (hr *HookRegistry) ConsoleHTTPHandlers() []*RuntimeHTTPHandler

ConsoleHTTPHandlers returns a snapshot of console custom HTTP handlers.

func (*HookRegistry) DispatchEvent

func (hr *HookRegistry) DispatchEvent(ctx context.Context, logger Logger, evt *Event)

DispatchEvent fans out to all registered event handlers asynchronously.

func (*HookRegistry) EventHandlers

func (hr *HookRegistry) EventHandlers() []EventHandler

EventHandlers returns a snapshot of registered event handlers.

func (*HookRegistry) GetAfter

func (hr *HookRegistry) GetAfter(name string) (AfterHook, bool)

GetAfter retrieves an after hook.

func (*HookRegistry) GetAfterHook

func (hr *HookRegistry) GetAfterHook(name string) (AfterHook, string, string, bool)

GetAfterHook retrieves an after hook.

func (*HookRegistry) GetBefore

func (hr *HookRegistry) GetBefore(name string) (BeforeHook, bool)

GetBefore retrieves a before hook.

func (*HookRegistry) GetBeforeHook

func (hr *HookRegistry) GetBeforeHook(name string) (BeforeHook, string, string, bool)

GetBeforeHook retrieves a before hook, returning runtime type and script function name if script-based.

func (*HookRegistry) GetLeaderboardReset

func (hr *HookRegistry) GetLeaderboardReset() LeaderboardResetHandler

func (*HookRegistry) GetMatch

func (hr *HookRegistry) GetMatch(name string) (MatchHandlerFactory, bool)

GetMatch retrieves a registered match handler factory.

func (*HookRegistry) GetMatchmakerMatched

func (hr *HookRegistry) GetMatchmakerMatched() MatchmakerMatchedHandler

func (*HookRegistry) GetMatchmakerOverride

func (hr *HookRegistry) GetMatchmakerOverride() MatchmakerOverrideHandler

func (*HookRegistry) GetMatchmakerProcessor

func (hr *HookRegistry) GetMatchmakerProcessor() MatchmakerProcessorHandler

func (*HookRegistry) GetPurchaseNotificationApple

func (hr *HookRegistry) GetPurchaseNotificationApple() PurchaseNotificationAppleHandler

func (*HookRegistry) GetPurchaseNotificationGoogle

func (hr *HookRegistry) GetPurchaseNotificationGoogle() PurchaseNotificationGoogleHandler

func (*HookRegistry) GetRPC

func (hr *HookRegistry) GetRPC(rpcName string) (RPCHandler, bool)

GetRPC retrieves an RPC handler.

func (*HookRegistry) GetRPCHook

func (hr *HookRegistry) GetRPCHook(name string) (RPCHandler, string, string, bool)

GetRPCHook retrieves an RPC handler.

func (*HookRegistry) GetSubscriptionNotificationApple

func (hr *HookRegistry) GetSubscriptionNotificationApple() SubscriptionNotificationAppleHandler

func (*HookRegistry) GetSubscriptionNotificationGoogle

func (hr *HookRegistry) GetSubscriptionNotificationGoogle() SubscriptionNotificationGoogleHandler

func (*HookRegistry) GetTournamentEnd

func (hr *HookRegistry) GetTournamentEnd() TournamentEndHandler

func (*HookRegistry) GetTournamentReset

func (hr *HookRegistry) GetTournamentReset() TournamentResetHandler

func (*HookRegistry) HTTPHandlers

func (hr *HookRegistry) HTTPHandlers() []*RuntimeHTTPHandler

HTTPHandlers returns a snapshot of client-API custom HTTP handlers.

func (*HookRegistry) InvokeShutdown

func (hr *HookRegistry) InvokeShutdown(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule)

InvokeShutdown runs all shutdown handlers synchronously with panic recovery.

func (*HookRegistry) ListCronJobs

func (hr *HookRegistry) ListCronJobs() map[string]*CronJob

ListCronJobs returns a snapshot of registered cron jobs.

func (*HookRegistry) RegisterAfter

func (hr *HookRegistry) RegisterAfter(name string, hook AfterHook)

RegisterAfter registers a response after hook.

func (*HookRegistry) RegisterBefore

func (hr *HookRegistry) RegisterBefore(name string, hook BeforeHook)

RegisterBefore registers a request before hook.

func (*HookRegistry) RegisterConsoleHttp

func (hr *HookRegistry) RegisterConsoleHttp(pathPattern string, handler func(http.ResponseWriter, *http.Request), methods ...string)

RegisterConsoleHttp stores a custom console HTTP handler.

func (*HookRegistry) RegisterCron

func (hr *HookRegistry) RegisterCron(jobName string, cron *CronJob) error

RegisterCron registers a scheduled background cron job. Schedule must be a valid cronexpr (5–7 fields). Invalid schedules are rejected.

func (*HookRegistry) RegisterEvent

func (hr *HookRegistry) RegisterEvent(handler EventHandler)

RegisterEvent registers an event handler.

func (*HookRegistry) RegisterEventSessionEnd

func (hr *HookRegistry) RegisterEventSessionEnd(handler EventHandler)

RegisterEventSessionEnd registers a session_end-specific handler.

func (*HookRegistry) RegisterEventSessionStart

func (hr *HookRegistry) RegisterEventSessionStart(handler EventHandler)

RegisterEventSessionStart registers a session_start-specific handler.

func (*HookRegistry) RegisterHttp

func (hr *HookRegistry) RegisterHttp(pathPattern string, handler func(http.ResponseWriter, *http.Request), methods ...string)

RegisterHttp stores a custom client-API HTTP handler.

func (*HookRegistry) RegisterJSAfter

func (hr *HookRegistry) RegisterJSAfter(name, fnName string)

func (*HookRegistry) RegisterJSBefore

func (hr *HookRegistry) RegisterJSBefore(name, fnName string)

func (*HookRegistry) RegisterJSRPC

func (hr *HookRegistry) RegisterJSRPC(name, fnName string)

func (*HookRegistry) RegisterLeaderboardReset

func (hr *HookRegistry) RegisterLeaderboardReset(fn LeaderboardResetHandler)

func (*HookRegistry) RegisterLuaAfter

func (hr *HookRegistry) RegisterLuaAfter(name, fnName string)

func (*HookRegistry) RegisterLuaBefore

func (hr *HookRegistry) RegisterLuaBefore(name, fnName string)

func (*HookRegistry) RegisterLuaRPC

func (hr *HookRegistry) RegisterLuaRPC(name, fnName string)

func (*HookRegistry) RegisterMatch

func (hr *HookRegistry) RegisterMatch(name string, factory MatchHandlerFactory) error

RegisterMatch registers a match handler factory.

func (*HookRegistry) RegisterMatchmakerMatched

func (hr *HookRegistry) RegisterMatchmakerMatched(fn MatchmakerMatchedHandler)

func (*HookRegistry) RegisterMatchmakerOverride

func (hr *HookRegistry) RegisterMatchmakerOverride(fn MatchmakerOverrideHandler)

func (*HookRegistry) RegisterMatchmakerProcessor

func (hr *HookRegistry) RegisterMatchmakerProcessor(fn MatchmakerProcessorHandler)

func (*HookRegistry) RegisterPurchaseNotificationApple

func (hr *HookRegistry) RegisterPurchaseNotificationApple(fn PurchaseNotificationAppleHandler)

func (*HookRegistry) RegisterPurchaseNotificationGoogle

func (hr *HookRegistry) RegisterPurchaseNotificationGoogle(fn PurchaseNotificationGoogleHandler)

func (*HookRegistry) RegisterRPC

func (hr *HookRegistry) RegisterRPC(rpcName string, handler RPCHandler)

RegisterRPC registers a custom RPC endpoint handler.

func (*HookRegistry) RegisterShutdown

func (hr *HookRegistry) RegisterShutdown(fn ShutdownHandler)

RegisterShutdown registers a shutdown handler.

func (*HookRegistry) RegisterSubscriptionNotificationApple

func (hr *HookRegistry) RegisterSubscriptionNotificationApple(fn SubscriptionNotificationAppleHandler)

func (*HookRegistry) RegisterSubscriptionNotificationGoogle

func (hr *HookRegistry) RegisterSubscriptionNotificationGoogle(fn SubscriptionNotificationGoogleHandler)

func (*HookRegistry) RegisterTournamentEnd

func (hr *HookRegistry) RegisterTournamentEnd(fn TournamentEndHandler)

func (*HookRegistry) RegisterTournamentReset

func (hr *HookRegistry) RegisterTournamentReset(fn TournamentResetHandler)

func (*HookRegistry) SessionEndHandlers

func (hr *HookRegistry) SessionEndHandlers() []EventHandler

SessionEndHandlers returns a snapshot of session_end handlers.

func (*HookRegistry) SessionStartHandlers

func (hr *HookRegistry) SessionStartHandlers() []EventHandler

SessionStartHandlers returns a snapshot of session_start handlers.

func (*HookRegistry) ShutdownHandlers

func (hr *HookRegistry) ShutdownHandlers() []ShutdownHandler

ShutdownHandlers returns a snapshot of shutdown handlers.

type ImportFacebookFriendsRequest

type ImportFacebookFriendsRequest struct {
	Token string `json:"token"`
	Reset *bool  `json:"reset"`
}

type ImportSteamFriendsRequest

type ImportSteamFriendsRequest struct {
	Token string `json:"token"`
	Reset *bool  `json:"reset"`
}

type InitModuleFunc

type InitModuleFunc func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, initializer Initializer) error

InitModuleFunc is the required entry point signature for Go runtime modules. Go plugins (.so files) must export a function with this exact signature named "InitModule".

type Initializer

type Initializer interface {
	RegisterRpc(id string, fn RPCHandler) error
	RegisterBeforeRt(id string, fn BeforeHook) error
	RegisterAfterRt(id string, fn AfterHook) error
	RegisterMatch(name string, fn MatchHandlerFactory) error
	RegisterMatchmakerMatched(fn MatchmakerMatchedHandler) error
	RegisterMatchmakerOverride(fn MatchmakerOverrideHandler) error
	RegisterMatchmakerProcessor(fn MatchmakerProcessorHandler) error
	RegisterLeaderboardReset(fn LeaderboardResetHandler) error
	RegisterTournamentEnd(fn TournamentEndHandler) error
	RegisterTournamentReset(fn TournamentResetHandler) error
	RegisterEvent(fn EventHandler) error
	RegisterEventSessionStart(fn EventHandler) error
	RegisterEventSessionEnd(fn EventHandler) error
	RegisterShutdown(fn ShutdownHandler) error
	RegisterHttp(pathPattern string, handler func(http.ResponseWriter, *http.Request), methods ...string) error
	RegisterConsoleHttp(pathPattern string, handler func(http.ResponseWriter, *http.Request), methods ...string) error
	RegisterCron(name, schedule string, fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule) error) error

	// Specific type-safe before hooks
	RegisterBeforeAuthenticateEmail(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateEmailRequest) (*AuthenticateEmailRequest, error)) error
	RegisterBeforeAuthenticateDevice(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateDeviceRequest) (*AuthenticateDeviceRequest, error)) error
	RegisterBeforeAuthenticateCustom(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateCustomRequest) (*AuthenticateCustomRequest, error)) error
	RegisterBeforeAuthenticateApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateAppleRequest) (*AuthenticateAppleRequest, error)) error
	RegisterBeforeAuthenticateGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateGoogleRequest) (*AuthenticateGoogleRequest, error)) error
	RegisterBeforeAuthenticateFacebook(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateFacebookRequest) (*AuthenticateFacebookRequest, error)) error
	RegisterBeforeAuthenticateSteam(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateSteamRequest) (*AuthenticateSteamRequest, error)) error
	RegisterBeforeSessionRefresh(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *SessionRefreshRequest) (*SessionRefreshRequest, error)) error
	RegisterBeforeSessionLogout(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *SessionLogoutRequest) (*SessionLogoutRequest, error)) error
	RegisterBeforeWriteStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *WriteStorageObjectsRequest) (*WriteStorageObjectsRequest, error)) error
	RegisterBeforeReadStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ReadStorageObjectsRequest) (*ReadStorageObjectsRequest, error)) error
	RegisterBeforeDeleteStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteStorageObjectsRequest) (*DeleteStorageObjectsRequest, error)) error
	RegisterBeforeListStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListStorageObjectsRequest) (*ListStorageObjectsRequest, error)) error
	RegisterBeforeAddFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AddFriendsRequest) (*AddFriendsRequest, error)) error
	RegisterBeforeDeleteFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteFriendsRequest) (*DeleteFriendsRequest, error)) error
	RegisterBeforeListFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListFriendsRequest) (*ListFriendsRequest, error)) error
	RegisterBeforeBlockFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *BlockFriendsRequest) (*BlockFriendsRequest, error)) error
	RegisterBeforeWriteLeaderboardRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *WriteLeaderboardRecordRequest) (*WriteLeaderboardRecordRequest, error)) error
	RegisterBeforeListLeaderboardRecords(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListLeaderboardRecordsRequest) (*ListLeaderboardRecordsRequest, error)) error
	RegisterBeforeJoinTournament(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *JoinTournamentRequest) (*JoinTournamentRequest, error)) error
	RegisterBeforeWriteTournamentRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *WriteTournamentRecordRequest) (*WriteTournamentRecordRequest, error)) error
	RegisterBeforeJoinGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *JoinGroupRequest) (*JoinGroupRequest, error)) error
	RegisterBeforeCreateGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *CreateGroupRequest) (*CreateGroupRequest, error)) error
	RegisterBeforeLeaveGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LeaveGroupRequest) (*LeaveGroupRequest, error)) error
	RegisterBeforeCreateMatch(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *CreateMatchRequest) (*CreateMatchRequest, error)) error
	RegisterBeforeListMatches(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListMatchesRequest) (*ListMatchesRequest, error)) error
	RegisterBeforeListChannelMessages(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListChannelMessagesRequest) (*ListChannelMessagesRequest, error)) error
	RegisterBeforeEvent(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *EventRequest) (*EventRequest, error)) error
	RegisterBeforeGetAccount(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *GetAccountRequest) (*GetAccountRequest, error)) error
	RegisterBeforeUpdateAccount(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UpdateAccountRequest) (*UpdateAccountRequest, error)) error
	RegisterBeforeDeleteAccount(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteAccountRequest) (*DeleteAccountRequest, error)) error
	RegisterBeforeGetWallet(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *GetWalletRequest) (*GetWalletRequest, error)) error
	RegisterBeforeListWalletLedger(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListWalletLedgerRequest) (*ListWalletLedgerRequest, error)) error

	RegisterBeforeLinkApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkAppleRequest) (*LinkAppleRequest, error)) error
	RegisterBeforeLinkGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkGoogleRequest) (*LinkGoogleRequest, error)) error
	RegisterBeforeLinkFacebook(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkFacebookRequest) (*LinkFacebookRequest, error)) error
	RegisterBeforeLinkSteam(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkSteamRequest) (*LinkSteamRequest, error)) error
	RegisterBeforeLinkDevice(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkDeviceRequest) (*LinkDeviceRequest, error)) error
	RegisterBeforeLinkCustom(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkCustomRequest) (*LinkCustomRequest, error)) error
	RegisterBeforeLinkEmail(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkEmailRequest) (*LinkEmailRequest, error)) error
	RegisterBeforeUnlinkApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkAppleRequest) (*UnlinkAppleRequest, error)) error
	RegisterBeforeUnlinkGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkGoogleRequest) (*UnlinkGoogleRequest, error)) error
	RegisterBeforeUnlinkFacebook(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkFacebookRequest) (*UnlinkFacebookRequest, error)) error
	RegisterBeforeUnlinkSteam(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkSteamRequest) (*UnlinkSteamRequest, error)) error
	RegisterBeforeUnlinkDevice(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkDeviceRequest) (*UnlinkDeviceRequest, error)) error
	RegisterBeforeUnlinkCustom(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkCustomRequest) (*UnlinkCustomRequest, error)) error
	RegisterBeforeUnlinkEmail(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkEmailRequest) (*UnlinkEmailRequest, error)) error
	RegisterBeforeValidatePurchaseApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ValidatePurchaseAppleRequest) (*ValidatePurchaseAppleRequest, error)) error
	RegisterBeforeValidatePurchaseGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ValidatePurchaseGoogleRequest) (*ValidatePurchaseGoogleRequest, error)) error
	RegisterBeforeValidatePurchaseHuawei(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ValidatePurchaseHuaweiRequest) (*ValidatePurchaseHuaweiRequest, error)) error
	RegisterBeforeValidateSubscriptionApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ValidateSubscriptionAppleRequest) (*ValidateSubscriptionAppleRequest, error)) error
	RegisterBeforeValidateSubscriptionGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ValidateSubscriptionGoogleRequest) (*ValidateSubscriptionGoogleRequest, error)) error
	RegisterBeforeBanGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *BanGroupUsersRequest) (*BanGroupUsersRequest, error)) error
	RegisterBeforeKickGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *KickGroupUsersRequest) (*KickGroupUsersRequest, error)) error
	RegisterBeforePromoteGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *PromoteGroupUsersRequest) (*PromoteGroupUsersRequest, error)) error
	RegisterBeforeDemoteGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DemoteGroupUsersRequest) (*DemoteGroupUsersRequest, error)) error
	RegisterBeforeAddGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AddGroupUsersRequest) (*AddGroupUsersRequest, error)) error
	RegisterBeforeUpdateGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UpdateGroupRequest) (*UpdateGroupRequest, error)) error
	RegisterBeforeDeleteGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteGroupRequest) (*DeleteGroupRequest, error)) error
	RegisterBeforeListGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListGroupUsersRequest) (*ListGroupUsersRequest, error)) error
	RegisterBeforeListUserGroups(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListUserGroupsRequest) (*ListUserGroupsRequest, error)) error
	RegisterBeforeListNotifications(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListNotificationsRequest) (*ListNotificationsRequest, error)) error
	RegisterBeforeDeleteNotifications(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteNotificationsRequest) (*DeleteNotificationsRequest, error)) error
	RegisterBeforeListFriendsOfFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListFriendsOfFriendsRequest) (*ListFriendsOfFriendsRequest, error)) error
	RegisterBeforeCreateParty(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *CreatePartyRequest) (*CreatePartyRequest, error)) error
	RegisterBeforeJoinParty(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *JoinPartyRequest) (*JoinPartyRequest, error)) error
	RegisterBeforeLeaveParty(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LeavePartyRequest) (*LeavePartyRequest, error)) error
	RegisterBeforeListTournaments(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListTournamentsRequest) (*ListTournamentsRequest, error)) error

	RegisterBeforeAuthenticateGameCenter(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateGameCenterRequest) (*AuthenticateGameCenterRequest, error)) error
	RegisterBeforeAuthenticateFacebookInstantGame(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AuthenticateFacebookInstantGameRequest) (*AuthenticateFacebookInstantGameRequest, error)) error
	RegisterBeforeLinkGameCenter(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkGameCenterRequest) (*LinkGameCenterRequest, error)) error
	RegisterBeforeLinkFacebookInstantGame(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkFacebookInstantGameRequest) (*LinkFacebookInstantGameRequest, error)) error
	RegisterBeforeUnlinkGameCenter(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkGameCenterRequest) (*UnlinkGameCenterRequest, error)) error
	RegisterBeforeUnlinkFacebookInstantGame(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkFacebookInstantGameRequest) (*UnlinkFacebookInstantGameRequest, error)) error
	RegisterBeforeValidatePurchaseFacebookInstant(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ValidatePurchaseFacebookInstantRequest) (*ValidatePurchaseFacebookInstantRequest, error)) error
	RegisterBeforeValidatePurchaseSamsung(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ValidatePurchaseSamsungRequest) (*ValidatePurchaseSamsungRequest, error)) error
	RegisterBeforeGetSubscription(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *GetSubscriptionRequest) (*GetSubscriptionRequest, error)) error
	RegisterBeforeListSubscriptions(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListSubscriptionsRequest) (*ListSubscriptionsRequest, error)) error
	RegisterBeforeGetMatchmakerStats(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *GetMatchmakerStatsRequest) (*GetMatchmakerStatsRequest, error)) error
	RegisterBeforeListParties(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListPartiesRequest) (*ListPartiesRequest, error)) error
	RegisterBeforeGetUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *GetUsersRequest) (*GetUsersRequest, error)) error
	RegisterBeforeListGroups(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListGroupsRequest) (*ListGroupsRequest, error)) error
	RegisterBeforeDeleteLeaderboardRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteLeaderboardRecordRequest) (*DeleteLeaderboardRecordRequest, error)) error
	RegisterBeforeDeleteTournamentRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteTournamentRecordRequest) (*DeleteTournamentRecordRequest, error)) error
	RegisterBeforeListLeaderboardRecordsAroundOwner(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListLeaderboardRecordsAroundOwnerRequest) (*ListLeaderboardRecordsAroundOwnerRequest, error)) error
	RegisterBeforeListTournamentRecords(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListTournamentRecordsRequest) (*ListTournamentRecordsRequest, error)) error
	RegisterBeforeListTournamentRecordsAroundOwner(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ListTournamentRecordsAroundOwnerRequest) (*ListTournamentRecordsAroundOwnerRequest, error)) error
	RegisterBeforeImportFacebookFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ImportFacebookFriendsRequest) (*ImportFacebookFriendsRequest, error)) error
	RegisterBeforeImportSteamFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ImportSteamFriendsRequest) (*ImportSteamFriendsRequest, error)) error

	// Specific type-safe after hooks
	RegisterAfterAuthenticateEmail(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateEmailRequest) error) error
	RegisterAfterWriteStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *StorageObjectAcks, in *WriteStorageObjectsRequest) error) error
	RegisterAfterAddFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AddFriendsRequest) error) error
	RegisterAfterJoinGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *JoinGroupRequest) error) error
	RegisterAfterAuthenticateDevice(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateDeviceRequest) error) error
	RegisterAfterAuthenticateCustom(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateCustomRequest) error) error
	RegisterAfterAuthenticateApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateAppleRequest) error) error
	RegisterAfterAuthenticateGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateGoogleRequest) error) error
	RegisterAfterAuthenticateFacebook(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateFacebookRequest) error) error
	RegisterAfterAuthenticateSteam(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateSteamRequest) error) error
	RegisterAfterSessionRefresh(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *SessionRefreshRequest) error) error
	RegisterAfterReadStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *StorageObjectList, in *ReadStorageObjectsRequest) error) error
	RegisterAfterDeleteStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteStorageObjectsRequest) error) error
	RegisterAfterDeleteFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteFriendsRequest) error) error
	RegisterAfterBlockFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *BlockFriendsRequest) error) error
	RegisterAfterWriteLeaderboardRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *LeaderboardRecord, in *WriteLeaderboardRecordRequest) error) error
	RegisterAfterJoinTournament(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *JoinTournamentRequest) error) error
	RegisterAfterCreateGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *GroupView, in *CreateGroupRequest) error) error
	RegisterAfterLeaveGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LeaveGroupRequest) error) error
	RegisterAfterBanGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *BanGroupUsersRequest) error) error
	RegisterAfterKickGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *KickGroupUsersRequest) error) error
	RegisterAfterValidatePurchaseApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidatePurchaseResponse, in *ValidatePurchaseAppleRequest) error) error
	RegisterAfterValidatePurchaseGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidatePurchaseResponse, in *ValidatePurchaseGoogleRequest) error) error
	RegisterAfterLinkApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkAppleRequest) error) error
	RegisterAfterLinkGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkGoogleRequest) error) error
	RegisterAfterUpdateAccount(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UpdateAccountRequest) error) error
	RegisterAfterDeleteNotifications(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteNotificationsRequest) error) error
	RegisterAfterAuthenticateGameCenter(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateGameCenterRequest) error) error
	RegisterAfterAuthenticateFacebookInstantGame(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Session, in *AuthenticateFacebookInstantGameRequest) error) error
	RegisterAfterLinkFacebook(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkFacebookRequest) error) error
	RegisterAfterLinkSteam(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkSteamRequest) error) error
	RegisterAfterLinkDevice(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkDeviceRequest) error) error
	RegisterAfterLinkCustom(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkCustomRequest) error) error
	RegisterAfterLinkEmail(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkEmailRequest) error) error
	RegisterAfterLinkGameCenter(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkGameCenterRequest) error) error
	RegisterAfterLinkFacebookInstantGame(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *LinkFacebookInstantGameRequest) error) error
	RegisterAfterUnlinkApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkAppleRequest) error) error
	RegisterAfterUnlinkGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkGoogleRequest) error) error
	RegisterAfterUnlinkFacebook(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkFacebookRequest) error) error
	RegisterAfterUnlinkSteam(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkSteamRequest) error) error
	RegisterAfterUnlinkDevice(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkDeviceRequest) error) error
	RegisterAfterUnlinkCustom(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkCustomRequest) error) error
	RegisterAfterUnlinkEmail(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkEmailRequest) error) error
	RegisterAfterUnlinkGameCenter(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkGameCenterRequest) error) error
	RegisterAfterUnlinkFacebookInstantGame(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UnlinkFacebookInstantGameRequest) error) error
	RegisterAfterListStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *StorageObjectList, in *ListStorageObjectsRequest) error) error
	RegisterAfterListFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *FriendList, in *ListFriendsRequest) error) error
	RegisterAfterListFriendsOfFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *FriendsOfFriendsList, in *ListFriendsOfFriendsRequest) error) error
	RegisterAfterListLeaderboardRecords(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *LeaderboardRecordList, in *ListLeaderboardRecordsRequest) error) error
	RegisterAfterListLeaderboardRecordsAroundOwner(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *LeaderboardRecordList, in *ListLeaderboardRecordsAroundOwnerRequest) error) error
	RegisterAfterDeleteLeaderboardRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteLeaderboardRecordRequest) error) error
	RegisterAfterWriteTournamentRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *LeaderboardRecord, in *WriteTournamentRecordRequest) error) error
	RegisterAfterListTournaments(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *TournamentList, in *ListTournamentsRequest) error) error
	RegisterAfterListTournamentRecords(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *LeaderboardRecordList, in *ListTournamentRecordsRequest) error) error
	RegisterAfterListTournamentRecordsAroundOwner(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *LeaderboardRecordList, in *ListTournamentRecordsAroundOwnerRequest) error) error
	RegisterAfterDeleteTournamentRecord(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteTournamentRecordRequest) error) error
	RegisterAfterPromoteGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *PromoteGroupUsersRequest) error) error
	RegisterAfterDemoteGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DemoteGroupUsersRequest) error) error
	RegisterAfterAddGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *AddGroupUsersRequest) error) error
	RegisterAfterUpdateGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *UpdateGroupRequest) error) error
	RegisterAfterDeleteGroup(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteGroupRequest) error) error
	RegisterAfterListGroupUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *GroupUserList, in *ListGroupUsersRequest) error) error
	RegisterAfterListUserGroups(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *UserGroupList, in *ListUserGroupsRequest) error) error
	RegisterAfterListGroups(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *GroupList, in *ListGroupsRequest) error) error
	RegisterAfterListNotifications(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *NotificationList, in *ListNotificationsRequest) error) error
	RegisterAfterValidatePurchaseHuawei(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidatePurchaseResponse, in *ValidatePurchaseHuaweiRequest) error) error
	RegisterAfterValidatePurchaseFacebookInstant(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidatePurchaseResponse, in *ValidatePurchaseFacebookInstantRequest) error) error
	RegisterAfterValidatePurchaseSamsung(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidatePurchaseResponse, in *ValidatePurchaseSamsungRequest) error) error
	RegisterAfterValidateSubscriptionApple(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidateSubscriptionResponse, in *ValidateSubscriptionAppleRequest) error) error
	RegisterAfterValidateSubscriptionGoogle(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidateSubscriptionResponse, in *ValidateSubscriptionGoogleRequest) error) error
	RegisterAfterGetSubscription(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ValidatedSubscriptionView, in *GetSubscriptionRequest) error) error
	RegisterAfterListSubscriptions(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *SubscriptionList, in *ListSubscriptionsRequest) error) error
	RegisterAfterGetUsers(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *UsersList, in *GetUsersRequest) error) error
	RegisterAfterGetAccount(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *Account, in *GetAccountRequest) error) error
	RegisterAfterDeleteAccount(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *DeleteAccountRequest) error) error
	RegisterAfterSessionLogout(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *SessionLogoutRequest) error) error
	RegisterAfterImportFacebookFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ImportFacebookFriendsRequest) error) error
	RegisterAfterImportSteamFriends(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, in *ImportSteamFriendsRequest) error) error
	RegisterAfterListMatches(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *MatchList, in *ListMatchesRequest) error) error
	RegisterAfterListChannelMessages(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *ChannelMessageList, in *ListChannelMessagesRequest) error) error
	RegisterAfterGetMatchmakerStats(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *MatchmakerStatsView, in *GetMatchmakerStatsRequest) error) error
	RegisterAfterListParties(fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, out *PartyListView, in *ListPartiesRequest) error) error

	RegisterStorageIndex(name, collection, key string, fields, sortableFields []string, maxEntries int, indexOnly bool) error
	RegisterStorageIndexFilter(indexName string, fn func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, write *StorageWrite) bool) error
	RegisterFleetManager(fm fleet.Manager) error

	RegisterPurchaseNotificationApple(fn PurchaseNotificationAppleHandler) error
	RegisterPurchaseNotificationGoogle(fn PurchaseNotificationGoogleHandler) error
	RegisterSubscriptionNotificationApple(fn SubscriptionNotificationAppleHandler) error
	RegisterSubscriptionNotificationGoogle(fn SubscriptionNotificationGoogleHandler) error
}

Initializer provides registration methods during module initialization. Available only during InitModule execution — do not store or cache globally.

type JoinGroupRequest

type JoinGroupRequest struct {
	GroupID string `json:"group_id"`
}

type JoinPartyRequest

type JoinPartyRequest struct {
	PartyID string `json:"party_id"`
}

type JoinTournamentRequest

type JoinTournamentRequest struct {
	TournamentID string `json:"tournament_id"`
}

type KickGroupUsersRequest

type KickGroupUsersRequest struct {
	GroupID string   `json:"group_id"`
	UserIDs []string `json:"user_ids"`
}

type Leaderboard

type Leaderboard struct {
	ID            string    `json:"id"`
	Authoritative bool      `json:"authoritative"`
	SortOrder     int       `json:"sort_order"`
	Operator      int       `json:"operator"`
	ResetSchedule string    `json:"reset_schedule"`
	Metadata      string    `json:"metadata"`
	CreateTime    time.Time `json:"create_time"`
	Category      int       `json:"category"`
	Description   string    `json:"description"`
	Duration      int       `json:"duration"`
	EndTime       time.Time `json:"end_time"`
	JoinRequired  bool      `json:"join_required"`
	MaxSize       int       `json:"max_size"`
	MaxNumScore   int       `json:"max_num_score"`
	Title         string    `json:"title"`
	Size          int       `json:"size"`
	StartTime     time.Time `json:"start_time"`
	EnableRanks   bool      `json:"enable_ranks"`
}

Leaderboard is a runtime-facing leaderboard/tournament config snapshot.

type LeaderboardRecord

type LeaderboardRecord struct {
	LeaderboardID string    `json:"leaderboard_id"`
	OwnerID       string    `json:"owner_id"`
	Username      string    `json:"username"`
	Score         int64     `json:"score"`
	Subscore      int64     `json:"subscore"`
	NumScore      int       `json:"num_score"`
	MaxNumScore   int       `json:"max_num_score"`
	Metadata      string    `json:"metadata"`
	CreateTime    time.Time `json:"create_time"`
	UpdateTime    time.Time `json:"update_time"`
	ExpiryTime    time.Time `json:"expiry_time"`
	Rank          int64     `json:"rank"`
}

type LeaderboardRecordList

type LeaderboardRecordList struct {
	Records      []*LeaderboardRecord `json:"records,omitempty"`
	OwnerRecords []*LeaderboardRecord `json:"owner_records,omitempty"`
	NextCursor   string               `json:"next_cursor,omitempty"`
	PrevCursor   string               `json:"prev_cursor,omitempty"`
}

type LeaderboardResetHandler

type LeaderboardResetHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, leaderboardID string, reset int64) error

LeaderboardResetHandler handles leaderboard reset events.

type LeaveGroupRequest

type LeaveGroupRequest struct {
	GroupID string `json:"group_id"`
}

type LeavePartyRequest

type LeavePartyRequest struct {
	PartyID string `json:"party_id"`
}

type LinkAppleRequest

type LinkAppleRequest struct {
	Token string            `json:"token"`
	Vars  map[string]string `json:"vars"`
}

type LinkCustomRequest

type LinkCustomRequest struct {
	ID   string            `json:"id"`
	Vars map[string]string `json:"vars"`
}

type LinkDeviceRequest

type LinkDeviceRequest struct {
	ID   string            `json:"id"`
	Vars map[string]string `json:"vars"`
}

type LinkEmailRequest

type LinkEmailRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

type LinkFacebookInstantGameRequest

type LinkFacebookInstantGameRequest struct {
	SignedPlayerInfo string `json:"signed_player_info"`
}

type LinkFacebookRequest

type LinkFacebookRequest struct {
	Token string            `json:"token"`
	Vars  map[string]string `json:"vars"`
}

type LinkGameCenterRequest

type LinkGameCenterRequest struct {
	PlayerID     string `json:"player_id"`
	BundleID     string `json:"bundle_id"`
	Timestamp    int64  `json:"timestamp_seconds"`
	Salt         string `json:"salt"`
	Signature    string `json:"signature"`
	PublicKeyURL string `json:"public_key_url"`
}

type LinkGoogleRequest

type LinkGoogleRequest struct {
	Token string            `json:"token"`
	Vars  map[string]string `json:"vars"`
}

type LinkSteamRequest

type LinkSteamRequest struct {
	Token string            `json:"token"`
	Vars  map[string]string `json:"vars"`
}

type ListChannelMessagesRequest

type ListChannelMessagesRequest struct {
	ChannelID string `json:"channel_id"`
	Limit     int32  `json:"limit"`
	Forward   bool   `json:"forward"`
	Cursor    string `json:"cursor"`
}

type ListFriendsOfFriendsRequest

type ListFriendsOfFriendsRequest struct {
	Limit  int32  `json:"limit"`
	Cursor string `json:"cursor"`
}

type ListFriendsRequest

type ListFriendsRequest struct {
	Limit  int32  `json:"limit"`
	State  *int32 `json:"state"`
	Cursor string `json:"cursor"`
}

type ListGroupUsersRequest

type ListGroupUsersRequest struct {
	GroupID string `json:"group_id"`
	Limit   int32  `json:"limit"`
	State   *int32 `json:"state"`
	Cursor  string `json:"cursor"`
}

type ListGroupsRequest

type ListGroupsRequest struct {
	Name    string `json:"name"`
	LangTag string `json:"lang_tag"`
	Members *int32 `json:"members"`
	Open    *bool  `json:"open"`
	Limit   int32  `json:"limit"`
	Cursor  string `json:"cursor"`
}

type ListLeaderboardRecordsAroundOwnerRequest

type ListLeaderboardRecordsAroundOwnerRequest struct {
	LeaderboardID string `json:"leaderboard_id"`
	OwnerID       string `json:"owner_id"`
	Limit         int32  `json:"limit"`
	Expiry        int64  `json:"expiry"`
}

type ListLeaderboardRecordsRequest

type ListLeaderboardRecordsRequest struct {
	LeaderboardID string   `json:"leaderboard_id"`
	OwnerIDs      []string `json:"owner_ids"`
	Limit         int32    `json:"limit"`
	Cursor        string   `json:"cursor"`
	Expiry        int64    `json:"expiry"`
}

type ListMatchesRequest

type ListMatchesRequest struct {
	Limit         int32  `json:"limit"`
	Authoritative *bool  `json:"authoritative"`
	Label         string `json:"label"`
	MinSize       *int32 `json:"min_size"`
	MaxSize       *int32 `json:"max_size"`
}

type ListNotificationsRequest

type ListNotificationsRequest struct {
	Limit  int32  `json:"limit"`
	Cursor string `json:"cursor"`
}

type ListPartiesRequest

type ListPartiesRequest struct {
	Limit  int32  `json:"limit"`
	Cursor string `json:"cursor"`
	Query  string `json:"query"`
	Open   *bool  `json:"open"`
}

type ListStorageObjectsRequest

type ListStorageObjectsRequest struct {
	UserID     string `json:"user_id"`
	Collection string `json:"collection"`
	Limit      int32  `json:"limit"`
	Cursor     string `json:"cursor"`
}

type ListSubscriptionsRequest

type ListSubscriptionsRequest struct {
	Limit  int32  `json:"limit"`
	Cursor string `json:"cursor"`
}

type ListTournamentRecordsAroundOwnerRequest

type ListTournamentRecordsAroundOwnerRequest struct {
	TournamentID string `json:"tournament_id"`
	OwnerID      string `json:"owner_id"`
	Limit        int32  `json:"limit"`
	Expiry       int64  `json:"expiry"`
}

type ListTournamentRecordsRequest

type ListTournamentRecordsRequest struct {
	TournamentID string   `json:"tournament_id"`
	OwnerIDs     []string `json:"owner_ids"`
	Limit        int32    `json:"limit"`
	Cursor       string   `json:"cursor"`
	Expiry       int64    `json:"expiry"`
}

type ListTournamentsRequest

type ListTournamentsRequest struct {
	CategoryStart int32  `json:"category_start"`
	CategoryEnd   int32  `json:"category_end"`
	StartTime     int32  `json:"start_time"`
	EndTime       int32  `json:"end_time"`
	Limit         int32  `json:"limit"`
	Cursor        string `json:"cursor"`
}

type ListUserGroupsRequest

type ListUserGroupsRequest struct {
	UserID string `json:"user_id"`
	Limit  int32  `json:"limit"`
	State  *int32 `json:"state"`
	Cursor string `json:"cursor"`
}

type ListWalletLedgerRequest

type ListWalletLedgerRequest struct {
	Limit  int32  `json:"limit"`
	Cursor string `json:"cursor"`
}

type LocalStreamManager

type LocalStreamManager struct {
	Tracker  *presence.LocalTracker
	Router   presence.MessageRouter
	Registry SessionDisconnecter
	// contains filtered or unexported fields
}

LocalStreamManager implements StreamManager with LocalTracker + MessageRouter.

func (*LocalStreamManager) SessionDisconnect

func (m *LocalStreamManager) SessionDisconnect(sessionID string) error

func (*LocalStreamManager) SetClusterMesh

func (m *LocalStreamManager) SetClusterMesh(mesh *cluster.Mesh, nodeID string)

SetClusterMesh enables cross-node StreamSend fan-out.

func (*LocalStreamManager) StreamClose

func (m *LocalStreamManager) StreamClose(mode int16, subject, subcontext, label string) error

func (*LocalStreamManager) StreamCount

func (m *LocalStreamManager) StreamCount(mode int16, subject, subcontext, label string) (int, error)

func (*LocalStreamManager) StreamSend

func (m *LocalStreamManager) StreamSend(mode int16, subject, subcontext, label, data string, sessionIDs []string, reliable bool) error

func (*LocalStreamManager) StreamSendLocal

func (m *LocalStreamManager) StreamSendLocal(mode int16, subject, subcontext, label, data string, sessionIDs []string) error

StreamSendLocal delivers to local sessions only (used by peer mesh handlers to avoid rebroadcast).

func (*LocalStreamManager) StreamSendRaw

func (m *LocalStreamManager) StreamSendRaw(mode int16, subject, subcontext, label string, data []byte, sessionIDs []string, reliable bool) error

func (*LocalStreamManager) StreamUserGet

func (m *LocalStreamManager) StreamUserGet(mode int16, subject, subcontext, label, userID, sessionID string) (*StreamPresenceView, error)

func (*LocalStreamManager) StreamUserJoin

func (m *LocalStreamManager) StreamUserJoin(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) (bool, error)

func (*LocalStreamManager) StreamUserKick

func (m *LocalStreamManager) StreamUserKick(mode int16, subject, subcontext, label string, presenceView StreamPresenceView) error

func (*LocalStreamManager) StreamUserLeave

func (m *LocalStreamManager) StreamUserLeave(mode int16, subject, subcontext, label, userID, sessionID string) error

func (*LocalStreamManager) StreamUserList

func (m *LocalStreamManager) StreamUserList(mode int16, subject, subcontext, label string, includeHidden, includeNotHidden bool) ([]StreamPresenceView, error)

func (*LocalStreamManager) StreamUserUpdate

func (m *LocalStreamManager) StreamUserUpdate(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) error

func (*LocalStreamManager) UntrackSession

func (m *LocalStreamManager) UntrackSession(sessionID string)

UntrackSession removes a session from all streams and emits stream_presence_event for custom modes.

type Logger

type Logger interface {
	Debug(format string, args ...interface{})
	Info(format string, args ...interface{})
	Warn(format string, args ...interface{})
	Error(format string, args ...interface{})
}

Logger provides structured logging for runtime modules.

type Match

type Match interface {
	MatchInit(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, params map[string]interface{}) (interface{}, int, string)
	MatchJoinAttempt(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, dispatcher interface{}, tick int64, state interface{}, presence Presence, metadata map[string]string) (interface{}, bool, string)
	MatchJoin(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, dispatcher interface{}, tick int64, state interface{}, presences []Presence) interface{}
	MatchLeave(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, dispatcher interface{}, tick int64, state interface{}, presences []Presence) interface{}
	MatchLoop(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, dispatcher interface{}, tick int64, state interface{}, messages []MatchData) interface{}
	MatchTerminate(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, dispatcher interface{}, tick int64, state interface{}, graceSeconds int) interface{}
	MatchSignal(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, dispatcher interface{}, tick int64, state interface{}, data string) (interface{}, string)
}

Match represents an authoritative match handler.

type MatchData

type MatchData interface {
	Presence
	GetOpCode() int64
	GetData() []byte
	GetReliable() bool
	GetReceiveTime() int64
}

MatchData represents match data messages passed into MatchLoop.

type MatchHandlerFactory

type MatchHandlerFactory func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule) (Match, error)

MatchHandlerFactory creates a new match handler instance.

type MatchInfo

type MatchInfo struct {
	MatchID       string `json:"match_id"`
	Authoritative bool   `json:"authoritative"`
	Label         string `json:"label"`
	Size          int    `json:"size"`
	MaxSize       int    `json:"max_size"`
	HandlerName   string `json:"handler_name,omitempty"`
}

MatchInfo is metadata for an active match (not full opaque state).

type MatchList

type MatchList struct {
	Matches []*MatchInfo `json:"matches"`
}

type MatchRegistry

type MatchRegistry interface {
	CreateAndRegisterMatch(ctx context.Context, matchID string, module string, params map[string]interface{}) error
	ListMatches(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize int) ([]*MatchInfo, error)
	GetMatch(ctx context.Context, matchID string) (*MatchInfo, error)
	MatchSignal(ctx context.Context, matchID, data string) (string, error)
}

type MatchmakerMatchedHandler

type MatchmakerMatchedHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, entries []interface{}) (string, error)

MatchmakerMatchedHandler handles matchmaker match events.

type MatchmakerOverrideHandler

type MatchmakerOverrideHandler func(ctx context.Context, matches [][]interface{}) [][]interface{}

MatchmakerOverrideHandler rewrites candidate match groups after default Process pairing.

type MatchmakerProcessorHandler

type MatchmakerProcessorHandler func(ctx context.Context, tickets []interface{}) [][]interface{}

MatchmakerProcessorHandler replaces default Process pairing. Tickets are *matchmaker.Ticket values.

type MatchmakerStatsView

type MatchmakerStatsView struct {
	TicketCount            int    `json:"ticket_count"`
	OldestTicketCreateTime string `json:"oldest_ticket_create_time"`
	CompletionCount        int    `json:"completion_count"`
}

type NotificationList

type NotificationList struct {
	Notifications   []*NotificationView `json:"notifications"`
	CacheableCursor string              `json:"cacheable_cursor,omitempty"`
}

type NotificationSendParams

type NotificationSendParams struct {
	UserID     string
	Subject    string
	Content    map[string]interface{}
	Code       int
	SenderID   string
	Persistent bool
}

NotificationSendParams is a batch send entry.

type NotificationUpdateParams

type NotificationUpdateParams struct {
	ID       string
	Subject  *string
	Content  *string
	SenderID *string
}

NotificationUpdateParams is a partial notification update.

type NotificationView

type NotificationView struct {
	ID         string    `json:"id"`
	UserID     string    `json:"user_id"`
	Subject    string    `json:"subject"`
	Content    string    `json:"content"`
	Code       int16     `json:"code"`
	SenderID   string    `json:"sender_id"`
	CreateTime time.Time `json:"create_time"`
	Persistent bool      `json:"persistent"`
}

NotificationView is a runtime notification record.

type PartyListEntry

type PartyListEntry struct {
	ID      string `json:"id"`
	Open    bool   `json:"open"`
	Hidden  bool   `json:"hidden"`
	MaxSize int    `json:"max_size"`
	Label   string `json:"label"`
}

PartyListEntry is a discoverable party for runtime PartyList.

type PartyListView

type PartyListView struct {
	Parties []*PartyListEntry `json:"parties"`
	Cursor  string            `json:"cursor,omitempty"`
}

type PartyLister

type PartyLister interface {
	List(limit int, open *bool, showHidden bool, query, cursor string) ([]*PartyListEntry, string, error)
}

PartyLister lists discoverable parties for runtime party_list.

type Presence

type Presence interface {
	GetUserId() string
	GetSessionId() string
	GetNodeId() string
	GetUsername() string
}

Presence represents a client presence within a match.

type PromoteGroupUsersRequest

type PromoteGroupUsersRequest struct {
	GroupID string   `json:"group_id"`
	UserIDs []string `json:"user_ids"`
}

type PurchaseNotificationAppleHandler

type PurchaseNotificationAppleHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, notificationType int, purchase *ValidatedPurchaseView, rawPayload string) error

PurchaseNotificationAppleHandler is invoked for Apple purchase RTDN events.

type PurchaseNotificationGoogleHandler

type PurchaseNotificationGoogleHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, notificationType int, purchase *ValidatedPurchaseView, rawPayload string) error

PurchaseNotificationGoogleHandler is invoked for Google purchase RTDN events.

type RPCConfig

type RPCConfig struct {
	HTTPKey            string
	ExecutionTimeoutMs int
	MaxPayloadBytes    int
}

RPCConfig holds custom RPC limits and auth.

func DefaultRPCConfig

func DefaultRPCConfig() RPCConfig

DefaultRPCConfig returns reference-aligned defaults.

type RPCDispatchOpts

type RPCDispatchOpts struct {
	UserID        string
	Username      string
	Vars          map[string]string
	ClientIP      string
	Env           string
	QueryParams   map[string][]string
	Headers       map[string][]string
	ExecutionMode string // "rpc", "http", "grpc", "websocket"
}

RPCDispatchOpts carries per-request RPC context.

type RPCDispatcherFunc

type RPCDispatcherFunc func(ctx context.Context, id, payload string, opts RPCDispatchOpts) (string, codes.Code, error)

RPCDispatcherFunc is set on GoRuntimeModule to avoid import cycles with VMs.

type RPCHandler

type RPCHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, payload string) (string, error)

RPCHandler represents a custom client-callable RPC endpoint handler. Go native handlers receive logger, db, and nk for full server API access.

type ReadStorageObjectsRequest

type ReadStorageObjectsRequest struct {
	ObjectIDs []StorageRead `json:"object_ids"`
}

type RtHookExecutor

type RtHookExecutor struct {
	Registry *HookRegistry
	Logger   Logger
	DB       *sql.DB
	NK       RuntimeModule
	LuaVM    *lua.LState
	JSVM     *goja.Runtime
	// contains filtered or unexported fields
}

RtHookExecutor runs before/after realtime hooks with Go → Lua → JS precedence.

func NewRtHookExecutor

func NewRtHookExecutor(reg *HookRegistry, logger Logger, db *sql.DB, nk RuntimeModule, luaVM *lua.LState, jsVM *goja.Runtime, luaMu, jsMu *sync.Mutex) *RtHookExecutor

NewRtHookExecutor builds an executor. luaMu/jsMu may be shared with HTTP interceptors.

func (*RtHookExecutor) RunAfterReq

func (e *RtHookExecutor) RunAfterReq(ctx context.Context, hookID string, out, in interface{}) error

RunAfterReq invokes an after request hook (caller should typically run async).

func (*RtHookExecutor) RunAfterRt

func (e *RtHookExecutor) RunAfterRt(ctx context.Context, hookID string, out, in map[string]interface{}) error

RunAfterRt invokes an after realtime hook (caller should run async).

func (*RtHookExecutor) RunBeforeReq

func (e *RtHookExecutor) RunBeforeReq(ctx context.Context, hookID string, in interface{}) (interface{}, error)

RunBeforeReq invokes a before request hook by id with Go → Lua → JS precedence. Returns the (possibly modified) request value and an error if the hook rejects.

func (*RtHookExecutor) RunBeforeRt

func (e *RtHookExecutor) RunBeforeRt(ctx context.Context, hookID string, envelope map[string]interface{}) (map[string]interface{}, error)

RunBeforeRt invokes a before realtime hook. Returns modified envelope map (or original) and error.

type RuntimeHTTPHandler

type RuntimeHTTPHandler struct {
	PathPattern string
	Handler     func(http.ResponseWriter, *http.Request)
	Methods     []string
}

RuntimeHTTPHandler is a custom HTTP route registered by a Go runtime module.

type RuntimeModule

type RuntimeModule interface {
	// Storage operations
	StorageRead(ctx context.Context, reads []*StorageRead) ([]*StorageObject, error)
	StorageWrite(ctx context.Context, writes []*StorageWrite) ([]*StorageObjectAck, error)
	StorageDelete(ctx context.Context, deletes []*StorageDelete) error
	StorageList(ctx context.Context, callerID, userID, collection string, limit int, cursor string) ([]*StorageObject, string, error)
	StorageWriteRetry(ctx context.Context, reads []*StorageRead, updateFn func([]*StorageObject) ([]*StorageWrite, error), maxRetries int) ([]*StorageObjectAck, error)

	// Wallet operations
	WalletUpdate(ctx context.Context, userID string, changeset map[string]int64, metadata map[string]interface{}, updateLedger bool) (updated, previous map[string]int64, err error)
	WalletsUpdate(ctx context.Context, updates []*WalletUpdateParams, updateLedger bool) ([]*WalletUpdateResultView, error)
	WalletLedgerList(ctx context.Context, userID string, limit int, cursor string) ([]*WalletLedgerView, string, error)
	WalletLedgerUpdate(ctx context.Context, ledgerID, userID string, metadata map[string]interface{}) error

	// IAP operations
	PurchaseValidateApple(ctx context.Context, userID, receipt string, persist bool) (*ValidatedPurchaseView, error)
	PurchaseValidateGoogle(ctx context.Context, userID, productID, purchaseToken string, persist bool) (*ValidatedPurchaseView, error)
	PurchaseValidateHuawei(ctx context.Context, userID, purchaseData, signature string, persist bool) (*ValidatedPurchaseView, error)
	PurchaseValidateFacebookInstant(ctx context.Context, userID, signedRequest string, persist bool) (*ValidatedPurchaseView, error)
	PurchaseValidateSamsung(ctx context.Context, userID, purchaseID string, persist bool) (*ValidatedPurchaseView, error)
	PurchasesList(ctx context.Context, userID string, limit int) ([]*ValidatedPurchaseView, error)
	SubscriptionValidateApple(ctx context.Context, userID, receipt string, persist bool) (*ValidatedSubscriptionView, error)
	SubscriptionValidateGoogle(ctx context.Context, userID, productID, purchaseToken string, persist bool) (*ValidatedSubscriptionView, error)
	SubscriptionsList(ctx context.Context, userID string, limit int) ([]*ValidatedSubscriptionView, error)
	SubscriptionGetProductID(ctx context.Context, userID, productID string) (*ValidatedSubscriptionView, error)

	// Account operations
	AccountGetId(ctx context.Context, userID string) (*Account, error)
	UsersGetId(ctx context.Context, userIDs []string) ([]*UserView, error)
	UsersGetUsername(ctx context.Context, usernames []string) ([]*UserView, error)
	UsersGetRandom(ctx context.Context, count int) ([]*UserView, error)
	UsersBanId(ctx context.Context, userIDs []string) error
	UsersUnbanId(ctx context.Context, userIDs []string) error

	// Leaderboard operations
	LeaderboardCreate(ctx context.Context, id string, authoritative bool, sortOrder int, operator int, resetSchedule string, metadata map[string]interface{}, enableRanks bool) error
	LeaderboardDelete(ctx context.Context, id string) error
	LeaderboardList(ctx context.Context, limit int, cursor string) ([]*Leaderboard, string, error)
	LeaderboardsGetId(ctx context.Context, ids []string) ([]*Leaderboard, error)
	LeaderboardRanksDisable(ctx context.Context, id string) error
	LeaderboardRecordWrite(ctx context.Context, id, ownerID, username string, score, subscore int64, metadata map[string]interface{}) (*LeaderboardRecord, error)
	LeaderboardRecordsList(ctx context.Context, id string, ownerIDs []string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)
	LeaderboardRecordsAroundOwner(ctx context.Context, id, ownerID string, limit int, expiry int64) ([]*LeaderboardRecord, error)
	LeaderboardRecordsHaystack(ctx context.Context, id, ownerID string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)
	LeaderboardRecordsListCursorFromRank(ctx context.Context, leaderboardID string, rank, expiry int64) (string, error)
	LeaderboardRecordDelete(ctx context.Context, id, ownerID string) error

	// Tournament operations
	TournamentCreate(ctx context.Context, id string, authoritative bool, sortOrder, operator int, resetSchedule string, metadata map[string]interface{}, title, description string, category int, startTime, endTime int64, duration, maxSize, maxNumScore int, joinRequired, enableRanks bool) error
	TournamentDelete(ctx context.Context, id string) error
	TournamentList(ctx context.Context, categoryStart, categoryEnd int, startTime, endTime int64, limit int, cursor string, active bool) ([]*TournamentView, string, error)
	TournamentsGetId(ctx context.Context, ids []string) ([]*Leaderboard, error)
	TournamentRanksDisable(ctx context.Context, id string) error
	TournamentJoin(ctx context.Context, id, ownerID, username string) error
	TournamentRecordWrite(ctx context.Context, id, ownerID, username string, score, subscore int64, metadata map[string]interface{}) (*LeaderboardRecord, error)
	TournamentRecordsList(ctx context.Context, id string, ownerIDs []string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)
	TournamentRecordsAroundOwner(ctx context.Context, id, ownerID string, limit int, expiry int64) ([]*LeaderboardRecord, error)
	TournamentRecordsHaystack(ctx context.Context, id, ownerID string, limit int, cursor string, expiry int64) ([]*LeaderboardRecord, string, string, error)
	TournamentRecordDelete(ctx context.Context, id, ownerID string) error
	TournamentAddAttempt(ctx context.Context, id, ownerID string, count int) error

	// Notification operations
	NotificationSend(ctx context.Context, userID, subject string, content map[string]interface{}, code int, senderID string, persistent bool) error
	NotificationsSend(ctx context.Context, notifications []*NotificationSendParams) error
	NotificationSendAll(ctx context.Context, subject string, content map[string]interface{}, code int, persistent bool) error
	NotificationsList(ctx context.Context, userID string, limit int, cursor string) ([]*NotificationView, string, error)
	NotificationsDelete(ctx context.Context, userID string, ids []string) error
	NotificationsUpdate(ctx context.Context, updates []*NotificationUpdateParams) error
	NotificationsGetId(ctx context.Context, userID string, ids []string) ([]*NotificationView, error)
	NotificationsDeleteId(ctx context.Context, userID string, ids []string) error

	// Friends operations
	FriendsList(ctx context.Context, userID string, limit int, state *int, cursor string) ([]*FriendEdge, string, error)
	FriendsAdd(ctx context.Context, userID string, ids, usernames []string, metadata map[string]any) error
	FriendsDelete(ctx context.Context, userID string, ids, usernames []string) error
	FriendsBlock(ctx context.Context, userID string, ids, usernames []string) error
	FriendsOfFriendsList(ctx context.Context, userID string, limit int, cursor string) ([]*FriendOfFriendEdge, string, error)
	UsersGetFriendStatus(ctx context.Context, userID string, friendIDs []string) (map[string]int, error)
	FriendMetadataUpdate(ctx context.Context, userID, friendID string, metadata map[string]any) error

	// Party operations
	PartyList(ctx context.Context, limit int, open *bool, showHidden bool, query, cursor string) ([]*PartyListEntry, string, error)

	// Group operations
	GroupsGetId(ctx context.Context, groupIDs []string) ([]*GroupView, error)
	GroupCreate(ctx context.Context, userID, name, description, avatarURL, langTag, metadata string, open bool, maxCount int) (*GroupView, error)
	GroupUpdate(ctx context.Context, groupID, userID, name, description, avatarURL, langTag, metadata string, open bool, maxCount int) error
	GroupDelete(ctx context.Context, groupID, userID string) error
	GroupUsersAdd(ctx context.Context, groupID, callerID string, userIDs []string) error
	GroupUsersBan(ctx context.Context, groupID, callerID string, userIDs []string) error
	GroupUsersKick(ctx context.Context, groupID, callerID string, userIDs []string) error
	GroupUsersPromote(ctx context.Context, groupID, callerID string, userIDs []string) error
	GroupUsersDemote(ctx context.Context, groupID, callerID string, userIDs []string) error
	GroupUsersList(ctx context.Context, groupID string, limit int, cursor string) ([]*GroupUserView, string, error)
	GroupsList(ctx context.Context, name, langTag string, open *bool, members, limit int, cursor string) ([]*GroupView, string, error)
	UserGroupsList(ctx context.Context, userID string, limit int, cursor string) ([]*UserGroupView, string, error)
	GroupsGetRandom(ctx context.Context, count int) ([]*GroupView, error)

	// Channel / chat operations
	ChannelIdBuild(ctx context.Context, userID, target string, chanType int) (string, error)
	ChannelMessageSend(ctx context.Context, channelID string, content map[string]interface{}, senderID, senderUsername string, persist bool) (*ChannelMessageAckView, error)
	ChannelMessageUpdate(ctx context.Context, channelID, messageID string, content map[string]interface{}, senderID, senderUsername string, persist bool) (*ChannelMessageAckView, error)
	ChannelMessageRemove(ctx context.Context, channelID, messageID, senderID, senderUsername string, persist bool) (*ChannelMessageAckView, error)
	ChannelMessagesList(ctx context.Context, channelID string, limit int, forward bool, cursor string) ([]*ChannelMessageView, string, string, string, error)

	// Match operations
	MatchCreate(ctx context.Context, module string, params map[string]interface{}) (string, error)
	MatchList(ctx context.Context, limit int, authoritative bool, label string, minSize, maxSize int) ([]*MatchInfo, error)
	MatchGet(ctx context.Context, matchID string) (*MatchInfo, error)
	MatchSignal(ctx context.Context, matchID, data string) (string, error)

	// Status presence
	StatusFollow(sessionID string, userIDs []string) error
	StatusUnfollow(sessionID string, userIDs []string) error

	// Stream Tracker (ADR-0020)
	StreamUserList(mode int16, subject, subcontext, label string, includeHidden, includeNotHidden bool) ([]StreamPresenceView, error)
	StreamUserGet(mode int16, subject, subcontext, label, userID, sessionID string) (*StreamPresenceView, error)
	StreamUserJoin(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) (bool, error)
	StreamUserLeave(mode int16, subject, subcontext, label, userID, sessionID string) error
	StreamUserUpdate(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) error
	StreamUserKick(mode int16, subject, subcontext, label string, presence StreamPresenceView) error
	StreamClose(mode int16, subject, subcontext, label string) error
	StreamCount(mode int16, subject, subcontext, label string) (int, error)
	StreamSend(mode int16, subject, subcontext, label, data string, sessionIDs []string, reliable bool) error
	StreamSendRaw(mode int16, subject, subcontext, label string, data []byte, sessionIDs []string, reliable bool) error
	SessionDisconnect(sessionID string) error

	// Auth / account (Round 8 nk batch 2b)
	AuthenticateDevice(ctx context.Context, id, username string, create bool) (userID, outUsername string, created bool, err error)
	AuthenticateCustom(ctx context.Context, id, username string, create bool) (userID, outUsername string, created bool, err error)
	AuthenticateEmail(ctx context.Context, email, password, username string, create bool) (userID, outUsername string, created bool, err error)
	AuthenticateTokenGenerate(userID, username string, expiresAt int64, vars map[string]string) (token string, exp int64, err error)
	LinkDevice(ctx context.Context, userID, deviceID string) error
	LinkCustom(ctx context.Context, userID, customID string) error
	LinkEmail(ctx context.Context, userID, email, password string) error
	UnlinkDevice(ctx context.Context, userID, deviceID string) error
	UnlinkCustom(ctx context.Context, userID string) error
	UnlinkEmail(ctx context.Context, userID string) error
	AccountUpdateId(ctx context.Context, userID, username string, metadata map[string]interface{}, displayName, timezone, location, langTag, avatarURL string) error
	AccountDeleteId(ctx context.Context, userID string) error
	SessionLogout(userID, token, refreshToken string) error
	GroupUserJoin(ctx context.Context, groupID, userID, username string) error
	GroupUserLeave(ctx context.Context, groupID, userID, username string) error

	// RPC
	RpcCall(ctx context.Context, id, payload string) (string, error)

	// Atomic multi-update (account + storage + wallet)
	MultiUpdate(ctx context.Context, accountUpdates []*AccountUpdateParams, storageWrites []*StorageWrite, storageDeletes []*StorageDelete, walletUpdates []*WalletUpdateParams, updateLedger bool) ([]*StorageObjectAck, []*WalletUpdateResultView, error)
	StorageIndexList(ctx context.Context, callerID, indexName, query string, limit int, order []string, cursor string) ([]*StorageObject, string, error)
	GetSatori() satori.Satori

	// Cron utilities (UTC, ADR-0025)
	CronNext(expression string, timestamp int64) (int64, error)
	CronPrev(expression string, timestamp int64) (int64, error)

	// Batch 3 utilities
	HttpRequest(ctx context.Context, url, method string, headers map[string]string, body string, timeoutMs int) (int, map[string]string, string, error)
	SqlExec(ctx context.Context, query string, args []interface{}) (int64, error)
	SqlQuery(ctx context.Context, query string, args []interface{}) ([]map[string]interface{}, error)
	LocalCacheGet(key string) (interface{}, bool)
	LocalCacheSet(key string, value interface{}, ttlSec int64)
	CryptoHash(algo, input string) (string, error)
	CryptoHmacHash(algo, key, input string) (string, error)
	BcryptHash(password string) (string, error)
	BcryptCompare(hash, password string) bool
	UuidV4() string
}

RuntimeModule provides access to all server-side APIs from runtime code. This interface is injected into all Go native runtime handler invocations.

type RuntimeType

type RuntimeType int

RuntimeType identifies the execution runtime for a registered handler.

const (
	// RuntimeGo is the Go native runtime (highest precedence).
	RuntimeGo RuntimeType = iota
	// RuntimeLua is the Lua VM sandbox runtime.
	RuntimeLua
	// RuntimeJS is the JavaScript VM sandbox runtime (lowest precedence).
	RuntimeJS
)

type Sandbox

type Sandbox struct {
	L *lua.LState
	// contains filtered or unexported fields
}

Sandbox wraps the Lua VM state with CPU instruction limits and memory quotas.

func NewSandbox

func NewSandbox(memoryLimit int64, cpuTimeout time.Duration) *Sandbox

NewSandbox creates a new isolated Gopher-Lua VM sandbox.

func (*Sandbox) Close

func (s *Sandbox) Close()

Close terminates the Lua VM state and frees resources.

func (*Sandbox) Run

func (s *Sandbox) Run(ctx context.Context, script string) (string, error)

Run executes a Lua script string inside the sandbox under CPU timeout and memory constraints.

type Session

type Session struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	UserID       string `json:"user_id"`
	Username     string `json:"username"`
}

type SessionDisconnecter

type SessionDisconnecter interface {
	DisconnectSession(sessionID string) error
}

SessionDisconnecter closes a live WebSocket session by ID.

type SessionLogoutRequest

type SessionLogoutRequest struct {
	Token        string `json:"token"`
	RefreshToken string `json:"refresh_token"`
}

type SessionRefreshRequest

type SessionRefreshRequest struct {
	Token string            `json:"token"`
	Vars  map[string]string `json:"vars"`
}

type ShutdownHandler

type ShutdownHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule)

ShutdownHandler runs once when the server receives a termination signal.

type StatusFollower

type StatusFollower interface {
	StatusFollow(sessionID string, userIDs []string) error
	StatusUnfollow(sessionID string, userIDs []string) error
}

StatusFollower follows/unfollows status presence for a session (runtime nk.status_follow).

type StorageDelete

type StorageDelete struct {
	Collection string `json:"collection"`
	Key        string `json:"key"`
	UserID     string `json:"user_id"`
	Version    string `json:"version"`
}

type StorageObject

type StorageObject struct {
	Collection      string    `json:"collection"`
	Key             string    `json:"key"`
	UserID          string    `json:"user_id"`
	Value           string    `json:"value"`
	Version         string    `json:"version"`
	PermissionRead  int32     `json:"permission_read"`
	PermissionWrite int32     `json:"permission_write"`
	CreateTime      time.Time `json:"create_time"`
	UpdateTime      time.Time `json:"update_time"`
}

type StorageObjectAck

type StorageObjectAck struct {
	Collection string    `json:"collection"`
	Key        string    `json:"key"`
	UserID     string    `json:"user_id"`
	Version    string    `json:"version"`
	CreateTime time.Time `json:"create_time"`
	UpdateTime time.Time `json:"update_time"`
}

type StorageObjectAcks

type StorageObjectAcks struct {
	Acks []*StorageObjectAck `json:"acks"`
}

type StorageObjectList

type StorageObjectList struct {
	Objects []*StorageObject `json:"objects"`
	Cursor  string           `json:"cursor,omitempty"`
}

type StorageRead

type StorageRead struct {
	Collection string `json:"collection"`
	Key        string `json:"key"`
	UserID     string `json:"user_id"`
}

type StorageWrite

type StorageWrite struct {
	Collection      string `json:"collection"`
	Key             string `json:"key"`
	UserID          string `json:"user_id"`
	Value           string `json:"value"`
	Version         string `json:"version"`
	PermissionRead  int32  `json:"permission_read"`
	PermissionWrite int32  `json:"permission_write"`
}

type StreamManager

type StreamManager interface {
	StreamUserList(mode int16, subject, subcontext, label string, includeHidden, includeNotHidden bool) ([]StreamPresenceView, error)
	StreamUserGet(mode int16, subject, subcontext, label, userID, sessionID string) (*StreamPresenceView, error)
	StreamUserJoin(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) (bool, error)
	StreamUserLeave(mode int16, subject, subcontext, label, userID, sessionID string) error
	StreamUserUpdate(mode int16, subject, subcontext, label, userID, sessionID string, hidden, persistence bool, status string) error
	StreamUserKick(mode int16, subject, subcontext, label string, presence StreamPresenceView) error
	StreamClose(mode int16, subject, subcontext, label string) error
	StreamCount(mode int16, subject, subcontext, label string) (int, error)
	StreamSend(mode int16, subject, subcontext, label, data string, sessionIDs []string, reliable bool) error
	StreamSendRaw(mode int16, subject, subcontext, label string, data []byte, sessionIDs []string, reliable bool) error
	SessionDisconnect(sessionID string) error
	UntrackSession(sessionID string)
}

StreamManager backs RuntimeModule stream_* APIs (ADR-0020 / ADR-0019).

type StreamPresenceView

type StreamPresenceView struct {
	UserID    string `json:"user_id"`
	SessionID string `json:"session_id"`
	Username  string `json:"username"`
	Status    string `json:"status,omitempty"`
	Hidden    bool   `json:"hidden,omitempty"`
}

StreamPresenceView is a runtime-facing presence on a typed stream.

type SubscriptionList

type SubscriptionList struct {
	ValidatedSubscriptions []*ValidatedSubscriptionView `json:"validated_subscriptions"`
	Cursor                 string                       `json:"cursor,omitempty"`
	PrevCursor             string                       `json:"prev_cursor,omitempty"`
}

type SubscriptionNotificationAppleHandler

type SubscriptionNotificationAppleHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, notificationType int, subscription *ValidatedSubscriptionView, rawPayload string) error

SubscriptionNotificationAppleHandler is invoked for Apple subscription RTDN events.

type SubscriptionNotificationGoogleHandler

type SubscriptionNotificationGoogleHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, notificationType int, subscription *ValidatedSubscriptionView, rawPayload string) error

SubscriptionNotificationGoogleHandler is invoked for Google subscription RTDN events.

type TournamentEndHandler

type TournamentEndHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, tournamentID string, end int64, reset int64) error

TournamentEndHandler handles tournament end events.

type TournamentList

type TournamentList struct {
	Tournaments []*TournamentView `json:"tournaments"`
	NextCursor  string            `json:"next_cursor,omitempty"`
}

type TournamentResetHandler

type TournamentResetHandler func(ctx context.Context, logger Logger, db *sql.DB, nk RuntimeModule, tournamentID string, end int64, reset int64) error

TournamentResetHandler handles tournament reset events.

type TournamentView

type TournamentView struct {
	*Leaderboard
	CanEnter    bool  `json:"can_enter"`
	StartActive int64 `json:"start_active"`
	EndActive   int64 `json:"end_active"`
	PrevReset   int64 `json:"prev_reset"`
	NextReset   int64 `json:"next_reset"`
}

TournamentView is a runtime-facing tournament listing entry.

type UnlinkAppleRequest

type UnlinkAppleRequest struct {
	Token string `json:"token"`
}

type UnlinkCustomRequest

type UnlinkCustomRequest struct {
	ID string `json:"id"`
}

type UnlinkDeviceRequest

type UnlinkDeviceRequest struct {
	ID string `json:"id"`
}

type UnlinkEmailRequest

type UnlinkEmailRequest struct {
	Email string `json:"email"`
}

type UnlinkFacebookInstantGameRequest

type UnlinkFacebookInstantGameRequest struct {
	SignedPlayerInfo string `json:"signed_player_info"`
}

type UnlinkFacebookRequest

type UnlinkFacebookRequest struct {
	Token string `json:"token"`
}

type UnlinkGameCenterRequest

type UnlinkGameCenterRequest struct {
	PlayerID string `json:"player_id"`
}

type UnlinkGoogleRequest

type UnlinkGoogleRequest struct {
	Token string `json:"token"`
}

type UnlinkSteamRequest

type UnlinkSteamRequest struct {
	Token string `json:"token"`
}

type UpdateAccountRequest

type UpdateAccountRequest struct {
	Username    string `json:"username"`
	DisplayName string `json:"display_name"`
	AvatarURL   string `json:"avatar_url"`
	LangTag     string `json:"lang_tag"`
	Location    string `json:"location"`
	Timezone    string `json:"timezone"`
	Metadata    string `json:"metadata"`
}

type UpdateGroupRequest

type UpdateGroupRequest struct {
	GroupID     string `json:"group_id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	AvatarURL   string `json:"avatar_url"`
	LangTag     string `json:"lang_tag"`
	Metadata    string `json:"metadata"`
	Open        *bool  `json:"open"`
}

type UserGroupList

type UserGroupList struct {
	UserGroups []*UserGroupView `json:"user_groups"`
	NextCursor string           `json:"next_cursor,omitempty"`
}

type UserGroupView

type UserGroupView struct {
	Group *GroupView `json:"group"`
	State int        `json:"state"`
}

UserGroupView is a runtime user→group relation.

type UserView

type UserView struct {
	ID          string    `json:"id"`
	Username    string    `json:"username"`
	DisplayName string    `json:"display_name"`
	AvatarURL   string    `json:"avatar_url"`
	LangTag     string    `json:"lang_tag"`
	Location    string    `json:"location"`
	Timezone    string    `json:"timezone"`
	Metadata    string    `json:"metadata"`
	Online      bool      `json:"online"`
	EdgeCount   int       `json:"edge_count"`
	CreateTime  time.Time `json:"create_time"`
	UpdateTime  time.Time `json:"update_time"`
}

type UsersList

type UsersList struct {
	Users []*UserView `json:"users"`
}

type ValidatePurchaseAppleRequest

type ValidatePurchaseAppleRequest struct {
	Receipt string `json:"receipt"`
	Persist *bool  `json:"persist"`
}

type ValidatePurchaseFacebookInstantRequest

type ValidatePurchaseFacebookInstantRequest struct {
	SignedRequest string `json:"signed_request"`
	Persist       *bool  `json:"persist"`
}

type ValidatePurchaseGoogleRequest

type ValidatePurchaseGoogleRequest struct {
	ProductID     string `json:"product_id"`
	PurchaseToken string `json:"purchase_token"`
	Persist       *bool  `json:"persist"`
}

type ValidatePurchaseHuaweiRequest

type ValidatePurchaseHuaweiRequest struct {
	Purchase  string `json:"purchase"`
	Signature string `json:"signature"`
	Persist   *bool  `json:"persist"`
}

type ValidatePurchaseResponse

type ValidatePurchaseResponse struct {
	ValidatedPurchases []*ValidatedPurchaseView `json:"validated_purchases"`
}

type ValidatePurchaseSamsungRequest

type ValidatePurchaseSamsungRequest struct {
	PurchaseID string `json:"purchase"`
	Persist    *bool  `json:"persist"`
}

type ValidateSubscriptionAppleRequest

type ValidateSubscriptionAppleRequest struct {
	Receipt string `json:"receipt"`
	Persist *bool  `json:"persist"`
}

type ValidateSubscriptionGoogleRequest

type ValidateSubscriptionGoogleRequest struct {
	ProductID     string `json:"product_id"`
	PurchaseToken string `json:"purchase_token"`
	Persist       *bool  `json:"persist"`
}

type ValidateSubscriptionResponse

type ValidateSubscriptionResponse struct {
	ValidatedSubscription *ValidatedSubscriptionView `json:"validated_subscription"`
}

type ValidatedPurchaseView

type ValidatedPurchaseView struct {
	UserID        string    `json:"user_id"`
	ProductID     string    `json:"product_id"`
	TransactionID string    `json:"transaction_id"`
	Store         int       `json:"store"`
	PurchaseTime  time.Time `json:"purchase_time"`
	SeenBefore    bool      `json:"seen_before"`
	Environment   int       `json:"environment"`
}

ValidatedPurchaseView is a runtime IAP purchase result.

type ValidatedSubscriptionView

type ValidatedSubscriptionView struct {
	UserID                string    `json:"user_id"`
	ProductID             string    `json:"product_id"`
	OriginalTransactionID string    `json:"original_transaction_id"`
	Store                 int       `json:"store"`
	PurchaseTime          time.Time `json:"purchase_time"`
	ExpireTime            time.Time `json:"expire_time"`
	Active                bool      `json:"active"`
	SeenBefore            bool      `json:"seen_before"`
	Environment           int       `json:"environment"`
}

ValidatedSubscriptionView is a runtime IAP subscription result.

type WalletLedgerView

type WalletLedgerView struct {
	ID         string                 `json:"id"`
	UserID     string                 `json:"user_id"`
	Changeset  map[string]int64       `json:"changeset"`
	Metadata   map[string]interface{} `json:"metadata"`
	CreateTime time.Time              `json:"create_time"`
	UpdateTime time.Time              `json:"update_time"`
}

WalletLedgerView is a ledger row for runtime.

type WalletUpdateParams

type WalletUpdateParams struct {
	UserID    string                 `json:"user_id"`
	Changeset map[string]int64       `json:"changeset"`
	Metadata  map[string]interface{} `json:"metadata"`
}

WalletUpdateParams is a batch wallet mutation for runtime WalletsUpdate.

type WalletUpdateResultView

type WalletUpdateResultView struct {
	UserID   string           `json:"user_id"`
	Updated  map[string]int64 `json:"updated"`
	Previous map[string]int64 `json:"previous"`
}

WalletUpdateResultView is returned from WalletsUpdate.

type WriteLeaderboardRecordRequest

type WriteLeaderboardRecordRequest struct {
	LeaderboardID string `json:"leaderboard_id"`
	Score         int64  `json:"score"`
	Subscore      int64  `json:"subscore"`
	Metadata      string `json:"metadata"`
}

type WriteStorageObjectsRequest

type WriteStorageObjectsRequest struct {
	Objects []*StorageWrite `json:"objects"`
}

type WriteTournamentRecordRequest

type WriteTournamentRecordRequest struct {
	TournamentID string `json:"tournament_id"`
	Score        int64  `json:"score"`
	Subscore     int64  `json:"subscore"`
	Metadata     string `json:"metadata"`
}

Jump to

Keyboard shortcuts

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