JGSL_gateway

JGSL gateway

Title JGSL gateway
Author(s) LiXizhi
Date 2008/12/23
File script/kids/3DMapSystemNetwork/JGSL_gateway.lua

Description

it helps the user to find the best grid server for a given region in a given world.

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemNetwork/JGSL_gateway.lua");
Map3DSystem.JGSL.gateway:Restart(configfile);

local gateway = Map3DSystem.JGSL.gateway;
local user = gateway:GetUser(jid)

Member Functions

gateway:Reset

------------------------------
 Grid User
------------------------------
 grid user info class
local GridUser = {
   -- server session key associated with the user. 
   SessionKey = nil,
   -- The main grid node server id (index)
   gid = nil,
   
   -- this is set when client first login.
   uid = nil,
   -- this is set when client first login.
   jid = nil,
}
; gateway.GridUser = GridUser;

create an agent. it will overwrite existing one, if any, with a newly created one.

syntax

function gateway:Reset()

gateway:Restart

restart the gateway. Usually the config file specifies which grid node serves which region of the world Since we always return the smallest sized grid server to client, we should use small sized grid node in map positions that have large population. And for large low population world, we can simply use just a single grid node. TODO: Currently, such configuration is manual, in future, we can automatically generate the ideal config file from user analysis it is also possible to work out a dynamic load balancing server, but it is for future release.

  • param configfile : nil or config file path

syntax

function gateway:Restart(configfile)

parameters

configfile nil or config file path

gateway:GetUser

it will create the agent structure if it does not exist

syntax

function gateway:GetUser(jid)

parameters

jid  

gateway:CreateUser

create an agent. it will overwrite existing one, if any, with a newly created one.

syntax

function gateway:CreateUser(jid)

parameters

jid  

gateway:GetBestGridNode

get the grid node info that is serving a given worldpath and a location in the world. we always return the smallest sized grid server that exist.

  • param worldpath :, x,y,z:
  • param IsObserver : true if we are just getting for an observer node.

syntax

function gateway:GetBestGridNode(worldpath, x,y,z, IsObserver)

parameters

worldpath , x,y,z:
x  
y  
z  
IsObserver  

gateway:HandleMessage

handle server messages

syntax

function gateway:HandleMessage(msg)

parameters

msg  
Topic revision: r1 - 2008-02-29 - LiXizhi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback