* minor: change misleading 'all assets found' message to instead tell how many were actually located

0.6.0-stable
Justin Clarke Casey 2008-07-21 17:13:32 +00:00
parent 6784cebf57
commit a13a4c6144
4 changed files with 35 additions and 23 deletions

View File

@ -132,7 +132,12 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
part.CreatorID = masterAvatarId;
part.OwnerID = masterAvatarId;
part.LastOwnerID = masterAvatarId;
}
// For now, give all incoming scene objects new uuids. This will allow scenes to be cloned
// on the same region server and multiple examples a single object archive to be imported
// to the same scene (when this is possible).
//part.UUID = LLUUID.Random();
}
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
{

View File

@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// <summary>
/// Method called when all the necessary assets for an archive request have been received.
/// </summary>
public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assets);
public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assetsFound, ICollection<LLUUID> assetsNotFoundUuids);
/// <summary>
/// Execute the write of an archive once we have received all the necessary data
@ -73,9 +73,15 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
m_savePath = savePath;
}
protected internal void ReceivedAllAssets(IDictionary<LLUUID, AssetBase> assets)
protected internal void ReceivedAllAssets(IDictionary<LLUUID, AssetBase> assetsFound, ICollection<LLUUID> assetsNotFoundUuids)
{
m_log.DebugFormat("[ARCHIVER]: Received all {0} assets required", assets.Count);
foreach (LLUUID uuid in assetsNotFoundUuids)
{
m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid);
}
m_log.InfoFormat(
"[ARCHIVER]: Received {0} of {1} assets requested", assetsFound.Count, assetsFound.Count + assetsNotFoundUuids.Count);
TarArchiveWriter archive = new TarArchiveWriter();
@ -108,7 +114,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
}
// Write out assets
AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
AssetsArchiver assetsArchiver = new AssetsArchiver(assetsFound);
assetsArchiver.Archive(archive);
archive.WriteTar(new GZipStream(new FileStream(m_savePath, FileMode.Create), CompressionMode.Compress));

View File

@ -121,23 +121,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
AssetBase asset = m_assets[uuid];
if (asset != null)
string extension = string.Empty;
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
{
string extension = string.Empty;
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
{
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
}
archive.AddFile(
ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension,
asset.Data);
}
else
{
m_log.WarnFormat("[ARCHIVER]: Could not find asset {0} to archive", uuid);
extension = ArchiveConstants.ASSET_TYPE_TO_EXTENSION[asset.Type];
}
archive.AddFile(
ArchiveConstants.ASSETS_PATH + uuid.ToString() + extension,
asset.Data);
}
}
}

View File

@ -54,6 +54,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// Assets retrieved in this request
/// </summary>
protected Dictionary<LLUUID, AssetBase> m_assets = new Dictionary<LLUUID, AssetBase>();
/// <summary>
/// Maintain a list of assets that could not be found. This will be passed back to the requester.
/// </summary>
protected List<LLUUID> m_notFoundAssetUuids = new List<LLUUID>();
/// <summary>
/// Record the number of asset replies required so we know when we've finished
@ -77,7 +82,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
{
// We can stop here if there are no assets to fetch
if (m_repliesRequired == 0)
m_assetsRequestCallback(m_assets);
m_assetsRequestCallback(m_assets, m_notFoundAssetUuids);
foreach (LLUUID uuid in m_uuids)
{
@ -92,7 +97,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// <param name="asset"></param>
public void AssetRequestCallback(LLUUID assetID, AssetBase asset)
{
m_assets[assetID] = asset;
if (asset != null)
m_assets[assetID] = asset;
else
m_notFoundAssetUuids.Add(assetID);
if (m_assets.Count == m_repliesRequired)
{
@ -108,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
/// </summary>
protected void PerformAssetsRequestCallback()
{
m_assetsRequestCallback(m_assets);
m_assetsRequestCallback(m_assets, m_notFoundAssetUuids);
}
}
}