diff options
author | teravus | 2012-11-15 09:46:41 -0500 |
---|---|---|
committer | teravus | 2012-11-15 09:46:41 -0500 |
commit | dfac269032300872c4d0dc507f4f9062d102b0f4 (patch) | |
tree | d60fca83f54417c349c33b46de6ac65748ff762f /OpenSim/Region/CoreModules/Asset | |
parent | * Fixes mesh loading issues in last commit. (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC-dfac269032300872c4d0dc507f4f9062d102b0f4.zip opensim-SC-dfac269032300872c4d0dc507f4f9062d102b0f4.tar.gz opensim-SC-dfac269032300872c4d0dc507f4f9062d102b0f4.tar.bz2 opensim-SC-dfac269032300872c4d0dc507f4f9062d102b0f4.tar.xz |
Merge master into teravuswork
Diffstat (limited to 'OpenSim/Region/CoreModules/Asset')
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | 1 |
2 files changed, 18 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 7d7176f..d1a563c 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -52,7 +52,7 @@ using OpenSim.Services.Interfaces; | |||
52 | [assembly: Addin("FlotsamAssetCache", "1.1")] | 52 | [assembly: Addin("FlotsamAssetCache", "1.1")] |
53 | [assembly: AddinDependency("OpenSim", "0.5")] | 53 | [assembly: AddinDependency("OpenSim", "0.5")] |
54 | 54 | ||
55 | namespace Flotsam.RegionModules.AssetCache | 55 | namespace OpenSim.Region.CoreModules.Asset |
56 | { | 56 | { |
57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] | 57 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] |
58 | public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService | 58 | public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService |
@@ -107,8 +107,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
107 | private IAssetService m_AssetService; | 107 | private IAssetService m_AssetService; |
108 | private List<Scene> m_Scenes = new List<Scene>(); | 108 | private List<Scene> m_Scenes = new List<Scene>(); |
109 | 109 | ||
110 | private bool m_DeepScanBeforePurge; | ||
111 | |||
112 | public FlotsamAssetCache() | 110 | public FlotsamAssetCache() |
113 | { | 111 | { |
114 | m_InvalidChars.AddRange(Path.GetInvalidPathChars()); | 112 | m_InvalidChars.AddRange(Path.GetInvalidPathChars()); |
@@ -170,8 +168,6 @@ namespace Flotsam.RegionModules.AssetCache | |||
170 | m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", m_CacheDirectoryTierLen); | 168 | m_CacheDirectoryTierLen = assetConfig.GetInt("CacheDirectoryTierLength", m_CacheDirectoryTierLen); |
171 | 169 | ||
172 | m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", m_CacheWarnAt); | 170 | m_CacheWarnAt = assetConfig.GetInt("CacheWarnAt", m_CacheWarnAt); |
173 | |||
174 | m_DeepScanBeforePurge = assetConfig.GetBoolean("DeepScanBeforePurge", m_DeepScanBeforePurge); | ||
175 | } | 171 | } |
176 | 172 | ||
177 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory {0}", m_CacheDirectory); | 173 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory {0}", m_CacheDirectory); |
@@ -519,13 +515,10 @@ namespace Flotsam.RegionModules.AssetCache | |||
519 | // Purge all files last accessed prior to this point | 515 | // Purge all files last accessed prior to this point |
520 | DateTime purgeLine = DateTime.Now - m_FileExpiration; | 516 | DateTime purgeLine = DateTime.Now - m_FileExpiration; |
521 | 517 | ||
522 | // An optional deep scan at this point will ensure assets present in scenes, | 518 | // An asset cache may contain local non-temporary assets that are not in the asset service. Therefore, |
523 | // or referenced by objects in the scene, but not recently accessed | 519 | // before cleaning up expired files we must scan the objects in the scene to make sure that we retain |
524 | // are not purged. | 520 | // such local assets if they have not been recently accessed. |
525 | if (m_DeepScanBeforePurge) | 521 | TouchAllSceneAssets(false); |
526 | { | ||
527 | CacheScenes(); | ||
528 | } | ||
529 | 522 | ||
530 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) | 523 | foreach (string dir in Directory.GetDirectories(m_CacheDirectory)) |
531 | { | 524 | { |
@@ -718,11 +711,14 @@ namespace Flotsam.RegionModules.AssetCache | |||
718 | 711 | ||
719 | /// <summary> | 712 | /// <summary> |
720 | /// Iterates through all Scenes, doing a deep scan through assets | 713 | /// Iterates through all Scenes, doing a deep scan through assets |
721 | /// to cache all assets present in the scene or referenced by assets | 714 | /// to update the access time of all assets present in the scene or referenced by assets |
722 | /// in the scene | 715 | /// in the scene. |
723 | /// </summary> | 716 | /// </summary> |
724 | /// <returns></returns> | 717 | /// <param name="storeUncached"> |
725 | private int CacheScenes() | 718 | /// If true, then assets scanned which are not found in cache are added to the cache. |
719 | /// </param> | ||
720 | /// <returns>Number of distinct asset references found in the scene.</returns> | ||
721 | private int TouchAllSceneAssets(bool storeUncached) | ||
726 | { | 722 | { |
727 | UuidGatherer gatherer = new UuidGatherer(m_AssetService); | 723 | UuidGatherer gatherer = new UuidGatherer(m_AssetService); |
728 | 724 | ||
@@ -745,7 +741,7 @@ namespace Flotsam.RegionModules.AssetCache | |||
745 | { | 741 | { |
746 | File.SetLastAccessTime(filename, DateTime.Now); | 742 | File.SetLastAccessTime(filename, DateTime.Now); |
747 | } | 743 | } |
748 | else | 744 | else if (storeUncached) |
749 | { | 745 | { |
750 | m_AssetService.Get(assetID.ToString()); | 746 | m_AssetService.Get(assetID.ToString()); |
751 | } | 747 | } |
@@ -873,13 +869,14 @@ namespace Flotsam.RegionModules.AssetCache | |||
873 | 869 | ||
874 | break; | 870 | break; |
875 | 871 | ||
876 | |||
877 | case "assets": | 872 | case "assets": |
878 | m_log.Info("[FLOTSAM ASSET CACHE]: Caching all assets, in all scenes."); | 873 | m_log.Info("[FLOTSAM ASSET CACHE]: Ensuring assets are cached for all scenes."); |
879 | 874 | ||
880 | Util.FireAndForget(delegate { | 875 | Util.FireAndForget(delegate { |
881 | int assetsCached = CacheScenes(); | 876 | int assetReferenceTotal = TouchAllSceneAssets(true); |
882 | m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Completed Scene Caching, {0} assets found.", assetsCached); | 877 | m_log.InfoFormat( |
878 | "[FLOTSAM ASSET CACHE]: Completed check with {0} assets.", | ||
879 | assetReferenceTotal); | ||
883 | }); | 880 | }); |
884 | 881 | ||
885 | break; | 882 | break; |
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index c91b25f..1c2bfd0 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | |||
@@ -35,7 +35,6 @@ using Nini.Config; | |||
35 | using NUnit.Framework; | 35 | using NUnit.Framework; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenMetaverse.Assets; | 37 | using OpenMetaverse.Assets; |
38 | using Flotsam.RegionModules.AssetCache; | ||
39 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
40 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
41 | using OpenSim.Region.Framework.Scenes.Serialization; | 40 | using OpenSim.Region.Framework.Scenes.Serialization; |