[Opensim-dev] Changing GetRegions(uint, uint, uint, uint) in GridManager

Mike Mazur mmazur at gmail.com
Tue Oct 28 07:56:31 UTC 2008


Hi,

In OpenSim/Grid/GridServer/GridManager.cs there is a method with the
following signature:

Dictionary<ulong, RegionProfileData> GetRegions(uint, uint, uint, uint)

This method grabs all the regions currently in the regions table, and
puts them in a dictionary with the region handle as the key. It's
invoked in GetSimNeighboursData() and XmlRpcMapBlockMethod().

I would like to modify this method to have the following signature:

List<RegionProfileData> GetRegions(uint, uint, uint, uint)

Note there is another method very similar already in GridManager:

List<RegionProfileData> GetRegions(string, int)

I don't immediately see any place that the region handle is required.
The dictionary is iterated over, the data from each region extracted
and passed on.

Why is the region handle required? It's calculated from the region's
coordinates, so maybe it's used to uniquely identify a region? In that
case, could the UUID be used instead?

The reason I want to do this is that for our load balancing application
we have multiple entries in the regions table for the same region;
different IPs and URIs for the same coordinates and hence same region
handle. The way the method is currently implemented, only one regions
table entry for each set of coordinates is returned.

Please find the proposed diff below. Am I introducing any bugs? Is there
a better way to do this?

If nobody has any issues with this, I'd like to check this in.

Thanks,
Mike


@@ -165,19 +165,15 @@ namespace OpenSim.Grid.GridServer
             return null;
         }
 
-        public Dictionary<ulong, RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax)
+        public List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax)
         {
-            Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>();
+            List<RegionProfileData> regions = new List<RegionProfileData>();
 
             foreach (IGridDataPlugin plugin in _plugins)
             {
                 try
                 {
-                    RegionProfileData[] neighbours = plugin.GetProfilesInRange(xmin, ymin, xmax, ymax);
-                    foreach (RegionProfileData neighbour in neighbours)
-                    {
-                        regions[neighbour.regionHandle] = neighbour;
-                    }
+                    regions.AddRange(plugin.GetProfilesInRange(xmin, ymin, xmax, ymax));
                 }
                 catch
                 {



More information about the Opensim-dev mailing list