* UuidGatherer now tracks asset types for assets it discovers. The asset types are inferred from context
* OAR saving will attempt to correct unknown asset types before writing broken assets to the OAR fileslimupdates
parent
5beb08be31
commit
33f5d0d1e9
|
@ -642,7 +642,7 @@ namespace Flotsam.RegionModules.AssetCache
|
||||||
{
|
{
|
||||||
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
UuidGatherer gatherer = new UuidGatherer(m_AssetService);
|
||||||
|
|
||||||
Dictionary<UUID, int> assets = new Dictionary<UUID, int>();
|
Dictionary<UUID, AssetType> assets = new Dictionary<UUID, AssetType>();
|
||||||
foreach (Scene s in m_Scenes)
|
foreach (Scene s in m_Scenes)
|
||||||
{
|
{
|
||||||
StampRegionStatusFile(s.RegionInfo.RegionID);
|
StampRegionStatusFile(s.RegionInfo.RegionID);
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Used to collect the uuids of the assets that we need to save into the archive
|
/// Used to collect the uuids of the assets that we need to save into the archive
|
||||||
/// </value>
|
/// </value>
|
||||||
protected Dictionary<UUID, int> m_assetUuids = new Dictionary<UUID, int>();
|
protected Dictionary<UUID, AssetType> m_assetUuids = new Dictionary<UUID, AssetType>();
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Used to collect the uuids of the users that we need to save into the archive
|
/// Used to collect the uuids of the users that we need to save into the archive
|
||||||
|
@ -305,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||||
}
|
}
|
||||||
|
|
||||||
new AssetsRequest(
|
new AssetsRequest(
|
||||||
new AssetsArchiver(m_archiveWriter), m_assetUuids.Keys,
|
new AssetsArchiver(m_archiveWriter), m_assetUuids,
|
||||||
m_scene.AssetService, ReceivedAllAssets).Execute();
|
m_scene.AssetService, ReceivedAllAssets).Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
// OK, now fetch the inside.
|
// OK, now fetch the inside.
|
||||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||||
foreach (UUID uuid in ids.Keys)
|
foreach (UUID uuid in ids.Keys)
|
||||||
|
@ -173,7 +173,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
AssetBase asset = m_scene.AssetService.Get(assetID.ToString());
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
{
|
{
|
||||||
Dictionary<UUID, int> ids = new Dictionary<UUID, int>();
|
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
|
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, string.Empty);
|
||||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
||||||
foreach (UUID uuid in ids.Keys)
|
foreach (UUID uuid in ids.Keys)
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception>
|
/// <exception cref="System.IO.IOException">if there was an io problem with creating the file</exception>
|
||||||
public void ArchiveRegion()
|
public void ArchiveRegion()
|
||||||
{
|
{
|
||||||
Dictionary<UUID, int> assetUuids = new Dictionary<UUID, int>();
|
Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
|
||||||
|
|
||||||
List<EntityBase> entities = m_scene.GetEntities();
|
List<EntityBase> entities = m_scene.GetEntities();
|
||||||
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
|
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
|
||||||
|
@ -142,18 +142,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
|
|
||||||
// Make sure that we also request terrain texture assets
|
// Make sure that we also request terrain texture assets
|
||||||
RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings;
|
RegionSettings regionSettings = m_scene.RegionInfo.RegionSettings;
|
||||||
|
|
||||||
if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1)
|
if (regionSettings.TerrainTexture1 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_1)
|
||||||
assetUuids[regionSettings.TerrainTexture1] = 1;
|
assetUuids[regionSettings.TerrainTexture1] = AssetType.Texture;
|
||||||
|
|
||||||
if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2)
|
if (regionSettings.TerrainTexture2 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_2)
|
||||||
assetUuids[regionSettings.TerrainTexture2] = 1;
|
assetUuids[regionSettings.TerrainTexture2] = AssetType.Texture;
|
||||||
|
|
||||||
if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3)
|
if (regionSettings.TerrainTexture3 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_3)
|
||||||
assetUuids[regionSettings.TerrainTexture3] = 1;
|
assetUuids[regionSettings.TerrainTexture3] = AssetType.Texture;
|
||||||
|
|
||||||
if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
|
if (regionSettings.TerrainTexture4 != RegionSettings.DEFAULT_TERRAIN_TEXTURE_4)
|
||||||
assetUuids[regionSettings.TerrainTexture4] = 1;
|
assetUuids[regionSettings.TerrainTexture4] = AssetType.Texture;
|
||||||
|
|
||||||
TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream);
|
TarArchiveWriter archiveWriter = new TarArchiveWriter(m_saveStream);
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
m_requestId);
|
m_requestId);
|
||||||
|
|
||||||
new AssetsRequest(
|
new AssetsRequest(
|
||||||
new AssetsArchiver(archiveWriter), assetUuids.Keys,
|
new AssetsArchiver(archiveWriter), assetUuids,
|
||||||
m_scene.AssetService, awre.ReceivedAllAssets).Execute();
|
m_scene.AssetService, awre.ReceivedAllAssets).Execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
/// <value>
|
/// <value>
|
||||||
/// uuids to request
|
/// uuids to request
|
||||||
/// </value>
|
/// </value>
|
||||||
protected ICollection<UUID> m_uuids;
|
protected IDictionary<UUID, AssetType> m_uuids;
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// Callback used when all the assets requested have been received.
|
/// Callback used when all the assets requested have been received.
|
||||||
|
@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
protected AssetsArchiver m_assetsArchiver;
|
protected AssetsArchiver m_assetsArchiver;
|
||||||
|
|
||||||
protected internal AssetsRequest(
|
protected internal AssetsRequest(
|
||||||
AssetsArchiver assetsArchiver, ICollection<UUID> uuids,
|
AssetsArchiver assetsArchiver, IDictionary<UUID, AssetType> uuids,
|
||||||
IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
|
IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
|
||||||
{
|
{
|
||||||
m_assetsArchiver = assetsArchiver;
|
m_assetsArchiver = assetsArchiver;
|
||||||
|
@ -132,9 +132,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (UUID uuid in m_uuids)
|
foreach (KeyValuePair<UUID, AssetType> kvp in m_uuids)
|
||||||
{
|
{
|
||||||
m_assetService.Get(uuid.ToString(), this, AssetRequestCallback);
|
m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_requestCallbackTimer.Enabled = true;
|
m_requestCallbackTimer.Enabled = true;
|
||||||
|
@ -157,7 +157,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
// Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure
|
// Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure
|
||||||
// case anyway.
|
// case anyway.
|
||||||
List<UUID> uuids = new List<UUID>();
|
List<UUID> uuids = new List<UUID>();
|
||||||
foreach (UUID uuid in m_uuids)
|
foreach (UUID uuid in m_uuids.Keys)
|
||||||
{
|
{
|
||||||
uuids.Add(uuid);
|
uuids.Add(uuid);
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void PreAssetRequestCallback(string fetchedAssetID, object assetType, AssetBase fetchedAsset)
|
||||||
|
{
|
||||||
|
// Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer
|
||||||
|
if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown)
|
||||||
|
{
|
||||||
|
AssetType type = (AssetType)assetType;
|
||||||
|
m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, type);
|
||||||
|
fetchedAsset.Type = (sbyte)type;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetRequestCallback(fetchedAssetID, this, fetchedAsset);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called back by the asset cache when it has the asset
|
/// Called back by the asset cache when it has the asset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero);
|
AssetBase corruptAsset = AssetHelpers.CreateAsset(corruptAssetUuid, "CORRUPT ASSET", UUID.Zero);
|
||||||
m_assetService.Store(corruptAsset);
|
m_assetService.Store(corruptAsset);
|
||||||
|
|
||||||
IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>();
|
IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
|
||||||
m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids);
|
m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids);
|
||||||
|
|
||||||
// We count the uuid as gathered even if the asset itself is corrupt.
|
// We count the uuid as gathered even if the asset itself is corrupt.
|
||||||
|
@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666");
|
||||||
IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>();
|
IDictionary<UUID, AssetType> foundAssetUuids = new Dictionary<UUID, AssetType>();
|
||||||
|
|
||||||
m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids);
|
m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids);
|
||||||
|
|
||||||
|
|
|
@ -84,9 +84,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
|
/// <param name="assetUuid">The uuid of the asset for which to gather referenced assets</param>
|
||||||
/// <param name="assetType">The type of the asset for the uuid given</param>
|
/// <param name="assetType">The type of the asset for the uuid given</param>
|
||||||
/// <param name="assetUuids">The assets gathered</param>
|
/// <param name="assetUuids">The assets gathered</param>
|
||||||
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, int> assetUuids)
|
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
{
|
||||||
assetUuids[assetUuid] = 1;
|
assetUuids[assetUuid] = assetType;
|
||||||
|
|
||||||
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
|
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
///
|
///
|
||||||
/// <param name="sceneObject">The scene object for which to gather assets</param>
|
/// <param name="sceneObject">The scene object for which to gather assets</param>
|
||||||
/// <param name="assetUuids">The assets gathered</param>
|
/// <param name="assetUuids">The assets gathered</param>
|
||||||
public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, int> assetUuids)
|
public void GatherAssetUuids(SceneObjectGroup sceneObject, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat(
|
// m_log.DebugFormat(
|
||||||
// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
|
// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
|
||||||
|
@ -131,7 +131,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Primitive.TextureEntry textureEntry = part.Shape.Textures;
|
Primitive.TextureEntry textureEntry = part.Shape.Textures;
|
||||||
|
|
||||||
// Get the prim's default texture. This will be used for faces which don't have their own texture
|
// Get the prim's default texture. This will be used for faces which don't have their own texture
|
||||||
assetUuids[textureEntry.DefaultTexture.TextureID] = 1;
|
assetUuids[textureEntry.DefaultTexture.TextureID] = AssetType.Texture;
|
||||||
|
|
||||||
// XXX: Not a great way to iterate through face textures, but there's no
|
// XXX: Not a great way to iterate through face textures, but there's no
|
||||||
// other method available to tell how many faces there actually are
|
// other method available to tell how many faces there actually are
|
||||||
|
@ -141,13 +141,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (texture != null)
|
if (texture != null)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++);
|
//m_log.DebugFormat("[ARCHIVER]: Got face {0}", i++);
|
||||||
assetUuids[texture.TextureID] = 1;
|
assetUuids[texture.TextureID] = AssetType.Texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the prim is a sculpt then preserve this information too
|
// If the prim is a sculpt then preserve this information too
|
||||||
if (part.Shape.SculptTexture != UUID.Zero)
|
if (part.Shape.SculptTexture != UUID.Zero)
|
||||||
assetUuids[part.Shape.SculptTexture] = 1;
|
assetUuids[part.Shape.SculptTexture] = AssetType.Texture;
|
||||||
|
|
||||||
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
|
TaskInventoryDictionary taskDictionary = (TaskInventoryDictionary)part.TaskInventory.Clone();
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scriptUuid"></param>
|
/// <param name="scriptUuid"></param>
|
||||||
/// <param name="assetUuids">Dictionary in which to record the references</param>
|
/// <param name="assetUuids">Dictionary in which to record the references</param>
|
||||||
protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary<UUID, int> assetUuids)
|
protected void GetScriptAssetUuids(UUID scriptUuid, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
{
|
||||||
AssetBase scriptAsset = GetAsset(scriptUuid);
|
AssetBase scriptAsset = GetAsset(scriptUuid);
|
||||||
|
|
||||||
|
@ -232,7 +232,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
UUID uuid = new UUID(uuidMatch.Value);
|
UUID uuid = new UUID(uuidMatch.Value);
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid);
|
//m_log.DebugFormat("[ARCHIVER]: Recording {0} in script", uuid);
|
||||||
assetUuids[uuid] = 1;
|
|
||||||
|
// Assume AssetIDs embedded in scripts are textures
|
||||||
|
assetUuids[uuid] = AssetType.Texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +244,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="wearableAssetUuid"></param>
|
/// <param name="wearableAssetUuid"></param>
|
||||||
/// <param name="assetUuids">Dictionary in which to record the references</param>
|
/// <param name="assetUuids">Dictionary in which to record the references</param>
|
||||||
protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, int> assetUuids)
|
protected void GetWearableAssetUuids(UUID wearableAssetUuid, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
{
|
||||||
AssetBase assetBase = GetAsset(wearableAssetUuid);
|
AssetBase assetBase = GetAsset(wearableAssetUuid);
|
||||||
|
|
||||||
|
@ -257,8 +259,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
foreach (UUID uuid in wearableAsset.Textures.Values)
|
foreach (UUID uuid in wearableAsset.Textures.Values)
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Got bodypart uuid {0}", uuid);
|
assetUuids[uuid] = AssetType.Texture;
|
||||||
assetUuids[uuid] = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sceneObject"></param>
|
/// <param name="sceneObject"></param>
|
||||||
/// <param name="assetUuids"></param>
|
/// <param name="assetUuids"></param>
|
||||||
protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, int> assetUuids)
|
protected void GetSceneObjectAssetUuids(UUID sceneObjectUuid, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
{
|
||||||
AssetBase objectAsset = GetAsset(sceneObjectUuid);
|
AssetBase objectAsset = GetAsset(sceneObjectUuid);
|
||||||
|
|
||||||
|
@ -284,7 +285,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, int> assetUuids)
|
protected void GetGestureAssetUuids(UUID gestureUuid, IDictionary<UUID, AssetType> assetUuids)
|
||||||
{
|
{
|
||||||
AssetBase assetBase = GetAsset(gestureUuid);
|
AssetBase assetBase = GetAsset(gestureUuid);
|
||||||
|
|
||||||
|
@ -316,7 +317,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// If it can be parsed as a UUID, it is an asset ID
|
// If it can be parsed as a UUID, it is an asset ID
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
if (UUID.TryParse(id, out uuid))
|
if (UUID.TryParse(id, out uuid))
|
||||||
assetUuids[uuid] = 1;
|
assetUuids[uuid] = AssetType.Animation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue