* minor: change misleading 'all assets found' message to instead tell how many were actually located
parent
6784cebf57
commit
a13a4c6144
|
@ -132,6 +132,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
part.CreatorID = masterAvatarId;
|
part.CreatorID = masterAvatarId;
|
||||||
part.OwnerID = masterAvatarId;
|
part.OwnerID = masterAvatarId;
|
||||||
part.LastOwnerID = 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))
|
if (m_scene.AddRestoredSceneObject(sceneObject, true, false))
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Method called when all the necessary assets for an archive request have been received.
|
/// Method called when all the necessary assets for an archive request have been received.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assets);
|
public delegate void AssetsRequestCallback(IDictionary<LLUUID, AssetBase> assetsFound, ICollection<LLUUID> assetsNotFoundUuids);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Execute the write of an archive once we have received all the necessary data
|
/// 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;
|
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();
|
TarArchiveWriter archive = new TarArchiveWriter();
|
||||||
|
|
||||||
|
@ -108,7 +114,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out assets
|
// Write out assets
|
||||||
AssetsArchiver assetsArchiver = new AssetsArchiver(assets);
|
AssetsArchiver assetsArchiver = new AssetsArchiver(assetsFound);
|
||||||
assetsArchiver.Archive(archive);
|
assetsArchiver.Archive(archive);
|
||||||
|
|
||||||
archive.WriteTar(new GZipStream(new FileStream(m_savePath, FileMode.Create), CompressionMode.Compress));
|
archive.WriteTar(new GZipStream(new FileStream(m_savePath, FileMode.Create), CompressionMode.Compress));
|
||||||
|
|
|
@ -121,23 +121,16 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
{
|
{
|
||||||
AssetBase asset = m_assets[uuid];
|
AssetBase asset = m_assets[uuid];
|
||||||
|
|
||||||
if (asset != null)
|
string extension = string.Empty;
|
||||||
{
|
|
||||||
string extension = string.Empty;
|
|
||||||
|
|
||||||
if (ArchiveConstants.ASSET_TYPE_TO_EXTENSION.ContainsKey(asset.Type))
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,11 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Dictionary<LLUUID, AssetBase> m_assets = new Dictionary<LLUUID, AssetBase>();
|
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>
|
/// <summary>
|
||||||
/// Record the number of asset replies required so we know when we've finished
|
/// Record the number of asset replies required so we know when we've finished
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -77,7 +82,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
{
|
{
|
||||||
// We can stop here if there are no assets to fetch
|
// We can stop here if there are no assets to fetch
|
||||||
if (m_repliesRequired == 0)
|
if (m_repliesRequired == 0)
|
||||||
m_assetsRequestCallback(m_assets);
|
m_assetsRequestCallback(m_assets, m_notFoundAssetUuids);
|
||||||
|
|
||||||
foreach (LLUUID uuid in m_uuids)
|
foreach (LLUUID uuid in m_uuids)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +97,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
/// <param name="asset"></param>
|
/// <param name="asset"></param>
|
||||||
public void AssetRequestCallback(LLUUID assetID, AssetBase asset)
|
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)
|
if (m_assets.Count == m_repliesRequired)
|
||||||
{
|
{
|
||||||
|
@ -108,7 +116,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected void PerformAssetsRequestCallback()
|
protected void PerformAssetsRequestCallback()
|
||||||
{
|
{
|
||||||
m_assetsRequestCallback(m_assets);
|
m_assetsRequestCallback(m_assets, m_notFoundAssetUuids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue