refactor: Make IteratingUUIDGatherer take a dictionary in its constructor like UUIDGatherer, so we can deal with future cases where the dictionary may already be pre-populated.
parent
bee3f203cd
commit
9208fb5d54
|
@ -604,7 +604,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
// "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
|
// "[HG ENTITY TRANSFER MODULE]: Incoming attachment {0} for HG user {1} with asset service {2}",
|
||||||
// so.Name, so.AttachedAvatar, url);
|
// so.Name, so.AttachedAvatar, url);
|
||||||
|
|
||||||
IteratingHGUuidGatherer uuidGatherer = new IteratingHGUuidGatherer(Scene.AssetService, url);
|
IDictionary<UUID, sbyte> ids = new Dictionary<UUID, sbyte>();
|
||||||
|
IteratingHGUuidGatherer uuidGatherer
|
||||||
|
= new IteratingHGUuidGatherer(Scene.AssetService, url, ids);
|
||||||
uuidGatherer.RecordAssetUuids(so);
|
uuidGatherer.RecordAssetUuids(so);
|
||||||
|
|
||||||
while (!uuidGatherer.Complete)
|
while (!uuidGatherer.Complete)
|
||||||
|
@ -632,8 +634,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IDictionary<UUID, sbyte> ids = uuidGatherer.GetGatheredUuids();
|
|
||||||
|
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
|
// "[HG ENTITY TRANSFER]: Fetching {0} assets for attachment {1} for HG user {2} with asset service {3}",
|
||||||
// ids.Count, so.Name, so.OwnerID, url);
|
// ids.Count, so.Name, so.OwnerID, url);
|
||||||
|
|
|
@ -648,6 +648,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gather uuids for a given entity.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This does a deep inspection of the entity to retrieve all the assets it uses (whether as textures, as scripts
|
||||||
|
/// contained in inventory, as scripts contained in objects contained in another object's inventory, etc. Assets
|
||||||
|
/// are only retrieved when they are necessary to carry out the inspection (i.e. a serialized object needs to be
|
||||||
|
/// retrieved to work out which assets it references).
|
||||||
|
/// </remarks>
|
||||||
public class IteratingUuidGatherer
|
public class IteratingUuidGatherer
|
||||||
{
|
{
|
||||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
@ -678,20 +687,25 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected Queue<UUID> m_assetUuidsToInspect;
|
protected Queue<UUID> m_assetUuidsToInspect;
|
||||||
|
|
||||||
public IteratingUuidGatherer(IAssetService assetService)
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="OpenSim.Region.Framework.Scenes.UuidGatherer"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetService">
|
||||||
|
/// Asset service.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="collector">
|
||||||
|
/// Gathered UUIDs will be collected in this dictinaory.
|
||||||
|
/// It can be pre-populated if you want to stop the gatherer from analyzing assets that have already been fetched and inspected.
|
||||||
|
/// </param>
|
||||||
|
public IteratingUuidGatherer(IAssetService assetService, IDictionary<UUID, sbyte> collector)
|
||||||
{
|
{
|
||||||
m_assetService = assetService;
|
m_assetService = assetService;
|
||||||
m_gatheredAssetUuids = new Dictionary<UUID, sbyte>();
|
m_gatheredAssetUuids = collector;
|
||||||
|
|
||||||
// FIXME: Not efficient for searching, can improve.
|
// FIXME: Not efficient for searching, can improve.
|
||||||
m_assetUuidsToInspect = new Queue<UUID>();
|
m_assetUuidsToInspect = new Queue<UUID>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDictionary<UUID, sbyte> GetGatheredUuids()
|
|
||||||
{
|
|
||||||
return new Dictionary<UUID, sbyte>(m_gatheredAssetUuids);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool AddAssetUuidToInspect(UUID uuid)
|
public bool AddAssetUuidToInspect(UUID uuid)
|
||||||
{
|
{
|
||||||
if (m_assetUuidsToInspect.Contains(uuid))
|
if (m_assetUuidsToInspect.Contains(uuid))
|
||||||
|
@ -1147,8 +1161,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected string m_assetServerURL;
|
protected string m_assetServerURL;
|
||||||
|
|
||||||
public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL)
|
public IteratingHGUuidGatherer(IAssetService assetService, string assetServerURL, IDictionary<UUID, sbyte> collector)
|
||||||
: base(assetService)
|
: base(assetService, collector)
|
||||||
{
|
{
|
||||||
m_assetServerURL = assetServerURL;
|
m_assetServerURL = assetServerURL;
|
||||||
if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))
|
if (!m_assetServerURL.EndsWith("/") && !m_assetServerURL.EndsWith("="))
|
||||||
|
|
Loading…
Reference in New Issue