mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Make the IteratingUuidGatherer the only UuidGatherer.
This UUID gatherer provides a superset of the previous gatherer's functionality as it also allows the caller to control gathering iterations for load purposes.
This commit is contained in:
@@ -776,7 +776,6 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
{
|
||||
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
||||
|
||||
Dictionary<UUID, sbyte> assetIdsToCheck = new Dictionary<UUID, sbyte>();
|
||||
Dictionary<UUID, bool> assetsFound = new Dictionary<UUID, bool>();
|
||||
|
||||
foreach (Scene s in m_Scenes)
|
||||
@@ -784,10 +783,11 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
StampRegionStatusFile(s.RegionInfo.RegionID);
|
||||
|
||||
s.ForEachSOG(delegate(SceneObjectGroup e)
|
||||
{
|
||||
gatherer.GatherAssetUuids(e, assetIdsToCheck);
|
||||
{
|
||||
gatherer.AddForInspection(e);
|
||||
gatherer.GatherAll();
|
||||
|
||||
foreach (UUID assetID in assetIdsToCheck.Keys)
|
||||
foreach (UUID assetID in gatherer.GatheredUuids.Keys)
|
||||
{
|
||||
if (!assetsFound.ContainsKey(assetID))
|
||||
{
|
||||
@@ -800,7 +800,7 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
else if (storeUncached)
|
||||
{
|
||||
AssetBase cachedAsset = m_AssetService.Get(assetID.ToString());
|
||||
if (cachedAsset == null && assetIdsToCheck[assetID] != (sbyte)AssetType.Unknown)
|
||||
if (cachedAsset == null && gatherer.GatheredUuids[assetID] != (sbyte)AssetType.Unknown)
|
||||
assetsFound[assetID] = false;
|
||||
else
|
||||
assetsFound[assetID] = true;
|
||||
@@ -810,11 +810,11 @@ namespace OpenSim.Region.CoreModules.Asset
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[FLOTSAM ASSET CACHE]: Could not find asset {0}, type {1} referenced by object {2} at {3} in scene {4} when pre-caching all scene assets",
|
||||
assetID, assetIdsToCheck[assetID], e.Name, e.AbsolutePosition, s.Name);
|
||||
assetID, gatherer.GatheredUuids[assetID], e.Name, e.AbsolutePosition, s.Name);
|
||||
}
|
||||
}
|
||||
|
||||
assetIdsToCheck.Clear();
|
||||
gatherer.GatheredUuids.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -93,11 +93,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
/// </value>
|
||||
protected UUID m_id;
|
||||
|
||||
/// <value>
|
||||
/// Used to collect the uuids of the assets that we need to save into the archive
|
||||
/// </value>
|
||||
protected Dictionary<UUID, sbyte> m_assetUuids = new Dictionary<UUID, sbyte>();
|
||||
|
||||
/// <value>
|
||||
/// Used to collect the uuids of the users that we need to save into the archive
|
||||
/// </value>
|
||||
@@ -225,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
// Don't chase down link asset items as they actually point to their target item IDs rather than an asset
|
||||
if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
|
||||
m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (sbyte)inventoryItem.AssetType, m_assetUuids);
|
||||
m_assetGatherer.AddForInspection(inventoryItem.AssetID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -422,12 +417,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
|
||||
if (SaveAssets)
|
||||
{
|
||||
m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count);
|
||||
m_assetGatherer.GatherAll();
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetGatherer.GatheredUuids.Count);
|
||||
|
||||
AssetsRequest ar
|
||||
= new AssetsRequest(
|
||||
new AssetsArchiver(m_archiveWriter),
|
||||
m_assetUuids, m_scene.AssetService,
|
||||
m_assetGatherer.GatheredUuids, m_scene.AssetService,
|
||||
m_scene.UserAccountService, m_scene.RegionInfo.ScopeID,
|
||||
options, ReceivedAllAssets);
|
||||
|
||||
|
||||
@@ -605,8 +605,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// so.Name, so.AttachedAvatar, url);
|
||||
|
||||
IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
|
||||
IteratingHGUuidGatherer uuidGatherer
|
||||
= new IteratingHGUuidGatherer(Scene.AssetService, url, ids);
|
||||
HGUuidGatherer uuidGatherer
|
||||
= new HGUuidGatherer(Scene.AssetService, url, ids);
|
||||
uuidGatherer.AddForInspection(so);
|
||||
|
||||
while (!uuidGatherer.Complete)
|
||||
|
||||
@@ -412,12 +412,13 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
// The act of gathering UUIDs downloads some assets from the remote server
|
||||
// but not all...
|
||||
Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, userAssetURL);
|
||||
uuidGatherer.GatherAssetUuids(assetID, meta.Type, ids);
|
||||
m_log.DebugFormat("[HG ASSET MAPPER]: Preparing to get {0} assets", ids.Count);
|
||||
uuidGatherer.AddForInspection(assetID);
|
||||
uuidGatherer.GatherAll();
|
||||
|
||||
m_log.DebugFormat("[HG ASSET MAPPER]: Preparing to get {0} assets", uuidGatherer.GatheredUuids.Count);
|
||||
bool success = true;
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
foreach (UUID uuid in uuidGatherer.GatheredUuids.Keys)
|
||||
if (FetchAsset(userAssetURL, uuid) == null)
|
||||
success = false;
|
||||
|
||||
@@ -428,7 +429,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
m_log.DebugFormat("[HG ASSET MAPPER]: Successfully got item {0} from asset server {1}", assetID, userAssetURL);
|
||||
}
|
||||
|
||||
|
||||
public void Post(UUID assetID, UUID ownerID, string userAssetURL)
|
||||
{
|
||||
m_log.DebugFormat("[HG ASSET MAPPER]: Starting to send asset {0} with children to asset server {1}", assetID, userAssetURL);
|
||||
@@ -442,9 +442,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
|
||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(m_scene.AssetService, string.Empty);
|
||||
uuidGatherer.GatherAssetUuids(asset.FullID, asset.Type, ids);
|
||||
uuidGatherer.AddForInspection(asset.FullID);
|
||||
|
||||
// Check which assets already exist in the destination server
|
||||
|
||||
@@ -452,16 +451,16 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
if (!url.EndsWith("/") && !url.EndsWith("="))
|
||||
url = url + "/";
|
||||
|
||||
string[] remoteAssetIDs = new string[ids.Count];
|
||||
string[] remoteAssetIDs = new string[uuidGatherer.GatheredUuids.Count];
|
||||
int i = 0;
|
||||
foreach (UUID id in ids.Keys)
|
||||
foreach (UUID id in uuidGatherer.GatheredUuids.Keys)
|
||||
remoteAssetIDs[i++] = url + id.ToString();
|
||||
|
||||
bool[] exist = m_scene.AssetService.AssetsExist(remoteAssetIDs);
|
||||
|
||||
var existSet = new HashSet<string>();
|
||||
i = 0;
|
||||
foreach (UUID id in ids.Keys)
|
||||
foreach (UUID id in uuidGatherer.GatheredUuids.Keys)
|
||||
{
|
||||
if (exist[i])
|
||||
existSet.Add(id.ToString());
|
||||
@@ -472,7 +471,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||
|
||||
bool success = true;
|
||||
|
||||
foreach (UUID uuid in ids.Keys)
|
||||
foreach (UUID uuid in uuidGatherer.GatheredUuids.Keys)
|
||||
{
|
||||
if (!existSet.Contains(uuid.ToString()))
|
||||
{
|
||||
|
||||
@@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids)
|
||||
{
|
||||
m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName);
|
||||
m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name);
|
||||
|
||||
EntityBase[] entities = scene.GetEntities();
|
||||
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
|
||||
@@ -253,13 +253,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
|
||||
if (SaveAssets)
|
||||
{
|
||||
UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService);
|
||||
UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids);
|
||||
int prevAssets = assetUuids.Count;
|
||||
|
||||
foreach (SceneObjectGroup sceneObject in sceneObjects)
|
||||
{
|
||||
assetGatherer.GatherAssetUuids(sceneObject, assetUuids);
|
||||
}
|
||||
assetGatherer.AddForInspection(sceneObject);
|
||||
|
||||
assetGatherer.GatherAll();
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets",
|
||||
|
||||
Reference in New Issue
Block a user