From bf3956aeb0a44d0dd455e330234fcf0e18f5ea43 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Apr 2010 22:29:11 +0100 Subject: Add --skip-assets option to load oar. This allows you to load an oar without loading its assets. This is useful if you know that the required assets are already in the asset service, since loading without assets is quicker. This option will become more useful when the ability to save oars without assets is added, which should happen fairly soon. At this point there will also be better documentation. --- .../World/Archiver/ArchiveReadRequest.cs | 40 ++++++++++++++-------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index b1b2336f8..cde7c93 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs @@ -53,25 +53,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); - private static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); + protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); + protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); - private Scene m_scene; - private Stream m_loadStream; - private Guid m_requestId; - private string m_errorMessage; + protected Scene m_scene; + protected Stream m_loadStream; + protected Guid m_requestId; + protected string m_errorMessage; /// /// Should the archive being loaded be merged with what is already on the region? /// - private bool m_merge; + protected bool m_merge; + + /// + /// Should we ignore any assets when reloading the archive? + /// + protected bool m_skipAssets; /// /// Used to cache lookups for valid uuids. /// private IDictionary m_validUserUuids = new Dictionary(); - public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId) + public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId) { m_scene = scene; @@ -89,14 +94,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_errorMessage = String.Empty; m_merge = merge; + m_skipAssets = skipAssets; m_requestId = requestId; } - public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId) + public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId) { m_scene = scene; m_loadStream = loadStream; m_merge = merge; + m_skipAssets = skipAssets; m_requestId = requestId; } @@ -135,7 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver { serialisedSceneObjects.Add(m_utf8Encoding.GetString(data)); } - else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) + else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH) && !m_skipAssets) { if (LoadAsset(filePath, data)) successfulAssetRestores++; @@ -178,12 +185,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver archive.Close(); } - m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); - - if (failedAssetRestores > 0) + if (!m_skipAssets) { - m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); - m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); + m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); + + if (failedAssetRestores > 0) + { + m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); + m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); + } } if (!m_merge) -- cgit v1.1