aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-04-16 22:29:11 +0100
committerJustin Clark-Casey (justincc)2010-04-16 22:29:11 +0100
commitbf3956aeb0a44d0dd455e330234fcf0e18f5ea43 (patch)
treeef98a5c369f1359ee1ebcfd9e90ad945039c9c17 /OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
parentadd a missing initialization of the m_memoryCache in XmlRpcGroupsServicesConn... (diff)
downloadopensim-SC_OLD-bf3956aeb0a44d0dd455e330234fcf0e18f5ea43.zip
opensim-SC_OLD-bf3956aeb0a44d0dd455e330234fcf0e18f5ea43.tar.gz
opensim-SC_OLD-bf3956aeb0a44d0dd455e330234fcf0e18f5ea43.tar.bz2
opensim-SC_OLD-bf3956aeb0a44d0dd455e330234fcf0e18f5ea43.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs40
1 files changed, 25 insertions, 15 deletions
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
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); 56 protected static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
57 private static UTF8Encoding m_utf8Encoding = new UTF8Encoding(); 57 protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
58 58
59 private Scene m_scene; 59 protected Scene m_scene;
60 private Stream m_loadStream; 60 protected Stream m_loadStream;
61 private Guid m_requestId; 61 protected Guid m_requestId;
62 private string m_errorMessage; 62 protected string m_errorMessage;
63 63
64 /// <value> 64 /// <value>
65 /// Should the archive being loaded be merged with what is already on the region? 65 /// Should the archive being loaded be merged with what is already on the region?
66 /// </value> 66 /// </value>
67 private bool m_merge; 67 protected bool m_merge;
68
69 /// <value>
70 /// Should we ignore any assets when reloading the archive?
71 /// </value>
72 protected bool m_skipAssets;
68 73
69 /// <summary> 74 /// <summary>
70 /// Used to cache lookups for valid uuids. 75 /// Used to cache lookups for valid uuids.
71 /// </summary> 76 /// </summary>
72 private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>(); 77 private IDictionary<UUID, bool> m_validUserUuids = new Dictionary<UUID, bool>();
73 78
74 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, Guid requestId) 79 public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId)
75 { 80 {
76 m_scene = scene; 81 m_scene = scene;
77 82
@@ -89,14 +94,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver
89 94
90 m_errorMessage = String.Empty; 95 m_errorMessage = String.Empty;
91 m_merge = merge; 96 m_merge = merge;
97 m_skipAssets = skipAssets;
92 m_requestId = requestId; 98 m_requestId = requestId;
93 } 99 }
94 100
95 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, Guid requestId) 101 public ArchiveReadRequest(Scene scene, Stream loadStream, bool merge, bool skipAssets, Guid requestId)
96 { 102 {
97 m_scene = scene; 103 m_scene = scene;
98 m_loadStream = loadStream; 104 m_loadStream = loadStream;
99 m_merge = merge; 105 m_merge = merge;
106 m_skipAssets = skipAssets;
100 m_requestId = requestId; 107 m_requestId = requestId;
101 } 108 }
102 109
@@ -135,7 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
135 { 142 {
136 serialisedSceneObjects.Add(m_utf8Encoding.GetString(data)); 143 serialisedSceneObjects.Add(m_utf8Encoding.GetString(data));
137 } 144 }
138 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 145 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH) && !m_skipAssets)
139 { 146 {
140 if (LoadAsset(filePath, data)) 147 if (LoadAsset(filePath, data))
141 successfulAssetRestores++; 148 successfulAssetRestores++;
@@ -178,12 +185,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
178 archive.Close(); 185 archive.Close();
179 } 186 }
180 187
181 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores); 188 if (!m_skipAssets)
182
183 if (failedAssetRestores > 0)
184 { 189 {
185 m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores); 190 m_log.InfoFormat("[ARCHIVER]: Restored {0} assets", successfulAssetRestores);
186 m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores); 191
192 if (failedAssetRestores > 0)
193 {
194 m_log.ErrorFormat("[ARCHIVER]: Failed to load {0} assets", failedAssetRestores);
195 m_errorMessage += String.Format("Failed to load {0} assets", failedAssetRestores);
196 }
187 } 197 }
188 198
189 if (!m_merge) 199 if (!m_merge)