aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-23 20:38:44 +0000
committerJustin Clarke Casey2009-01-23 20:38:44 +0000
commitdbd2b4523319758c8c0e093a89be8bcb9b2e4ee1 (patch)
tree2dea0b57cbb6ffacf263c81d4689777753e2746b
parentThank you kindly, TLaukkan (Tommil) for a patch that: (diff)
downloadopensim-SC_OLD-dbd2b4523319758c8c0e093a89be8bcb9b2e4ee1.zip
opensim-SC_OLD-dbd2b4523319758c8c0e093a89be8bcb9b2e4ee1.tar.gz
opensim-SC_OLD-dbd2b4523319758c8c0e093a89be8bcb9b2e4ee1.tar.bz2
opensim-SC_OLD-dbd2b4523319758c8c0e093a89be8bcb9b2e4ee1.tar.xz
* Write a simple archive loading test which doesn't actually do any testing yet apart from not blow up
-rw-r--r--OpenSim/Framework/Communications/Cache/AssetCache.cs10
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs11
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs6
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs26
5 files changed, 43 insertions, 12 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AssetCache.cs b/OpenSim/Framework/Communications/Cache/AssetCache.cs
index 436f175..653597b 100644
--- a/OpenSim/Framework/Communications/Cache/AssetCache.cs
+++ b/OpenSim/Framework/Communications/Cache/AssetCache.cs
@@ -41,16 +41,12 @@ namespace OpenSim.Framework.Communications.Cache
41 41
42 /// <summary> 42 /// <summary>
43 /// Manages local cache of assets and their sending to viewers. 43 /// Manages local cache of assets and their sending to viewers.
44 /// 44 /// </summary>
45 ///
45 /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either 46 /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either
46 /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and 47 /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and
47 /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and 48 /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and
48 /// AssetNotFound(), which means they do share the same asset and texture caches. 49 /// AssetNotFound(), which means they do share the same asset and texture caches.I agr
49 ///
50 /// TODO: Assets in this cache are effectively immortal (they are never disposed of through old age).
51 /// This is not a huge problem at the moment since other memory use usually dwarfs that used by assets
52 /// but it's something to bear in mind.
53 /// </summary>
54 public class AssetCache : IAssetReceiver 50 public class AssetCache : IAssetReceiver
55 { 51 {
56 protected ICache m_memcache = new SimpleMemoryCache(); 52 protected ICache m_memcache = new SimpleMemoryCache();
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
index bd58e7c..ce293e4 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveReadRequest.cs
@@ -276,6 +276,17 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
276 asset.Data = data; 276 asset.Data = data;
277 277
278 m_scene.AssetCache.AddAsset(asset); 278 m_scene.AssetCache.AddAsset(asset);
279
280 /**
281 * Create layers on decode for image assets. This is likely to significantly increase the time to load archives so
282 * it might be best done when dearchive takes place on a separate thread
283 if (asset.Type=AssetType.Texture)
284 {
285 IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
286 if (cacheLayerDecode != null)
287 cacheLayerDecode.syncdecode(asset.FullID, asset.Data);
288 }
289 */
279 290
280 return true; 291 return true;
281 } 292 }
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
index 0c75951..bade121 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
88 TarArchiveWriter archive = new TarArchiveWriter(); 88 TarArchiveWriter archive = new TarArchiveWriter();
89 89
90 // Write out control file 90 // Write out control file
91 archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, CreateControlFile()); 91 archive.AddFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p2ControlFile());
92 92
93 // Write out region settings 93 // Write out region settings
94 string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_regionInfo.RegionName); 94 string settingsPath = String.Format("{0}{1}.xml", ArchiveConstants.SETTINGS_PATH, m_regionInfo.RegionName);
@@ -129,10 +129,10 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver
129 } 129 }
130 130
131 /// <summary> 131 /// <summary>
132 /// Create the control file for this archive 132 /// Create the control file for a 0.2 version archive
133 /// </summary> 133 /// </summary>
134 /// <returns></returns> 134 /// <returns></returns>
135 protected string CreateControlFile() 135 public static string Create0p2ControlFile()
136 { 136 {
137 StringWriter sw = new StringWriter(); 137 StringWriter sw = new StringWriter();
138 XmlTextWriter xtw = new XmlTextWriter(sw); 138 XmlTextWriter xtw = new XmlTextWriter(sw);
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs
index d4a8a46..55edec0 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/TarArchiveWriter.cs
@@ -32,7 +32,7 @@ using System.Text;
32//using System.Reflection; 32//using System.Reflection;
33//using log4net; 33//using log4net;
34 34
35namespace OpenSim.Region.Environment 35namespace OpenSim.Region.Environment.Modules.World.Archiver
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Temporary code to produce a tar archive in tar v7 format 38 /// Temporary code to produce a tar archive in tar v7 format
diff --git a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
index db296b0..4f4f53c 100644
--- a/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/Environment/Modules/World/Archiver/Tests/ArchiverTests.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
40 public class ArchiverTests 40 public class ArchiverTests
41 { 41 {
42 /// <summary> 42 /// <summary>
43 /// Test saving a V0.2 OpenSim Region Archive. Does not yet do what it says on the tin 43 /// Test saving a V0.2 OpenSim Region Archive.
44 /// </summary> 44 /// </summary>
45 [Test] 45 [Test]
46 public void TestSaveOarV0p2() 46 public void TestSaveOarV0p2()
@@ -76,5 +76,29 @@ namespace OpenSim.Region.Environment.Modules.World.Archiver.Tests
76 76
77 // TODO: Test presence of more files and contents of files. 77 // TODO: Test presence of more files and contents of files.
78 } 78 }
79
80 /// <summary>
81 /// Test loading a V0.2 OpenSim Region Archive. Does not yet do what it says on the tin.
82 /// </summary>
83 [Test]
84 public void TestLoadOarV0p2()
85 {
86 MemoryStream archiveWriteStream = new MemoryStream();
87 TarArchiveWriter tar = new TarArchiveWriter();
88
89 tar.AddFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
90 tar.WriteTar(archiveWriteStream);
91
92 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
93
94 ArchiverModule archiverModule = new ArchiverModule();
95
96 Scene scene = SceneSetupHelpers.SetupScene();
97 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
98
99 archiverModule.DearchiveRegion(archiveReadStream);
100
101 // TODO: Okay, so nothing is tested yet apart from the fact that it doesn't blow up
102 }
79 } 103 }
80} \ No newline at end of file 104} \ No newline at end of file