From 4a4ecb1cdefd3ffc53317e12d54eadb42107d88b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 2 Feb 2011 17:34:53 -0800 Subject: [PATCH 1/5] Initial stubs and code for quark/actor registration and lookup --- .../Grid/LocalGridServiceConnector.cs | 20 +++ .../Grid/RemoteGridServiceConnector.cs | 20 +++ .../Connectors/Grid/GridServiceConnector.cs | 20 +++ .../SimianGrid/SimianGridServiceConnector.cs | 118 ++++++++++++++++++ OpenSim/Services/GridService/GridService.cs | 20 +++ OpenSim/Services/Interfaces/IGridService.cs | 18 +++ 6 files changed, 216 insertions(+) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 023a44c601..2924b9213a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -256,5 +256,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid } } + #region SYNC SERVER + // Stubs for actor and quark management. Only implementation is in SimianGridService + public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + { + return m_GridService.RegisterActor(gai, lgqi); + } + public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + { + return m_GridService.RegisterActor(gai, gqi); + } + public virtual List LookupQuark(GridQuarkInfo gqi) + { + return m_GridService.LookupQuark(gqi); + } + public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + { + return m_GridService.LookupQuark(gqi, actorType); + } + #endregion SYNC SERVER + } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 33cc838322..7869e8f433 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -288,5 +288,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return flags; } #endregion + + #region SYNC SERVER + // Stubs for actor and quark management. Only implementation is in SimianGridService + public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + { + return m_RemoteGridService.RegisterActor(gai, lgqi); + } + public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + { + return m_RemoteGridService.RegisterActor(gai, gqi); + } + public virtual List LookupQuark(GridQuarkInfo gqi) + { + return LookupQuark(gqi); + } + public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + { + return LookupQuark(gqi, actorType); + } + #endregion SYNC SERVER } } diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 5092d741e6..9e556ecb9b 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -653,5 +653,25 @@ namespace OpenSim.Services.Connectors #endregion + #region SYNC SERVER + // Stubs for actor and quark management. Only implementation is in SimianGridService + public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + { + return false; + } + public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + { + return false; + } + public virtual List LookupQuark(GridQuarkInfo gqi) + { + return null; + } + public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + { + return null; + } + #endregion SYNC SERVER + } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 918544f1f6..dd1fe48a39 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -432,5 +432,123 @@ namespace OpenSim.Services.Connectors.SimianGrid return region; } + + #region SYNC SERVER + // Stubs for actor and quark management. Only implementation is in SimianGridService + public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + { + OSDArray quarks = new OSDArray(); + foreach (GridQuarkInfo gqi in lgqi) + { + OSDMap quarkMap = new OSDMap + { + { "locX", OSD.FromInteger(gqi.locX) }, + { "locY", OSD.FromInteger(gqi.locY) } + }; + quarks.Add(quarkMap); + } + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "RegisterActor" }, + { "actorID", gai.actorID }, + { "type", gai.type }, + { "address", gai.address }, + { "port", gai.port.ToString() }, + { "quarks", OSDParser.SerializeJsonString(quarks) } + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + return true; + } + return false; + } + + public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + { + OSDMap quarkMap = new OSDMap + { + { "locX", OSD.FromInteger(gqi.locX) }, + { "locY", OSD.FromInteger(gqi.locY) } + }; + OSDArray quarks = new OSDArray(); + quarks.Add(quarkMap); + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "RegisterActor" }, + { "actorID", gai.actorID }, + { "actorType", gai.type }, + { "address", gai.address }, + { "port", gai.port.ToString() }, + { "quarks", OSDParser.SerializeJsonString(quarks) } + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + return true; + } + return false; + } + + public virtual List LookupQuark(GridQuarkInfo gqi) + { + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "LookupQuark" }, + { "locX", gqi.locX.ToString() }, + { "locY", gqi.locY.ToString() } + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + List lgai = new List(); + OSDArray gridActors = (OSDArray)response["actors"]; + for (int ii = 0; ii < gridActors.Count; ii++) + { + OSDMap thisGridActor = (OSDMap)gridActors[ii]; + GridActorInfo gai = new GridActorInfo(); + gai.actorID = thisGridActor["actorID"].AsString(); + gai.type = thisGridActor["actorType"].AsString(); + gai.address = thisGridActor["address"].AsString(); + gai.port = thisGridActor["port"].AsInteger(); + lgai.Add(gai); + } + return lgai; + } + return null; + } + public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + { + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "LookupQuark" }, + { "locX", gqi.locX.ToString() }, + { "locY", gqi.locY.ToString() }, + { "actorType", actorType } + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + List lgai = new List(); + OSDArray gridActors = (OSDArray)response["actors"]; + for (int ii = 0; ii < gridActors.Count; ii++) + { + OSDMap thisGridActor = (OSDMap)gridActors[ii]; + GridActorInfo gai = new GridActorInfo(); + gai.actorID = thisGridActor["actorID"].AsString(); + gai.type = thisGridActor["actorType"].AsString(); + gai.address = thisGridActor["address"].AsString(); + gai.port = thisGridActor["port"].AsInteger(); + lgai.Add(gai); + } + return lgai; + } + return null; + } + #endregion SYNC SERVER } } diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 125c2be8cf..b26e04deaf 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -548,5 +548,25 @@ namespace OpenSim.Services.GridService m_Database.Store(r); } } + + #region SYNC SERVER + // Stubs for actor and quark management. Only implementation is in SimianGridService + public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + { + return false; + } + public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + { + return false; + } + public virtual List LookupQuark(GridQuarkInfo gqi) + { + return null; + } + public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + { + return null; + } + #endregion SYNC SERVER } } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index a34f0bebf6..72c970a404 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -95,6 +95,24 @@ namespace OpenSim.Services.Interfaces List GetHyperlinks(UUID scopeID); int GetRegionFlags(UUID scopeID, UUID regionID); + + bool RegisterActor(GridActorInfo gai, List lgqi); + bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi); + List LookupQuark(GridQuarkInfo gqi); + List LookupQuark(GridQuarkInfo gqi, string actorType); + } + + public class GridQuarkInfo + { + public int locX; + public int locY; + } + public class GridActorInfo + { + public string address; + public int port; + public string type; + public string actorID; } public class GridRegion : Object From f5870a1e231dfc2b421ddefb02c3a67e4f169c49 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 4 Feb 2011 09:25:54 -0800 Subject: [PATCH 2/5] slight optimization in the actor registration code --- .../SimianGrid/SimianGridServiceConnector.cs | 51 ++++--------------- 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index dd1fe48a39..901a82ecac 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -467,29 +467,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) { - OSDMap quarkMap = new OSDMap - { - { "locX", OSD.FromInteger(gqi.locX) }, - { "locY", OSD.FromInteger(gqi.locY) } - }; - OSDArray quarks = new OSDArray(); - quarks.Add(quarkMap); - NameValueCollection requestArgs = new NameValueCollection - { - { "RequestMethod", "RegisterActor" }, - { "actorID", gai.actorID }, - { "actorType", gai.type }, - { "address", gai.address }, - { "port", gai.port.ToString() }, - { "quarks", OSDParser.SerializeJsonString(quarks) } - }; - - OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); - if (response["Success"].AsBoolean()) - { - return true; - } - return false; + List lgqi = new List(); + lgqi.Add(gqi); + return RegisterActor(gai, lgqi); } public virtual List LookupQuark(GridQuarkInfo gqi) @@ -500,26 +480,9 @@ namespace OpenSim.Services.Connectors.SimianGrid { "locX", gqi.locX.ToString() }, { "locY", gqi.locY.ToString() } }; - - OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); - if (response["Success"].AsBoolean()) - { - List lgai = new List(); - OSDArray gridActors = (OSDArray)response["actors"]; - for (int ii = 0; ii < gridActors.Count; ii++) - { - OSDMap thisGridActor = (OSDMap)gridActors[ii]; - GridActorInfo gai = new GridActorInfo(); - gai.actorID = thisGridActor["actorID"].AsString(); - gai.type = thisGridActor["actorType"].AsString(); - gai.address = thisGridActor["address"].AsString(); - gai.port = thisGridActor["port"].AsInteger(); - lgai.Add(gai); - } - return lgai; - } - return null; + return LookupQuark(requestArgs); } + public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) { NameValueCollection requestArgs = new NameValueCollection @@ -529,7 +492,11 @@ namespace OpenSim.Services.Connectors.SimianGrid { "locY", gqi.locY.ToString() }, { "actorType", actorType } }; + return LookupQuark(requestArgs); + } + private List LookupQuark(NameValueCollection requestArgs) + { OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); if (response["Success"].AsBoolean()) { From 4fe0bd32d43334456132c4cb502cc574ae4fba24 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Wed, 9 Feb 2011 17:17:50 -0800 Subject: [PATCH 3/5] Actor/Quark registration for Simian backend --- OpenSim/Framework/RegionInfo.cs | 2 +- .../PhysEngineToSceneConnectorModule.cs | 6 +- .../SymmetricSync/RegionSyncModule.cs | 46 +++++++++ .../Grid/LocalGridServiceConnector.cs | 8 +- .../Grid/RemoteGridServiceConnector.cs | 12 ++- .../Connectors/Grid/GridServiceConnector.cs | 6 +- .../SimianGrid/SimianGridServiceConnector.cs | 95 +++++++++++++------ OpenSim/Services/GridService/GridService.cs | 6 +- OpenSim/Services/Interfaces/IGridService.cs | 13 ++- 9 files changed, 146 insertions(+), 48 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 8892996394..9914a64e17 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -902,7 +902,7 @@ namespace OpenSim.Framework string quarkLocation = config.GetString("SyncQuarkLocation", "1000,1000"); - string[] quarkLocElements = location.Split(new char[] { ',' }); + string[] quarkLocElements = quarkLocation.Split(new char[] { ',' }); m_quarkLocX = Convert.ToUInt32(quarkLocElements[0]); m_quarkLocY = Convert.ToUInt32(quarkLocElements[1]); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnectorModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnectorModule.cs index 0b77ea898b..0e7d94276c 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnectorModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/PhysEngineToSceneConnectorModule.cs @@ -36,6 +36,7 @@ using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Physics.Manager; +using OpenSim.Services.Interfaces; using log4net; using System.Net; using System.Net.Sockets; @@ -105,11 +106,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.Debug(LogHeader + " Init PEToSceneConnectorModule, for local scene " + scene.RegionInfo.RegionName); - // string configString = scene.RegionInfo.RegionName + "_SceneToPESyncServerIP"; - // m_serveraddr = syncConfig.GetString(configString, "127.0.0.1"); - // configString = scene.RegionInfo.RegionName + "_SceneToPESyncServerPort"; - // m_serverport = syncConfig.GetInt(configString, 13000); - m_scene = scene; m_scene.RegisterModuleInterface(this); m_syncConfig = syncConfig; diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index ecbae7927c..2a34e4a2d6 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -13,6 +13,7 @@ using OpenSim.Region.CoreModules.Framework.InterfaceCommander; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; +using OpenSim.Services.Interfaces; using log4net; using System.Net; using System.Net.Sockets; @@ -764,6 +765,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (!addr.Equals(IPAddrUnknown) && port != PortUnknown) { RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port); + + // Register this actor as a endpoint for this quark + // Note that this is wrong in that this module is not an actor + // Resolve by figuring out registation of endpoints vs actors + List lgqi = new List(); + GridQuarkInfo gqi = new GridQuarkInfo(); + gqi.locX = m_scene.RegionInfo.SyncQuarkLocationX; + gqi.locY = m_scene.RegionInfo.SyncQuarkLocationY; + lgqi.Add(gqi); + GridActorInfo gai = new GridActorInfo(); + // gai.actorID = m_actorID; + // gai.actorID = m_scene.RegionInfo.RegionName; + gai.actorID = m_scene.RegionInfo.RegionID.ToString(); + gai.address = addr; + gai.port = port; + // the actor really doesn't belong here -- the sync server is actor agnostic + // the registration should be of just the endpoint with a separate registration for the actor + gai.actorType = "scene_persistence"; + if (!m_scene.GridService.RegisterActor(gai, lgqi)) + { + m_log.ErrorFormat("{0}: Failure registering actor endpoint", LogHeader); + } return info; } @@ -785,6 +808,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule string addr = m_scene.RegionInfo.SyncServerAddress; int port = m_scene.RegionInfo.SyncServerPort; + // if the address is not specified in the region configuration file, get it from the grid service + if (addr.Equals(IPAddrUnknown)) + { + GridQuarkInfo gqi = new GridQuarkInfo(); + gqi.locX = m_scene.RegionInfo.SyncQuarkLocationX; + gqi.locY = m_scene.RegionInfo.SyncQuarkLocationY; + List lgai = m_scene.GridService.LookupQuark(gqi, "scene_persistence"); + if (lgai == null || lgai.Count != 1) + { + m_log.ErrorFormat("{0}: Failed to find quark persistence actor", LogHeader); + addr = IPAddrUnknown; + port = PortUnknown; + } + else + { + GridActorInfo gai = lgai[0]; + addr = gai.address; + port = gai.port; + m_log.WarnFormat("{0}: Found quark ({1}/{2}) persistence actor at {3}:{4}", LogHeader, + gqi.locX.ToString(), gqi.locY.ToString(), addr, port.ToString()); + } + } + if (!addr.Equals(IPAddrUnknown) && port != PortUnknown) { RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 2924b9213a..276130feeb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -262,9 +262,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { return m_GridService.RegisterActor(gai, lgqi); } - public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + public virtual bool RegisterActor(GridActorInfo gai) { - return m_GridService.RegisterActor(gai, gqi); + return m_GridService.RegisterActor(gai); + } + public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) + { + return m_GridService.RegisterQuark(actorID, gqi); } public virtual List LookupQuark(GridQuarkInfo gqi) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 7869e8f433..b45f4c81fb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -295,17 +295,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { return m_RemoteGridService.RegisterActor(gai, lgqi); } - public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + public virtual bool RegisterActor(GridActorInfo gai) { - return m_RemoteGridService.RegisterActor(gai, gqi); + return m_RemoteGridService.RegisterActor(gai); + } + public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) + { + return m_RemoteGridService.RegisterQuark(actorID, gqi); } public virtual List LookupQuark(GridQuarkInfo gqi) { - return LookupQuark(gqi); + return m_RemoteGridService.LookupQuark(gqi); } public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) { - return LookupQuark(gqi, actorType); + return m_RemoteGridService.LookupQuark(gqi, actorType); } #endregion SYNC SERVER } diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 9e556ecb9b..849b83b9e7 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -659,7 +659,11 @@ namespace OpenSim.Services.Connectors { return false; } - public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + public virtual bool RegisterActor(GridActorInfo gai) + { + return false; + } + public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) { return false; } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 901a82ecac..561ee4a89a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -434,51 +434,82 @@ namespace OpenSim.Services.Connectors.SimianGrid } #region SYNC SERVER - // Stubs for actor and quark management. Only implementation is in SimianGridService + /// + /// Register an actor and it's associated quarks + /// + /// + /// + /// public virtual bool RegisterActor(GridActorInfo gai, List lgqi) { - OSDArray quarks = new OSDArray(); - foreach (GridQuarkInfo gqi in lgqi) + if (RegisterActor(gai)) { - OSDMap quarkMap = new OSDMap + bool success = true; + foreach (GridQuarkInfo gqi in lgqi) { - { "locX", OSD.FromInteger(gqi.locX) }, - { "locY", OSD.FromInteger(gqi.locY) } - }; - quarks.Add(quarkMap); + if (!RegisterQuark(gai.actorID, gqi)) + { + success = false; + break; + } + } + return success; } + return false; + } + + public virtual bool RegisterActor(GridActorInfo gai) + { NameValueCollection requestArgs = new NameValueCollection { - { "RequestMethod", "RegisterActor" }, - { "actorID", gai.actorID }, - { "type", gai.type }, - { "address", gai.address }, - { "port", gai.port.ToString() }, - { "quarks", OSDParser.SerializeJsonString(quarks) } + { "RequestMethod", "AddActor" }, + { "ActorID", gai.actorID }, + { "ActorType", gai.actorType }, + { "Address", gai.address }, + { "Port", gai.port.ToString() }, }; OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); if (response["Success"].AsBoolean()) { + m_log.WarnFormat("{0}: Registration of actor {1} at addr={2}:{3} successful", + "[SIMIAN GRID CONNECTOR]", gai.actorID, gai.address, gai.port.ToString()); return true; } + m_log.ErrorFormat("{0}: Registration of actor {1} at addr={2}:{3} failed: {4}", + "[SIMIAN GRID CONNECTOR]", gai.actorID, gai.address, gai.port.ToString(), response["Message"]); return false; } - public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) { - List lgqi = new List(); - lgqi.Add(gqi); - return RegisterActor(gai, lgqi); + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "AddQuark" }, + { "ActorID", actorID }, + { "LocX", gqi.locX.ToString() }, + { "LocY", gqi.locY.ToString() }, + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + m_log.WarnFormat("{0}: Registration of quark at {1}/{2} successful", + "[SIMIAN GRID CONNECTOR]", gqi.locX.ToString(), gqi.locY.ToString()); + return true; + } + m_log.ErrorFormat("{0}: Registration of quark at {1}/{2} failed: {3}", + "[SIMIAN GRID CONNECTOR]", gqi.locX.ToString(), gqi.locY.ToString(), response["Message"]); + return false; } public virtual List LookupQuark(GridQuarkInfo gqi) { NameValueCollection requestArgs = new NameValueCollection { - { "RequestMethod", "LookupQuark" }, - { "locX", gqi.locX.ToString() }, - { "locY", gqi.locY.ToString() } + { "RequestMethod", "GetQuark" }, + { "LocX", gqi.locX.ToString() }, + { "LocY", gqi.locY.ToString() } }; return LookupQuark(requestArgs); } @@ -487,10 +518,10 @@ namespace OpenSim.Services.Connectors.SimianGrid { NameValueCollection requestArgs = new NameValueCollection { - { "RequestMethod", "LookupQuark" }, - { "locX", gqi.locX.ToString() }, - { "locY", gqi.locY.ToString() }, - { "actorType", actorType } + { "RequestMethod", "GetQuark" }, + { "LocX", gqi.locX.ToString() }, + { "LocY", gqi.locY.ToString() }, + { "ActorType", actorType } }; return LookupQuark(requestArgs); } @@ -501,19 +532,23 @@ namespace OpenSim.Services.Connectors.SimianGrid if (response["Success"].AsBoolean()) { List lgai = new List(); - OSDArray gridActors = (OSDArray)response["actors"]; + OSDArray gridActors = (OSDArray)response["Actors"]; + m_log.WarnFormat("{0}: Lookup of quark successful. {1} addresses", + "[SIMIAN GRID CONNECTOR]", gridActors.Count); for (int ii = 0; ii < gridActors.Count; ii++) { OSDMap thisGridActor = (OSDMap)gridActors[ii]; GridActorInfo gai = new GridActorInfo(); - gai.actorID = thisGridActor["actorID"].AsString(); - gai.type = thisGridActor["actorType"].AsString(); - gai.address = thisGridActor["address"].AsString(); - gai.port = thisGridActor["port"].AsInteger(); + gai.actorID = thisGridActor["ActorID"].AsString(); + gai.actorType = thisGridActor["ActorType"].AsString(); + gai.address = thisGridActor["Address"].AsString(); + gai.port = thisGridActor["Port"].AsInteger(); lgai.Add(gai); } return lgai; } + m_log.ErrorFormat("{0}: Lookup of quark failed: {1}", + "[SIMIAN GRID CONNECTOR]", response["Message"]); return null; } #endregion SYNC SERVER diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index b26e04deaf..acd0475487 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -555,7 +555,11 @@ namespace OpenSim.Services.GridService { return false; } - public virtual bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi) + public virtual bool RegisterActor(GridActorInfo gai) + { + return false; + } + public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) { return false; } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 72c970a404..db3dc1a5fa 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -96,24 +96,29 @@ namespace OpenSim.Services.Interfaces int GetRegionFlags(UUID scopeID, UUID regionID); + // SYNC SERVER bool RegisterActor(GridActorInfo gai, List lgqi); - bool RegisterActor(GridActorInfo gai, GridQuarkInfo gqi); + bool RegisterActor(GridActorInfo gai); + bool RegisterQuark(string actorID, GridQuarkInfo gqi); List LookupQuark(GridQuarkInfo gqi); List LookupQuark(GridQuarkInfo gqi, string actorType); + // END SYNC SERVER } + // SYNC SERVER public class GridQuarkInfo { - public int locX; - public int locY; + public uint locX; + public uint locY; } public class GridActorInfo { public string address; public int port; - public string type; + public string actorType; public string actorID; } + // END SYNC SERVER public class GridRegion : Object { From 9970677ed8271c8779544547d239b84f2a396f2b Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 11 Feb 2011 15:50:25 -0800 Subject: [PATCH 4/5] Quark/Endpoint registration and lookup for three table database --- .../SymmetricSync/RegionSyncModule.cs | 56 +++---- .../Grid/LocalGridServiceConnector.cs | 24 +-- .../Grid/RemoteGridServiceConnector.cs | 24 +-- .../Connectors/Grid/GridServiceConnector.cs | 14 +- .../SimianGrid/SimianGridServiceConnector.cs | 146 +++++++++++------- OpenSim/Services/GridService/GridService.cs | 14 +- OpenSim/Services/Interfaces/IGridService.cs | 24 ++- 7 files changed, 174 insertions(+), 128 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 2a34e4a2d6..0a9ad781ac 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -766,27 +766,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { RegionSyncListenerInfo info = new RegionSyncListenerInfo(addr, port); - // Register this actor as a endpoint for this quark - // Note that this is wrong in that this module is not an actor - // Resolve by figuring out registation of endpoints vs actors - List lgqi = new List(); - GridQuarkInfo gqi = new GridQuarkInfo(); - gqi.locX = m_scene.RegionInfo.SyncQuarkLocationX; - gqi.locY = m_scene.RegionInfo.SyncQuarkLocationY; - lgqi.Add(gqi); - GridActorInfo gai = new GridActorInfo(); - // gai.actorID = m_actorID; - // gai.actorID = m_scene.RegionInfo.RegionName; - gai.actorID = m_scene.RegionInfo.RegionID.ToString(); - gai.address = addr; - gai.port = port; - // the actor really doesn't belong here -- the sync server is actor agnostic - // the registration should be of just the endpoint with a separate registration for the actor - gai.actorType = "scene_persistence"; - if (!m_scene.GridService.RegisterActor(gai, lgqi)) + // remove any cruft from previous runs + m_scene.GridService.CleanUpEndpoint(m_scene.RegionInfo.RegionID.ToString()); + // Register the endpoint and quark and persistence actor for this simulator instance + GridEndpointInfo gei = new GridEndpointInfo(); + gei.syncServerID = m_scene.RegionInfo.RegionID.ToString(); + gei.address = m_scene.RegionInfo.SyncServerAddress; + gei.port = (uint)m_scene.RegionInfo.SyncServerPort; + if (!m_scene.GridService.RegisterEndpoint(gei)) { - m_log.ErrorFormat("{0}: Failure registering actor endpoint", LogHeader); + m_log.ErrorFormat("{0}: Failure registering endpoint", LogHeader); } + if (!m_scene.GridService.RegisterActor(m_scene.RegionInfo.RegionID.ToString(), + "scene_persistence", m_scene.RegionInfo.RegionID.ToString())) + { + m_log.ErrorFormat("{0}: Failure registering actor", LogHeader); + } + if (!m_scene.GridService.RegisterQuark(m_scene.RegionInfo.RegionID.ToString(), + m_scene.RegionInfo.SyncQuarkLocationX, m_scene.RegionInfo.SyncQuarkLocationY)) + { + m_log.ErrorFormat("{0}: Failure registering quark", LogHeader); + } + return info; } @@ -811,11 +812,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // if the address is not specified in the region configuration file, get it from the grid service if (addr.Equals(IPAddrUnknown)) { - GridQuarkInfo gqi = new GridQuarkInfo(); - gqi.locX = m_scene.RegionInfo.SyncQuarkLocationX; - gqi.locY = m_scene.RegionInfo.SyncQuarkLocationY; - List lgai = m_scene.GridService.LookupQuark(gqi, "scene_persistence"); - if (lgai == null || lgai.Count != 1) + List lgei = m_scene.GridService.LookupQuark( + m_scene.RegionInfo.SyncQuarkLocationX, m_scene.RegionInfo.SyncQuarkLocationY, "scene_persistence"); + if (lgei == null || lgei.Count != 1) { m_log.ErrorFormat("{0}: Failed to find quark persistence actor", LogHeader); addr = IPAddrUnknown; @@ -823,11 +822,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else { - GridActorInfo gai = lgai[0]; - addr = gai.address; - port = gai.port; + GridEndpointInfo gei = lgei[0]; + addr = gei.address; + port = (int)gei.port; m_log.WarnFormat("{0}: Found quark ({1}/{2}) persistence actor at {3}:{4}", LogHeader, - gqi.locX.ToString(), gqi.locY.ToString(), addr, port.ToString()); + m_scene.RegionInfo.SyncQuarkLocationX, m_scene.RegionInfo.SyncQuarkLocationY, + addr, port.ToString()); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 276130feeb..9315c1449a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -258,25 +258,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region SYNC SERVER // Stubs for actor and quark management. Only implementation is in SimianGridService - public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + public bool RegisterEndpoint(GridEndpointInfo gei) { - return m_GridService.RegisterActor(gai, lgqi); + return m_GridService.RegisterEndpoint(gei); } - public virtual bool RegisterActor(GridActorInfo gai) + public bool RegisterActor(string actorID, string actorType, string syncServerID) { - return m_GridService.RegisterActor(gai); + return m_GridService.RegisterActor(actorID, actorType, syncServerID); } - public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) + public bool RegisterQuark(string syncServerID, uint locX, uint locY) { - return m_GridService.RegisterQuark(actorID, gqi); + return m_GridService.RegisterQuark(syncServerID, locX, locY); } - public virtual List LookupQuark(GridQuarkInfo gqi) + public List LookupQuark(uint locX, uint locY) { - return m_GridService.LookupQuark(gqi); + return m_GridService.LookupQuark(locX, locY); } - public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + public List LookupQuark(uint locX, uint locY, string actorType) { - return m_GridService.LookupQuark(gqi, actorType); + return m_GridService.LookupQuark(locX, locY, actorType); + } + public bool CleanUpEndpoint(string syncServerID) + { + return m_GridService.CleanUpEndpoint(syncServerID); } #endregion SYNC SERVER diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index b45f4c81fb..4797a7c3d7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -291,25 +291,29 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid #region SYNC SERVER // Stubs for actor and quark management. Only implementation is in SimianGridService - public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + public bool RegisterEndpoint(GridEndpointInfo gei) { - return m_RemoteGridService.RegisterActor(gai, lgqi); + return m_RemoteGridService.RegisterEndpoint(gei); } - public virtual bool RegisterActor(GridActorInfo gai) + public bool RegisterActor(string actorID, string actorType, string syncServerID) { - return m_RemoteGridService.RegisterActor(gai); + return m_RemoteGridService.RegisterActor(actorID, actorType, syncServerID); } - public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) + public bool RegisterQuark(string syncServerID, uint locX, uint locY) { - return m_RemoteGridService.RegisterQuark(actorID, gqi); + return m_RemoteGridService.RegisterQuark(syncServerID, locX, locY); } - public virtual List LookupQuark(GridQuarkInfo gqi) + public List LookupQuark(uint locX, uint locY) { - return m_RemoteGridService.LookupQuark(gqi); + return m_RemoteGridService.LookupQuark(locX, locY); } - public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + public List LookupQuark(uint locX, uint locY, string actorType) { - return m_RemoteGridService.LookupQuark(gqi, actorType); + return m_RemoteGridService.LookupQuark(locX, locY, actorType); + } + public bool CleanUpEndpoint(string syncServerID) + { + return m_RemoteGridService.CleanUpEndpoint(syncServerID); } #endregion SYNC SERVER } diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 849b83b9e7..10b28e0baf 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -655,26 +655,30 @@ namespace OpenSim.Services.Connectors #region SYNC SERVER // Stubs for actor and quark management. Only implementation is in SimianGridService - public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + public bool RegisterEndpoint(GridEndpointInfo gei) { return false; } - public virtual bool RegisterActor(GridActorInfo gai) + public bool RegisterActor(string actorID, string actorType, string syncServerID) { return false; } - public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) + public bool RegisterQuark(string syncServerID, uint locX, uint locY) { return false; } - public virtual List LookupQuark(GridQuarkInfo gqi) + public List LookupQuark(uint locX, uint locY) { return null; } - public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + public List LookupQuark(uint locX, uint locY, string actorType) { return null; } + public bool CleanUpEndpoint(string syncServerID) + { + return false; + } #endregion SYNC SERVER } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 561ee4a89a..d535bb4754 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -434,115 +434,113 @@ namespace OpenSim.Services.Connectors.SimianGrid } #region SYNC SERVER - /// - /// Register an actor and it's associated quarks - /// - /// - /// - /// - public virtual bool RegisterActor(GridActorInfo gai, List lgqi) - { - if (RegisterActor(gai)) - { - bool success = true; - foreach (GridQuarkInfo gqi in lgqi) - { - if (!RegisterQuark(gai.actorID, gqi)) - { - success = false; - break; - } - } - return success; - } - return false; - } - - public virtual bool RegisterActor(GridActorInfo gai) + public virtual bool RegisterEndpoint(GridEndpointInfo gei) { NameValueCollection requestArgs = new NameValueCollection { - { "RequestMethod", "AddActor" }, - { "ActorID", gai.actorID }, - { "ActorType", gai.actorType }, - { "Address", gai.address }, - { "Port", gai.port.ToString() }, + { "RequestMethod", "AddEndpoint" }, + { "SyncServerID", gei.syncServerID }, + { "Address", gei.address }, + { "Port", gei.port.ToString() }, }; OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); if (response["Success"].AsBoolean()) { - m_log.WarnFormat("{0}: Registration of actor {1} at addr={2}:{3} successful", - "[SIMIAN GRID CONNECTOR]", gai.actorID, gai.address, gai.port.ToString()); + m_log.WarnFormat("{0}: Registration of endpoint {1} at addr={2}:{3} successful", + "[SIMIAN GRID CONNECTOR]", gei.syncServerID, gei.address, gei.port.ToString()); return true; } - m_log.ErrorFormat("{0}: Registration of actor {1} at addr={2}:{3} failed: {4}", - "[SIMIAN GRID CONNECTOR]", gai.actorID, gai.address, gai.port.ToString(), response["Message"]); + m_log.ErrorFormat("{0}: Registration of endpoint {1} at addr={2}:{3} failed: {4}", + "[SIMIAN GRID CONNECTOR]", gei.syncServerID, gei.address, gei.port.ToString(), response["Message"]); return false; } - public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) + public virtual bool RegisterActor(string actorID, string actorType, string syncServerID) + { + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "AddActor" }, + { "ActorID", actorID }, + { "ActorType", actorType }, + { "SyncServerID", syncServerID }, + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + m_log.WarnFormat("{0}: Registration of actor {1} of type {2} successful", + "[SIMIAN GRID CONNECTOR]", actorID, actorType); + return true; + } + m_log.ErrorFormat("{0}: Registration of actor {1} of type {2} failed: {3}", + "[SIMIAN GRID CONNECTOR]", actorID, actorType, response["Message"]); + return false; + return false; + } + + public virtual bool RegisterQuark(string syncServerID, uint locX, uint locY) { NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "AddQuark" }, - { "ActorID", actorID }, - { "LocX", gqi.locX.ToString() }, - { "LocY", gqi.locY.ToString() }, + { "SyncServerID", syncServerID }, + { "LocX", locX.ToString() }, + { "LocY", locY.ToString() }, }; OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); if (response["Success"].AsBoolean()) { m_log.WarnFormat("{0}: Registration of quark at {1}/{2} successful", - "[SIMIAN GRID CONNECTOR]", gqi.locX.ToString(), gqi.locY.ToString()); + "[SIMIAN GRID CONNECTOR]", locX.ToString(), locY.ToString()); return true; } m_log.ErrorFormat("{0}: Registration of quark at {1}/{2} failed: {3}", - "[SIMIAN GRID CONNECTOR]", gqi.locX.ToString(), gqi.locY.ToString(), response["Message"]); + "[SIMIAN GRID CONNECTOR]", locX.ToString(), locY.ToString(), response["Message"]); return false; } - public virtual List LookupQuark(GridQuarkInfo gqi) + public virtual List LookupQuark(uint locX, uint locY) { NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "GetQuark" }, - { "LocX", gqi.locX.ToString() }, - { "LocY", gqi.locY.ToString() } + { "LocX", locX.ToString() }, + { "LocY", locY.ToString() } }; return LookupQuark(requestArgs); } - public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + public virtual List LookupQuark(uint locX, uint locY, string actorType) { NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "GetQuark" }, - { "LocX", gqi.locX.ToString() }, - { "LocY", gqi.locY.ToString() }, + { "LocX", locX.ToString() }, + { "LocY", locY.ToString() }, { "ActorType", actorType } }; return LookupQuark(requestArgs); } - private List LookupQuark(NameValueCollection requestArgs) + private List LookupQuark(NameValueCollection requestArgs) { OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); if (response["Success"].AsBoolean()) { - List lgai = new List(); - OSDArray gridActors = (OSDArray)response["Actors"]; + List lgai = new List(); + OSDArray gridEndpoints = (OSDArray)response["Endpoints"]; m_log.WarnFormat("{0}: Lookup of quark successful. {1} addresses", - "[SIMIAN GRID CONNECTOR]", gridActors.Count); - for (int ii = 0; ii < gridActors.Count; ii++) + "[SIMIAN GRID CONNECTOR]", gridEndpoints.Count); + for (int ii = 0; ii < gridEndpoints.Count; ii++) { - OSDMap thisGridActor = (OSDMap)gridActors[ii]; - GridActorInfo gai = new GridActorInfo(); - gai.actorID = thisGridActor["ActorID"].AsString(); - gai.actorType = thisGridActor["ActorType"].AsString(); - gai.address = thisGridActor["Address"].AsString(); - gai.port = thisGridActor["Port"].AsInteger(); + OSDMap thisEndpoint = (OSDMap)gridEndpoints[ii]; + GridEndpointInfo gai = new GridEndpointInfo(); + gai.syncServerID = thisEndpoint["SyncServerID"].AsString(); + gai.actorType = thisEndpoint["ActorType"].AsString(); + gai.address = thisEndpoint["Address"].AsString(); + gai.port = (uint)thisEndpoint["Port"].AsInteger(); lgai.Add(gai); } return lgai; @@ -551,6 +549,40 @@ namespace OpenSim.Services.Connectors.SimianGrid "[SIMIAN GRID CONNECTOR]", response["Message"]); return null; } + + // Clean up the information for this endpoint. Removes both the endpoint + // information from the Endpoint table but also removes ALL the quarks associated + // with the endpoint. + public virtual bool CleanUpEndpoint(string syncServerID) + { + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "RemoveEndpoint" }, + { "SyncServerID", syncServerID }, + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + requestArgs = new NameValueCollection + { + { "RequestMethod", "RemoveQuark" }, + { "SyncServerID", syncServerID }, + }; + + response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + return true; + } + m_log.ErrorFormat("{0}: removal of quarks for Endpoint failed: {1}", + "[SIMIAN GRID CONNECTOR]", response["Message"]); + return false; + } + m_log.ErrorFormat("{0}: removal of Endpoint failed: {1}", + "[SIMIAN GRID CONNECTOR]", response["Message"]); + return false; + } #endregion SYNC SERVER } } diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index acd0475487..fe5ef489e1 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -551,26 +551,30 @@ namespace OpenSim.Services.GridService #region SYNC SERVER // Stubs for actor and quark management. Only implementation is in SimianGridService - public virtual bool RegisterActor(GridActorInfo gai, List lgqi) + public bool RegisterEndpoint(GridEndpointInfo gei) { return false; } - public virtual bool RegisterActor(GridActorInfo gai) + public bool RegisterActor(string actorID, string actorType, string syncServerID) { return false; } - public virtual bool RegisterQuark(string actorID, GridQuarkInfo gqi) + public bool RegisterQuark(string syncServerID, uint locX, uint locY) { return false; } - public virtual List LookupQuark(GridQuarkInfo gqi) + public List LookupQuark(uint locX, uint locY) { return null; } - public virtual List LookupQuark(GridQuarkInfo gqi, string actorType) + public List LookupQuark(uint locX, uint locY, string actorType) { return null; } + public bool CleanUpEndpoint(string syncServerID) + { + return false; + } #endregion SYNC SERVER } } diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index db3dc1a5fa..56823954bc 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -97,26 +97,24 @@ namespace OpenSim.Services.Interfaces int GetRegionFlags(UUID scopeID, UUID regionID); // SYNC SERVER - bool RegisterActor(GridActorInfo gai, List lgqi); - bool RegisterActor(GridActorInfo gai); - bool RegisterQuark(string actorID, GridQuarkInfo gqi); - List LookupQuark(GridQuarkInfo gqi); - List LookupQuark(GridQuarkInfo gqi, string actorType); + bool RegisterEndpoint(GridEndpointInfo gei); + bool RegisterActor(string actorID, string actorType, string syncServerID); + bool RegisterQuark(string syncServerID, uint locX, uint locY); + List LookupQuark(uint locX, uint locY); + List LookupQuark(uint locX, uint locY, string actorType); + bool CleanUpEndpoint(string syncServerID); // END SYNC SERVER } // SYNC SERVER - public class GridQuarkInfo - { - public uint locX; - public uint locY; - } - public class GridActorInfo + public class GridEndpointInfo { + public string syncServerID; public string address; - public int port; + public uint port; + public string internalAddress; + public uint internalPort; public string actorType; - public string actorID; } // END SYNC SERVER From 4d343d0feadb53c70169363d5608798f056b731a Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 14 Feb 2011 09:37:36 -0800 Subject: [PATCH 5/5] Move actor registration to actor modules. Add physics registation --- .../SymmetricSync/PhysicsEngineSyncModule.cs | 7 +++++++ .../RegionSyncModule/SymmetricSync/RegionSyncModule.cs | 5 ----- .../SymmetricSync/ScenePersistenceSyncModule.cs | 7 +++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/PhysicsEngineSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/PhysicsEngineSyncModule.cs index 757d6eb23f..addb52e041 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/PhysicsEngineSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/PhysicsEngineSyncModule.cs @@ -77,6 +77,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //register the module with SceneGraph. If needed, SceneGraph checks the module's ActorType to know what type of module it is. m_scene.RegisterModuleInterface(this); + // register actor + if (!scene.GridService.RegisterActor(scene.RegionInfo.RegionID.ToString(), + "physics_engine", scene.RegionInfo.RegionID.ToString())) + { + m_log.ErrorFormat("{0}: Failure registering actor", LogHeader); + } + // Setup the command line interface //m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; //InstallInterfaces(); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 0a9ad781ac..318efda12f 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -777,11 +777,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { m_log.ErrorFormat("{0}: Failure registering endpoint", LogHeader); } - if (!m_scene.GridService.RegisterActor(m_scene.RegionInfo.RegionID.ToString(), - "scene_persistence", m_scene.RegionInfo.RegionID.ToString())) - { - m_log.ErrorFormat("{0}: Failure registering actor", LogHeader); - } if (!m_scene.GridService.RegisterQuark(m_scene.RegionInfo.RegionID.ToString(), m_scene.RegionInfo.SyncQuarkLocationX, m_scene.RegionInfo.SyncQuarkLocationY)) { diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScenePersistenceSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScenePersistenceSyncModule.cs index 69b3472728..5d6512b359 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScenePersistenceSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScenePersistenceSyncModule.cs @@ -74,6 +74,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //register the module with SceneGraph. If needed, SceneGraph checks the module's ActorType to know what type of module it is. m_scene.RegisterModuleInterface(this); + // register actor + if (!scene.GridService.RegisterActor(scene.RegionInfo.RegionID.ToString(), + "scene_persistence", scene.RegionInfo.RegionID.ToString())) + { + m_log.ErrorFormat("{0}: Failure registering actor", LogHeader); + } + // Setup the command line interface //m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; //InstallInterfaces();